feat: add USDC send examples (AA + non-AA) across JS, Go, Python - #24
Open
Rshahatit wants to merge 1 commit into
Open
feat: add USDC send examples (AA + non-AA) across JS, Go, Python#24Rshahatit wants to merge 1 commit into
Rshahatit wants to merge 1 commit into
Conversation
Rshahatit
force-pushed
the
rami/eng-7711-doc-5-add-usdc-examples-to-enclave-example-repo
branch
from
June 19, 2026 00:53
f1613bd to
c13c814
Compare
The example repo previously only demonstrated native-token sends, which left customers hand-building ERC-20 transactions. Add USDC examples that use the enclave `POST /v1/assets/send` endpoint (which builds, signs, and broadcasts the transfer for you), each covering both flows: - AA flow (sponsorGas omitted/true): Portal sponsors gas; requires an Account Abstraction client. Wallet does not need native tokens. - Non-AA flow (sponsorGas: false): wallet pays its own gas and must hold the chain's native token (the common "insufficient balance" gotcha). Changes: - Javascript/eth-send-assets.js: generalized to send USDC (and any token) with AA/non-AA variants (+ yarn sendUsdc / sendUsdcSponsored) - Go/sendUsdc/sendUsdc.go + Go/cmd/sendUsdc/main.go (+ make sendUsdc / sendUsdcSponsored) - Python/send_usdc.py (python send_usdc.py [sponsored]) Also harden Go/Python .gitignore to exclude clientApiKey.txt, shares.txt, and backupShares.txt (previously only the JS example ignored wallet credentials). Verified end-to-end on Sepolia: non-AA send (real tx) and AA sponsored send (UserOp, gas sponsored, smart account deployed) confirmed on-chain in all three languages. Ref: ENG-7711
Rshahatit
force-pushed
the
rami/eng-7711-doc-5-add-usdc-examples-to-enclave-example-repo
branch
from
June 22, 2026 18:55
c13c814 to
a89d548
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves ENG-7711. The example repo previously only demonstrated native-token sends, which left customers hand-building ERC-20 transactions (see the linked support thread — the customer hit repeated "insufficient balance" errors). These examples use the enclave
POST /v1/assets/sendendpoint, which builds, signs, and broadcasts the transfer for you, and cover both account-abstraction and standard flows.Each language demonstrates:
sponsorGasomitted/true): Portal sponsors the gas. Requires an Account Abstraction client (isAccountAbstracted: trueat signup). The wallet does not need to hold native tokens.sponsorGas: false): a standard wallet pays its own gas and must hold the chain's native token — the exact "insufficient balance" gotcha from the support thread.The
tokenfield uses the"USDC"shorthand (the enclave resolves it to the right ERC-20 per chain); a contract-address fallback is documented for chains where the shorthand isn't supported.Changes
Javascript/eth-send-assets.jsgeneralized to send USDC (and any token) with AA/non-AA variants — folded into the existing assets/send example rather than a new fileyarn sendUsdc/yarn sendUsdcSponsoredGo/sendUsdc/sendUsdc.go+Go/cmd/sendUsdc/main.gomake sendUsdc/make sendUsdcSponsoredPython/send_usdc.pypython send_usdc.py [sponsored]READMEs updated in each folder with run steps for both flows, the native-gas requirement, and a Circle-faucet pointer.
Security hardening
The JS folder's
.gitignoreexcludedclientApiKey.txt/shares.txt, but Go and Python did not — so anyone running those examples could have committed wallet credentials to this public repo. AddedclientApiKey.txt,shares.txt, andbackupShares.txtto bothGo/.gitignoreandPython/.gitignore.Verification
Static checks: Go
build/vet/gofmt, JSnode --check, Pythonpy_compileall pass.Live end-to-end on Sepolia — all three languages confirmed on-chain:
0x064cc6…acc50(status 1).make sendUsdcSponsored— balance dropped on-chain (UserOp0x2020d3…b5d4).python send_usdc.py sponsored— balance dropped on-chain (UserOp0x845eeb…969d).AA sends return a UserOperation hash (verify on a UserOp explorer like JiffyScan, not Etherscan). The non-AA path is the same code with
sponsorGas: false, proven by the JS non-AA real tx above.