feat(pay-tests): add USDT-on-Polygon Permit2 pay flow + allowance-reset script#97
feat(pay-tests): add USDT-on-Polygon Permit2 pay flow + allowance-reset script#97ignaciosantise wants to merge 4 commits into
Conversation
…set script Add pay_usdt_arbitrum.yaml: creates a payment, selects USDT on Arbitrum, pays, and asserts the success screen. USDT is a Permit2 token, so the wallet sends an approve (allowance) tx then the payment tx; the flow best-effort observes the approve step via the new pay-loading-setup-note testID. To keep the approve step exercised on every run, consumers must reset the Permit2 allowance to 0 after the test. Add a shared CI-helper Node script (scripts/revoke-permit2-approval.js + package.json pinning ethers@5) for this. It signs a transaction, so it lives outside .maestro/scripts/ and runs as a Node post-test step, not a Maestro runScript (the GraalJS sandbox can't sign). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Claude finished @ignaciosantise's task in 2m 10s —— View job Code Review
Found 3 issue(s)Issue 1: Private key exposed in OS process list via CLI argumentID: revoke-permit2-privatekey-cli-exposure-a3f1 Context:
Recommendation: Accept the private key from an environment variable as a fallback so consumers can avoid passing it on the command line: // in parseArgs / normalizePrivateKey flow
const privateKeyInput = args.privateKey || process.env.PERMIT2_REVOKE_PRIVATE_KEY;
const privateKey = normalizePrivateKey(privateKeyInput);Then document the env-var path as the preferred CI usage: PERMIT2_REVOKE_PRIVATE_KEY="$TEST_WALLET_PRIVATE_KEY" \
node revoke-permit2-approval.js --chainId eip155:42161 --rpcUrl ...Issue 2:
|
USDT on Arbitrum (0xFd086…) is EIP-3009 (signature-based, gasless), so WC Pay never returns an on-chain approve action for it — the approve step the test is meant to cover would never run. USDT on Polygon (0xc2132D…) is a plain ERC-20, so WC Pay uses the Permit2 approve + pay path. Rename the flow to pay_usdt_polygon (tag pay-usdt-polygon), assert pay-review-token-polygon, and update the reset invocation to --chainId eip155:137 --rpcUrl https://polygon-rpc.com. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
polygon-rpc.com returns HTTP 401 "tenant disabled" from CI runners; use https://polygon-bor-rpc.publicnode.com (keyless) in the allowance-reset example. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The merchant lists USDT on multiple networks (e.g. Arbitrum + Polygon), so a
"USDT" text match selected the wrong row (Arbitrum, EIP-3009, no approve). Select
the Polygon option by its stable `pay-option-usdt-polygon` testID (scrolling it
into view first). Document the additive `pay-option-{assetSymbol}-{networkName}`
id in the README.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
What
Adds a shared Maestro Pay flow for a USDT (Permit2) payment on Polygon, plus the cross-platform allowance-reset helper it depends on.
Files
.maestro/pay_usdt_polygon.yaml— creates a payment (MULTI_NOKYC merchant, which offers USDT on Polygon), opens the wallet, selects the USDT/Polygon option, pays, and asserts the success screen. Taggedpay+pay-usdt-polygon.scripts/revoke-permit2-approval.js+scripts/package.json— shared CI-helper that resets the Permit2 allowance back to0after the test, so every run re-exercises theapprovestep. Pinsethers@5.README.md— newpay-loading-setup-notetestID, a Test Catalog row, and a "Permit2 tokens & the allowance reset" section.Why Polygon (not Arbitrum)
The wallet just executes whatever
actionsthe Pay backend returns; it does no local allowance check. USDT on Arbitrum (0xFd086…) is EIP-3009 (transferWithAuthorization, signature-based / gasless), so the backend never returns an on-chainapproveaction — no gas, no approval step, and the approve path we want to cover would never run. USDT on Polygon (0xc2132D…) is a plain ERC-20, so WC Pay uses the Permit2 path (one-time on-chainapprove(PERMIT2)+ signature) — exactly the two-txapprove+payflow under test.Key design notes
runScript. Maestro'srunScriptruns in a GraalJS sandbox (norequire, no signing), so it can't sign the reset tx. The script lives in a siblingscripts/CI-helper dir (not.maestro/scripts/) and is run as a post-test Node step.--walletAddressis optional — derived from the private key when omitted; verified to match when passed. Consumers need only the key + an RPC.when: visiblescreenshot onpay-loading-setup-note, never an assertion) since the setup note can flash by quickly; the success screen is the only hard assertion.--chainId eip155:137 --rpcUrl https://polygon-rpc.com(Polygon min priority fee defaults to 25 gwei in the script).Consumer wiring (react-native-examples)
Companion PR reown-com/react-native-examples#533 wires the post-test reset step into its WalletKit Maestro action, adds USDT + POL(gas)-on-Polygon balance monitoring, and pins
maestro/pay-teststo this PR's head SHA for testing (re-pin to the merge commit once this lands).Open items / reviewer notes
MULTI_NOKYCsurfaces USDT on Polygon and thattapOn: text: ".*USDT.*"is unambiguous (no USDT on a second network). Pin withmaestro studiobefore un-drafting.maestro/permit2-resetcomposite action so consumersuses:it instead of copy-pasting the run step.🤖 Generated with Claude Code