Pular para o conteúdo

1Money transaction types

1Money is a stablecoin-native chain, so its tokens don't follow ERC-20 or SPL. Token operations are expressed as explicit transaction types rather than contract calls, and you access them through raw signing.

Encode each of the payloads below using the envelope described in 1Money in Transaction encoding formats.

Transaction typeDescription
TokenCreateIssue a new token
TokenMintMint tokens to an address
TokenBurnBurn tokens from an address
TokenTransferTransfer tokens between addresses
TokenGrantAuthorityGrant an authority role to an address
TokenRevokeAuthorityRevoke an authority role from an address
TokenBlacklistAccountAdd an address to the token blacklist
TokenWhitelistAccountAdd an address to the token whitelist
TokenPausePause token operations
TokenUnpauseUnpause token operations
TokenUpdateMetadataUpdate the token name, URI, or metadata
BatchPaymentPay many recipients of one token in a single transaction

TokenMint, TokenBurn, and TokenTransfer

These three types share the same payload shape:

{
  "transactionType": "TokenMint",
  "payload": {
    "chain_id": 1212101,
    "nonce": 0,
    "recipient": "0x1234567890123456789012345678901234567890",
    "value": 1000000000000000000,
    "token": "0xabcdef0123456789abcdef0123456789abcdef01"
  }
}

TokenCreate

{
  "transactionType": "TokenCreate",
  "payload": {
    "chain_id": 1212101,
    "nonce": 0,
    "symbol": "MYTOKEN",
    "name": "My Token",
    "decimals": 18,
    "master_authority": "0x1234567890123456789012345678901234567890",
    "is_private": false
  }
}

The response metadata for a TokenCreate transaction includes the new token's contract address:

{
  "transaction_identifier": {
    "hash": "0x..."
  },
  "metadata": {
    "token_contract_address": "0x1234567890123456789012345678901234567890"
  }
}

TokenGrantAuthority and TokenRevokeAuthority

{
  "transactionType": "TokenGrantAuthority",
  "payload": {
    "chain_id": 1212101,
    "nonce": 0,
    "action": "Grant",
    "authority_type": "MasterMintBurn",
    "authority_address": "0x1234567890123456789012345678901234567890",
    "token": "0xabcdef0123456789abcdef0123456789abcdef01",
    "value": 0
  }
}

Authority types: MasterMintBurn, MintBurn, Pause, List, MetadataUpdate, BridgeMint.

TokenBlacklistAccount and TokenWhitelistAccount

{
  "transactionType": "TokenBlacklistAccount",
  "payload": {
    "chain_id": 1212101,
    "nonce": 0,
    "action": "Add",
    "address": "0x1234567890123456789012345678901234567890",
    "token": "0xabcdef0123456789abcdef0123456789abcdef01"
  }
}

TokenPause and TokenUnpause

{
  "transactionType": "TokenPause",
  "payload": {
    "chain_id": 1212101,
    "nonce": 0,
    "action": "Pause",
    "token": "0xabcdef0123456789abcdef0123456789abcdef01"
  }
}

TokenUpdateMetadata

{
  "transactionType": "TokenUpdateMetadata",
  "payload": {
    "chain_id": 1212101,
    "nonce": 0,
    "name": "Updated Token Name",
    "uri": "https://example.com/token-metadata",
    "token": "0xabcdef0123456789abcdef0123456789abcdef01",
    "additional_metadata": []
  }
}

BatchPayment

BatchPayment pays many recipients of a single token in one transaction:

{
  "transactionType": "BatchPayment",
  "payload": {
    "chain_id": 1212101,
    "nonce": 0,
    "token": "0xabcdef0123456789abcdef0123456789abcdef01",
    "operations": [
      { "recipient": "0x1234567890123456789012345678901234567890", "amount": 1500000 },
      { "recipient": "0xa0B640D215622e72198D1BFf88aCd8aFB9198844", "amount": 2500000 }
    ],
    "created_at": 1755090000
  }
}

Key behaviors:

  • operations is ordered, and the order is significant — it forms part of the signed bytes.
  • created_at is caller-supplied Unix seconds — the SDK doesn't stamp a clock of its own. It also forms part of the signed bytes, so use the same value throughout signing and submission.
  • operations_hash and batch_id are optional trailing fields. Leaving operations_hash unset is always valid. If you set it, it must equal the canonical hash of operations (use DeriveBatchPaymentOperationsHash), or Ripple Custody (Wallet) rejects the payload before signing.
  • Policies evaluate the sum of the operation amounts, not a per-recipient figure, so a transaction limit must cover the whole batch. Each token contract needs its own configured limit — assets are keyed on symbol, blockchain, and contract address.
  • These payloads fail locally before signing rather than at the node: an empty operations list, a zero-address recipient, a zero or absent amount, amounts totalling more than 2^256−1, and an operations_hash that doesn't match operations.
BatchPayment signs a different digest

Unlike the other transaction types, BatchPayment exists only in the SDK's domain-separated v2 format and has no legacy v1 equivalent. The connector handles this — you don't need to do anything differently — but a client configured with the 1Money SDK's WithLegacyV1 option can't send one.

Example: mint tokens

  1. Get the current nonce for your wallet:

    GET /v2/vaults/{vaultId}/wallets/{walletId}/sequence
    {
      "sequence": "5"
    }
  2. Build the raw transaction in your application:

    payload := onemoney.TokenMintPayload{
        ChainID:   1212101,
        Nonce:     5,  // from step 1
        Recipient: common.HexToAddress("0xa0B640D215622e72198D1BFf88aCd8aFB9198844"),
        Value:     big.NewInt(1000000000000000000), // 1 token (18 decimals)
        Token:     common.HexToAddress("0x6b01a50120ebcd864a0376375d911a001395a062"),
    }
    
    rawTx := map[string]interface{}{
        "transactionType": "TokenMint",
        "payload":         payload,
    }
    
    // Marshal to JSON and hex encode
    jsonBytes, _ := json.Marshal(rawTx)
    encodedTx := hex.EncodeToString(jsonBytes)
  3. Submit the raw transaction:

    POST /v2/vaults/{vaultId}/wallets/{walletId}/transactions/raw
    Content-Type: application/json
    
    {
      "encodedTransaction": "7b227472616e73616374696f6e54797065223a22546f6b656e4d696e74222c...",
      "signOnly": false
    }
    {
      "id": "tx-uuid-here",
      "status": "REQUESTED",
      "asset": {
        "id": "asset-uuid",
        "symbol": "BOB"
      }
    }
  4. Poll the transaction status until it's confirmed. See Track the transaction lifecycle.

    GET /v2/vaults/{vaultId}/wallets/{walletId}/transactions/{txId}