EVM chains like Ethereum, Polygon, Base, etc support the following kind:
Transaction: broadcasts an EVM transaction.
UserOperations: fee sponsorship of smart contract invocation.
Transaction
Signs an unsigned transaction and broadcasts it to chain.
Hex String
Typescript Example with Ethers
First install the Ethers JS. You can find the full documentation here
Here a code sample to broadcast a transaction via the DFNS TypeScript SDK:
EvmTransactionJson
| Field | Description | Type - Optional |
|---|
type | Ethereum transaction type. 0 for legacy transaction; 2 for EIP-1559 transaction; 4 for EIP-7702 transaction. Default is 2 if undefined. | Integer (optional) |
to | The destination address or target contract. Leave undefined when the transaction is a contract deployment. | String (optional) |
value | The amount of native tokens to transfer in minimum denomination. | String (optional) |
data | ABI encoded function call data in hex format. Can also be the encoded smart contract data when the transaction is a contract deployment. | String (optional) |
nonce | The transaction number to guarantee idempotency. If omitted, it will be provided automatically. Note the same nonce can be submitted multiple times with a higher maxFeePerGas to “overwrite” existing transactions in the mempool. | Integer or String (optional) |
gasLimit | The maximum amount of gas that can be spent for executing the transaction. If omitted, it will be calculated automatically. | String (optional) |
gasPrice | The amount of per unit gas. Only valid for a type 0 legacy transaction. If omitted, it will be calculated automatically. | String (optional) |
maxFeePerGas | The maximum amount of per unit gas willing to be paid for the transaction. Valid for type 2 and type 4 transactions. If omitted, it will be calculated automatically. | String (optional) |
maxPriorityFeePerGas | The maximum amount of per unit gas to be included as a tip to the validator. Valid for type 2 and type 4 transactions. If omitted, it will be calculated automatically. | String (optional) |
authorizationList | A list that indicates what code the signer of each authorization desires to execute in the context of their EOA. Only valid for type 4 transaction. | Authorization (optional) |
Authorization
User Operations
Signs one or more user operations and broadcasts to chain using a sponsored transaction. Used for invoking arbitrary smart contract calls, including batch operations, with a fee sponsor.
Can only be used with a fee sponsor. Unsponsored user operations are not supported.
UserOperation
EVM Templates
Evm and Eip1559 kinds are deprecated. They only support type 2 transactions. Use the new JSON format with Transaction kind instead which has support for legacy and type 4 transactions.
Complete examples
For complete working examples, see the SDK examples on GitHub:
Ethers.js:
Viem: