Skip to content

Commit

Permalink
chore: added USDC gasless transfer e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
milan-cb committed Jan 26, 2025
1 parent cd78a03 commit f2d5acc
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/tests/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,44 @@ describe("Coinbase SDK E2E Test", () => {
networkId: exportedWallet.networkId,
});
}, 60000);

it("should be able to make gasless transfers", async () => {
// Import wallet with balance
const seedFile = JSON.parse(process.env.WALLET_DATA || "");
const walletId = Object.keys(seedFile)[0];
const seed = seedFile[walletId].seed;

const sourceWallet = await Wallet.import({
seed,
walletId,
networkId: Coinbase.networks.BaseSepolia,
});

// Create destination wallet
const destinationWallet = await Wallet.create();

console.log("Making gasless transfer of 0.000001 USDC...");
const transfer = await sourceWallet.createTransfer({
amount: 0.000001,
assetId: Coinbase.assets.Usdc,
destination: destinationWallet,
gasless: true,
});

await transfer.wait();

expect(transfer.toString()).toBeDefined();
expect(await transfer.getStatus()).toBe(TransferStatus.COMPLETE);
console.log(`Completed gasless transfer from ${sourceWallet} to ${destinationWallet}`);

// Verify balances
const sourceBalance = await sourceWallet.listBalances();
const destBalance = await destinationWallet.listBalances();
expect(sourceBalance.get(Coinbase.assets.Usdc)).not.toEqual("0");
expect(destBalance.get(Coinbase.assets.Usdc)?.toString()).toEqual("0.000001");
console.log(`Source balance: ${sourceBalance}`);
console.log(`Destination balance: ${destBalance}`);
}, 200000);
});

describe("Coinbase SDK Stake E2E Test", () => {
Expand Down

0 comments on commit f2d5acc

Please sign in to comment.