• Queries a bridge operation to determine expected outcomes and fees

    Parameters

    Returns Promise<null | BridgeQueryResult>

    Promise resolving to BridgeQueryResult or null if received amount cannot be determined

    Throws

    Error if bridge plugin does not return a received amount

    Example

    const result = await queryBridge({
    fromChain: optimism,
    toChain: base,
    amount: BigInt("1000000"), // 1 USDC
    account: myMultichainAccount,
    tokenMapping: {
    deployments: [
    { chainId: 10, address: "0x123..." },
    { chainId: base.id, address: "0x456..." }
    ],
    on: (chainId) => deployments.find(d => d.chainId === chainId).address
    }
    });

    if (result) {
    console.log(`Expected to receive: ${result.receivedAtDestination}`);
    console.log(`Expected duration: ${result.bridgingDurationExpectedMs}ms`);
    }