@avalabs/bridge-unified
Advanced tools
Comparing version 0.0.0-CP-8544-BTC-bridge-2-20241023155601 to 0.0.0-CP-8544-BTC-bridge-2-20241023231815
import { Address } from 'viem'; | ||
import { z } from 'zod'; | ||
import { Address as Address$1 } from 'abitype'; | ||
import { Simplify, Except } from 'type-fest'; | ||
@@ -44,22 +44,103 @@ type Chain = { | ||
*/ | ||
interface BitcoinInputUTXO { | ||
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; | ||
confirmedTime: z.ZodOptional<z.ZodNumber>; | ||
}, "strip", z.ZodTypeAny, { | ||
value: number; | ||
txHash: string; | ||
txHex?: string; | ||
index: number; | ||
script: string; | ||
blockHeight: number; | ||
confirmations: number; | ||
txHex?: string | undefined; | ||
confirmedTime?: number | undefined; | ||
}, { | ||
value: number; | ||
txHash: string; | ||
index: number; | ||
script: string; | ||
blockHeight: number; | ||
confirmations: number; | ||
confirmedTime?: string; | ||
} | ||
txHex?: string | undefined; | ||
confirmedTime?: number | 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; | ||
confirmedTime: z.ZodOptional<z.ZodNumber>; | ||
}, { | ||
script: z.ZodOptional<z.ZodString>; | ||
}>, "strip", z.ZodTypeAny, { | ||
value: number; | ||
txHash: string; | ||
index: number; | ||
blockHeight: number; | ||
confirmations: number; | ||
txHex?: string | undefined; | ||
script?: string | undefined; | ||
confirmedTime?: number | undefined; | ||
}, { | ||
value: number; | ||
txHash: string; | ||
index: number; | ||
blockHeight: number; | ||
confirmations: number; | ||
txHex?: string | undefined; | ||
script?: string | undefined; | ||
confirmedTime?: number | undefined; | ||
}>; | ||
type BitcoinInputUTXOWithOptionalScript = typeof BitcoinInputUTXOWithOptionalScript._output; | ||
/** | ||
* Used for defining outputs when creating a transaction. | ||
*/ | ||
interface BitcoinOutputUTXO { | ||
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; | ||
}[]; | ||
} | ||
interface BitcoinInputUTXOWithOptionalScript extends Omit<BitcoinInputUTXO, 'script'> { | ||
script?: string; | ||
} | ||
@@ -162,81 +243,2 @@ type Hex = `0x${string}`; | ||
type ValidBtcToAvaTransferParams = TransferParams & { | ||
fromAddress: string; | ||
toAddress: Address$1; | ||
}; | ||
type BtcToAvaBridgeTransfer = Simplify<Except<BridgeTransfer, 'targetTxHash' | 'toAddress'> & { | ||
targetTxHash?: Hex; | ||
toAddress: Address$1; | ||
}>; | ||
type BtcToAvaTrackingParams = TrackingParams & { | ||
bridgeTransfer: BtcToAvaBridgeTransfer; | ||
}; | ||
type BtcToAvalancheBridgeService = BridgeServiceBase & { | ||
type: BridgeType.AVALANCHE_BTC_AVA; | ||
analyzeTx: (params: AnalyzeTxParams) => AnalyzeTxResult; | ||
estimateGas: (params: GasEstimationParams) => Promise<bigint>; | ||
estimateReceiveAmount: (params: GasEstimationParams) => Promise<{ | ||
asset: Asset; | ||
amount: bigint; | ||
}>; | ||
transferAsset: (params: TransferParams) => Promise<BtcToAvaBridgeTransfer>; | ||
trackTransfer: (transfer: TrackingParams) => { | ||
cancel: () => void; | ||
result: Promise<BtcToAvaBridgeTransfer>; | ||
}; | ||
}; | ||
type ValidAvaToBtcTransferParams = TransferParams & { | ||
fromAddress: Address$1; | ||
toAddress: string; | ||
}; | ||
type AvaToBtcBridgeTransfer = Simplify<Except<BridgeTransfer, 'sourceTxHash' | 'fromAddress'> & { | ||
sourceTxHash: Hex; | ||
fromAddress: Address$1; | ||
}>; | ||
type AvaToBtcTrackingParams = TrackingParams & { | ||
bridgeTransfer: AvaToBtcBridgeTransfer; | ||
}; | ||
type AvalancheToBtcBridgeService = BridgeServiceBase & { | ||
type: BridgeType.AVALANCHE_AVA_BTC; | ||
analyzeTx: (params: AnalyzeTxParams) => AnalyzeTxResult; | ||
estimateGas: (params: GasEstimationParams) => Promise<bigint>; | ||
estimateReceiveAmount: (params: GasEstimationParams) => Promise<{ | ||
asset: Asset; | ||
amount: bigint; | ||
}>; | ||
transferAsset: (params: TransferParams) => Promise<AvaToBtcBridgeTransfer>; | ||
trackTransfer: (transfer: TrackingParams) => { | ||
cancel: () => void; | ||
result: Promise<AvaToBtcBridgeTransfer>; | ||
}; | ||
}; | ||
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; | ||
}[]; | ||
} | ||
declare enum BridgeType { | ||
@@ -313,8 +315,2 @@ AVALANCHE_EVM = "avalanche-evm", | ||
type GasEstimationParams = Omit<TransferParams, 'onStepChange'>; | ||
type EvmBridgeTransfer = Simplify<Except<BridgeTransfer, 'sourceTxHash' | 'targetTxHash' | 'fromAddress' | 'toAddress'> & { | ||
sourceTxHash: Hex; | ||
targetTxHash?: Hex; | ||
fromAddress: Address$1; | ||
toAddress: Address$1; | ||
}>; | ||
type TrackingParams = { | ||
@@ -324,5 +320,2 @@ bridgeTransfer: BridgeTransfer; | ||
}; | ||
type EvmTrackingParams = TrackingParams & { | ||
bridgeTransfer: EvmBridgeTransfer; | ||
}; | ||
type AnalyzeTxParams = { | ||
@@ -338,12 +331,2 @@ chainId: string; | ||
}; | ||
type EvmAnalyzeTxParams = { | ||
chainId: string; | ||
from: Address$1; | ||
to: Address$1; | ||
tokenTransfers: { | ||
from: Address$1; | ||
to: Address$1; | ||
symbol: string; | ||
}[]; | ||
}; | ||
type AnalyzeTxResult = { | ||
@@ -357,9 +340,4 @@ isBridgeTx: true; | ||
}; | ||
type BridgeServiceBase = { | ||
getAssets: () => ChainAssetMap; | ||
getFees: (params: FeeParams) => Promise<AssetFeeMap>; | ||
getMinimumTransferAmount: (params: FeeParams) => Promise<bigint>; | ||
}; | ||
type EvmBridgeService = BridgeServiceBase & { | ||
type: BridgeType.CCTP | BridgeType.ICTT_ERC20_ERC20 | BridgeType.AVALANCHE_EVM; | ||
type BridgeService = { | ||
type: BridgeType; | ||
analyzeTx: (params: AnalyzeTxParams) => AnalyzeTxResult; | ||
@@ -371,3 +349,3 @@ estimateGas: (params: GasEstimationParams) => Promise<bigint>; | ||
}>; | ||
transferAsset: (params: TransferParams) => Promise<EvmBridgeTransfer>; | ||
transferAsset: (params: TransferParams) => Promise<BridgeTransfer>; | ||
trackTransfer: (transfer: TrackingParams) => { | ||
@@ -377,6 +355,7 @@ cancel: () => void; | ||
}; | ||
getAssets: () => ChainAssetMap; | ||
getFees: (params: FeeParams) => Promise<AssetFeeMap>; | ||
getMinimumTransferAmount: (params: FeeParams) => Promise<bigint>; | ||
}; | ||
type BridgeService = EvmBridgeService | BtcToAvalancheBridgeService | AvalancheToBtcBridgeService; | ||
type EvmBridgeServiceFactory = (environment: Environment, signer: EvmSigner) => Promise<EvmBridgeService>; | ||
type BridgeServiceFactory = (environment: Environment) => Promise<EvmBridgeService | BtcToAvalancheBridgeService | AvalancheToBtcBridgeService>; | ||
type BridgeServiceFactory = (environment: Environment) => Promise<BridgeService>; | ||
@@ -445,3 +424,3 @@ declare enum TokenType { | ||
}; | ||
transferAsset: (params: TransferParams) => Promise<EvmBridgeTransfer | AvaToBtcBridgeTransfer | BtcToAvaBridgeTransfer>; | ||
transferAsset: (params: TransferParams) => Promise<BridgeTransfer>; | ||
}; | ||
@@ -458,4 +437,14 @@ | ||
type ValidBtcToAvaTransferParams = TransferParams & { | ||
fromAddress: string; | ||
toAddress: Address$1; | ||
}; | ||
type ValidAvaToBtcTransferParams = TransferParams & { | ||
fromAddress: Address$1; | ||
toAddress: string; | ||
}; | ||
declare const getEnabledBridgeServices: (environment: Environment, enabledBridgeInitializers: (EvmBridgeInitializer | AvaToBtcBridgeInitializer | BtcToAvaBridgeInitializer)[]) => Promise<BridgeServicesMap>; | ||
export { AnalyzeTxParams, AnalyzeTxResult, Asset, AssetFeeMap, AvaToBtcBridgeInitializer, AvaToBtcTrackingParams, AvalancheChainIds, BTC_BRIDGE_TYPES, BitcoinChainIds, BitcoinFunctions, BitcoinInputUTXO, BitcoinInputUTXOWithOptionalScript, BitcoinTx, BridgeAsset, BridgeService, BridgeServiceBase, BridgeServiceConfig, BridgeServiceFactory, BridgeServicesMap, BridgeSignatureReason, BridgeStepDetails, BridgeTransfer, BridgeType, BtcDispatch, BtcSign, BtcSigner, BtcToAvaBridgeInitializer, BtcToAvaTrackingParams, BtcTransactionRequest, Chain, ChainAssetMap, DestinationInfo, EVM_BRIDGE_TYPES, Environment, Erc20Asset, ErrorCode, ErrorReason, EthereumChainIds, EvmAnalyzeTxParams, EvmBridgeInitializer, EvmBridgeService, EvmBridgeServiceFactory, EvmBridgeTransfer, EvmDispatch, EvmProvider, EvmSign, EvmSigner, EvmTrackingParams, EvmTransactionRequest, FeeParams, GasEstimationParams, Hex, NativeAsset, Signer, SignerType, TokenType, TrackingParams, TransferParams, ValidAvaToBtcTransferParams, ValidBtcToAvaTransferParams, _default as caip2, createUnifiedBridgeService, getEnabledBridgeServices, isAvaToBtcBridgeInitializer, isBtcSigner, isBtcToAvaBridgeInitializer, isErc20Asset, isEvmBridgeInitializer, isEvmSigner, isNativeAsset }; | ||
export { AnalyzeTxParams, AnalyzeTxResult, Asset, AssetFeeMap, AvaToBtcBridgeInitializer, AvalancheChainIds, BTC_BRIDGE_TYPES, BitcoinChainIds, BitcoinFunctions, BitcoinInputUTXO, BitcoinInputUTXOWithOptionalScript, BitcoinTx, BridgeAsset, BridgeService, BridgeServiceConfig, BridgeServiceFactory, BridgeServicesMap, BridgeSignatureReason, BridgeStepDetails, BridgeTransfer, BridgeType, BtcDispatch, BtcSign, BtcSigner, BtcToAvaBridgeInitializer, BtcTransactionRequest, Chain, ChainAssetMap, DestinationInfo, EVM_BRIDGE_TYPES, Environment, Erc20Asset, ErrorCode, ErrorReason, EthereumChainIds, EvmBridgeInitializer, EvmDispatch, EvmProvider, EvmSign, EvmSigner, EvmTransactionRequest, FeeParams, GasEstimationParams, Hex, NativeAsset, Signer, SignerType, TokenType, TrackingParams, TransferParams, ValidAvaToBtcTransferParams, ValidBtcToAvaTransferParams, _default as caip2, createUnifiedBridgeService, getEnabledBridgeServices, isAvaToBtcBridgeInitializer, isBtcSigner, isBtcToAvaBridgeInitializer, isErc20Asset, isEvmBridgeInitializer, isEvmSigner, isNativeAsset }; |
{ | ||
"name": "@avalabs/bridge-unified", | ||
"license": "Limited Ecosystem License", | ||
"version": "0.0.0-CP-8544-BTC-bridge-2-20241023155601", | ||
"version": "0.0.0-CP-8544-BTC-bridge-2-20241023231815", | ||
"main": "dist/index.cjs", | ||
@@ -6,0 +6,0 @@ "module": "dist/index.js", |
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
1120213
1317