Skip to main content

unsafe_mergeCoins

Transaction Builder API Create an unsigned transaction to merge multiple coins into one coin.

Transaction Builder API Create an unsigned transaction to merge multiple coins into one coin.

Parameters

  • signer : <SuiAddress> - the transaction signer's Sui address
  • primary_coin : <ObjectID> - the coin object to merge into, this coin will remain after the transaction
  • coin_to_merge : <ObjectID> - the coin object to be merged, this coin will be destroyed, the balance will be added to `primary_coin`
  • gas : <ObjectID> - gas object to be used in this transaction, node will pick one from the signer's possession if not provided
  • gas_budget : <uint64> - the gas budget, the transaction will fail if the gas cost exceed the budget

Returns

  • TransactionBytes : <TransactionBytes>
    • gas : <[ObjectRef]> - the gas object to be used
    • inputObjects : <[InputObjectKind]> - objects to be used in this transaction
    • txBytes : <[Base64]> - BCS serialized transaction data bytes without its type tag, as base-64 encoded string.

Example Request and Result for unsafe_mergeCoins

Request

curl --location 'https://sui-testnet.blastapi.io/<project-id>' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "unsafe_mergeCoins",
"params": [
"0x4c05f4f76ed81d210e9a29ac0756c7a3129e4b9ecacbbb9fc1579505947630cf",
"0x5b14e6b640d6254959803aafff56b3d42c559760f38c3f98a91f557233b8ebc9 ",
"0x47011883c7c75aaeb5beec48ade6eebb428bb8a89a340936e9b24fcbacdc67ea",
"8aPfVmE7k1h3BFju4WFhGJ59oWpMFSiRqsCa1EsyJxtS",
"3"
]
}'