Added new XDR support for Soroban constructors which allows a contract to run custom initialization logic atomically when it's first created. You can read more about this change in CAP-58. The following changes are introduced:
A new special contract function __constructor that may only be called by the Soroban host environment. The environment will call __constructor function if and only if the contract is being created from a Wasm exporting that function.
Introduce a new host function create_contract_with_constructor in Soroban environment that allows constracts to instantiate other contracts with constructors.
Introduce a new HostFunction XDR variant HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2 that acts in the same way as HOST_FUNCTION_TYPE_CREATE_CONTRACT, but also allows users to specify the constructor arguments.
Introduce a new SorobanAuthorizedFunction XDR variant SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN that allows users to sign the authorization payload corresponding to HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2 host function calls.
Horizon API
Breaking Changes
Changed ErrorResultXDR field naming from camelcase to snakecase - error_result_xdr - for transactions_async endpoint. (#5445)
The following deprecated fields have been removed (#5478):
/transactions/:id: valid_before and valid_afterfields
Soroban-RPC
Breaking Changes
createdAt field in getTransaction response is now encoded as string instead of int64. (#251)
The fields in getVersionInfo response were changed to Camel-case naming (#164):
commitHash
buildTimestamp
captiveCoreVersion
protocolVersion
The legacy cost field has been removed from simulateTransaction response. (#295):
The correct resource costs can now be retrieved from the transactionData XDR in the response.
Remove pagingToken from getEvents response and replace it with cursor. (#297)
Instead of being present in all event objects, the cursor will be at the top level of the response similar to getTransactions. This makes it easier to use and brings it in sync with how Cursor is used in other RPC endpoints
Deprecated getLedgerEntry endpoint is now removed. (#276)
Users can use the more powerful getLedgerEntries endpoint to get the same result.
Non-Breaking Changes
Add transaction hash field - txHash - to getTransactions and getTransaction response. (#299, #314)
Each transaction object in the response now also includes a hex-encoded transaction hash string.
Protocol 22
XDR Changes
__constructor
that may only be called by the Soroban host environment. The environment will call__constructor
function if and only if the contract is being created from a Wasm exporting that function.create_contract_with_constructor
in Soroban environment that allows constracts to instantiate other contracts with constructors.HostFunction
XDR variantHOST_FUNCTION_TYPE_CREATE_CONTRACT_V2
that acts in the same way asHOST_FUNCTION_TYPE_CREATE_CONTRACT
, but also allows users to specify the constructor arguments.SorobanAuthorizedFunction
XDR variantSOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN
that allows users to sign the authorization payload corresponding toHOST_FUNCTION_TYPE_CREATE_CONTRACT_V2
host function calls.Horizon API
Breaking Changes
ErrorResultXDR
field naming from camelcase to snakecase -error_result_xdr
- fortransactions_async
endpoint. (#5445)/asset
:num_accounts
andamount
fields/transactions/:id
:valid_before
andvalid_after
fieldsSoroban-RPC
Breaking Changes
createdAt
field ingetTransaction
response is now encoded asstring
instead ofint64
. (#251)getVersionInfo
response were changed to Camel-case naming (#164):commitHash
buildTimestamp
captiveCoreVersion
protocolVersion
cost
field has been removed fromsimulateTransaction
response. (#295):transactionData
XDR in the response.pagingToken
fromgetEvents
response and replace it withcursor
. (#297)cursor
will be at the top level of the response similar togetTransactions
. This makes it easier to use and brings it in sync with how Cursor is used in other RPC endpointsgetLedgerEntry
endpoint is now removed. (#276)getLedgerEntries
endpoint to get the same result.Non-Breaking Changes
txHash
- togetTransactions
andgetTransaction
response. (#299, #314)SDF Reference Implementations