Creating an Onchain Wallet
An onchain wallet can be created using the same Create Wallet endpoint detailed in the Wallets concepts page. See below for examples on how to process this creation:- Java
- .NET
- Go
- Python
- CLI
- TS/JS
Receiving funds into Prime Onchain Wallet
This functionality works identically to deriving a deposit address for any other Prime wallet. See Deposits for more information.Address groups
Prime Onchain Wallet utilizes address groups, which are collections of addresses organized for specific purposes, such as grouping addresses associated with a particular Uniswap pool. To list the available Onchain Address Groups, use the List Onchain Address Groups endpoint. An example request is shown below:- Java
- .NET
- Go
- Python
- TS/JS
- CLI
Creating an onchain transaction
Creating an onchain transaction is accomplished via the Create Onchain Transaction endpoint. While this endpoint processes the initiation of a transaction, please note:- The transaction still requires signing through the standard Onchain wallet flows.
- Consensus approval still applies if required by the portfolio’s transfer rules.
raw_unsigned_txn value for EVM and Solana transactions, including contract calls, see Building the raw unsigned transaction.
See below for an example request.
- Java
- .NET
- Go
- Python
- CLI
- TS/JS
Building the raw unsigned transaction
Theraw_unsigned_txn field takes a complete, unsigned transaction, serialized and hex-encoded. A leading 0x is optional. Prime signs the transaction with the wallet in the request path, so the transaction does not need a sender field or a signature. The examples below use Python and reproduce the EVM and Solana examples in the API reference.
Install the Python packages used in the examples:
Dynamic nonce and gas (EVM)
By default, Prime sets the nonce and gas fees of EVM transactions before signing (evm_params.disable_dynamic_nonce and evm_params.disable_dynamic_gas both default to false). With these defaults, set the nonce and fee fields to 0 in the transaction you build.
To control either value yourself, set it in the transaction and set the matching disable_dynamic_* option to true. To speed up or cancel a pending transaction, pass its ID in evm_params.replaced_transaction_id and leave dynamic nonce enabled.
EVM transactions
Prime expects EIP-1559 (type 2) transactions. Fields in an RLP-encoded transaction are positional, so a field you want Prime to set is encoded as0 rather than omitted.
In RLP, the integer
0 is encoded as the single byte 0x80 (an empty string), not 0x00. The rlp package used below handles this for you. If you encode the transaction another way, write 0x80 for each zero-valued field.evm_params is required for EVM wallets and must include chain_id. Set the chain ID in the transaction and in evm_params.chain_id, and make sure they match.
Encoding contract calls (EVM)
For a contract call,data is the 4-byte function selector followed by the ABI-encoded arguments. The selector is the first 4 bytes of the Keccak-256 hash of the canonical function signature, such as transfer(address,uint256).
If you have the contract’s ABI, for example from the contract’s verified source on a block explorer, use web3.py to encode the call. The ABI entry validates the argument types for you.
uint256, not uint), no spaces, and no parameter names.
exactInputSingle:
Solana transactions
Prime expects a versioned (v0) transaction with an empty signature slot for the Prime Onchain Wallet in the request path. In the common case, the Onchain Wallet is the fee payer and the only signer, as in the examples below. If the transaction requires other signers, collect their signatures before you submit it: Prime adds its signature to the first empty signature slot. Omitevm_params for Solana wallets. Requests that include it are rejected.