@avalabs/bridge-unified
Advanced tools
Comparing version 0.0.0-CP-8544-BTC-bridge-2-20241028154947 to 0.0.0-CP-8544-BTC-bridge-2-20241028230707
{ | ||
"name": "@avalabs/bridge-unified", | ||
"license": "Limited Ecosystem License", | ||
"version": "0.0.0-CP-8544-BTC-bridge-2-20241028154947", | ||
"version": "0.0.0-CP-8544-BTC-bridge-2-20241028230707", | ||
"main": "dist/index.cjs", | ||
@@ -6,0 +6,0 @@ "module": "dist/index.js", |
@@ -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. | ||
@@ -44,4 +44,58 @@ Future bridges we plan to support: | ||
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 disabledBridgeTypes = [] | ||
const enabledBridgeInitializers: BridgeInitializer[] = [ | ||
cctpInitializer, | ||
icttErc20Initializer, | ||
avalancheEvmInitializer, | ||
avalancheBtcInitializer, | ||
bitcoinAvaInitializer, | ||
] | ||
@@ -74,3 +128,3 @@ // fetch all available bridge services | ||
// immediatelly stops tracking and rejects the tracker's promise | ||
// immediately stops tracking and rejects the tracker's promise | ||
// cancel() | ||
@@ -161,2 +215,16 @@ | ||
Params tips: | ||
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 | ||
@@ -172,3 +240,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. | ||
@@ -175,0 +243,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 too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1109232
243