Mersi

Deposit

Verify a Sui USDC deposit and fund the user's Crossmint EVM wallet.

Requires a valid crossmint-jwt cookie. Onboarding completion is not required — users can fund their wallet before finishing onboarding.

POST /api/deposit/verify

Verifies that a Sui blockchain transaction deposited USDC into the user's wallet, then credits the user's Crossmint EVM wallet with the equivalent USDMX amount. Replay attacks are prevented by the unique constraint on orders.tx_hash — the same txDigest cannot be processed twice.

Auth required: Yes (JWT cookie)

Request Body

FieldTypeRequiredDescription
txDigeststringYesSui transaction digest of the deposit transaction
noncestringYesUnique nonce embedded in the transaction — must match the PaymentReceipt event
amountstringYesAmount in MIST units (1 USDC = 1,000,000 MIST)
coinTypestringYesSui coin type, e.g. 0xa1ec7fc00a...::usdc::USDC
{
  "txDigest": "0xabc123def456sui_tx_hash",
  "nonce": "deposit_123_1745000000000",
  "amount": "1000000",
  "coinType": "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC"
}

amount is in MIST, not USDC. 1 USDC = 1,000,000 MIST. The frontend should pass the raw MIST value from the @mysten/payment-kit SDK.

Response 200 OK

{
  "success": true,
  "txDigest": "0xabc123def456sui_tx_hash",
  "usdcAmount": 1,
  "usdmxAmount": "1.00"
}
FieldTypeDescription
successbooleantrue if deposit was verified and wallet funded
txDigeststringThe Sui transaction digest echoed back
usdcAmountnumberUSDC amount received (e.g. 1 = 1 USDC)
usdmxAmountstringUSDMX amount credited to Crossmint EVM wallet

Errors

StatusCode / MessageCause
400Wallet not provisionedUser has no Sui or EVM wallet yet
400Invalid coin typecoinType is not the USDC coin type
400No PaymentReceipt event foundTransaction did not emit the expected on-chain event
400Nonce mismatchNonce in request doesn't match the on-chain event
400Amount mismatchAmount in request doesn't match the on-chain event
400Receiver mismatchRecipient in on-chain event doesn't match user's wallet
409Deposit already processedtxDigest was already used (unique constraint on orders.tx_hash)
500Faucet failed: ...Crossmint EVM wallet funding failed

curl Example

curl -b cookies.txt -X POST http://localhost:3000/api/deposit/verify \
  -H "Content-Type: application/json" \
  -d '{
    "txDigest": "0xabc123...",
    "nonce": "deposit_123_1745000000000",
    "amount": "1000000",
    "coinType": "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC"
  }'

Deposit Flow

How is this guide?

On this page