import { ChainAddress, TokenTransfer } from "@wormhole-foundation/sdk";
import { Wormhole, TransferState, wormhole, amount } from "@wormhole-foundation/sdk";
import cosmwasm from "@wormhole-foundation/sdk/cosmwasm";
import evm from "@wormhole-foundation/sdk/evm";
const CLO_BSC_ADDRESS = "0x81D3A238b02827F62B9f390f947D36d4A5bf89D2";
const CLO_DECIMALS = 18;
async function bridgeCloBscToSei(momey:string) {
const wh = await wormhole("Mainnet", [evm]);
const bsc = wh.getChain("Bsc");
const sei = wh.getChain("Seievm"); //Seievm和Sei
const wrapper_evm = await evm();
const source = await wrapper_evm.getSigner(await bsc.getRpc(), process.env.PRIVATE_KEY!);
const destination = await wrapper_evm.getSigner(await sei.getRpc(), process.env.PRIVATE_KEY!);
const token = Wormhole.tokenId(bsc.chain, CLO_BSC_ADDRESS);
const amt = amount.units(amount.parse(momey, CLO_DECIMALS));
const sourceAddress = Wormhole.chainAddress(bsc.chain, source.address());
const destAddress = Wormhole.chainAddress(sei.chain, destination.address());
const xfer = await wh.tokenTransfer(
token,
amt,
sourceAddress,
destAddress,
"AutomaticTokenBridge"
);
const quote = await TokenTransfer.quoteTransfer(
wh,
bsc,
sei,
xfer.transfer,
);
const amt = amount.units(amount.parse(momey, CLO_DECIMALS));
Argument of type 'TokenTransferDetails' is not assignable to parameter of type 'QuoteTransferDetails'.
Type 'BaseTokenTransferDetails & { protocol: "ExecutorTokenBridge"; executorQuote?: ExecutorQuote | undefined; referrerFee?: ReferrerFee | undefined; }' is not assignable to type 'QuoteTransferDetails'.
Type 'BaseTokenTransferDetails & { protocol: "ExecutorTokenBridge"; executorQuote?: ExecutorQuote | undefined; referrerFee?: ReferrerFee | undefined; }' is not assignable to type 'BaseQuoteDetails & { protocol: "ExecutorTokenBridge"; msgValue: bigint; gasLimit: bigint; nativeGas?: bigint | undefined; referrerFee?: { feeDbps: bigint; referrer: ChainAddress; } | undefined; }'.
Type 'BaseTokenTransferDetails & { protocol: "ExecutorTokenBridge"; executorQuote?: ExecutorQuote | undefined; referrerFee?: ReferrerFee | undefined; }' is missing the following properties from type '{ protocol: "ExecutorTokenBridge"; msgValue: bigint; gasLimit: bigint; nativeGas?: bigint | undefined; referrerFee?: { feeDbps: bigint; referrer: ChainAddress; } | undefined; }': msgValue, gasLimitts(2345)
i want to calc total cast.
get error:
i want to calc total cast.