Skip to content

Argument of type 'TokenTransferDetails' is not assignable to parameter of type 'QuoteTransferDetails'. #982

Description

@jackyyu118
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,
  );

get error:

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)
Image

i want to calc total cast.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions