Documentation Index
Fetch the complete documentation index at: https://docs.polygon.technology/llms.txt
Use this file to discover all available pages before exploring further.
Send USDC by submitting an ERC-20 transfer contract call from an authenticated embedded wallet.
1. Authenticate
Authenticate the user and resolve an active wallet session before submitting transactions. These snippets use email OTP, matching the quickstart flow.
await oms.wallet.startEmailAuth({ email: 'user@example.com' })
// Show your OTP input, then complete auth with the user-entered code.
const { walletAddress } = await oms.wallet.completeEmailAuth({ code: '123456' })
console.log('Wallet address:', walletAddress)
try await oms.wallet.startEmailAuth(email: "user@example.com")
// Show your OTP input, then complete auth with the user-entered code.
let result = try await oms.wallet.completeEmailAuth(code: "123456")
if case let .walletSelected(walletAddress, _, _, _) = result {
print("Wallet address:", walletAddress)
}
import com.omsclient.kotlin_sdk.wallet.CompleteAuthResult
client.wallet.startEmailAuth("user@example.com")
// Show your OTP input, then complete auth with the user-entered code.
val result = client.wallet.completeEmailAuth("123456")
check(result is CompleteAuthResult.WalletSelected)
println("Wallet address: ${result.walletAddress}")
2. Send USDC
Send USDC by calling the ERC-20 transfer method from the authenticated wallet. USDC uses 6 decimals, so 1.00 USDC is the raw base-unit value 1000000.
Replace 0xTokenContract with the USDC contract for the network you are sending on. For Polygon PoS mainnet, native USDC is 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359. The snippets use Polygon mainnet; to test on Polygon Amoy, switch the network value and use a test ERC-20 contract with 6 decimals.
import { Networks } from '@0xsequence/typescript-sdk'
import { parseUnits, type Abi, type Address } from 'viem'
const usdcContract = '0xTokenContract' as Address
const recipient = '0xRecipient' as Address
const amount = parseUnits('1.00', 6)
const usdcAbi = [
{
name: 'transfer',
type: 'function',
inputs: [
{ name: 'to', type: 'address' },
{ name: 'amount', type: 'uint256' },
],
},
] as const satisfies Abi
const tx = await oms.wallet.sendTransaction({
network: Networks.polygon,
to: usdcContract,
abi: usdcAbi,
functionName: 'transfer',
args: [recipient, amount],
})
console.log('USDC transaction:', tx.txnHash ?? tx.txnId)
let amount = try parseUnits(value: "1.00", decimals: 6)
let tx = try await oms.wallet.callContract(
network: .polygon,
contract: "0xTokenContract",
method: "transfer(address,uint256)",
args: [
AbiArg(type: "address", value: .string("0xRecipient")),
AbiArg(type: "uint256", value: .string(amount))
]
)
print("USDC transaction:", tx.txnHash ?? tx.txnId)
import com.omsclient.kotlin_sdk.Network
import com.omsclient.kotlin_sdk.models.AbiArg
import com.omsclient.kotlin_sdk.utils.parseUnits
import kotlinx.serialization.json.JsonPrimitive
val amount = parseUnits("1.00", 6)
val tx = client.wallet.callContract(
network = Network.POLYGON,
contract = "0xTokenContract",
method = "transfer(address,uint256)",
args = listOf(
AbiArg(type = "address", value = JsonPrimitive("0xRecipient")),
AbiArg(type = "uint256", value = JsonPrimitive(amount.toString())),
),
)
println("USDC transaction id: ${tx.txnId}")
println("USDC transaction hash: ${tx.txnHash}")