Skip to content

Commit a6efed7

Browse files
committed
Support non-sandbox for usdc base
1 parent 56f7a2a commit a6efed7

1 file changed

Lines changed: 31 additions & 10 deletions

File tree

  • .claude/skills/grid-base-usdc-sandbox

.claude/skills/grid-base-usdc-sandbox/SKILL.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ export GRID_API_CLIENT_SECRET=$(jq -r .apiClientSecret ~/.grid-credentials)
2929
export GRID_BASE_URL=$(jq -r '.baseUrl // "https://api.lightspark.com/grid/2025-10-13"' ~/.grid-credentials)
3030
```
3131

32+
### 1b. Detect sandbox vs non-sandbox platform
33+
34+
Try a sandbox endpoint to determine platform type. Save the result for use in tests that have sandbox-specific behavior.
35+
36+
```bash
37+
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET" \
38+
-X POST -H "Content-Type: application/json" \
39+
-d '{"amount": 0}' \
40+
"$GRID_BASE_URL/sandbox/internal-accounts/dummy/fund"
41+
```
42+
43+
- If the response contains `"not a sandbox platform"`, set `IS_SANDBOX=false`
44+
- Otherwise (any other error like "not found", or success), set `IS_SANDBOX=true`
45+
46+
Report the detected mode to the user (e.g., "Detected non-sandbox platform" or "Detected sandbox platform").
47+
3248
### 2. Verify Base testnet key exists
3349

3450
```bash
@@ -193,26 +209,28 @@ $BASE_HELPER usdc-balance
193209

194210
Save `raw` as `INITIAL_ONCHAIN_USDC`.
195211

196-
3. Transfer out 0.10 USDC:
212+
3. Transfer out 0.20 USDC:
197213

198214
```bash
199215
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET" \
200216
-X POST -H "Content-Type: application/json" \
201217
-d "{
202218
\"source\": {\"accountId\": \"$USDC_INTERNAL_ID\"},
203219
\"destination\": {\"accountId\": \"$USDC_EXTERNAL_ID\"},
204-
\"amount\": 100000
220+
\"amount\": 200000
205221
}" \
206222
"$GRID_BASE_URL/transfer-out"
207223
```
208224

225+
Note: the amount must exceed the custody provider fee (~100100 micro-USDC), so 200000 is the minimum safe amount.
226+
209227
4. Poll on-chain USDC balance every 5 seconds, up to 120 seconds:
210228

211229
```bash
212230
$BASE_HELPER usdc-balance
213231
```
214232

215-
5. **PASS criteria:** On-chain USDC balance (`raw`) increases by approximately 100000 (0.10 USDC) from `INITIAL_ONCHAIN_USDC`.
233+
5. **PASS criteria:** On-chain USDC balance (`raw`) increases above `INITIAL_ONCHAIN_USDC` (net amount will be ~99900 after fees).
216234

217235
---
218236

@@ -398,8 +416,7 @@ curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET" \
398416
},
399417
\"destination\": {
400418
\"destinationType\": \"ACCOUNT\",
401-
\"accountId\": \"$MXN_EXTERNAL_ID\",
402-
\"paymentRail\": \"SPEI\"
419+
\"accountId\": \"$MXN_EXTERNAL_ID\"
403420
},
404421
\"lockedCurrencySide\": \"RECEIVING\",
405422
\"lockedCurrencyAmount\": 200,
@@ -408,7 +425,7 @@ curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET" \
408425
"$GRID_BASE_URL/quotes"
409426
```
410427

411-
Note: `lockedCurrencyAmount: 200` = 2.00 MXN (smallest unit = centavos), roughly ~$0.10 USD.
428+
Note: `lockedCurrencyAmount: 200` = 2.00 MXN (smallest unit = centavos), roughly ~$0.10 USD. Do not include `paymentRail` — the API infers it from the external account.
412429

413430
3. Extract `QUOTE_ID`, `TRANSACTION_ID`, `PAYMENT_ADDRESS`, and `TOTAL_SENDING_AMOUNT`.
414431

@@ -435,7 +452,9 @@ curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET" \
435452

436453
**Steps:**
437454

438-
1. Fund the USD internal account via sandbox endpoint:
455+
1. Fund the USD internal account:
456+
457+
**If `IS_SANDBOX=true`:** Use the sandbox fund endpoint:
439458

440459
```bash
441460
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET" \
@@ -446,6 +465,8 @@ curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET" \
446465

447466
Verify the balance increased (response contains updated account).
448467

468+
**If `IS_SANDBOX=false`:** Check the current USD internal account balance. If balance is 0, skip this test with a note: "SKIP: Non-sandbox platform — USD internal account has no balance. Requires a prior successful USDC→USD conversion (Test 4) or manual funding." If balance > 0, proceed.
469+
449470
2. Record initial on-chain USDC balance:
450471

451472
```bash
@@ -530,8 +551,8 @@ Include in Details: relevant amounts, transaction IDs, error messages, or timing
530551

531552
All tests use small amounts to conserve testnet funds:
532553
- Test 2: 0.50 USDC deposit (500000 micro-USDC)
533-
- Test 3: 0.10 USDC transfer-out (100000 micro-USDC)
554+
- Test 3: 0.20 USDC transfer-out (200000 micro-USDC) — must exceed ~100100 custody fee
534555
- Tests 4-5: ~$0.10 USD locked on receiving side (10 cents)
535556
- Test 6: ~2.00 MXN locked on receiving side (~$0.10 USD)
536-
- Test 7: $0.50 USD → USDC (50 cents)
537-
- **Total USDC needed: ~1.0 USDC + gas (~0.001 ETH on Base Sepolia)**
557+
- Test 7: $0.50 USD → USDC (50 cents) — requires sandbox or prior USD balance
558+
- **Total USDC needed: ~1.2 USDC + gas (~0.001 ETH on Base Sepolia)**

0 commit comments

Comments
 (0)