/construction/preprocess

POST https://rosetta.s0.b.hmny.io/construction/preprocess

Overview

This endpoint is offline.

The endpoint is called prior to the /construction/payloads endpoint to construct a request for any metadata that is needed for transaction construction given (i.e. account nonce).

Reference Rosetta Documentation

Harmony Specific Documentation

Gas Fees

It is considered invalid to provide the Gas operation since (in most cases) the true gas fee is only known once the transaction is finalized. Instead, you must only provide the intended non-Gas operations.

You can optionally specify the priority of the transaction in the mempool by providing a suggested_fee_multiplier >= 1. Transactions with a higher fee multiplier will be prioritized over transactions with a lower fee multiplier when validators construct the next block. By default, the suggested_fee_multiplier is 1.

Supported Operations

Currently, Harmony supports the construction of the following types of transactions: * Native same-shard transfer * Native cross-shard transfer * Contract creation

Reference the /block/transaction documentation for more details on the operations of such transactions.
You can also view some examples of how to construct each transaction in the example Rosetta-CLI config here & here.

Metadata

Relevant metadata fields for construction:

KeyValue TypeValue Description
to_shardIntThe destination shard ID. Optional for name same-shard transfer, required for native cross-shard transfer.
from_shardIntThe source shard ID. Optional for name same-shard transfer, required for native cross-shard transfer.
contract_account_identifierAccountIdentifierThe main contract address for any transaction involving smart contract calls. Empty for contract construction transactions. This is necessary if any EVM evaluation checks is desired from the /construction/metadata endpoint.

Request Body

{"network_identifier"=>{"blockchain"=>"Harmony", "network"=>"Testnet", "sub_network_identifier"=>{"network"=>"shard 0", "metadata"=>{"is_beacon"=>true}}}, "operations"=>[{"operation_identifier"=>{"index"=>0}, "type"=>"NativeTransfer", "status"=>"", "account"=>{"address"=>"one1kxkr9svezrwjgddh2fq2q3w49mjvvkadqkcfkw", "metadata"=>{"hex_address"=>"0xB1ac32C19910DD2435B75240A045D52EE4c65BAd"}}, "amount"=>{"value"=>"-3347819199729047095735837923", "currency"=>{"symbol"=>"ONE", "decimals"=>18}}}, {"operation_identifier"=>{"index"=>1}, "related_operations"=>[{"index"=>0}], "type"=>"NativeTransfer", "status"=>"", "account"=>{"address"=>"one13lx3exmpfc446vsguc5d0mtgha2ff7h5uz85pk", "metadata"=>{"hex_address"=>"0x8fCD1C9B614E2b5D3208E628d7eD68bF5494faF4"}}, "amount"=>{"value"=>"3347819199729047095735837923", "currency"=>{"symbol"=>"ONE", "decimals"=>18}}}], "suggested_fee_multiplier"=>2, "metadata"=>{"from_shard"=>0, "to_shard"=>0}}

RESPONSES

status: OK

{"options":{"gas_price_multiplier":2,"operation_type":"NativeTransfer","transaction_metadata":{"to_shard":0,"from_shard":0}},"required_public_keys":[{"address":"one1kxkr9svezrwjgddh2fq2q3w49mjvvkadqkcfkw","metadata":{"hex_address":"0xB1ac32C19910DD2435B75240A045D52EE4c65BAd"}}]}