This doc covers how to interact with the EvmTx type returned by the Skip Go API
EvmTx
type for the developer to pass to the user for signingEvmTx
to help their users move from/to EVM chains.EvmTx
Data StructureThe EvmTx has 4 fields that the developer needs to understand:
to
: The address of the smart contract or externally owned account (EOA) with which this transaction interacts, as a hex-string prefixed with 0x (e.g. 0xfc05aD74C6FE2e7046E091D6Ad4F660D2A159762)value
: The amount of wei
this transaction sends to the contract its interacting with (1 ETH = 1^18 WEI)data
: The calldata this transaction uses to call the smart contract it interacts with, as a hex string. The data bytes will be interpreted according to the application-binary-interface (ABI) of the contract that’s being interacted with. If this field is empty, it means the transaction is sending funds to an address, rather than calling a contract.required_erc20_approvals
: The permissions that must be granted to a specific smart contract to spend or transfer a certain amount of their ERC-20 tokens on behalf of the end user. This allows smart contracts to execute expressive flows that may involve moving some amount of the user’s ERC-20 tokens
EvmTx
populated by the other fields in the response can be submitted to the network. Otherwise, it will fail to execute with a permission error.ERC20Approval
object has 3 fields that define approval:
_ token_contract
: The address of the ERC-20 token on which the approval is granted
_ spender
: The address of the contract to which the approval will grant spend authority * amount
: The amount of token_contract
tokens the approval will grant the spender
to spendchain_id
: This is the same as in the Cosmos context (simply an identifier for the chain), but it’s an int instead of a stringFor more information on transactions, check out the Ethereum foundation’s docs
To enable EVM transactions in your application, first install an EVM developer library. The most popular options are:
The code snippets below use viem.
SkipClient
client with the EVM WalletClient
objectAll 3 libraries mentioned above allow you to create WalletClient “signer” objects that:
You need to set up the getEVMSigner
function in the SkipClient
constructor to initialize this signer object for the a given EVM chain.
For example, with Viem, we do the following:
SkipClient
and get required chainNext, request your route as normal:
Use the route to determine the chains for which you need to supply a user address (the source, destination, and all intermediate chains that require a recovery address for receiving tokens in case of a failure)
SkipClient
Finally, you can use SkipClient.executeRoute
to prompt the user to sign the approval(s) and transaction, and submit the transaction on chain.
Have questions or feedback? Help us get better!
Join our Discord and select the “Skip Go Developer” role to share your questions and feedback.