Skip to main content

unsafe_pay

Transaction Builder API

Transaction Builder API

Send Coin<T> to a list of addresses, where T can be any coin type, following a list of amounts, The object specified in the gas field will be used to pay the gas fee for the transaction. The gas object can not appear in input_coins. If the gas object is not specified, the RPC server will auto-select one.

Parameters

  • signer : <SuiAddress> - the transaction signer's Sui address
  • input_coins : <[ObjectID]> - the Sui coins to be used in this transaction
  • recipients : <[SuiAddress]> - the recipients' addresses, the length of this vector must be the same as amounts.
  • amounts : <[BigInt_for_uint64]> - the amounts to be transferred to recipients, following the same order
  • gas : <ObjectID> - gas object to be used in this transaction, node will pick one from the signer's possession if not provided
  • gas_budget : <BigInt_for_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 sui_pay

Request

curl --location 'https://sui-testnet.blastapi.io/<project-id>' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "unsafe_pay",
"params": [
"0x00c364252964511b32b084c17a492093d5b762cbe2766d46911912718e56950f",
[
"0x0b79bbcfa2c40970eeab8c453ce32587c9d61351ff36f6ee90b4301607871c73"
],
[
"0x8933942921bd522d69d7af12f875ba4f4963ad01431df8403597dfa8692f417d"
],
[
"10"
],
"0x06850c139e7f8923edd306226efe08d7ed699eafa8f8b8e59a7fa6aa31f481ff",
"2000"
]
}'

Result

{
"jsonrpc": "2.0",
"result": {
"txBytes": "AAADAQALebvPosQJcO6rjEU84yWHydYTUf829u6QtDAWB4cccz3N1gAAAAAAIFxF9+kv7u0JCiraVPFzXEQZRLCpl25bpIEPXeauj9IZAAgKAAAAAAAAAAAgiTOUKSG9Ui1p168S+HW6T0ljrQFDHfhANZffqGkvQX0CAgEAAAEBAQABAQMAAAAAAQIAAMNkJSlkURsysITBekkgk9W3Ysvidm1GkRkScY5WlQ8BBoUME55/iSPt0wYibv4I1+1pnq+o+Ljlmn+mqjH0gf+FQ9cAAAAAACAlOpVdGBlgqhK95qpVTddBWUUZkfnelKa4Md8l6JM2xwDDZCUpZFEbMrCEwXpJIJPVt2LL4nZtRpEZEnGOVpUP6AMAAAAAAADQBwAAAAAAAAA=",
"gas": [
{
"objectId": "0x06850c139e7f8923edd306226efe08d7ed699eafa8f8b8e59a7fa6aa31f481ff",
"version": 14107525,
"digest": "3WKtzDa1Xmj8c97hhFgLr4MtUUGqt9Nu7JnqfDstBh1g"
}
],
"inputObjects": [
{
"ImmOrOwnedMoveObject": {
"objectId": "0x0b79bbcfa2c40970eeab8c453ce32587c9d61351ff36f6ee90b4301607871c73",
"version": 14077245,
"digest": "7DCPYGBYsBFoe25UNtdN4fKSNp5WpwHSixzfmtRU38iL"
}
},
{
"ImmOrOwnedMoveObject": {
"objectId": "0x06850c139e7f8923edd306226efe08d7ed699eafa8f8b8e59a7fa6aa31f481ff",
"version": 14107525,
"digest": "3WKtzDa1Xmj8c97hhFgLr4MtUUGqt9Nu7JnqfDstBh1g"
}
}
]
},
"id": 1
}