Skip to main content

unsafe_publish

Transaction Builder API: Create an unsigned transaction to publish Move module.

Transaction Builder API: Create an unsigned transaction to publish Move module.

Parameters

  • sender : <SuiAddress> - the transaction signer's Sui address
  • compiled_modules : <[Base64]> - the compiled bytes of a Move package
  • dependencies : <[ObjectID]> - a list of transitive dependency addresses that this set of modules depends on.
  • 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 unsafe_publish

Request

curl --location 'https://sui-testnet.blastapi.io/<project-id>' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "unsafe_publish",
"params": [
"0xeeb30f4dc675a7d49b8abedf58eb2e3738facfc554c80f4b27ab62aa02878f56",
[
"UDYCDa2aWEDMU0HrzbHIwSynps1KS/SmcWkdXjWE8j1Q/EXOnhbI2+0QILrztBoHkxDT8VpkxGe2ZgprmWO4Dw=="
],
["0x06850c139e7f8923edd306226efe08d7ed699eafa8f8b8e59a7fa6aa31f481ff"],
"2"
]
}'

Result

{
"jsonrpc": "2.0",
"result": {
"txBytes": "AAEBYQBviFz6Y6H4RjBva6ARJNNMc6TT7ATjOibU4ESkWPM8r1nMCMq1OKoR1XrCk9D6J9FtMT9G+kqiBZ3lsU7wwuIDBE8TbGiR+lASjfxn4meOl/IjFf3ci1P8x8FTKwafVU0w2reNWEcaeElutxwsbne6Jo8DkDoOobmA6nL3RXhPeThmlRJ0z5Vlc6AGAAAAAAAg52EjC2IvYUY3YUndrVNlQfdL5hj0pWzgMM0rSmicQbwBAAAAAAAAAAEAAAAAAAAA",
"gas": {
"objectId": "0x3a0ea1b980ea72f745784f793866951274cf9565",
"version": 434291,
"digest": "52EjC2IvYUY3YUndrVNlQfdL5hj0pWzgMM0rSmicQbw="
},
"inputObjects": [
{
"ImmOrOwnedMoveObject": {
"objectId": "0x3a0ea1b980ea72f745784f793866951274cf9565",
"version": 434291,
"digest": "52EjC2IvYUY3YUndrVNlQfdL5hj0pWzgMM0rSmicQbw="
}
}
]
},
"id": 1
}