Module 6 - Understanding Router Wasm Bindings
Introduction
router_wasm_bindings
is a crate
package which we’ll be using to Import all the features provided by Router Protocol. It includes methods for making your DApp CrossChain. Refer this Documentation to Learn in-detail the router_wasm_bindings
package.
Now, Let’s Explore Some of the Methods available in router_wasm_bindings
package.
Structs
RouterQuerier
This is a helper Wrapper to easily use our Custom Queries.
CrossChainRequestResponse
This is a Wrapper used to Record CrossChain Response.
GasPriceResponse
This is a Wrapper used to Record Gas Price Response.
RequestMetaData
This is a Wrapper used to get the Request Metadata to be used while Initiating cross-chain Request.
TokenPriceResponse
This is a Wrapper used to get the Token Price Response.
Enums
RouterMsg
A number of Custom Messages that can Call into the Router Bindings.
RouterQuery
An Enum used to Query Token Price and Gas Price.
SudoMsg
An Enum consists of HandleIReceive and HandleIAck -
-
HandleIReceive - a function to handle the Acknowledgement received from the Destination Chain Back on the Source Chain.
-
HandleIAck - function to handle the cross-chain Request received from some Other Chain.
AckType
An Enum which gives the Acknowledgement Type of the Request.
ChainType
An Enum which tells about the Type of the Chain.
Functions
convert_address_from_bytes_to_string
A function which is used to convert an Address from Bytes to String.
convert_address_from_string_to_bytes
A function which is used to convert an Address from String to Bytes.
evm_address_to_router_address
A function which is used to Convert any EVM Address to Router Chain Address.
fetch_oracle_gas_price
A function which is used to fetch the Gas Price of an Oracle.
fetch_oracle_token_price
A function which is used to fetch the Token Price of an Oracle.
router_address_to_evm_address
A function which is used to Convert any Router Chain Address to EVM Address.
Constants
EVM_ADDRESS_LENGTH
A Constant which is used to Calculate the Length of an EVM Address.
INBOUND_OUTBOUND_MAPPING_EVENT_NAME
A Constant which is used to Determine the InBound and OutBound Mapping.
NATIVE_DENOM
A Constant which is set to Natve Denom as “route”.