Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@avalabs/bridge-unified

Package Overview
Dependencies
Maintainers
0
Versions
188
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@avalabs/bridge-unified - npm Package Compare versions

Comparing version 0.0.0-fix-address-comparison-20240119122152 to 0.0.0-fix-check-btc-values-20241217232648

LICENSE

339

dist/index.d.ts
import { Address } from 'viem';
import { z } from 'zod';

@@ -10,46 +11,131 @@ type Chain = {

};
networkToken: Asset;
networkToken: NativeAsset;
};
declare enum AvalancheChainIds {
FUJI = "eip155:43113",
MAINNET = "eip155:43114"
}
declare enum EthereumChainIds {
MAINNET = "eip155:1",
SEPOLIA = "eip155:11155111"
}
declare enum BitcoinChainIds {
MAINNET = "bip122:000000000019d6689c085ae165831e93",
TESTNET = "bip122:000000000933ea01ad0ee984209779ba"
}
declare const AVALANCHE_FUJI_CHAIN: Chain;
declare const AVALANCHE_MAINNET_CHAIN: Chain;
declare const ETHEREUM_SEPOLIA_CHAIN: Chain;
declare const ETHEREUM_MAINNET_CHAIN: Chain;
declare const BITCOIN_TESTNET_CHAIN: Chain;
declare const BITCOIN_MAINNET_CHAIN: Chain;
type Token = {
address: Address;
name: string;
symbol: string;
decimals: number;
};
type ChainData = {
chainId: string;
domain: number;
tokenRouterAddress: Address;
messageTransmitterAddress: Address;
tokens: Token[];
minimumConfirmations: number;
};
type Config = ChainData[];
declare enum Environment {
DEV = "dev",
PROD = "production",
STAGING = "staging",
TEST = "test"
}
type BridgeServiceConfig = {
environment: Environment;
disabledBridgeTypes?: BridgeType[];
};
type BridgeConfig = Config;
/**
* Custom Bitcoin UTXO interface.
*/
type RequestArguments = {
method: string;
params?: unknown[] | Record<string | number, unknown>;
};
type Provider = {
/**
* EIP-1193 compatible request method
* https://eips.ethereum.org/EIPS/eip-1193#request-1
*/
request: (args: RequestArguments) => Promise<unknown>;
};
declare const BitcoinInputUTXO: z.ZodObject<{
txHash: z.ZodString;
txHex: z.ZodOptional<z.ZodString>;
index: z.ZodNumber;
value: z.ZodNumber;
script: z.ZodString;
blockHeight: z.ZodNumber;
confirmations: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
txHash: string;
value: number;
index: number;
script: string;
blockHeight: number;
confirmations: number;
txHex?: string | undefined;
}, {
txHash: string;
value: number;
index: number;
script: string;
blockHeight: number;
confirmations: number;
txHex?: string | undefined;
}>;
type BitcoinInputUTXO = typeof BitcoinInputUTXO._output;
declare const BitcoinInputUTXOWithOptionalScript: z.ZodObject<z.objectUtil.extendShape<{
txHash: z.ZodString;
txHex: z.ZodOptional<z.ZodString>;
index: z.ZodNumber;
value: z.ZodNumber;
script: z.ZodString;
blockHeight: z.ZodNumber;
confirmations: z.ZodNumber;
}, {
script: z.ZodOptional<z.ZodString>;
}>, "strip", z.ZodTypeAny, {
txHash: string;
value: number;
index: number;
blockHeight: number;
confirmations: number;
txHex?: string | undefined;
script?: string | undefined;
}, {
txHash: string;
value: number;
index: number;
blockHeight: number;
confirmations: number;
txHex?: string | undefined;
script?: string | undefined;
}>;
type BitcoinInputUTXOWithOptionalScript = typeof BitcoinInputUTXOWithOptionalScript._output;
/**
* Used for defining outputs when creating a transaction.
*/
declare const BitcoinOutputUTXO: z.ZodObject<{
address: z.ZodString;
value: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
value: number;
address: string;
}, {
value: number;
address: string;
}>;
type BitcoinOutputUTXO = typeof BitcoinOutputUTXO._output;
interface BitcoinTx {
hash: string;
fees: number;
block: number;
amount: number;
confirmations: number;
blockTime: number;
addresses: string[];
inputs: {
txid: string;
vout: number;
sequence: number;
n: number;
addresses: string[];
isAddress: boolean;
value: number;
}[];
outputs: {
addresses: string[];
value: number;
n: number;
spent: boolean;
hex: string;
isAddress: boolean;
}[];
}
type Hex = `0x${string}`;
type TransactionRequest = {
type EvmTransactionRequest = {
type?: number | null;

@@ -66,5 +152,18 @@ data?: Hex | null;

maxFeePerGas?: bigint | null;
chainId?: string;
};
type Dispatch = (signedTxHash: Hex) => Promise<Hex>;
type Signer = (data: TransactionRequest, dispatch: Dispatch) => Promise<Hex>;
type EvmDispatch = (signedTxHash: Hex) => Promise<Hex>;
type EvmSign = (data: EvmTransactionRequest, dispatch: EvmDispatch, step: BridgeStepDetails) => Promise<Hex>;
type EvmSigner = {
sign: EvmSign;
};
type BtcTransactionRequest = {
inputs: BitcoinInputUTXO[];
outputs: BitcoinOutputUTXO[];
};
type BtcDispatch = (signedTxHash: string) => Promise<string>;
type BtcSign = (data: BtcTransactionRequest, dispatch: BtcDispatch, step: BridgeStepDetails) => Promise<string>;
type BtcSigner = {
sign: BtcSign;
};

@@ -79,11 +178,20 @@ declare enum ErrorCode {

declare enum ErrorReason {
UNKNOWN = "UNKNOWN",
ASSET_NOT_SUPPORTED = "ASSET_NOT_SUPPORTED",
CHAIN_NOT_SUPPORTED = "CHAIN_NOT_SUPPORTED",
CONFIG_NOT_AVAILABLE = "CONFIG_NOT_AVAILABLE",
INVALID_PARAMS = "INVALID_PARAMS",
CONFIRMATION_COUNT_UNKNOWN = "CONFIRMATION_COUNT_UNKNOWN",
ENVIRONMENT_NOT_SUPPORTED = "ENVIRONMENT_NOT_SUPPORTED",
IDENTICAL_CHAINS_PROVIDED = "IDENTICAL_CHAINS_PROVIDED",
INCORRECT_ADDRESS_PROVIDED = "INCORRECT_ADDRESS_PROVIDED",
INCORRECT_AMOUNT_PROVIDED = "INCORRECT_AMOUNT_PROVIDED",
INCORRECT_ADDRESS_PROVIDED = "INCORRECT_ADDRESS_PROVIDED",
CHAIN_NOT_SUPPORTED = "CHAIN_NOT_SUPPORTED",
ASSET_NOT_SUPPORTED = "ASSET_NOT_SUPPORTED",
CONFIRMATION_COUNT_UNKNOWN = "CONFIRMATION_COUNT_UNKNOWN"
INCORRECT_HASH_PROVIDED = "INCORRECT_HASH_PROVIDED",
INCORRECT_PROVIDER_PROVIDED = "INCORRECT_PROVIDER_PROVIDED",
INCORRECT_SIGNER_PROVIDED = "INCORRECT_SIGNER_PROVIDED",
INCORRECT_TXHASH_PROVIDED = "INCORRECT_TXHASH_PROVIDED",
INVALID_PARAMS = "INVALID_PARAMS",
UNKNOWN = "UNKNOWN",
VULNERABLE_TOKEN_APPROVAL_ADDRESS = "VULNERABLE_TOKEN_APPROVAL_ADDRESS",
WARDEN_CONFIG_MISMATCH = "WARDEN_CONFIG_MISMATCH",
WARDEN_CONFIG_MISSING_NETWORK = "WARDEN_CONFIG_MISSING_NETWORK",
ADDRESS_IS_BLOCKED = "ADDRESS_IS_BLOCKED"
}

@@ -97,4 +205,3 @@

amount: bigint;
amountDecimals: number;
symbol: string;
asset: BridgeAsset;
completedAt?: number;

@@ -108,3 +215,3 @@ errorCode?: ErrorCode;

sourceConfirmationCount: number;
requiredSourceConfirmationCount: number;
sourceRequiredConfirmationCount: number;
targetChain: Chain;

@@ -115,10 +222,55 @@ targetStartedAt?: number;

targetConfirmationCount: number;
requiredTargetConfirmationCount: number;
startBlockNumber?: bigint;
targetRequiredConfirmationCount: number;
targetStartBlockNumber?: bigint;
metadata?: Record<string, unknown>;
};
interface BitcoinFunctions {
getChainHeight: () => Promise<number>;
getUTXOs: (address: string, withScripts?: boolean) => Promise<{
confirmed: BitcoinInputUTXOWithOptionalScript[];
unconfirmed: BitcoinInputUTXOWithOptionalScript[];
}>;
getTransaction: (hash: string) => Promise<BitcoinTx>;
getFeeRates: () => Promise<{
low: number;
medium: number;
high: number;
}>;
getUtxoBalance: (address: string, withScripts?: boolean) => Promise<{
utxos: BitcoinInputUTXOWithOptionalScript[];
utxosUnconfirmed: BitcoinInputUTXOWithOptionalScript[];
}>;
getScriptsForUtxos: (utxos: BitcoinInputUTXOWithOptionalScript[]) => Promise<BitcoinInputUTXO[]>;
issueRawTx: (tx: string) => Promise<string>;
}
declare enum BridgeType {
CCTP = "cctp"
AVALANCHE_EVM = "avalanche-evm",
AVALANCHE_BTC_AVA = "avalanche-btc-ava",
AVALANCHE_AVA_BTC = "avalanche-ava-btc",
CCTP = "cctp",
ICTT_ERC20_ERC20 = "ictt-erc20-erc20"
}
declare const BTC_BRIDGE_TYPES: readonly [BridgeType.AVALANCHE_AVA_BTC, BridgeType.AVALANCHE_BTC_AVA];
declare const EVM_BRIDGE_TYPES: readonly [BridgeType.AVALANCHE_EVM, BridgeType.CCTP, BridgeType.ICTT_ERC20_ERC20];
type ArrayElement<A> = A extends readonly (infer T)[] ? T : never;
type EvmBridgeInitializer = {
type: ArrayElement<typeof EVM_BRIDGE_TYPES>;
signer: EvmSigner;
};
type AvaToBtcBridgeInitializer = {
type: BridgeType.AVALANCHE_AVA_BTC;
signer: EvmSigner;
bitcoinFunctions: BitcoinFunctions;
};
type BtcToAvaBridgeInitializer = {
type: BridgeType.AVALANCHE_BTC_AVA;
signer: BtcSigner;
bitcoinFunctions: BitcoinFunctions;
};
type BridgeInitializer = EvmBridgeInitializer | AvaToBtcBridgeInitializer | BtcToAvaBridgeInitializer;
declare const isEvmBridgeInitializer: (initializer: BridgeInitializer) => initializer is EvmBridgeInitializer;
declare const isAvaToBtcBridgeInitializer: (initializer: BridgeInitializer) => initializer is AvaToBtcBridgeInitializer;
declare const isBtcToAvaBridgeInitializer: (initializer: BridgeInitializer) => initializer is BtcToAvaBridgeInitializer;
type FeeParams = {

@@ -129,7 +281,7 @@ asset: BridgeAsset;

targetChain: Chain;
provider?: Provider;
};
declare enum BridgeSignatureReason {
AllowanceApproval = "allowance-approval",
TokensTransfer = "tokens-transfer"
TokensTransfer = "tokens-transfer",
WrapToken = "wrap-token"
}

@@ -141,2 +293,6 @@ type BridgeStepDetails = {

};
type GasSettings = {
price: bigint;
tip?: bigint;
};
type TransferParams = {

@@ -146,23 +302,39 @@ asset: BridgeAsset;

fromAddress: string;
toAddress?: string;
toAddress: string;
sourceChain: Chain;
targetChain: Chain;
sourceProvider?: Provider;
targetProvider?: Provider;
gasSettings?: GasSettings;
onStepChange?: (stepDetails: BridgeStepDetails) => void;
sign?: Signer;
};
type GasEstimationParams = Omit<TransferParams, 'onStepChange' | 'toAddress'>;
type TrackingParams = {
bridgeTransfer: BridgeTransfer;
sourceProvider?: Provider;
targetProvider?: Provider;
updateListener: (transfer: BridgeTransfer) => void;
};
type AnalyzeTxParams = {
chainId: string;
from: string;
to: string;
tokenTransfers: {
from?: string;
to?: string;
symbol: string;
}[];
};
type AnalyzeTxResult = {
isBridgeTx: true;
bridgeType: BridgeType;
sourceChainId?: string;
targetChainId?: string;
} | {
isBridgeTx: false;
};
type BridgeService = {
type: BridgeType;
config: BridgeConfig | null;
ensureHasConfig: () => Promise<void>;
updateConfig: () => Promise<void>;
getAssets: () => Promise<ChainAssetMap>;
getFees: (params: FeeParams) => Promise<AssetFeeMap>;
analyzeTx: (params: AnalyzeTxParams) => AnalyzeTxResult;
estimateGas: (params: GasEstimationParams) => Promise<bigint>;
estimateReceiveAmount: (params: GasEstimationParams) => Promise<{
asset: Asset;
amount: bigint;
}>;
transferAsset: (params: TransferParams) => Promise<BridgeTransfer>;

@@ -173,4 +345,7 @@ trackTransfer: (transfer: TrackingParams) => {

};
getAssets: () => ChainAssetMap;
getFees: (params: FeeParams) => Promise<AssetFeeMap>;
getMinimumTransferAmount: (params: FeeParams) => Promise<bigint>;
};
type BridgeServiceFactory = (environment: Environment) => BridgeService;
type BridgeServiceFactory = (environment: Environment) => Promise<BridgeService>;

@@ -181,5 +356,3 @@ declare enum TokenType {

}
type Asset = {
type: TokenType;
address?: Address;
type BaseAsset = {
name: string;

@@ -189,2 +362,12 @@ symbol: string;

};
type Erc20Asset = BaseAsset & {
type: TokenType.ERC20;
address: Address;
};
type NativeAsset = BaseAsset & {
type: TokenType.NATIVE;
};
declare const isErc20Asset: (asset: Asset) => asset is Erc20Asset;
declare const isNativeAsset: (asset: Asset) => asset is NativeAsset;
type Asset = Erc20Asset | NativeAsset;
type DestinationInfo = Record<string, BridgeType[]>;

@@ -195,19 +378,16 @@ type BridgeAsset = Asset & {

type ChainAssetMap = Record<string, BridgeAsset[]>;
type AssetFeeMap = Record<Address, bigint>;
type AssetFeeMap = Record<string, Partial<Record<Address | 'NATIVE', bigint>>>;
declare const createUnifiedBridgeService: ({ environment, disabledBridgeTypes }: BridgeServiceConfig) => {
type BridgeServicesMap = Map<BridgeType, BridgeService>;
type BridgeServiceConfig = {
environment: Environment;
bridges: Map<BridgeType, BridgeService>;
init: () => Promise<void>;
updateConfigs: () => Promise<void>;
getAssets: () => Promise<ChainAssetMap>;
getFees: (params: FeeParams) => Promise<AssetFeeMap>;
enabledBridgeServices: BridgeServicesMap;
};
type UnifiedBridgeService = Omit<BridgeService, 'type'> & {
canTransferAsset: (asset: BridgeAsset, targetChainId: string) => boolean;
transferAsset: (params: TransferParams) => Promise<BridgeTransfer>;
trackTransfer: (params: TrackingParams) => {
cancel: () => void;
result: Promise<BridgeTransfer>;
};
environment: Environment;
};
declare const createUnifiedBridgeService: ({ environment, enabledBridgeServices }: BridgeServiceConfig) => UnifiedBridgeService;
type Caip2ChainId = {

@@ -220,4 +400,7 @@ namespace: string;

toString: ({ namespace, reference }: Caip2ChainId) => string;
toEip155HexChainId: ({ namespace, reference }: Caip2ChainId) => string;
};
export { Asset, AssetFeeMap, BridgeAsset, BridgeConfig, BridgeService, BridgeServiceConfig, BridgeServiceFactory, BridgeSignatureReason, BridgeStepDetails, BridgeTransfer, BridgeType, Chain, ChainAssetMap, DestinationInfo, Dispatch, Environment, ErrorCode, ErrorReason, FeeParams, Hex, Provider, Signer, TokenType, TrackingParams, TransactionRequest, TransferParams, _default as caip2, createUnifiedBridgeService };
declare const getEnabledBridgeServices: (environment: Environment, enabledBridgeInitializers: BridgeInitializer[]) => Promise<BridgeServicesMap>;
export { AVALANCHE_FUJI_CHAIN, AVALANCHE_MAINNET_CHAIN, AnalyzeTxParams, AnalyzeTxResult, ArrayElement, Asset, AssetFeeMap, AvaToBtcBridgeInitializer, AvalancheChainIds, BITCOIN_MAINNET_CHAIN, BITCOIN_TESTNET_CHAIN, BTC_BRIDGE_TYPES, BitcoinChainIds, BitcoinFunctions, BitcoinInputUTXO, BitcoinInputUTXOWithOptionalScript, BitcoinTx, BridgeAsset, BridgeInitializer, BridgeService, BridgeServiceConfig, BridgeServiceFactory, BridgeServicesMap, BridgeSignatureReason, BridgeStepDetails, BridgeTransfer, BridgeType, BtcDispatch, BtcSign, BtcSigner, BtcToAvaBridgeInitializer, BtcTransactionRequest, Chain, ChainAssetMap, DestinationInfo, ETHEREUM_MAINNET_CHAIN, ETHEREUM_SEPOLIA_CHAIN, EVM_BRIDGE_TYPES, Environment, Erc20Asset, ErrorCode, ErrorReason, EthereumChainIds, EvmBridgeInitializer, EvmDispatch, EvmSign, EvmSigner, EvmTransactionRequest, FeeParams, GasEstimationParams, GasSettings, Hex, NativeAsset, TokenType, TrackingParams, TransferParams, UnifiedBridgeService, _default as caip2, createUnifiedBridgeService, getEnabledBridgeServices, isAvaToBtcBridgeInitializer, isBtcToAvaBridgeInitializer, isErc20Asset, isEvmBridgeInitializer, isNativeAsset };
{
"name": "@avalabs/bridge-unified",
"version": "0.0.0-fix-address-comparison-20240119122152",
"license": "Limited Ecosystem License",
"version": "0.0.0-fix-check-btc-values-20241217232648",
"main": "dist/index.cjs",

@@ -8,6 +9,14 @@ "module": "dist/index.js",

"type": "module",
"files": [
"dist"
],
"dependencies": {
"@noble/hashes": "1.5.0",
"@scure/base": "1.1.9",
"abitype": "0.9.3",
"lodash": "4.17.21",
"viem": "1.19.8"
"viem": "2.11.1",
"zod": "3.23.8",
"@scure/btc-signer": "1.3.2",
"coinselect": "3.1.13"
},

@@ -25,2 +34,3 @@ "devDependencies": {

"build": "tsup",
"build:watch": "tsup --watch",
"lint": "eslint \"src/**/*.ts\"",

@@ -27,0 +37,0 @@ "test": "jest",

@@ -19,3 +19,3 @@ <p align="center">

- **CCTP** - preferred for brdiging USDC between Ethereum and Avalanche C-Chain. See the `bridges/cctp` folder.
- **CCTP** - preferred for bridging USDC between Ethereum and Avalanche C-Chain. See the `bridges/cctp` folder.

@@ -41,12 +41,71 @@ Future bridges we plan to support:

```js
import { createUnifiedBridgeService, Environment, BridgeTransfer } from '@avalabs/bridge-unified';
import { createUnifiedBridgeService, getEnabledBridgeServices, Environment, BridgeTransfer } from '@avalabs/bridge-unified';
// create a new service for an environment
const environment = Environment.TEST;
const evmSigner: EvmSigner = {
sign: async ({ data, from, to, value }) => {
return await window.ethereum.request({
method: 'eth_sendTransaction,',
params:{
account: from,
data: data ?? undefined,
from,
to: to ?? null,
chain: undefined,
value
}
});
},
};
const btcSigner: BtcSigner = {
sign: async ({ inputs, outputs }) => {
return await window.ethereum.request({
method: 'bitcoin_signTransaction',
params: { inputs, outputs },
});
},
};
const cctpInitializer: EvmBridgeInitializer = {
type: BridgeType.CCTP,
signer: evmSigner,
};
const icttErc20Initializer: EvmBridgeInitializer = {
type: BridgeType.ICTT_ERC20_ERC20,
signer: evmSigner,
};
const avalancheEvmInitializer: EvmBridgeInitializer = {
type: BridgeType.AVALANCHE_EVM,
signer: evmSigner,
};
const avalancheBtcInitializer: AvaToBtcBridgeInitializer = {
type: BridgeType.AVALANCHE_AVA_BTC,
signer: evmSigner,
bitcoinFunctions: bitcoinProvider as BitcoinFunctions,
};
const bitcoinAvaInitializer: BtcToAvaBridgeInitializer = {
type: BridgeType.AVALANCHE_BTC_AVA,
signer: btcSigner,
bitcoinFunctions: bitcoinProvider as BitcoinFunctions,
};
// use all available bridges
const enabledBridgeInitializers: BridgeInitializer[] = [
cctpInitializer,
icttErc20Initializer,
avalancheEvmInitializer,
avalancheBtcInitializer,
bitcoinAvaInitializer,
]
// fetch all available bridge services
const enabledBridgeServices = await getEnabledBridgeServices(environment, disabledBridgeTypes);
// create a new service for a given environment and list of bridge services
const unifiedService = createUnifiedBridgeService({
environment: Environment.TEST,
environment,
enabledBridgeServices
});
// init the service, fetch and setup its configs
await unifiedService.init();
// get the list of supported assets, grouped by caip2 (https://chainagnostic.org/CAIPs/caip-2) chain IDs

@@ -69,3 +128,3 @@ const assets = await unifiedService.getAssets()

// immediatelly stops tracking and rejects the tracker's promise
// immediately stops tracking and rejects the tracker's promise
// cancel()

@@ -79,6 +138,8 @@

### createUnifiedBridgeService({ environment, disabledBridgeTypes? })
### getEnabledBridgeServices(environment, enabledBridgeInitializers);
Returns a new `unifiedBridgeService` for the given `environment`, using all supported bridge integrations by default. Individual bridges can be turned off via the `disabledBridgeTypes` array.
Type: `(environment: Environment, enabledBridgeInitializers: BridgeInitializer[]) => Promise<BridgeServicesMap>`
Returns all available bridge services for a given environment (excluding disabledBridgeTypes). Any bridge service which fails to initialize will be absent from this returned value.
#### environment

@@ -90,8 +151,18 @@

#### disabledBridgeTypes
#### enabledBridgeInitializers
Type: `BridgeType[] | undefined`
Type: `BridgeInitializer[]`
Disables the integration of the provided `BridgeType`s.
Enables the integration of the provided `BridgeType`s based on each `BridgeInitializer`.
#### enabledBridgeServices
Type: `BridgeServicesMap` => `Map<BridgeType, BridgeService>`
This includes all the bridge services which were initialized successfully, to pass to `createUnifiedBridgeService`.
### createUnifiedBridgeService({ environment, enabledBridgeServices })
Returns a new `unifiedBridgeService` for the given `environment` and `enabledBridgeServices` map.
### unifiedBridgeService

@@ -105,7 +176,6 @@

environment, // the provided Environment during initialization
bridges, // the list of enabled bridge integrations
init,
updateConfigs,
getAssets,
getFees,
estimateGas,
canTransferAsset,
transferAsset,

@@ -116,14 +186,2 @@ trackTransfer,

#### init
Type: `() => Promise<void>`
Initializes the unified service by attempting to fetch the configurations of the enabled bridges.
#### updateConfigs
Type: `() => Promise<void>`
Attempts to fetch the configurations of the enabled bridges.
#### getAssets

@@ -141,2 +199,14 @@

#### estimateGas
Type: `(params: TransferParams) => Promise<bigint>`
Estimates the gas cost of a specific transfer.
#### getMinimumTransferAmount
Type: `(params: FeeParams) => Promise<bigint>`
Calculates and returns the minimum transfer amount for a given bridge transfer.
#### transferAsset

@@ -147,5 +217,19 @@

Starts a new bridge transfer, executing every required step in a single call.
Transactions signing is done by either the provided `sourceProvider` or a custom `sign` callback. Clients using their custom `sign` implementation may use their own solution or the default `dispatch` callback to submit the transaction to the network.
Transactions signing is done by a custom `sign` callback. The custom `sign` implementation may use their own solution or the default `dispatch` callback to submit the transaction to the network.
Returns a `BridgeTransfer` containing all the (known) initial values such as: environment, addresses, amount, fee, transaction hash, required and actual block confirmation counts, etc.
Notes about TransferParams:
fromAddress: The address where the bridge amount is from.
toAddress: The address where the bridge amount is going to end up.
For example, A user has an account with AddressC and AddressBtc.
The user wants to bridge some funds from Ethereum to Avalanche using the same address. FromAddress and toAddress will be both AddressC.
The user wants to bridge some funds from Bitcoin to Avalanche.
FromAddress is AddressBtc and toAddress is AddressC.
Some bridges allows you to bridge the tokens to a different address. (CCTP and ICTT ERC20).
In this case, fromAddress is the address of the token is getting bridged from. And toAddress is the address which is going to receive the bridged funds.
#### trackTransfer

@@ -161,3 +245,3 @@

If it's still pending, rejects the tracker's promise (`result`) immediatelly and breaks its loop under the hood.
If it's still pending, rejects the tracker's promise (`result`) immediately and breaks its loop under the hood.

@@ -164,0 +248,0 @@ ###### result

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 too big to display

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