The SDK helps you interact with the messaging layer across chains. It handles functionality such as, fee estimation, message hashing, and network activity checks. The SDK is compatible whether you're working with EVM or Solana. It gives you the tools to simulate and prepare cross-chain messages with minimal setup. This guide will walk you through the setup process for the SDK.
The SDK provides fees functionalities that's used to calculate fees, check network activity, and calculate message hashes from source network transaction receipts. Below we go over examples and usage
Reach out to us via our for suggestions or requests.
Installation
Begin by installing the SDK in your project first. We'll be using NPM in this guide. Run the installation command below to get started.
npm install @entangle-labs/uip-sdk
API
There are two main methods for estimation as shown below.
public async estimateExecutionWithGas({
srcChainId: bigint,
destChainId: bigint,
gasLimit: bigint
})
import { FeesEvm, FeesSolana, UIPProvider } from "@entangle-labs/uip-sdk"
const provider = new UIPProvider("<https://json-rpc.entangle.fi>")
const feesEvm = new FeesEvm(provider)
async function getDstChainFee() {
const fee = await feesSdk.estimateExecutionWithGas({
srcChainId: 11155111n,
destChainId: 33133n,
gasLimit: 200000n,
});
console.log("Estimated price:", fee)
}
import { generateReceiptHash } from "@entangle-labs/uip-sdk"
// ... get receipt
const msgHash = await generateReceiptHash(BigInt(33133), receipt)
import { FeesSolana } from "@entangle-labs/uip-sdk"
const feesSolana = new FeesSolana()
fee = await feesSolana.estimateExecutionSolana({
connection: new Connection(srcChain.rpcUrl),
payload: Buffer.from(payloadOriginal),
srcChain: BigInt(srcChainId),
senderAddr: Buffer.from(senderContractAddr),
destChain: BigInt(dstChainId),
destAddr: new PublicKey(destAddr),
accounts: [
// Provide the accounts required for execution on the destination address
],
})