Socket
Socket
Sign inDemoInstall

@wormhole-foundation/sdk-connect

Package Overview
Dependencies
Maintainers
6
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wormhole-foundation/sdk-connect - npm Package Compare versions

Comparing version 0.6.9-beta.1 to 0.7.0-beta.0

dist/cjs/protocols/cctp/cctpTransfer.d.ts

2

dist/cjs/config.js

@@ -19,3 +19,3 @@ "use strict";

Devnet: {
api: "http://guardian:7071",
api: "http://guardian:7071", // Tilt Guardian REST api
circleAPI: "",

@@ -22,0 +22,0 @@ chains: (0, sdk_definitions_1.buildConfig)("Devnet"),

@@ -5,6 +5,3 @@ export * from "./wormhole.js";

export * from "./types.js";
export * from "./protocols/wormholeTransfer.js";
export * from "./protocols/tokenTransfer.js";
export * from "./protocols/cctpTransfer.js";
export * from "./protocols/gatewayTransfer.js";
export * from "./protocols/index.js";
export * as tasks from "./tasks.js";

@@ -11,0 +8,0 @@ export * as circleApi from "./circle-api.js";

@@ -34,6 +34,3 @@ "use strict";

__exportStar(require("./types.js"), exports);
__exportStar(require("./protocols/wormholeTransfer.js"), exports);
__exportStar(require("./protocols/tokenTransfer.js"), exports);
__exportStar(require("./protocols/cctpTransfer.js"), exports);
__exportStar(require("./protocols/gatewayTransfer.js"), exports);
__exportStar(require("./protocols/index.js"), exports);
exports.tasks = __importStar(require("./tasks.js"));

@@ -40,0 +37,0 @@ exports.circleApi = __importStar(require("./circle-api.js"));

import type { Chain, Network } from "@wormhole-foundation/sdk-base";
import { amount } from "@wormhole-foundation/sdk-base";
import type { ChainContext, Signer, TokenId } from "@wormhole-foundation/sdk-definitions";
import type { CircleAttestationReceipt } from "../../protocols/cctpTransfer.js";
import type { ChainAddress, ChainContext, Signer, TokenId } from "@wormhole-foundation/sdk-definitions";
import { CircleTransfer } from "../../protocols/cctp/cctpTransfer.js";
import type { StaticRouteMethods } from "../route.js";

@@ -27,3 +27,3 @@ import { AutomaticRoute } from "../route.js";

type QR = QuoteResult<Op, Vp>;
type R = Receipt<CircleAttestationReceipt>;
type R = Receipt<CircleTransfer.AttestationReceipt>;
export declare class AutomaticCCTPRoute<N extends Network> extends AutomaticRoute<N, Op, Vp, R> implements StaticRouteMethods<typeof AutomaticCCTPRoute> {

@@ -45,6 +45,6 @@ NATIVE_GAS_DROPOFF_SUPPORTED: boolean;

private toTransferDetails;
initiate(signer: Signer, quote: Q): Promise<R>;
track(receipt: R, timeout?: number): AsyncGenerator<import("../../protocols/cctpTransfer.js").CircleTransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">, void, unknown>;
initiate(signer: Signer, quote: Q, to: ChainAddress): Promise<R>;
track(receipt: R, timeout?: number): AsyncGenerator<CircleTransfer.TransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">, void, unknown>;
}
export {};
//# sourceMappingURL=automatic.d.ts.map

@@ -5,3 +5,3 @@ "use strict";

const sdk_base_1 = require("@wormhole-foundation/sdk-base");
const cctpTransfer_js_1 = require("../../protocols/cctpTransfer.js");
const cctpTransfer_js_1 = require("../../protocols/cctp/cctpTransfer.js");
const types_js_1 = require("../../types.js");

@@ -74,3 +74,7 @@ const wormhole_js_1 = require("../../wormhole.js");

try {
return this.request.displayQuote(await cctpTransfer_js_1.CircleTransfer.quoteTransfer(this.request.fromChain, this.request.toChain, this.toTransferDetails(params)), params);
return this.request.displayQuote(await cctpTransfer_js_1.CircleTransfer.quoteTransfer(this.request.fromChain, this.request.toChain, {
automatic: true,
amount: sdk_base_1.amount.units(params.normalizedParams.amount),
nativeGas: sdk_base_1.amount.units(params.normalizedParams.nativeGasAmount),
}), params);
}

@@ -87,3 +91,3 @@ catch (e) {

const ctb = await this.request.fromChain.getAutomaticCircleBridge();
const fee = await ctb.getRelayerFee(this.request.to.chain);
const fee = await ctb.getRelayerFee(this.request.toChain.chain);
const minAmount = (fee * 105n) / 100n;

@@ -110,6 +114,6 @@ if (sdk_base_1.amount.units(amt) < minAmount) {

}
toTransferDetails(params) {
toTransferDetails(params, from, to) {
return {
from: this.request.from,
to: this.request.to,
from,
to,
amount: sdk_base_1.amount.units(params.normalizedParams.amount),

@@ -120,5 +124,5 @@ automatic: true,

}
async initiate(signer, quote) {
async initiate(signer, quote, to) {
const { params } = quote;
let transfer = this.toTransferDetails(params);
let transfer = this.toTransferDetails(params, wormhole_js_1.Wormhole.chainAddress(signer.chain(), signer.address()), to);
let txids = await cctpTransfer_js_1.CircleTransfer.transfer(this.request.fromChain, transfer, signer);

@@ -125,0 +129,0 @@ const msg = await cctpTransfer_js_1.CircleTransfer.getTransferMessage(this.request.fromChain, txids[txids.length - 1].txid);

import type { Chain, Network } from "@wormhole-foundation/sdk-base";
import { amount } from "@wormhole-foundation/sdk-base";
import type { ChainContext, Signer, TokenId } from "@wormhole-foundation/sdk-definitions";
import type { CircleAttestationReceipt } from "../../protocols/cctpTransfer.js";
import { CircleTransfer } from "../../protocols/cctp/cctpTransfer.js";
import type { TransferReceipt } from "../../types.js";

@@ -9,2 +9,3 @@ import type { StaticRouteMethods } from "../route.js";

import type { Quote, QuoteResult, TransferParams, ValidatedTransferParams, ValidationResult } from "../types.js";
import { ChainAddress } from "@wormhole-foundation/sdk-definitions";
export declare namespace CCTPRoute {

@@ -27,3 +28,3 @@ type Options = {

type QR = QuoteResult<Op, Vp>;
type R = TransferReceipt<CircleAttestationReceipt>;
type R = TransferReceipt<CircleTransfer.AttestationReceipt>;
export declare class CCTPRoute<N extends Network> extends ManualRoute<N, Op, Vp, R> implements StaticRouteMethods<typeof CCTPRoute> {

@@ -41,5 +42,5 @@ static meta: {

quote(params: Vp): Promise<QR>;
initiate(signer: Signer, quote: Q): Promise<R>;
initiate(signer: Signer, quote: Q, to: ChainAddress): Promise<R>;
complete(signer: Signer, receipt: R): Promise<R>;
track(receipt: R, timeout?: number): AsyncGenerator<import("../../protocols/cctpTransfer.js").CircleTransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">, void, unknown>;
track(receipt: R, timeout?: number): AsyncGenerator<CircleTransfer.TransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">, void, unknown>;
private toTransferDetails;

@@ -46,0 +47,0 @@ }

@@ -7,3 +7,3 @@ "use strict";

const common_js_1 = require("../../common.js");
const cctpTransfer_js_1 = require("../../protocols/cctpTransfer.js");
const cctpTransfer_js_1 = require("../../protocols/cctp/cctpTransfer.js");
const types_js_1 = require("../../types.js");

@@ -61,3 +61,7 @@ const wormhole_js_1 = require("../../wormhole.js");

try {
return this.request.displayQuote(await cctpTransfer_js_1.CircleTransfer.quoteTransfer(this.request.fromChain, this.request.toChain, this.toTransferDetails(params)), params);
return this.request.displayQuote(await cctpTransfer_js_1.CircleTransfer.quoteTransfer(this.request.fromChain, this.request.toChain, {
automatic: false,
amount: sdk_base_1.amount.units(params.normalizedParams.amount),
...params.options,
}), params);
}

@@ -71,5 +75,5 @@ catch (e) {

}
async initiate(signer, quote) {
async initiate(signer, quote, to) {
const { params } = quote;
const transfer = await cctpTransfer_js_1.CircleTransfer.destinationOverrides(this.request.fromChain, this.request.toChain, this.toTransferDetails(params));
const transfer = await cctpTransfer_js_1.CircleTransfer.destinationOverrides(this.request.fromChain, this.request.toChain, this.toTransferDetails(params, wormhole_js_1.Wormhole.chainAddress(signer.chain(), signer.address()), to));
const txids = await cctpTransfer_js_1.CircleTransfer.transfer(this.request.fromChain, transfer, signer);

@@ -94,3 +98,3 @@ const msg = await cctpTransfer_js_1.CircleTransfer.getTransferMessage(this.request.fromChain, txids[txids.length - 1].txid);

const cb = await this.request.toChain.getCircleBridge();
const xfer = cb.redeem(this.request.to.address, message, attestation);
const xfer = cb.redeem(message.payload.mintRecipient, message, attestation);
const dstTxids = await (0, common_js_1.signSendWait)(this.request.toChain, xfer, signer);

@@ -111,6 +115,6 @@ return {

}
toTransferDetails(params) {
toTransferDetails(params, from, to) {
return {
from: this.request.from,
to: this.request.to,
from,
to,
amount: sdk_base_1.amount.units(params.normalizedParams.amount),

@@ -117,0 +121,0 @@ automatic: false,

@@ -6,2 +6,3 @@ import type { StaticRouteMethods } from "../route.js";

import { PorticoBridge, TransferState, amount } from "./../../index.js";
import { ChainAddress } from "@wormhole-foundation/sdk-definitions";
export declare const SLIPPAGE_BPS = 15n;

@@ -44,5 +45,5 @@ export declare const BPS_PER_HUNDRED_PERCENT = 10000n;

quote(params: VP): Promise<QR>;
initiate(sender: Signer<N>, quote: Q): Promise<SourceInitiatedTransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">>;
initiate(sender: Signer<N>, quote: Q, to: ChainAddress): Promise<SourceInitiatedTransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">>;
track(receipt: R, timeout?: number): AsyncGenerator<{
vaa: import("./../../index.js").VAA<"TokenBridge:TransferWithPayload">;
vaa: import("@wormhole-foundation/sdk-definitions").VAA<"TokenBridge:TransferWithPayload">;
parsed: {

@@ -57,4 +58,4 @@ readonly flagSet: {

};
readonly finalTokenAddress: import("./../../index.js").UniversalAddress;
readonly recipientAddress: import("./../../index.js").UniversalAddress;
readonly finalTokenAddress: import("@wormhole-foundation/sdk-definitions").UniversalAddress;
readonly recipientAddress: import("@wormhole-foundation/sdk-definitions").UniversalAddress;
readonly cannonAssetAmount: bigint;

@@ -61,0 +62,0 @@ readonly minAmountFinish: bigint;

@@ -78,4 +78,4 @@ "use strict";

try {
if ((0, index_js_1.chainToPlatform)(this.request.from.chain) !== "Evm" ||
(0, index_js_1.chainToPlatform)(this.request.to.chain) !== "Evm") {
if ((0, index_js_1.chainToPlatform)(this.request.fromChain.chain) !== "Evm" ||
(0, index_js_1.chainToPlatform)(this.request.toChain.chain) !== "Evm") {
throw new Error("Only EVM chains are supported");

@@ -147,3 +147,3 @@ }

}
async initiate(sender, quote) {
async initiate(sender, quote, to) {
const { params, details } = quote;

@@ -153,3 +153,3 @@ const sourceToken = this.request.source.id.address;

const fromPorticoBridge = await this.request.fromChain.getPorticoBridge();
const xfer = fromPorticoBridge.transfer(this.request.from.address, this.request.to, sourceToken, index_js_1.amount.units(params.normalizedParams.amount), destToken, details);
const xfer = fromPorticoBridge.transfer(index_js_1.Wormhole.parseAddress(sender.chain(), sender.address()), to, sourceToken, index_js_1.amount.units(params.normalizedParams.amount), destToken, details);
const txids = await (0, index_js_1.signSendWait)(this.request.fromChain, xfer, sender);

@@ -159,4 +159,4 @@ const receipt = {

state: index_js_1.TransferState.SourceInitiated,
from: this.request.from.chain,
to: this.request.to.chain,
from: this.request.fromChain.chain,
to: this.request.toChain.chain,
};

@@ -163,0 +163,0 @@ return receipt;

import type { Chain, Network } from "@wormhole-foundation/sdk-base";
import { amount } from "@wormhole-foundation/sdk-base";
import type { ChainAddress, ChainContext, TokenId } from "@wormhole-foundation/sdk-definitions";
import type { ChainContext, TokenId } from "@wormhole-foundation/sdk-definitions";
import type { TransferQuote } from "../types.js";

@@ -9,4 +9,2 @@ import type { Wormhole } from "../wormhole.js";

export declare class RouteTransferRequest<N extends Network> {
from: ChainAddress;
to: ChainAddress;
source: TokenDetails;

@@ -21,4 +19,2 @@ destination: TokenDetails;

static create<N extends Network, FC extends Chain, TC extends Chain>(wh: Wormhole<N>, params: {
from: ChainAddress<FC>;
to: ChainAddress<TC>;
source: TokenId<FC>;

@@ -25,0 +21,0 @@ destination: TokenId<TC>;

@@ -7,4 +7,2 @@ "use strict";

class RouteTransferRequest {
from;
to;
source;

@@ -14,6 +12,4 @@ destination;

toChain;
constructor(from, to, fromChain, toChain, source, destination) {
this.from = from;
constructor(fromChain, toChain, source, destination) {
this.fromChain = fromChain;
this.to = to;
this.toChain = toChain;

@@ -58,7 +54,7 @@ this.source = source;

static async create(wh, params, fromChain, toChain) {
fromChain = fromChain ?? wh.getChain(params.from.chain);
toChain = toChain ?? wh.getChain(params.to.chain);
fromChain = fromChain ?? wh.getChain(params.source.chain);
toChain = toChain ?? wh.getChain(params.destination.chain);
const sourceDetails = await (0, token_js_1.getTokenDetails)(fromChain, params.source);
const destDetails = await (0, token_js_1.getTokenDetails)(toChain, params.destination);
const rtr = new RouteTransferRequest(params.from, params.to, fromChain, toChain, sourceDetails, destDetails);
const rtr = new RouteTransferRequest(fromChain, toChain, sourceDetails, destDetails);
return rtr;

@@ -65,0 +61,0 @@ }

@@ -48,4 +48,4 @@ "use strict";

const protocolSupported = rc.supportedNetworks().includes(this.wh.network) &&
rc.supportedChains(this.wh.network).includes(request.to.chain) &&
rc.supportedChains(this.wh.network).includes(request.from.chain) &&
rc.supportedChains(this.wh.network).includes(request.toChain.chain) &&
rc.supportedChains(this.wh.network).includes(request.fromChain.chain) &&
rc.isProtocolSupported(request.fromChain) &&

@@ -52,0 +52,0 @@ rc.isProtocolSupported(request.toChain);

@@ -6,2 +6,3 @@ import type { Chain, Network } from "@wormhole-foundation/sdk-base";

import type { Options, Quote, QuoteResult, Receipt, TransferParams, ValidatedTransferParams, ValidationResult } from "./types.js";
import { ChainAddress } from "@wormhole-foundation/sdk-definitions";
export declare abstract class Route<N extends Network, OP extends Options = Options, VP extends ValidatedTransferParams<OP> = ValidatedTransferParams<OP>, R extends Receipt = Receipt> {

@@ -15,3 +16,3 @@ wh: Wormhole<N>;

abstract quote(params: ValidatedTransferParams<OP>): Promise<QuoteResult<OP, VP>>;
abstract initiate(sender: Signer, quote: Quote<OP, VP>): Promise<R>;
abstract initiate(sender: Signer, quote: Quote<OP, VP>, to: ChainAddress): Promise<R>;
abstract track(receipt: R, timeout?: number): AsyncGenerator<R>;

@@ -18,0 +19,0 @@ transferUrl(txid: string): string;

import type { Chain, Network } from "@wormhole-foundation/sdk-base";
import { amount } from "@wormhole-foundation/sdk-base";
import type { ChainContext, Signer, TokenId } from "@wormhole-foundation/sdk-definitions";
import { TokenTransfer } from "../../protocols/tokenBridge/tokenTransfer.js";
import type { AttestationReceipt } from "../../types.js";

@@ -8,2 +9,3 @@ import type { StaticRouteMethods } from "../route.js";

import type { Quote, QuoteResult, Receipt, TransferParams, ValidatedTransferParams, ValidationResult } from "../types.js";
import { ChainAddress } from "@wormhole-foundation/sdk-definitions";
export declare namespace AutomaticTokenBridgeRoute {

@@ -44,4 +46,4 @@ type Options = {

quote(params: Vp): Promise<QR>;
initiate(signer: Signer, quote: Q): Promise<R>;
track(receipt: R, timeout?: number): AsyncGenerator<import("../../protocols/tokenTransfer.js").TokenTransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">, void, unknown>;
initiate(signer: Signer, quote: Q, to: ChainAddress): Promise<R>;
track(receipt: R, timeout?: number): AsyncGenerator<TokenTransfer.TransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">, void, unknown>;
private toTransferDetails;

@@ -48,0 +50,0 @@ }

@@ -6,5 +6,6 @@ "use strict";

const sdk_definitions_1 = require("@wormhole-foundation/sdk-definitions");
const tokenTransfer_js_1 = require("../../protocols/tokenTransfer.js");
const tokenTransfer_js_1 = require("../../protocols/tokenBridge/tokenTransfer.js");
const types_js_1 = require("../../types.js");
const route_js_1 = require("../route.js");
const wormhole_js_1 = require("../../wormhole.js");
class AutomaticTokenBridgeRoute extends route_js_1.AutomaticRoute {

@@ -79,3 +80,3 @@ NATIVE_GAS_DROPOFF_SUPPORTED = true;

const atb = await this.request.fromChain.getAutomaticTokenBridge();
const fee = await atb.getRelayerFee(this.request.from.address, this.request.to, inputToken.address);
const fee = await atb.getRelayerFee(this.request.toChain.chain, inputToken.address);
// Min amount is fee + 5%

@@ -105,3 +106,8 @@ const minAmount = (fee * 105n) / 100n;

try {
let quote = await tokenTransfer_js_1.TokenTransfer.quoteTransfer(this.wh, this.request.fromChain, this.request.toChain, this.toTransferDetails(params));
let quote = await tokenTransfer_js_1.TokenTransfer.quoteTransfer(this.wh, this.request.fromChain, this.request.toChain, {
automatic: true,
amount: sdk_base_1.amount.units(params.normalizedParams.amount),
token: this.request.source.id,
nativeGas: sdk_base_1.amount.units(params.normalizedParams.nativeGasAmount),
});
return this.request.displayQuote(quote, params);

@@ -116,5 +122,5 @@ }

}
async initiate(signer, quote) {
async initiate(signer, quote, to) {
const { params } = quote;
const transfer = this.toTransferDetails(params);
const transfer = this.toTransferDetails(params, wormhole_js_1.Wormhole.chainAddress(signer.chain(), signer.address()), to);
const txids = await tokenTransfer_js_1.TokenTransfer.transfer(this.request.fromChain, transfer, signer);

@@ -136,7 +142,7 @@ return {

}
toTransferDetails(params) {
toTransferDetails(params, from, to) {
const transfer = {
from,
to,
automatic: true,
from: this.request.from,
to: this.request.to,
amount: sdk_base_1.amount.units(params.normalizedParams.amount),

@@ -143,0 +149,0 @@ token: this.request.source.id,

import type { Chain, Network } from "@wormhole-foundation/sdk-base";
import { amount } from "@wormhole-foundation/sdk-base";
import type { ChainContext, Signer, TokenId } from "@wormhole-foundation/sdk-definitions";
import { TokenTransfer } from "../../protocols/tokenBridge/tokenTransfer.js";
import type { AttestationReceipt, TransferReceipt } from "../../types.js";

@@ -8,2 +9,3 @@ import type { StaticRouteMethods } from "../route.js";

import type { Quote, QuoteResult, TransferParams, ValidatedTransferParams, ValidationResult } from "../types.js";
import { ChainAddress } from "@wormhole-foundation/sdk-definitions";
export declare namespace TokenBridgeRoute {

@@ -39,5 +41,5 @@ type Options = {

quote(params: Vp): Promise<QR>;
initiate(signer: Signer, quote: Q): Promise<R>;
initiate(signer: Signer, quote: Q, to: ChainAddress): Promise<R>;
complete(signer: Signer, receipt: R): Promise<R>;
track(receipt: R, timeout?: number): AsyncGenerator<import("../../protocols/tokenTransfer.js").TokenTransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">, void, unknown>;
track(receipt: R, timeout?: number): AsyncGenerator<TokenTransfer.TransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">, void, unknown>;
private toTransferDetails;

@@ -44,0 +46,0 @@ }

@@ -5,3 +5,3 @@ "use strict";

const sdk_base_1 = require("@wormhole-foundation/sdk-base");
const tokenTransfer_js_1 = require("../../protocols/tokenTransfer.js");
const tokenTransfer_js_1 = require("../../protocols/tokenBridge/tokenTransfer.js");
const types_js_1 = require("../../types.js");

@@ -47,3 +47,7 @@ const wormhole_js_1 = require("../../wormhole.js");

try {
return this.request.displayQuote(await tokenTransfer_js_1.TokenTransfer.quoteTransfer(this.wh, this.request.fromChain, this.request.toChain, this.toTransferDetails(params)), params);
return this.request.displayQuote(await tokenTransfer_js_1.TokenTransfer.quoteTransfer(this.wh, this.request.fromChain, this.request.toChain, {
token: this.request.source.id,
amount: sdk_base_1.amount.units(params.normalizedParams.amount),
...params.options,
}), params);
}

@@ -57,5 +61,5 @@ catch (e) {

}
async initiate(signer, quote) {
async initiate(signer, quote, to) {
const { params } = quote;
const transfer = await tokenTransfer_js_1.TokenTransfer.destinationOverrides(this.request.fromChain, this.request.toChain, this.toTransferDetails(params));
const transfer = await tokenTransfer_js_1.TokenTransfer.destinationOverrides(this.request.fromChain, this.request.toChain, this.toTransferDetails(params, wormhole_js_1.Wormhole.chainAddress(signer.chain(), signer.address()), to));
const txids = await tokenTransfer_js_1.TokenTransfer.transfer(this.request.fromChain, transfer, signer);

@@ -82,7 +86,7 @@ return {

}
toTransferDetails(params) {
toTransferDetails(params, from, to) {
return {
from,
to,
token: this.request.source.id,
from: this.request.from,
to: this.request.to,
amount: sdk_base_1.amount.units(params.normalizedParams.amount),

@@ -89,0 +93,0 @@ ...params.options,

@@ -5,7 +5,7 @@ import type { Chain } from "@wormhole-foundation/sdk-base";

Failed = -1,
Created = 0,
SourceInitiated = 1,
SourceFinalized = 2,
Attested = 3,
DestinationInitiated = 4,
Created = 0,// The TokenTransfer object is created
SourceInitiated = 1,// Source chain transactions are submitted
SourceFinalized = 2,// Source chain transactions are finalized or whenever we have a message id
Attested = 3,// VAA or Circle Attestation is available
DestinationInitiated = 4,// Attestation is submitted to destination chain
DestinationFinalized = 5

@@ -12,0 +12,0 @@ }

import type { Chain, Network, Platform } from "@wormhole-foundation/sdk-base";
import type { ChainAddress, ChainContext, Contracts, NativeAddress, PayloadDiscriminator, PayloadLiteral, PlatformContext, PlatformUtils, TokenAddress, TokenId, TxHash, WormholeMessageId, deserialize } from "@wormhole-foundation/sdk-definitions";
import { WormholeConfig, WormholeConfigOverrides } from "./config.js";
import { CircleTransfer } from "./protocols/cctpTransfer.js";
import { TokenTransfer } from "./protocols/tokenTransfer.js";
import { CircleTransfer } from "./protocols/cctp/cctpTransfer.js";
import { TokenTransfer } from "./protocols/tokenBridge/tokenTransfer.js";
import type { RouteConstructor } from "./routes/index.js";

@@ -7,0 +7,0 @@ import { RouteResolver } from "./routes/resolver.js";

@@ -9,4 +9,4 @@ "use strict";

const config_js_2 = require("./config.js");
const cctpTransfer_js_1 = require("./protocols/cctpTransfer.js");
const tokenTransfer_js_1 = require("./protocols/tokenTransfer.js");
const cctpTransfer_js_1 = require("./protocols/cctp/cctpTransfer.js");
const tokenTransfer_js_1 = require("./protocols/tokenBridge/tokenTransfer.js");
const resolver_js_1 = require("./routes/resolver.js");

@@ -13,0 +13,0 @@ const tasks_js_1 = require("./tasks.js");

@@ -16,3 +16,3 @@ import { circle } from "@wormhole-foundation/sdk-base";

Devnet: {
api: "http://guardian:7071",
api: "http://guardian:7071", // Tilt Guardian REST api
circleAPI: "",

@@ -19,0 +19,0 @@ chains: buildConfig("Devnet"),

@@ -5,6 +5,3 @@ export * from "./wormhole.js";

export * from "./types.js";
export * from "./protocols/wormholeTransfer.js";
export * from "./protocols/tokenTransfer.js";
export * from "./protocols/cctpTransfer.js";
export * from "./protocols/gatewayTransfer.js";
export * from "./protocols/index.js";
export * as tasks from "./tasks.js";

@@ -11,0 +8,0 @@ export * as circleApi from "./circle-api.js";

@@ -5,6 +5,3 @@ export * from "./wormhole.js";

export * from "./types.js";
export * from "./protocols/wormholeTransfer.js";
export * from "./protocols/tokenTransfer.js";
export * from "./protocols/cctpTransfer.js";
export * from "./protocols/gatewayTransfer.js";
export * from "./protocols/index.js";
export * as tasks from "./tasks.js";

@@ -11,0 +8,0 @@ export * as circleApi from "./circle-api.js";

import type { Chain, Network } from "@wormhole-foundation/sdk-base";
import { amount } from "@wormhole-foundation/sdk-base";
import type { ChainContext, Signer, TokenId } from "@wormhole-foundation/sdk-definitions";
import type { CircleAttestationReceipt } from "../../protocols/cctpTransfer.js";
import type { ChainAddress, ChainContext, Signer, TokenId } from "@wormhole-foundation/sdk-definitions";
import { CircleTransfer } from "../../protocols/cctp/cctpTransfer.js";
import type { StaticRouteMethods } from "../route.js";

@@ -27,3 +27,3 @@ import { AutomaticRoute } from "../route.js";

type QR = QuoteResult<Op, Vp>;
type R = Receipt<CircleAttestationReceipt>;
type R = Receipt<CircleTransfer.AttestationReceipt>;
export declare class AutomaticCCTPRoute<N extends Network> extends AutomaticRoute<N, Op, Vp, R> implements StaticRouteMethods<typeof AutomaticCCTPRoute> {

@@ -45,6 +45,6 @@ NATIVE_GAS_DROPOFF_SUPPORTED: boolean;

private toTransferDetails;
initiate(signer: Signer, quote: Q): Promise<R>;
track(receipt: R, timeout?: number): AsyncGenerator<import("../../protocols/cctpTransfer.js").CircleTransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">, void, unknown>;
initiate(signer: Signer, quote: Q, to: ChainAddress): Promise<R>;
track(receipt: R, timeout?: number): AsyncGenerator<CircleTransfer.TransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">, void, unknown>;
}
export {};
//# sourceMappingURL=automatic.d.ts.map
import { amount, circle, contracts } from "@wormhole-foundation/sdk-base";
import { CircleTransfer } from "../../protocols/cctpTransfer.js";
import { CircleTransfer } from "../../protocols/cctp/cctpTransfer.js";
import { TransferState } from "../../types.js";

@@ -70,3 +70,7 @@ import { Wormhole } from "../../wormhole.js";

try {
return this.request.displayQuote(await CircleTransfer.quoteTransfer(this.request.fromChain, this.request.toChain, this.toTransferDetails(params)), params);
return this.request.displayQuote(await CircleTransfer.quoteTransfer(this.request.fromChain, this.request.toChain, {
automatic: true,
amount: amount.units(params.normalizedParams.amount),
nativeGas: amount.units(params.normalizedParams.nativeGasAmount),
}), params);
}

@@ -83,3 +87,3 @@ catch (e) {

const ctb = await this.request.fromChain.getAutomaticCircleBridge();
const fee = await ctb.getRelayerFee(this.request.to.chain);
const fee = await ctb.getRelayerFee(this.request.toChain.chain);
const minAmount = (fee * 105n) / 100n;

@@ -106,6 +110,6 @@ if (amount.units(amt) < minAmount) {

}
toTransferDetails(params) {
toTransferDetails(params, from, to) {
return {
from: this.request.from,
to: this.request.to,
from,
to,
amount: amount.units(params.normalizedParams.amount),

@@ -116,5 +120,5 @@ automatic: true,

}
async initiate(signer, quote) {
async initiate(signer, quote, to) {
const { params } = quote;
let transfer = this.toTransferDetails(params);
let transfer = this.toTransferDetails(params, Wormhole.chainAddress(signer.chain(), signer.address()), to);
let txids = await CircleTransfer.transfer(this.request.fromChain, transfer, signer);

@@ -121,0 +125,0 @@ const msg = await CircleTransfer.getTransferMessage(this.request.fromChain, txids[txids.length - 1].txid);

import type { Chain, Network } from "@wormhole-foundation/sdk-base";
import { amount } from "@wormhole-foundation/sdk-base";
import type { ChainContext, Signer, TokenId } from "@wormhole-foundation/sdk-definitions";
import type { CircleAttestationReceipt } from "../../protocols/cctpTransfer.js";
import { CircleTransfer } from "../../protocols/cctp/cctpTransfer.js";
import type { TransferReceipt } from "../../types.js";

@@ -9,2 +9,3 @@ import type { StaticRouteMethods } from "../route.js";

import type { Quote, QuoteResult, TransferParams, ValidatedTransferParams, ValidationResult } from "../types.js";
import { ChainAddress } from "@wormhole-foundation/sdk-definitions";
export declare namespace CCTPRoute {

@@ -27,3 +28,3 @@ type Options = {

type QR = QuoteResult<Op, Vp>;
type R = TransferReceipt<CircleAttestationReceipt>;
type R = TransferReceipt<CircleTransfer.AttestationReceipt>;
export declare class CCTPRoute<N extends Network> extends ManualRoute<N, Op, Vp, R> implements StaticRouteMethods<typeof CCTPRoute> {

@@ -41,5 +42,5 @@ static meta: {

quote(params: Vp): Promise<QR>;
initiate(signer: Signer, quote: Q): Promise<R>;
initiate(signer: Signer, quote: Q, to: ChainAddress): Promise<R>;
complete(signer: Signer, receipt: R): Promise<R>;
track(receipt: R, timeout?: number): AsyncGenerator<import("../../protocols/cctpTransfer.js").CircleTransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">, void, unknown>;
track(receipt: R, timeout?: number): AsyncGenerator<CircleTransfer.TransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">, void, unknown>;
private toTransferDetails;

@@ -46,0 +47,0 @@ }

import { amount, circle, contracts } from "@wormhole-foundation/sdk-base";
import { CircleBridge } from "@wormhole-foundation/sdk-definitions";
import { signSendWait } from "../../common.js";
import { CircleTransfer } from "../../protocols/cctpTransfer.js";
import { CircleTransfer } from "../../protocols/cctp/cctpTransfer.js";
import { TransferState, isAttested } from "../../types.js";

@@ -57,3 +57,7 @@ import { Wormhole } from "../../wormhole.js";

try {
return this.request.displayQuote(await CircleTransfer.quoteTransfer(this.request.fromChain, this.request.toChain, this.toTransferDetails(params)), params);
return this.request.displayQuote(await CircleTransfer.quoteTransfer(this.request.fromChain, this.request.toChain, {
automatic: false,
amount: amount.units(params.normalizedParams.amount),
...params.options,
}), params);
}

@@ -67,5 +71,5 @@ catch (e) {

}
async initiate(signer, quote) {
async initiate(signer, quote, to) {
const { params } = quote;
const transfer = await CircleTransfer.destinationOverrides(this.request.fromChain, this.request.toChain, this.toTransferDetails(params));
const transfer = await CircleTransfer.destinationOverrides(this.request.fromChain, this.request.toChain, this.toTransferDetails(params, Wormhole.chainAddress(signer.chain(), signer.address()), to));
const txids = await CircleTransfer.transfer(this.request.fromChain, transfer, signer);

@@ -90,3 +94,3 @@ const msg = await CircleTransfer.getTransferMessage(this.request.fromChain, txids[txids.length - 1].txid);

const cb = await this.request.toChain.getCircleBridge();
const xfer = cb.redeem(this.request.to.address, message, attestation);
const xfer = cb.redeem(message.payload.mintRecipient, message, attestation);
const dstTxids = await signSendWait(this.request.toChain, xfer, signer);

@@ -107,6 +111,6 @@ return {

}
toTransferDetails(params) {
toTransferDetails(params, from, to) {
return {
from: this.request.from,
to: this.request.to,
from,
to,
amount: amount.units(params.normalizedParams.amount),

@@ -113,0 +117,0 @@ automatic: false,

@@ -6,2 +6,3 @@ import type { StaticRouteMethods } from "../route.js";

import { PorticoBridge, TransferState, amount } from "./../../index.js";
import { ChainAddress } from "@wormhole-foundation/sdk-definitions";
export declare const SLIPPAGE_BPS = 15n;

@@ -44,5 +45,5 @@ export declare const BPS_PER_HUNDRED_PERCENT = 10000n;

quote(params: VP): Promise<QR>;
initiate(sender: Signer<N>, quote: Q): Promise<SourceInitiatedTransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">>;
initiate(sender: Signer<N>, quote: Q, to: ChainAddress): Promise<SourceInitiatedTransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">>;
track(receipt: R, timeout?: number): AsyncGenerator<{
vaa: import("./../../index.js").VAA<"TokenBridge:TransferWithPayload">;
vaa: import("@wormhole-foundation/sdk-definitions").VAA<"TokenBridge:TransferWithPayload">;
parsed: {

@@ -57,4 +58,4 @@ readonly flagSet: {

};
readonly finalTokenAddress: import("./../../index.js").UniversalAddress;
readonly recipientAddress: import("./../../index.js").UniversalAddress;
readonly finalTokenAddress: import("@wormhole-foundation/sdk-definitions").UniversalAddress;
readonly recipientAddress: import("@wormhole-foundation/sdk-definitions").UniversalAddress;
readonly cannonAssetAmount: bigint;

@@ -61,0 +62,0 @@ readonly minAmountFinish: bigint;

@@ -75,4 +75,4 @@ import { filters } from "@wormhole-foundation/sdk-base";

try {
if (chainToPlatform(this.request.from.chain) !== "Evm" ||
chainToPlatform(this.request.to.chain) !== "Evm") {
if (chainToPlatform(this.request.fromChain.chain) !== "Evm" ||
chainToPlatform(this.request.toChain.chain) !== "Evm") {
throw new Error("Only EVM chains are supported");

@@ -144,3 +144,3 @@ }

}
async initiate(sender, quote) {
async initiate(sender, quote, to) {
const { params, details } = quote;

@@ -150,3 +150,3 @@ const sourceToken = this.request.source.id.address;

const fromPorticoBridge = await this.request.fromChain.getPorticoBridge();
const xfer = fromPorticoBridge.transfer(this.request.from.address, this.request.to, sourceToken, amount.units(params.normalizedParams.amount), destToken, details);
const xfer = fromPorticoBridge.transfer(Wormhole.parseAddress(sender.chain(), sender.address()), to, sourceToken, amount.units(params.normalizedParams.amount), destToken, details);
const txids = await signSendWait(this.request.fromChain, xfer, sender);

@@ -156,4 +156,4 @@ const receipt = {

state: TransferState.SourceInitiated,
from: this.request.from.chain,
to: this.request.to.chain,
from: this.request.fromChain.chain,
to: this.request.toChain.chain,
};

@@ -160,0 +160,0 @@ return receipt;

import type { Chain, Network } from "@wormhole-foundation/sdk-base";
import { amount } from "@wormhole-foundation/sdk-base";
import type { ChainAddress, ChainContext, TokenId } from "@wormhole-foundation/sdk-definitions";
import type { ChainContext, TokenId } from "@wormhole-foundation/sdk-definitions";
import type { TransferQuote } from "../types.js";

@@ -9,4 +9,2 @@ import type { Wormhole } from "../wormhole.js";

export declare class RouteTransferRequest<N extends Network> {
from: ChainAddress;
to: ChainAddress;
source: TokenDetails;

@@ -21,4 +19,2 @@ destination: TokenDetails;

static create<N extends Network, FC extends Chain, TC extends Chain>(wh: Wormhole<N>, params: {
from: ChainAddress<FC>;
to: ChainAddress<TC>;
source: TokenId<FC>;

@@ -25,0 +21,0 @@ destination: TokenId<TC>;

import { amount } from "@wormhole-foundation/sdk-base";
import { getTokenDetails } from "./token.js";
export class RouteTransferRequest {
from;
to;
source;

@@ -10,6 +8,4 @@ destination;

toChain;
constructor(from, to, fromChain, toChain, source, destination) {
this.from = from;
constructor(fromChain, toChain, source, destination) {
this.fromChain = fromChain;
this.to = to;
this.toChain = toChain;

@@ -54,7 +50,7 @@ this.source = source;

static async create(wh, params, fromChain, toChain) {
fromChain = fromChain ?? wh.getChain(params.from.chain);
toChain = toChain ?? wh.getChain(params.to.chain);
fromChain = fromChain ?? wh.getChain(params.source.chain);
toChain = toChain ?? wh.getChain(params.destination.chain);
const sourceDetails = await getTokenDetails(fromChain, params.source);
const destDetails = await getTokenDetails(toChain, params.destination);
const rtr = new RouteTransferRequest(params.from, params.to, fromChain, toChain, sourceDetails, destDetails);
const rtr = new RouteTransferRequest(fromChain, toChain, sourceDetails, destDetails);
return rtr;

@@ -61,0 +57,0 @@ }

@@ -45,4 +45,4 @@ import { canonicalAddress, isNative, resolveWrappedToken, } from "@wormhole-foundation/sdk-definitions";

const protocolSupported = rc.supportedNetworks().includes(this.wh.network) &&
rc.supportedChains(this.wh.network).includes(request.to.chain) &&
rc.supportedChains(this.wh.network).includes(request.from.chain) &&
rc.supportedChains(this.wh.network).includes(request.toChain.chain) &&
rc.supportedChains(this.wh.network).includes(request.fromChain.chain) &&
rc.isProtocolSupported(request.fromChain) &&

@@ -49,0 +49,0 @@ rc.isProtocolSupported(request.toChain);

@@ -6,2 +6,3 @@ import type { Chain, Network } from "@wormhole-foundation/sdk-base";

import type { Options, Quote, QuoteResult, Receipt, TransferParams, ValidatedTransferParams, ValidationResult } from "./types.js";
import { ChainAddress } from "@wormhole-foundation/sdk-definitions";
export declare abstract class Route<N extends Network, OP extends Options = Options, VP extends ValidatedTransferParams<OP> = ValidatedTransferParams<OP>, R extends Receipt = Receipt> {

@@ -15,3 +16,3 @@ wh: Wormhole<N>;

abstract quote(params: ValidatedTransferParams<OP>): Promise<QuoteResult<OP, VP>>;
abstract initiate(sender: Signer, quote: Quote<OP, VP>): Promise<R>;
abstract initiate(sender: Signer, quote: Quote<OP, VP>, to: ChainAddress): Promise<R>;
abstract track(receipt: R, timeout?: number): AsyncGenerator<R>;

@@ -18,0 +19,0 @@ transferUrl(txid: string): string;

import type { Chain, Network } from "@wormhole-foundation/sdk-base";
import { amount } from "@wormhole-foundation/sdk-base";
import type { ChainContext, Signer, TokenId } from "@wormhole-foundation/sdk-definitions";
import { TokenTransfer } from "../../protocols/tokenBridge/tokenTransfer.js";
import type { AttestationReceipt } from "../../types.js";

@@ -8,2 +9,3 @@ import type { StaticRouteMethods } from "../route.js";

import type { Quote, QuoteResult, Receipt, TransferParams, ValidatedTransferParams, ValidationResult } from "../types.js";
import { ChainAddress } from "@wormhole-foundation/sdk-definitions";
export declare namespace AutomaticTokenBridgeRoute {

@@ -44,4 +46,4 @@ type Options = {

quote(params: Vp): Promise<QR>;
initiate(signer: Signer, quote: Q): Promise<R>;
track(receipt: R, timeout?: number): AsyncGenerator<import("../../protocols/tokenTransfer.js").TokenTransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">, void, unknown>;
initiate(signer: Signer, quote: Q, to: ChainAddress): Promise<R>;
track(receipt: R, timeout?: number): AsyncGenerator<TokenTransfer.TransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">, void, unknown>;
private toTransferDetails;

@@ -48,0 +50,0 @@ }

import { amount, contracts } from "@wormhole-foundation/sdk-base";
import { isNative, isTokenId, nativeTokenId } from "@wormhole-foundation/sdk-definitions";
import { TokenTransfer } from "../../protocols/tokenTransfer.js";
import { TokenTransfer } from "../../protocols/tokenBridge/tokenTransfer.js";
import { TransferState } from "../../types.js";
import { AutomaticRoute } from "../route.js";
import { Wormhole } from "../../wormhole.js";
export class AutomaticTokenBridgeRoute extends AutomaticRoute {

@@ -75,3 +76,3 @@ NATIVE_GAS_DROPOFF_SUPPORTED = true;

const atb = await this.request.fromChain.getAutomaticTokenBridge();
const fee = await atb.getRelayerFee(this.request.from.address, this.request.to, inputToken.address);
const fee = await atb.getRelayerFee(this.request.toChain.chain, inputToken.address);
// Min amount is fee + 5%

@@ -101,3 +102,8 @@ const minAmount = (fee * 105n) / 100n;

try {
let quote = await TokenTransfer.quoteTransfer(this.wh, this.request.fromChain, this.request.toChain, this.toTransferDetails(params));
let quote = await TokenTransfer.quoteTransfer(this.wh, this.request.fromChain, this.request.toChain, {
automatic: true,
amount: amount.units(params.normalizedParams.amount),
token: this.request.source.id,
nativeGas: amount.units(params.normalizedParams.nativeGasAmount),
});
return this.request.displayQuote(quote, params);

@@ -112,5 +118,5 @@ }

}
async initiate(signer, quote) {
async initiate(signer, quote, to) {
const { params } = quote;
const transfer = this.toTransferDetails(params);
const transfer = this.toTransferDetails(params, Wormhole.chainAddress(signer.chain(), signer.address()), to);
const txids = await TokenTransfer.transfer(this.request.fromChain, transfer, signer);

@@ -132,7 +138,7 @@ return {

}
toTransferDetails(params) {
toTransferDetails(params, from, to) {
const transfer = {
from,
to,
automatic: true,
from: this.request.from,
to: this.request.to,
amount: amount.units(params.normalizedParams.amount),

@@ -139,0 +145,0 @@ token: this.request.source.id,

import type { Chain, Network } from "@wormhole-foundation/sdk-base";
import { amount } from "@wormhole-foundation/sdk-base";
import type { ChainContext, Signer, TokenId } from "@wormhole-foundation/sdk-definitions";
import { TokenTransfer } from "../../protocols/tokenBridge/tokenTransfer.js";
import type { AttestationReceipt, TransferReceipt } from "../../types.js";

@@ -8,2 +9,3 @@ import type { StaticRouteMethods } from "../route.js";

import type { Quote, QuoteResult, TransferParams, ValidatedTransferParams, ValidationResult } from "../types.js";
import { ChainAddress } from "@wormhole-foundation/sdk-definitions";
export declare namespace TokenBridgeRoute {

@@ -39,5 +41,5 @@ type Options = {

quote(params: Vp): Promise<QR>;
initiate(signer: Signer, quote: Q): Promise<R>;
initiate(signer: Signer, quote: Q, to: ChainAddress): Promise<R>;
complete(signer: Signer, receipt: R): Promise<R>;
track(receipt: R, timeout?: number): AsyncGenerator<import("../../protocols/tokenTransfer.js").TokenTransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">, void, unknown>;
track(receipt: R, timeout?: number): AsyncGenerator<TokenTransfer.TransferReceipt<"Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance", "Solana" | "Btc" | "Algorand" | "Sui" | "Aptos" | "Near" | "Acala" | "Arbitrum" | "Aurora" | "Avalanche" | "Base" | "Bsc" | "Celo" | "Ethereum" | "Fantom" | "Gnosis" | "Karura" | "Klaytn" | "Moonbeam" | "Neon" | "Oasis" | "Optimism" | "Polygon" | "Rootstock" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia" | "Mantle" | "Scroll" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Pythnet" | "Cosmoshub" | "Evmos" | "Injective" | "Kujira" | "Osmosis" | "Sei" | "Terra" | "Terra2" | "Wormchain" | "Xpla" | "Dymension" | "Neutron" | "Stargaze" | "Celestia" | "Seda" | "Provenance">, void, unknown>;
private toTransferDetails;

@@ -44,0 +46,0 @@ }

import { amount, contracts } from "@wormhole-foundation/sdk-base";
import { TokenTransfer } from "../../protocols/tokenTransfer.js";
import { TokenTransfer } from "../../protocols/tokenBridge/tokenTransfer.js";
import { TransferState, isAttested } from "../../types.js";

@@ -43,3 +43,7 @@ import { Wormhole } from "../../wormhole.js";

try {
return this.request.displayQuote(await TokenTransfer.quoteTransfer(this.wh, this.request.fromChain, this.request.toChain, this.toTransferDetails(params)), params);
return this.request.displayQuote(await TokenTransfer.quoteTransfer(this.wh, this.request.fromChain, this.request.toChain, {
token: this.request.source.id,
amount: amount.units(params.normalizedParams.amount),
...params.options,
}), params);
}

@@ -53,5 +57,5 @@ catch (e) {

}
async initiate(signer, quote) {
async initiate(signer, quote, to) {
const { params } = quote;
const transfer = await TokenTransfer.destinationOverrides(this.request.fromChain, this.request.toChain, this.toTransferDetails(params));
const transfer = await TokenTransfer.destinationOverrides(this.request.fromChain, this.request.toChain, this.toTransferDetails(params, Wormhole.chainAddress(signer.chain(), signer.address()), to));
const txids = await TokenTransfer.transfer(this.request.fromChain, transfer, signer);

@@ -78,7 +82,7 @@ return {

}
toTransferDetails(params) {
toTransferDetails(params, from, to) {
return {
from,
to,
token: this.request.source.id,
from: this.request.from,
to: this.request.to,
amount: amount.units(params.normalizedParams.amount),

@@ -85,0 +89,0 @@ ...params.options,

@@ -5,7 +5,7 @@ import type { Chain } from "@wormhole-foundation/sdk-base";

Failed = -1,
Created = 0,
SourceInitiated = 1,
SourceFinalized = 2,
Attested = 3,
DestinationInitiated = 4,
Created = 0,// The TokenTransfer object is created
SourceInitiated = 1,// Source chain transactions are submitted
SourceFinalized = 2,// Source chain transactions are finalized or whenever we have a message id
Attested = 3,// VAA or Circle Attestation is available
DestinationInitiated = 4,// Attestation is submitted to destination chain
DestinationFinalized = 5

@@ -12,0 +12,0 @@ }

import type { Chain, Network, Platform } from "@wormhole-foundation/sdk-base";
import type { ChainAddress, ChainContext, Contracts, NativeAddress, PayloadDiscriminator, PayloadLiteral, PlatformContext, PlatformUtils, TokenAddress, TokenId, TxHash, WormholeMessageId, deserialize } from "@wormhole-foundation/sdk-definitions";
import { WormholeConfig, WormholeConfigOverrides } from "./config.js";
import { CircleTransfer } from "./protocols/cctpTransfer.js";
import { TokenTransfer } from "./protocols/tokenTransfer.js";
import { CircleTransfer } from "./protocols/cctp/cctpTransfer.js";
import { TokenTransfer } from "./protocols/tokenBridge/tokenTransfer.js";
import type { RouteConstructor } from "./routes/index.js";

@@ -7,0 +7,0 @@ import { RouteResolver } from "./routes/resolver.js";

@@ -6,4 +6,4 @@ import { chainToPlatform, circle } from "@wormhole-foundation/sdk-base";

import { DEFAULT_TASK_TIMEOUT } from "./config.js";
import { CircleTransfer } from "./protocols/cctpTransfer.js";
import { TokenTransfer } from "./protocols/tokenTransfer.js";
import { CircleTransfer } from "./protocols/cctp/cctpTransfer.js";
import { TokenTransfer } from "./protocols/tokenBridge/tokenTransfer.js";
import { RouteResolver } from "./routes/resolver.js";

@@ -10,0 +10,0 @@ import { retry } from "./tasks.js";

{
"name": "@wormhole-foundation/sdk-connect",
"version": "0.6.9-beta.1",
"version": "0.7.0-beta.0",
"repository": {

@@ -65,2 +65,5 @@ "type": "git",

"*": {
"tokens": [
"./dist/cjs/tokens.d.ts"
],
"*": [

@@ -99,6 +102,6 @@ "./dist/cjs/index.d.ts"

"axios": "^1.4.0",
"@wormhole-foundation/sdk-base": "0.6.9-beta.1",
"@wormhole-foundation/sdk-definitions": "0.6.9-beta.1"
"@wormhole-foundation/sdk-base": "0.7.0-beta.0",
"@wormhole-foundation/sdk-definitions": "0.7.0-beta.0"
},
"type": "module"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc