From b1b4d04fcf8c8151aac649833957cc45afb65592 Mon Sep 17 00:00:00 2001 From: Lukasz Zimnoch Date: Thu, 14 Mar 2024 14:43:04 +0100 Subject: [PATCH] Re-generate API reference docs --- typescript/api-reference/README.md | 232 +++++++++++++++--- .../api-reference/classes/DepositsService.md | 113 +++++++-- .../api-reference/classes/EthereumBridge.md | 52 ++-- .../classes/EthereumTBTCToken.md | 6 +- .../classes/EthereumTBTCVault.md | 34 +-- .../classes/EthereumWalletRegistry.md | 18 +- typescript/api-reference/classes/TBTC.md | 123 +++++++++- 7 files changed, 459 insertions(+), 119 deletions(-) diff --git a/typescript/api-reference/README.md b/typescript/api-reference/README.md index 7101b6d59..1f7650455 100644 --- a/typescript/api-reference/README.md +++ b/typescript/api-reference/README.md @@ -5,6 +5,7 @@ ### Namespaces - [BitcoinNetwork](modules/BitcoinNetwork.md) +- [Chains](modules/Chains.md) - [GetChainEvents](modules/GetChainEvents.md) - [WalletState](modules/WalletState.md) @@ -15,6 +16,8 @@ ### Classes +- [BaseL2BitcoinDepositor](classes/BaseL2BitcoinDepositor.md) +- [BaseL2TBTCToken](classes/BaseL2TBTCToken.md) - [BitcoinTxHash](classes/BitcoinTxHash.md) - [Deposit](classes/Deposit.md) - [DepositFunding](classes/DepositFunding.md) @@ -24,7 +27,9 @@ - [ElectrumClient](classes/ElectrumClient.md) - [EthereumAddress](classes/EthereumAddress.md) - [EthereumBridge](classes/EthereumBridge.md) +- [EthereumCrossChainExtraDataEncoder](classes/EthereumCrossChainExtraDataEncoder.md) - [EthereumDepositorProxy](classes/EthereumDepositorProxy.md) +- [EthereumL1BitcoinDepositor](classes/EthereumL1BitcoinDepositor.md) - [EthereumTBTCToken](classes/EthereumTBTCToken.md) - [EthereumTBTCVault](classes/EthereumTBTCVault.md) - [EthereumWalletRegistry](classes/EthereumWalletRegistry.md) @@ -51,11 +56,16 @@ - [Bridge](interfaces/Bridge.md) - [ChainEvent](interfaces/ChainEvent.md) - [ChainIdentifier](interfaces/ChainIdentifier.md) +- [CrossChainContractsLoader](interfaces/CrossChainContractsLoader.md) +- [CrossChainExtraDataEncoder](interfaces/CrossChainExtraDataEncoder.md) - [DepositReceipt](interfaces/DepositReceipt.md) - [DepositRequest](interfaces/DepositRequest.md) - [DepositorProxy](interfaces/DepositorProxy.md) - [ElectrumCredentials](interfaces/ElectrumCredentials.md) - [EthereumContractConfig](interfaces/EthereumContractConfig.md) +- [L1BitcoinDepositor](interfaces/L1BitcoinDepositor.md) +- [L2BitcoinDepositor](interfaces/L2BitcoinDepositor.md) +- [L2TBTCToken](interfaces/L2TBTCToken.md) - [RedemptionRequest](interfaces/RedemptionRequest.md) - [TBTCToken](interfaces/TBTCToken.md) - [TBTCVault](interfaces/TBTCVault.md) @@ -66,15 +76,19 @@ - [BitcoinTxInput](README.md#bitcointxinput) - [BitcoinUtxo](README.md#bitcoinutxo) +- [ChainMapping](README.md#chainmapping) +- [CrossChainContracts](README.md#crosschaincontracts) - [DepositRevealedEvent](README.md#depositrevealedevent) - [DkgResultApprovedEvent](README.md#dkgresultapprovedevent) - [DkgResultChallengedEvent](README.md#dkgresultchallengedevent) - [DkgResultSubmittedEvent](README.md#dkgresultsubmittedevent) - [ElectrumClientOptions](README.md#electrumclientoptions) - [ErrorMatcherFn](README.md#errormatcherfn) -- [EthereumNetwork](README.md#ethereumnetwork) - [EthereumSigner](README.md#ethereumsigner) - [ExecutionLoggerFn](README.md#executionloggerfn) +- [L1CrossChainContracts](README.md#l1crosschaincontracts) +- [L2Chain](README.md#l2chain) +- [L2CrossChainContracts](README.md#l2crosschaincontracts) - [NewWalletRegisteredEvent](README.md#newwalletregisteredevent) - [OptimisticMintingCancelledEvent](README.md#optimisticmintingcancelledevent) - [OptimisticMintingFinalizedEvent](README.md#optimisticmintingfinalizedevent) @@ -95,16 +109,19 @@ - [BitcoinPublicKeyUtils](README.md#bitcoinpublickeyutils) - [BitcoinScriptUtils](README.md#bitcoinscriptutils) - [BitcoinTargetConverter](README.md#bitcointargetconverter) +- [ChainMappings](README.md#chainmappings) ### Functions - [assembleBitcoinSpvProof](README.md#assemblebitcoinspvproof) - [backoffRetrier](README.md#backoffretrier) +- [chainIdFromSigner](README.md#chainidfromsigner) - [computeElectrumScriptHash](README.md#computeelectrumscripthash) - [ethereumAddressFromSigner](README.md#ethereumaddressfromsigner) -- [ethereumNetworkFromSigner](README.md#ethereumnetworkfromsigner) +- [ethereumCrossChainContractsLoader](README.md#ethereumcrosschaincontractsloader) - [extractBitcoinRawTxVectors](README.md#extractbitcoinrawtxvectors) -- [loadEthereumContracts](README.md#loadethereumcontracts) +- [loadBaseCrossChainContracts](README.md#loadbasecrosschaincontracts) +- [loadEthereumCoreContracts](README.md#loadethereumcorecontracts) - [packRevealDepositParameters](README.md#packrevealdepositparameters) - [retryAll](README.md#retryall) - [skipRetryWhenMatched](README.md#skipretrywhenmatched) @@ -139,6 +156,38 @@ Data about a Bitcoin unspent transaction output. ___ +### ChainMapping + +Ƭ **ChainMapping**: `Object` + +Type representing a mapping between specific L1 and L2 chains. + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `base?` | [`Base`](enums/Chains.Base.md) | Identifier of the Base L2 chain. | +| `ethereum?` | [`Ethereum`](enums/Chains.Ethereum.md) | Identifier of the Ethereum L1 chain. | + +#### Defined in + +[src/lib/contracts/chain.ts:26](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/contracts/chain.ts#L26) + +___ + +### CrossChainContracts + +Ƭ **CrossChainContracts**: [`L2CrossChainContracts`](README.md#l2crosschaincontracts) & [`L1CrossChainContracts`](README.md#l1crosschaincontracts) + +Convenience type aggregating TBTC cross-chain contracts forming a connector +between TBTC L1 ledger chain and a specific supported L2/side-chain. + +#### Defined in + +[src/lib/contracts/cross-chain.ts:12](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/contracts/cross-chain.ts#L12) + +___ + ### DepositRevealedEvent Ƭ **DepositRevealedEvent**: [`DepositReceipt`](interfaces/DepositReceipt.md) & `Pick`\<[`DepositRequest`](interfaces/DepositRequest.md), ``"amount"`` \| ``"vault"``\> & \{ `fundingOutputIndex`: `number` ; `fundingTxHash`: [`BitcoinTxHash`](classes/BitcoinTxHash.md) } & [`ChainEvent`](interfaces/ChainEvent.md) @@ -228,18 +277,6 @@ True if the error matches, false otherwise. ___ -### EthereumNetwork - -Ƭ **EthereumNetwork**: ``"local"`` \| ``"sepolia"`` \| ``"mainnet"`` - -Supported Ethereum networks. - -#### Defined in - -[src/lib/ethereum/index.ts:75](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/index.ts#L75) - -___ - ### EthereumSigner Ƭ **EthereumSigner**: `Signer` \| `providers.Provider` @@ -250,7 +287,7 @@ or a Provider that works only in the read-only mode. #### Defined in -[src/lib/ethereum/index.ts:26](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/index.ts#L26) +[src/lib/ethereum/index.ts:34](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/index.ts#L34) ___ @@ -280,6 +317,55 @@ A function that is called with execution status messages. ___ +### L1CrossChainContracts + +Ƭ **L1CrossChainContracts**: `Object` + +Aggregates L1-specific TBTC cross-chain contracts. + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `l1BitcoinDepositor` | [`L1BitcoinDepositor`](interfaces/L1BitcoinDepositor.md) | + +#### Defined in + +[src/lib/contracts/cross-chain.ts:25](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/contracts/cross-chain.ts#L25) + +___ + +### L2Chain + +Ƭ **L2Chain**: `Exclude`\ + +Layer 2 chains supported by tBTC v2 contracts. + +#### Defined in + +[src/lib/contracts/chain.ts:21](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/contracts/chain.ts#L21) + +___ + +### L2CrossChainContracts + +Ƭ **L2CrossChainContracts**: `Object` + +Aggregates L2-specific TBTC cross-chain contracts. + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `l2BitcoinDepositor` | [`L2BitcoinDepositor`](interfaces/L2BitcoinDepositor.md) | +| `l2TbtcToken` | [`L2TBTCToken`](interfaces/L2TBTCToken.md) | + +#### Defined in + +[src/lib/contracts/cross-chain.ts:17](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/contracts/cross-chain.ts#L17) + +___ + ### NewWalletRegisteredEvent Ƭ **NewWalletRegisteredEvent**: \{ `ecdsaWalletID`: [`Hex`](classes/Hex.md) ; `walletPublicKeyHash`: [`Hex`](classes/Hex.md) } & [`ChainEvent`](interfaces/ChainEvent.md) @@ -397,7 +483,7 @@ ___ Ƭ **TBTCContracts**: `Object` -Convenience type aggregating all TBTC contracts handles. +Convenience type aggregating all TBTC core contracts. #### Type declaration @@ -410,7 +496,7 @@ Convenience type aggregating all TBTC contracts handles. #### Defined in -[src/lib/contracts/index.ts:17](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/contracts/index.ts#L17) +[src/lib/contracts/index.ts:19](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/contracts/index.ts#L19) ## Variables @@ -589,6 +675,18 @@ Utility functions allowing to perform Bitcoin target conversions. [src/lib/bitcoin/header.ts:268](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/bitcoin/header.ts#L268) +___ + +### ChainMappings + +• `Const` **ChainMappings**: [`ChainMapping`](README.md#chainmapping)[] + +List of chain mappings supported by tBTC v2 contracts. + +#### Defined in + +[src/lib/contracts/chain.ts:40](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/contracts/chain.ts#L40) + ## Functions ### assembleBitcoinSpvProof @@ -668,6 +766,30 @@ A function that can retry any function. ___ +### chainIdFromSigner + +▸ **chainIdFromSigner**(`signer`): `Promise`\<`string`\> + +Resolves the chain ID from the given signer. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `signer` | [`EthereumSigner`](README.md#ethereumsigner) | The signer whose chain ID should be resolved. | + +#### Returns + +`Promise`\<`string`\> + +Chain ID as a string. + +#### Defined in + +[src/lib/ethereum/index.ts:41](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/index.ts#L41) + +___ + ### computeElectrumScriptHash ▸ **computeElectrumScriptHash**(`script`): `string` @@ -719,31 +841,40 @@ Throws an error if the address of the signer is not a proper #### Defined in -[src/lib/ethereum/index.ts:62](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/index.ts#L62) +[src/lib/ethereum/index.ts:63](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/index.ts#L63) ___ -### ethereumNetworkFromSigner +### ethereumCrossChainContractsLoader -▸ **ethereumNetworkFromSigner**(`signer`): `Promise`\<[`EthereumNetwork`](README.md#ethereumnetwork)\> +▸ **ethereumCrossChainContractsLoader**(`signer`, `chainId`): `Promise`\<[`CrossChainContractsLoader`](interfaces/CrossChainContractsLoader.md)\> -Resolves the Ethereum network the given signer is tied to. +Creates the Ethereum implementation of tBTC cross-chain contracts loader. +The provided signer is attached to loaded L1 contracts. The given +Ethereum chain ID is used to load the L1 contracts and resolve the chain +mapping that provides corresponding L2 chains IDs. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `signer` | [`EthereumSigner`](README.md#ethereumsigner) | The signer whose network should be resolved. | +| `signer` | [`EthereumSigner`](README.md#ethereumsigner) | Ethereum L1 signer. | +| `chainId` | [`Ethereum`](enums/Chains.Ethereum.md) | Ethereum L1 chain ID. | #### Returns -`Promise`\<[`EthereumNetwork`](README.md#ethereumnetwork)\> +`Promise`\<[`CrossChainContractsLoader`](interfaces/CrossChainContractsLoader.md)\> + +Loader for tBTC cross-chain contracts. + +**`Throws`** -Ethereum network. +Throws an error if the signer's Ethereum chain ID is other than + the one used to construct the loader. #### Defined in -[src/lib/ethereum/index.ts:33](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/index.ts#L33) +[src/lib/ethereum/index.ts:129](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/index.ts#L129) ___ @@ -772,34 +903,65 @@ Transaction data with fields represented as un-prefixed hex strings. ___ -### loadEthereumContracts +### loadBaseCrossChainContracts + +▸ **loadBaseCrossChainContracts**(`signer`, `chainId`): `Promise`\<[`L2CrossChainContracts`](README.md#l2crosschaincontracts)\> + +Loads Base implementation of tBTC cross-chain contracts for the given Base +chain ID and attaches the given signer there. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `signer` | [`EthereumSigner`](README.md#ethereumsigner) | Signer that should be attached to the contracts. | +| `chainId` | [`Base`](enums/Chains.Base.md) | Base chain ID. | + +#### Returns + +`Promise`\<[`L2CrossChainContracts`](README.md#l2crosschaincontracts)\> + +Handle to the contracts. + +**`Throws`** + +Throws an error if the signer's Base chain ID is other than + the one used to load contracts. + +#### Defined in + +[src/lib/base/index.ts:22](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/base/index.ts#L22) + +___ + +### loadEthereumCoreContracts -▸ **loadEthereumContracts**(`signer`, `network`): `Promise`\<[`TBTCContracts`](README.md#tbtccontracts)\> +▸ **loadEthereumCoreContracts**(`signer`, `chainId`): `Promise`\<[`TBTCContracts`](README.md#tbtccontracts)\> -Loads Ethereum implementation of tBTC contracts for the given Ethereum -network and attaches the given signer there. +Loads Ethereum implementation of tBTC core contracts for the given Ethereum +chain ID and attaches the given signer there. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `signer` | [`EthereumSigner`](README.md#ethereumsigner) | Signer that should be attached to tBTC contracts. | -| `network` | [`EthereumNetwork`](README.md#ethereumnetwork) | Ethereum network. | +| `chainId` | [`Ethereum`](enums/Chains.Ethereum.md) | Ethereum chain ID. | #### Returns `Promise`\<[`TBTCContracts`](README.md#tbtccontracts)\> -Handle to tBTC contracts. +Handle to tBTC core contracts. **`Throws`** -Throws an error if the signer's Ethereum network is other than +Throws an error if the signer's Ethereum chain ID is other than the one used to load tBTC contracts. #### Defined in -[src/lib/ethereum/index.ts:86](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/index.ts#L86) +[src/lib/ethereum/index.ts:82](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/index.ts#L82) ___ @@ -843,7 +1005,7 @@ Packed parameters. #### Defined in -[src/lib/ethereum/bridge.ts:687](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L687) +[src/lib/ethereum/bridge.ts:688](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L688) ___ diff --git a/typescript/api-reference/classes/DepositsService.md b/typescript/api-reference/classes/DepositsService.md index 31dad4af5..5b3a91e08 100644 --- a/typescript/api-reference/classes/DepositsService.md +++ b/typescript/api-reference/classes/DepositsService.md @@ -10,14 +10,16 @@ Service exposing features related to tBTC v2 deposits. ### Properties +- [#crossChainContracts](DepositsService.md##crosschaincontracts) +- [#defaultDepositor](DepositsService.md##defaultdepositor) - [bitcoinClient](DepositsService.md#bitcoinclient) -- [defaultDepositor](DepositsService.md#defaultdepositor) - [depositRefundLocktimeDuration](DepositsService.md#depositrefundlocktimeduration) - [tbtcContracts](DepositsService.md#tbtccontracts) ### Methods - [generateDepositReceipt](DepositsService.md#generatedepositreceipt) +- [initiateCrossChainDeposit](DepositsService.md#initiatecrosschaindeposit) - [initiateDeposit](DepositsService.md#initiatedeposit) - [initiateDepositWithProxy](DepositsService.md#initiatedepositwithproxy) - [setDefaultDepositor](DepositsService.md#setdefaultdepositor) @@ -26,7 +28,7 @@ Service exposing features related to tBTC v2 deposits. ### constructor -• **new DepositsService**(`tbtcContracts`, `bitcoinClient`): [`DepositsService`](DepositsService.md) +• **new DepositsService**(`tbtcContracts`, `bitcoinClient`, `crossChainContracts`): [`DepositsService`](DepositsService.md) #### Parameters @@ -34,6 +36,7 @@ Service exposing features related to tBTC v2 deposits. | :------ | :------ | | `tbtcContracts` | [`TBTCContracts`](../README.md#tbtccontracts) | | `bitcoinClient` | [`BitcoinClient`](../interfaces/BitcoinClient.md) | +| `crossChainContracts` | (`_`: ``"Base"``) => `undefined` \| [`CrossChainContracts`](../README.md#crosschaincontracts) | #### Returns @@ -41,32 +44,61 @@ Service exposing features related to tBTC v2 deposits. #### Defined in -[src/services/deposits/deposits-service.ts:41](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L41) +[src/services/deposits/deposits-service.ts:51](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L51) ## Properties -### bitcoinClient +### #crossChainContracts -• `Private` `Readonly` **bitcoinClient**: [`BitcoinClient`](../interfaces/BitcoinClient.md) +• `Private` `Readonly` **#crossChainContracts**: (`_`: ``"Base"``) => `undefined` \| [`CrossChainContracts`](../README.md#crosschaincontracts) -Bitcoin client handle. +#### Type declaration + +▸ (`_`): `undefined` \| [`CrossChainContracts`](../README.md#crosschaincontracts) + +Gets cross-chain contracts for the given supported L2 chain. + +##### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `_` | ``"Base"`` | Name of the L2 chain for which to get cross-chain contracts. | + +##### Returns + +`undefined` \| [`CrossChainContracts`](../README.md#crosschaincontracts) + +Cross-chain contracts for the given L2 chain or + undefined if not initialized. #### Defined in -[src/services/deposits/deposits-service.ts:34](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L34) +[src/services/deposits/deposits-service.ts:49](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L49) ___ -### defaultDepositor +### #defaultDepositor -• `Private` **defaultDepositor**: `undefined` \| [`ChainIdentifier`](../interfaces/ChainIdentifier.md) +• `Private` **#defaultDepositor**: `undefined` \| [`ChainIdentifier`](../interfaces/ChainIdentifier.md) Chain-specific identifier of the default depositor used for deposits initiated by this service. #### Defined in -[src/services/deposits/deposits-service.ts:39](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L39) +[src/services/deposits/deposits-service.ts:42](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L42) + +___ + +### bitcoinClient + +• `Private` `Readonly` **bitcoinClient**: [`BitcoinClient`](../interfaces/BitcoinClient.md) + +Bitcoin client handle. + +#### Defined in + +[src/services/deposits/deposits-service.ts:37](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L37) ___ @@ -79,7 +111,7 @@ This is 9 month in seconds assuming 1 month = 30 days #### Defined in -[src/services/deposits/deposits-service.ts:26](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L26) +[src/services/deposits/deposits-service.ts:29](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L29) ___ @@ -91,7 +123,7 @@ Handle to tBTC contracts. #### Defined in -[src/services/deposits/deposits-service.ts:30](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L30) +[src/services/deposits/deposits-service.ts:33](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L33) ## Methods @@ -113,7 +145,56 @@ Handle to tBTC contracts. #### Defined in -[src/services/deposits/deposits-service.ts:119](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L119) +[src/services/deposits/deposits-service.ts:177](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L177) + +___ + +### initiateCrossChainDeposit + +▸ **initiateCrossChainDeposit**(`bitcoinRecoveryAddress`, `l2ChainName`): `Promise`\<[`Deposit`](Deposit.md)\> + +Initiates the tBTC v2 cross-chain deposit process. A cross-chain deposit +is a deposit that targets an L2 chain other than the L1 chain the tBTC +system is deployed on. Such a deposit is initiated using a transaction +on the L2 chain. To make it happen, the given L2 cross-chain contracts +must be initialized along with a L2 signer first. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `bitcoinRecoveryAddress` | `string` | P2PKH or P2WPKH Bitcoin address that can be used for emergency recovery of the deposited funds. | +| `l2ChainName` | ``"Base"`` | Name of the L2 chain the deposit is targeting. | + +#### Returns + +`Promise`\<[`Deposit`](Deposit.md)\> + +Handle to the initiated deposit process. + +**`Throws`** + +Throws an error if one of the following occurs: + - There are no active wallet in the Bridge contract + - The Bitcoin recovery address is not a valid P2(W)PKH + - The cross-chain contracts for the given L2 chain are not + initialized + - The L2 deposit owner cannot be resolved. This typically + happens if the L2 cross-chain contracts operate with a + read-only signer whose address cannot be resolved. + +**`See`** + +for cross-chain contracts initialization. + +**`Dev`** + +This is actually a call to initiateDepositWithProxy with a built-in + depositor proxy. + +#### Defined in + +[src/services/deposits/deposits-service.ts:157](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L157) ___ @@ -147,7 +228,7 @@ Throws an error if one of the following occurs: #### Defined in -[src/services/deposits/deposits-service.ts:61](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L61) +[src/services/deposits/deposits-service.ts:76](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L76) ___ @@ -189,7 +270,7 @@ Throws an error if one of the following occurs: #### Defined in -[src/services/deposits/deposits-service.ts:100](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L100) +[src/services/deposits/deposits-service.ts:115](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L115) ___ @@ -218,4 +299,4 @@ Typically, there is no need to use this method when DepositsService #### Defined in -[src/services/deposits/deposits-service.ts:197](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L197) +[src/services/deposits/deposits-service.ts:255](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/deposits/deposits-service.ts#L255) diff --git a/typescript/api-reference/classes/EthereumBridge.md b/typescript/api-reference/classes/EthereumBridge.md index f4510f780..683eb5750 100644 --- a/typescript/api-reference/classes/EthereumBridge.md +++ b/typescript/api-reference/classes/EthereumBridge.md @@ -59,14 +59,14 @@ for reference. ### constructor -• **new EthereumBridge**(`config`, `deploymentType?`): [`EthereumBridge`](EthereumBridge.md) +• **new EthereumBridge**(`config`, `chainId?`): [`EthereumBridge`](EthereumBridge.md) #### Parameters | Name | Type | Default value | | :------ | :------ | :------ | | `config` | [`EthereumContractConfig`](../interfaces/EthereumContractConfig.md) | `undefined` | -| `deploymentType` | ``"local"`` \| ``"sepolia"`` \| ``"mainnet"`` | `"local"` | +| `chainId` | [`Ethereum`](../enums/Chains.Ethereum.md) | `Chains.Ethereum.Local` | #### Returns @@ -78,7 +78,7 @@ EthersContractHandle\<BridgeTypechain\>.constructor #### Defined in -[src/lib/ethereum/bridge.ts:59](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L59) +[src/lib/ethereum/bridge.ts:60](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L60) ## Properties @@ -148,7 +148,7 @@ EthersContractHandle.\_totalRetryAttempts #### Defined in -[src/lib/ethereum/bridge.ts:493](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L493) +[src/lib/ethereum/bridge.ts:494](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L494) ___ @@ -177,7 +177,7 @@ Builds the UTXO hash based on the UTXO components. UTXO hash is computed as #### Defined in -[src/lib/ethereum/bridge.ts:617](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L617) +[src/lib/ethereum/bridge.ts:618](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L618) ___ @@ -204,7 +204,7 @@ ___ #### Defined in -[src/lib/ethereum/bridge.ts:428](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L428) +[src/lib/ethereum/bridge.ts:429](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L429) ___ @@ -246,7 +246,7 @@ ___ #### Defined in -[src/lib/ethereum/bridge.ts:86](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L86) +[src/lib/ethereum/bridge.ts:87](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L87) ___ @@ -273,7 +273,7 @@ Bridge.getDepositRevealedEvents #### Defined in -[src/lib/ethereum/bridge.ts:94](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L94) +[src/lib/ethereum/bridge.ts:95](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L95) ___ @@ -284,7 +284,7 @@ ___ Get events emitted by the Ethereum contract. It starts searching from provided block number. If the GetEvents.Options#fromBlock option is missing it looks for a contract's defined property -[_deployedAtBlockNumber](EthereumBridge.md#_deployedatblocknumber). If the property is missing starts searching +[_deployedAtBlockNumber](BaseL2BitcoinDepositor.md#_deployedatblocknumber). If the property is missing starts searching from block `0`. #### Parameters @@ -334,7 +334,7 @@ Bridge.getNewWalletRegisteredEvents #### Defined in -[src/lib/ethereum/bridge.ts:529](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L529) +[src/lib/ethereum/bridge.ts:530](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L530) ___ @@ -361,7 +361,7 @@ Bridge.getRedemptionRequestedEvents #### Defined in -[src/lib/ethereum/bridge.ts:634](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L634) +[src/lib/ethereum/bridge.ts:635](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L635) ___ @@ -381,7 +381,7 @@ ___ #### Defined in -[src/lib/ethereum/bridge.ts:514](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L514) +[src/lib/ethereum/bridge.ts:515](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L515) ___ @@ -405,7 +405,7 @@ Parsed deposit request. #### Defined in -[src/lib/ethereum/bridge.ts:473](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L473) +[src/lib/ethereum/bridge.ts:474](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L474) ___ @@ -430,7 +430,7 @@ Parsed redemption request. #### Defined in -[src/lib/ethereum/bridge.ts:212](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L212) +[src/lib/ethereum/bridge.ts:213](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L213) ___ @@ -454,7 +454,7 @@ Parsed wallet data. #### Defined in -[src/lib/ethereum/bridge.ts:588](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L588) +[src/lib/ethereum/bridge.ts:589](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L589) ___ @@ -481,7 +481,7 @@ ___ #### Defined in -[src/lib/ethereum/bridge.ts:131](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L131) +[src/lib/ethereum/bridge.ts:132](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L132) ___ @@ -510,7 +510,7 @@ ___ #### Defined in -[src/lib/ethereum/bridge.ts:333](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L333) +[src/lib/ethereum/bridge.ts:334](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L334) ___ @@ -539,7 +539,7 @@ ___ #### Defined in -[src/lib/ethereum/bridge.ts:230](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L230) +[src/lib/ethereum/bridge.ts:231](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L231) ___ @@ -568,7 +568,7 @@ ___ #### Defined in -[src/lib/ethereum/bridge.ts:267](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L267) +[src/lib/ethereum/bridge.ts:268](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L268) ___ @@ -597,7 +597,7 @@ ___ #### Defined in -[src/lib/ethereum/bridge.ts:377](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L377) +[src/lib/ethereum/bridge.ts:378](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L378) ___ @@ -624,7 +624,7 @@ ___ #### Defined in -[src/lib/ethereum/bridge.ts:154](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L154) +[src/lib/ethereum/bridge.ts:155](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L155) ___ @@ -644,7 +644,7 @@ ___ #### Defined in -[src/lib/ethereum/bridge.ts:319](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L319) +[src/lib/ethereum/bridge.ts:320](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L320) ___ @@ -664,7 +664,7 @@ ___ #### Defined in -[src/lib/ethereum/bridge.ts:554](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L554) +[src/lib/ethereum/bridge.ts:555](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L555) ___ @@ -690,7 +690,7 @@ ___ #### Defined in -[src/lib/ethereum/bridge.ts:571](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L571) +[src/lib/ethereum/bridge.ts:572](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L572) ___ @@ -715,7 +715,7 @@ Deposit key. #### Defined in -[src/lib/ethereum/bridge.ts:454](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L454) +[src/lib/ethereum/bridge.ts:455](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L455) ___ @@ -740,4 +740,4 @@ The redemption key. #### Defined in -[src/lib/ethereum/bridge.ts:182](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L182) +[src/lib/ethereum/bridge.ts:183](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/bridge.ts#L183) diff --git a/typescript/api-reference/classes/EthereumTBTCToken.md b/typescript/api-reference/classes/EthereumTBTCToken.md index 107b12bfc..95a043433 100644 --- a/typescript/api-reference/classes/EthereumTBTCToken.md +++ b/typescript/api-reference/classes/EthereumTBTCToken.md @@ -42,14 +42,14 @@ for reference. ### constructor -• **new EthereumTBTCToken**(`config`, `deploymentType?`): [`EthereumTBTCToken`](EthereumTBTCToken.md) +• **new EthereumTBTCToken**(`config`, `chainId?`): [`EthereumTBTCToken`](EthereumTBTCToken.md) #### Parameters | Name | Type | Default value | | :------ | :------ | :------ | | `config` | [`EthereumContractConfig`](../interfaces/EthereumContractConfig.md) | `undefined` | -| `deploymentType` | ``"local"`` \| ``"sepolia"`` \| ``"mainnet"`` | `"local"` | +| `chainId` | [`Ethereum`](../enums/Chains.Ethereum.md) | `Chains.Ethereum.Local` | #### Returns @@ -218,7 +218,7 @@ ___ Get events emitted by the Ethereum contract. It starts searching from provided block number. If the GetEvents.Options#fromBlock option is missing it looks for a contract's defined property -[_deployedAtBlockNumber](EthereumBridge.md#_deployedatblocknumber). If the property is missing starts searching +[_deployedAtBlockNumber](BaseL2BitcoinDepositor.md#_deployedatblocknumber). If the property is missing starts searching from block `0`. #### Parameters diff --git a/typescript/api-reference/classes/EthereumTBTCVault.md b/typescript/api-reference/classes/EthereumTBTCVault.md index 43c6971ca..cf5df7fde 100644 --- a/typescript/api-reference/classes/EthereumTBTCVault.md +++ b/typescript/api-reference/classes/EthereumTBTCVault.md @@ -50,14 +50,14 @@ for reference. ### constructor -• **new EthereumTBTCVault**(`config`, `deploymentType?`): [`EthereumTBTCVault`](EthereumTBTCVault.md) +• **new EthereumTBTCVault**(`config`, `chainId?`): [`EthereumTBTCVault`](EthereumTBTCVault.md) #### Parameters | Name | Type | Default value | | :------ | :------ | :------ | | `config` | [`EthereumContractConfig`](../interfaces/EthereumContractConfig.md) | `undefined` | -| `deploymentType` | ``"local"`` \| ``"sepolia"`` \| ``"mainnet"`` | `"local"` | +| `chainId` | [`Ethereum`](../enums/Chains.Ethereum.md) | `Chains.Ethereum.Local` | #### Returns @@ -69,7 +69,7 @@ EthersContractHandle\<TBTCVaultTypechain\>.constructor #### Defined in -[src/lib/ethereum/tbtc-vault.ts:40](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L40) +[src/lib/ethereum/tbtc-vault.ts:41](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L41) ## Properties @@ -146,7 +146,7 @@ EthersContractHandle.\_totalRetryAttempts #### Defined in -[src/lib/ethereum/tbtc-vault.ts:149](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L149) +[src/lib/ethereum/tbtc-vault.ts:150](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L150) ___ @@ -173,7 +173,7 @@ ___ #### Defined in -[src/lib/ethereum/tbtc-vault.ts:172](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L172) +[src/lib/ethereum/tbtc-vault.ts:173](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L173) ___ @@ -215,7 +215,7 @@ ___ #### Defined in -[src/lib/ethereum/tbtc-vault.ts:67](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L67) +[src/lib/ethereum/tbtc-vault.ts:68](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L68) ___ @@ -226,7 +226,7 @@ ___ Get events emitted by the Ethereum contract. It starts searching from provided block number. If the GetEvents.Options#fromBlock option is missing it looks for a contract's defined property -[_deployedAtBlockNumber](EthereumBridge.md#_deployedatblocknumber). If the property is missing starts searching +[_deployedAtBlockNumber](BaseL2BitcoinDepositor.md#_deployedatblocknumber). If the property is missing starts searching from block `0`. #### Parameters @@ -269,7 +269,7 @@ ___ #### Defined in -[src/lib/ethereum/tbtc-vault.ts:89](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L89) +[src/lib/ethereum/tbtc-vault.ts:90](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L90) ___ @@ -296,7 +296,7 @@ TBTCVault.getOptimisticMintingCancelledEvents #### Defined in -[src/lib/ethereum/tbtc-vault.ts:267](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L267) +[src/lib/ethereum/tbtc-vault.ts:268](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L268) ___ @@ -323,7 +323,7 @@ TBTCVault.getOptimisticMintingFinalizedEvents #### Defined in -[src/lib/ethereum/tbtc-vault.ts:294](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L294) +[src/lib/ethereum/tbtc-vault.ts:295](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L295) ___ @@ -350,7 +350,7 @@ TBTCVault.getOptimisticMintingRequestedEvents #### Defined in -[src/lib/ethereum/tbtc-vault.ts:234](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L234) +[src/lib/ethereum/tbtc-vault.ts:235](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L235) ___ @@ -376,7 +376,7 @@ ___ #### Defined in -[src/lib/ethereum/tbtc-vault.ts:113](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L113) +[src/lib/ethereum/tbtc-vault.ts:114](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L114) ___ @@ -402,7 +402,7 @@ ___ #### Defined in -[src/lib/ethereum/tbtc-vault.ts:103](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L103) +[src/lib/ethereum/tbtc-vault.ts:104](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L104) ___ @@ -422,7 +422,7 @@ ___ #### Defined in -[src/lib/ethereum/tbtc-vault.ts:75](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L75) +[src/lib/ethereum/tbtc-vault.ts:76](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L76) ___ @@ -449,7 +449,7 @@ ___ #### Defined in -[src/lib/ethereum/tbtc-vault.ts:198](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L198) +[src/lib/ethereum/tbtc-vault.ts:199](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L199) ___ @@ -473,7 +473,7 @@ Parsed optimistic minting request. #### Defined in -[src/lib/ethereum/tbtc-vault.ts:221](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L221) +[src/lib/ethereum/tbtc-vault.ts:222](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L222) ___ @@ -500,4 +500,4 @@ ___ #### Defined in -[src/lib/ethereum/tbtc-vault.ts:123](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L123) +[src/lib/ethereum/tbtc-vault.ts:124](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/tbtc-vault.ts#L124) diff --git a/typescript/api-reference/classes/EthereumWalletRegistry.md b/typescript/api-reference/classes/EthereumWalletRegistry.md index 8483e8f90..78e6b65d6 100644 --- a/typescript/api-reference/classes/EthereumWalletRegistry.md +++ b/typescript/api-reference/classes/EthereumWalletRegistry.md @@ -42,14 +42,14 @@ for reference. ### constructor -• **new EthereumWalletRegistry**(`config`, `deploymentType?`): [`EthereumWalletRegistry`](EthereumWalletRegistry.md) +• **new EthereumWalletRegistry**(`config`, `chainId?`): [`EthereumWalletRegistry`](EthereumWalletRegistry.md) #### Parameters | Name | Type | Default value | | :------ | :------ | :------ | | `config` | [`EthereumContractConfig`](../interfaces/EthereumContractConfig.md) | `undefined` | -| `deploymentType` | ``"local"`` \| ``"sepolia"`` \| ``"mainnet"`` | `"local"` | +| `chainId` | [`Ethereum`](../enums/Chains.Ethereum.md) | `Chains.Ethereum.Local` | #### Returns @@ -61,7 +61,7 @@ EthersContractHandle\<WalletRegistryTypechain\>.constructor #### Defined in -[src/lib/ethereum/wallet-registry.ts:32](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/wallet-registry.ts#L32) +[src/lib/ethereum/wallet-registry.ts:33](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/wallet-registry.ts#L33) ## Properties @@ -153,7 +153,7 @@ ___ #### Defined in -[src/lib/ethereum/wallet-registry.ts:59](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/wallet-registry.ts#L59) +[src/lib/ethereum/wallet-registry.ts:60](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/wallet-registry.ts#L60) ___ @@ -180,7 +180,7 @@ WalletRegistry.getDkgResultApprovedEvents #### Defined in -[src/lib/ethereum/wallet-registry.ts:125](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/wallet-registry.ts#L125) +[src/lib/ethereum/wallet-registry.ts:126](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/wallet-registry.ts#L126) ___ @@ -207,7 +207,7 @@ WalletRegistry.getDkgResultChallengedEvents #### Defined in -[src/lib/ethereum/wallet-registry.ts:150](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/wallet-registry.ts#L150) +[src/lib/ethereum/wallet-registry.ts:151](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/wallet-registry.ts#L151) ___ @@ -234,7 +234,7 @@ WalletRegistry.getDkgResultSubmittedEvents #### Defined in -[src/lib/ethereum/wallet-registry.ts:82](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/wallet-registry.ts#L82) +[src/lib/ethereum/wallet-registry.ts:83](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/wallet-registry.ts#L83) ___ @@ -245,7 +245,7 @@ ___ Get events emitted by the Ethereum contract. It starts searching from provided block number. If the GetEvents.Options#fromBlock option is missing it looks for a contract's defined property -[_deployedAtBlockNumber](EthereumBridge.md#_deployedatblocknumber). If the property is missing starts searching +[_deployedAtBlockNumber](BaseL2BitcoinDepositor.md#_deployedatblocknumber). If the property is missing starts searching from block `0`. #### Parameters @@ -294,4 +294,4 @@ ___ #### Defined in -[src/lib/ethereum/wallet-registry.ts:67](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/wallet-registry.ts#L67) +[src/lib/ethereum/wallet-registry.ts:68](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/lib/ethereum/wallet-registry.ts#L68) diff --git a/typescript/api-reference/classes/TBTC.md b/typescript/api-reference/classes/TBTC.md index eaaa27565..68f119868 100644 --- a/typescript/api-reference/classes/TBTC.md +++ b/typescript/api-reference/classes/TBTC.md @@ -10,6 +10,8 @@ Entrypoint component of the tBTC v2 SDK. ### Properties +- [#crossChainContracts](TBTC.md##crosschaincontracts) +- [#crossChainContractsLoader](TBTC.md##crosschaincontractsloader) - [bitcoinClient](TBTC.md#bitcoinclient) - [deposits](TBTC.md#deposits) - [maintenance](TBTC.md#maintenance) @@ -18,6 +20,8 @@ Entrypoint component of the tBTC v2 SDK. ### Methods +- [crossChainContracts](TBTC.md#crosschaincontracts) +- [initializeCrossChain](TBTC.md#initializecrosschain) - [initializeCustom](TBTC.md#initializecustom) - [initializeEthereum](TBTC.md#initializeethereum) - [initializeMainnet](TBTC.md#initializemainnet) @@ -27,7 +31,7 @@ Entrypoint component of the tBTC v2 SDK. ### constructor -• **new TBTC**(`tbtcContracts`, `bitcoinClient`): [`TBTC`](TBTC.md) +• **new TBTC**(`tbtcContracts`, `bitcoinClient`, `crossChainContractsLoader?`): [`TBTC`](TBTC.md) #### Parameters @@ -35,6 +39,7 @@ Entrypoint component of the tBTC v2 SDK. | :------ | :------ | | `tbtcContracts` | [`TBTCContracts`](../README.md#tbtccontracts) | | `bitcoinClient` | [`BitcoinClient`](../interfaces/BitcoinClient.md) | +| `crossChainContractsLoader?` | [`CrossChainContractsLoader`](../interfaces/CrossChainContractsLoader.md) | #### Returns @@ -42,10 +47,36 @@ Entrypoint component of the tBTC v2 SDK. #### Defined in -[src/services/tbtc.ts:40](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L40) +[src/services/tbtc.ts:59](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L59) ## Properties +### #crossChainContracts + +• `Private` `Readonly` **#crossChainContracts**: `Map`\<``"Base"``, [`CrossChainContracts`](../README.md#crosschaincontracts)\> + +Mapping of cross-chain contracts for different supported L2 chains. +Each set of cross-chain contracts must be first initialized using +the `initializeCrossChain` method. + +#### Defined in + +[src/services/tbtc.ts:57](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L57) + +___ + +### #crossChainContractsLoader + +• `Private` `Optional` `Readonly` **#crossChainContractsLoader**: [`CrossChainContractsLoader`](../interfaces/CrossChainContractsLoader.md) + +Reference to the cross-chain contracts loader. + +#### Defined in + +[src/services/tbtc.ts:51](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L51) + +___ + ### bitcoinClient • `Readonly` **bitcoinClient**: [`BitcoinClient`](../interfaces/BitcoinClient.md) @@ -54,7 +85,7 @@ Bitcoin client handle for low-level access. #### Defined in -[src/services/tbtc.ts:38](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L38) +[src/services/tbtc.ts:47](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L47) ___ @@ -66,7 +97,7 @@ Service supporting the tBTC v2 deposit flow. #### Defined in -[src/services/tbtc.ts:21](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L21) +[src/services/tbtc.ts:30](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L30) ___ @@ -79,7 +110,7 @@ and operators. #### Defined in -[src/services/tbtc.ts:26](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L26) +[src/services/tbtc.ts:35](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L35) ___ @@ -91,7 +122,7 @@ Service supporting the tBTC v2 redemption flow. #### Defined in -[src/services/tbtc.ts:30](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L30) +[src/services/tbtc.ts:39](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L39) ___ @@ -103,10 +134,76 @@ Handle to tBTC contracts for low-level access. #### Defined in -[src/services/tbtc.ts:34](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L34) +[src/services/tbtc.ts:43](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L43) ## Methods +### crossChainContracts + +▸ **crossChainContracts**(`l2ChainName`): `undefined` \| [`CrossChainContracts`](../README.md#crosschaincontracts) + +Gets cross-chain contracts for the given supported L2 chain. +The given L2 chain contracts must be first initialized using the +`initializeCrossChain` method. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `l2ChainName` | ``"Base"`` | Name of the L2 chain for which to get cross-chain contracts. | + +#### Returns + +`undefined` \| [`CrossChainContracts`](../README.md#crosschaincontracts) + +Cross-chain contracts for the given L2 chain or + undefined if not initialized. + +#### Defined in + +[src/services/tbtc.ts:233](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L233) + +___ + +### initializeCrossChain + +▸ **initializeCrossChain**(`l2ChainName`, `l2Signer`): `Promise`\<`void`\> + +Initializes cross-chain contracts for the given L2 chain, using the +given signer. Updates the signer on subsequent calls. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `l2ChainName` | ``"Base"`` | Name of the L2 chain for which to initialize cross-chain contracts. | +| `l2Signer` | [`EthereumSigner`](../README.md#ethereumsigner) | Signer to use with the L2 chain contracts. | + +#### Returns + +`Promise`\<`void`\> + +Void promise. + +**`Throws`** + +Throws an error if: + - Cross-chain contracts loader is not available for this TBTC SDK instance, + - Chain mapping between the L1 and the given L2 chain is not defined. + +**`Dev`** + +In case this function needs to support non-EVM L2 chains that can't + use EthereumSigner as a signer type, the l2Signer parameter should + probably be turned into a union of multiple supported types or + generalized in some other way. + +#### Defined in + +[src/services/tbtc.ts:185](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L185) + +___ + ### initializeCustom ▸ **initializeCustom**(`tbtcContracts`, `bitcoinClient`): `Promise`\<[`TBTC`](TBTC.md)\> @@ -135,13 +232,13 @@ This function is especially useful for local development as it gives #### Defined in -[src/services/tbtc.ts:117](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L117) +[src/services/tbtc.ts:163](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L163) ___ ### initializeEthereum -▸ **initializeEthereum**(`signer`, `ethereumNetwork`, `bitcoinNetwork`): `Promise`\<[`TBTC`](TBTC.md)\> +▸ **initializeEthereum**(`signer`, `ethereumChainId`, `bitcoinNetwork`): `Promise`\<[`TBTC`](TBTC.md)\> Initializes the tBTC v2 SDK entrypoint for the given Ethereum network and Bitcoin network. The initialized instance uses default Electrum servers to interact @@ -152,7 +249,7 @@ with Bitcoin network. | Name | Type | Description | | :------ | :------ | :------ | | `signer` | [`EthereumSigner`](../README.md#ethereumsigner) | Ethereum signer. | -| `ethereumNetwork` | [`EthereumNetwork`](../README.md#ethereumnetwork) | Ethereum network. | +| `ethereumChainId` | [`Ethereum`](../enums/Chains.Ethereum.md) | Ethereum chain ID. | | `bitcoinNetwork` | [`BitcoinNetwork`](../enums/BitcoinNetwork-1.md) | Bitcoin network. | #### Returns @@ -168,7 +265,7 @@ Throws an error if the underlying signer's Ethereum network is #### Defined in -[src/services/tbtc.ts:88](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L88) +[src/services/tbtc.ts:122](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L122) ___ @@ -199,7 +296,7 @@ Throws an error if the signer's Ethereum network is other than #### Defined in -[src/services/tbtc.ts:60](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L60) +[src/services/tbtc.ts:86](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L86) ___ @@ -230,4 +327,4 @@ Throws an error if the signer's Ethereum network is other than #### Defined in -[src/services/tbtc.ts:73](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L73) +[src/services/tbtc.ts:103](https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/services/tbtc.ts#L103)