@atomiqlabs/chain-evm 2.1.12 → 2.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -0
- package/dist/chains/EVMOptions.d.ts +66 -0
- package/dist/chains/EVMOptions.js +2 -0
- package/dist/chains/alpen/AlpenInitializer.d.ts +3 -30
- package/dist/chains/alpen/AlpenInitializer.js +3 -3
- package/dist/chains/botanix/BotanixInitializer.d.ts +3 -30
- package/dist/chains/botanix/BotanixInitializer.js +3 -3
- package/dist/chains/citrea/CitreaBtcRelay.d.ts +5 -0
- package/dist/chains/citrea/CitreaBtcRelay.js +7 -2
- package/dist/chains/citrea/CitreaFees.d.ts +3 -5
- package/dist/chains/citrea/CitreaFees.js +3 -5
- package/dist/chains/citrea/CitreaInitializer.d.ts +3 -29
- package/dist/chains/citrea/CitreaInitializer.js +3 -3
- package/dist/chains/citrea/CitreaSpvVaultContract.d.ts +5 -0
- package/dist/chains/citrea/CitreaSpvVaultContract.js +7 -2
- package/dist/chains/citrea/CitreaSwapContract.d.ts +7 -2
- package/dist/chains/citrea/CitreaSwapContract.js +10 -5
- package/dist/chains/citrea/CitreaTokens.d.ts +5 -0
- package/dist/chains/citrea/CitreaTokens.js +5 -0
- package/dist/chains/goat/GoatInitializer.d.ts +3 -30
- package/dist/chains/goat/GoatInitializer.js +3 -3
- package/dist/evm/btcrelay/EVMBtcRelay.d.ts +41 -10
- package/dist/evm/btcrelay/EVMBtcRelay.js +50 -18
- package/dist/evm/btcrelay/headers/EVMBtcHeader.d.ts +53 -7
- package/dist/evm/btcrelay/headers/EVMBtcHeader.js +43 -5
- package/dist/evm/btcrelay/headers/EVMBtcStoredHeader.d.ts +53 -8
- package/dist/evm/btcrelay/headers/EVMBtcStoredHeader.js +41 -1
- package/dist/evm/chain/EVMChainInterface.d.ts +57 -2
- package/dist/evm/chain/EVMChainInterface.js +7 -7
- package/dist/evm/chain/EVMModule.d.ts +5 -0
- package/dist/evm/chain/EVMModule.js +6 -1
- package/dist/evm/chain/modules/EVMBlocks.d.ts +7 -0
- package/dist/evm/chain/modules/EVMBlocks.js +2 -0
- package/dist/evm/chain/modules/EVMEvents.js +19 -19
- package/dist/evm/chain/modules/EVMFees.d.ts +41 -5
- package/dist/evm/chain/modules/EVMFees.js +24 -5
- package/dist/evm/chain/modules/EVMTokens.d.ts +1 -1
- package/dist/evm/chain/modules/EVMTokens.js +1 -1
- package/dist/evm/chain/modules/EVMTransactions.d.ts +20 -2
- package/dist/evm/chain/modules/EVMTransactions.js +11 -8
- package/dist/evm/contract/EVMContractBase.d.ts +28 -10
- package/dist/evm/contract/EVMContractBase.js +9 -18
- package/dist/evm/contract/EVMContractModule.d.ts +5 -0
- package/dist/evm/contract/EVMContractModule.js +5 -0
- package/dist/evm/contract/modules/EVMContractEvents.d.ts +7 -1
- package/dist/evm/contract/modules/EVMContractEvents.js +23 -3
- package/dist/evm/events/EVMChainEvents.d.ts +8 -0
- package/dist/evm/events/EVMChainEvents.js +8 -0
- package/dist/evm/events/EVMChainEventsBrowser.d.ts +87 -19
- package/dist/evm/events/EVMChainEventsBrowser.js +53 -18
- package/dist/evm/providers/JsonRpcProviderWithRetries.d.ts +9 -0
- package/dist/evm/providers/JsonRpcProviderWithRetries.js +9 -0
- package/dist/evm/providers/ReconnectingWebSocketProvider.d.ts +5 -0
- package/dist/evm/providers/ReconnectingWebSocketProvider.js +5 -0
- package/dist/evm/providers/WebSocketProviderWithRetries.d.ts +9 -0
- package/dist/evm/providers/WebSocketProviderWithRetries.js +9 -0
- package/dist/evm/spv_swap/EVMSpvVaultContract.d.ts +46 -21
- package/dist/evm/spv_swap/EVMSpvVaultContract.js +61 -23
- package/dist/evm/spv_swap/EVMSpvVaultData.d.ts +57 -2
- package/dist/evm/spv_swap/EVMSpvVaultData.js +57 -2
- package/dist/evm/spv_swap/EVMSpvWithdrawalData.d.ts +12 -0
- package/dist/evm/spv_swap/EVMSpvWithdrawalData.js +12 -0
- package/dist/evm/swaps/EVMSwapContract.d.ts +58 -13
- package/dist/evm/swaps/EVMSwapContract.js +81 -54
- package/dist/evm/swaps/EVMSwapData.d.ts +27 -6
- package/dist/evm/swaps/EVMSwapData.js +26 -0
- package/dist/evm/swaps/EVMSwapModule.d.ts +5 -0
- package/dist/evm/swaps/EVMSwapModule.js +5 -0
- package/dist/evm/swaps/handlers/IHandler.d.ts +5 -0
- package/dist/evm/swaps/handlers/claim/ClaimHandlers.d.ts +15 -0
- package/dist/evm/swaps/handlers/claim/ClaimHandlers.js +5 -0
- package/dist/evm/swaps/handlers/claim/btc/BitcoinNoncedOutputClaimHandler.d.ts +5 -0
- package/dist/evm/swaps/handlers/claim/btc/BitcoinOutputClaimHandler.d.ts +10 -0
- package/dist/evm/swaps/handlers/claim/btc/BitcoinTxIdClaimHandler.d.ts +5 -0
- package/dist/evm/swaps/handlers/claim/btc/IBitcoinClaimHandler.d.ts +15 -0
- package/dist/evm/swaps/handlers/claim/btc/IBitcoinClaimHandler.js +7 -2
- package/dist/evm/swaps/modules/EVMLpVault.d.ts +5 -0
- package/dist/evm/swaps/modules/EVMLpVault.js +9 -4
- package/dist/evm/swaps/modules/EVMSwapClaim.d.ts +7 -2
- package/dist/evm/swaps/modules/EVMSwapClaim.js +11 -6
- package/dist/evm/swaps/modules/EVMSwapInit.d.ts +10 -0
- package/dist/evm/swaps/modules/EVMSwapInit.js +11 -6
- package/dist/evm/swaps/modules/EVMSwapRefund.d.ts +5 -0
- package/dist/evm/swaps/modules/EVMSwapRefund.js +9 -4
- package/dist/evm/wallet/EVMBrowserSigner.d.ts +22 -2
- package/dist/evm/wallet/EVMBrowserSigner.js +40 -2
- package/dist/evm/wallet/EVMPersistentSigner.d.ts +13 -2
- package/dist/evm/wallet/EVMPersistentSigner.js +13 -1
- package/dist/evm/wallet/EVMSigner.d.ts +30 -1
- package/dist/evm/wallet/EVMSigner.js +34 -1
- package/dist/index.d.ts +71 -0
- package/dist/index.js +70 -0
- package/dist/node/index.d.ts +10 -0
- package/dist/node/index.js +15 -0
- package/dist/utils/Utils.d.ts +50 -0
- package/dist/utils/Utils.js +45 -0
- package/node/index.d.ts +1 -0
- package/node/index.js +3 -0
- package/package.json +4 -3
- package/src/chains/EVMOptions.ts +70 -0
- package/src/chains/alpen/AlpenInitializer.ts +5 -27
- package/src/chains/botanix/BotanixChainType.ts +5 -5
- package/src/chains/botanix/BotanixInitializer.ts +5 -27
- package/src/chains/citrea/CitreaBtcRelay.ts +8 -3
- package/src/chains/citrea/CitreaFees.ts +3 -6
- package/src/chains/citrea/CitreaInitializer.ts +5 -27
- package/src/chains/citrea/CitreaSpvVaultContract.ts +7 -2
- package/src/chains/citrea/CitreaSwapContract.ts +11 -6
- package/src/chains/citrea/CitreaTokens.ts +6 -1
- package/src/chains/goat/GoatChainType.ts +5 -5
- package/src/chains/goat/GoatInitializer.ts +3 -25
- package/src/evm/btcrelay/EVMBtcRelay.ts +54 -22
- package/src/evm/btcrelay/headers/EVMBtcHeader.ts +60 -13
- package/src/evm/btcrelay/headers/EVMBtcStoredHeader.ts +55 -10
- package/src/evm/chain/EVMChainInterface.ts +66 -14
- package/src/evm/chain/EVMModule.ts +6 -1
- package/src/evm/chain/modules/EVMBlocks.ts +7 -0
- package/src/evm/chain/modules/EVMEvents.ts +19 -19
- package/src/evm/chain/modules/EVMFees.ts +41 -5
- package/src/evm/chain/modules/EVMTokens.ts +1 -1
- package/src/evm/chain/modules/EVMTransactions.ts +27 -8
- package/src/evm/contract/EVMContractBase.ts +29 -24
- package/src/evm/contract/EVMContractModule.ts +5 -0
- package/src/evm/contract/modules/EVMContractEvents.ts +27 -8
- package/src/evm/events/EVMChainEvents.ts +8 -0
- package/src/evm/events/EVMChainEventsBrowser.ts +103 -29
- package/src/evm/providers/JsonRpcProviderWithRetries.ts +10 -1
- package/src/evm/providers/ReconnectingWebSocketProvider.ts +6 -1
- package/src/evm/providers/WebSocketProviderWithRetries.ts +10 -1
- package/src/evm/spv_swap/EVMSpvVaultContract.ts +72 -32
- package/src/evm/spv_swap/EVMSpvVaultData.ts +57 -2
- package/src/evm/spv_swap/EVMSpvWithdrawalData.ts +12 -0
- package/src/evm/swaps/EVMSwapContract.ts +108 -63
- package/src/evm/swaps/EVMSwapData.ts +27 -1
- package/src/evm/swaps/EVMSwapModule.ts +5 -0
- package/src/evm/swaps/handlers/IHandler.ts +5 -0
- package/src/evm/swaps/handlers/claim/ClaimHandlers.ts +15 -0
- package/src/evm/swaps/handlers/claim/btc/BitcoinNoncedOutputClaimHandler.ts +5 -0
- package/src/evm/swaps/handlers/claim/btc/BitcoinOutputClaimHandler.ts +10 -0
- package/src/evm/swaps/handlers/claim/btc/BitcoinTxIdClaimHandler.ts +5 -0
- package/src/evm/swaps/handlers/claim/btc/IBitcoinClaimHandler.ts +17 -2
- package/src/evm/swaps/modules/EVMLpVault.ts +10 -5
- package/src/evm/swaps/modules/EVMSwapClaim.ts +12 -7
- package/src/evm/swaps/modules/EVMSwapInit.ts +17 -7
- package/src/evm/swaps/modules/EVMSwapRefund.ts +9 -4
- package/src/evm/wallet/EVMBrowserSigner.ts +44 -5
- package/src/evm/wallet/EVMPersistentSigner.ts +14 -2
- package/src/evm/wallet/EVMSigner.ts +37 -1
- package/src/index.ts +72 -0
- package/src/node/index.ts +10 -0
- package/src/utils/Utils.ts +50 -1
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# @atomiqlabs/chain-evm
|
|
2
|
+
|
|
3
|
+
`@atomiqlabs/chain-evm` is the EVM integration package for the Atomiq protocol.
|
|
4
|
+
|
|
5
|
+
Within the Atomiq stack, this library provides the EVM-side building blocks used for Bitcoin-aware swaps and SPV-backed vault flows on supported EVM-compatible chains. It includes:
|
|
6
|
+
|
|
7
|
+
- chain initializers for Atomiq-supported EVM networks
|
|
8
|
+
- the `EVMChainInterface` used to talk to chain RPCs
|
|
9
|
+
- BTC relay, escrow swap, and SPV vault contract wrappers
|
|
10
|
+
- browser and server-side EVM signer helpers
|
|
11
|
+
- event utilities for tracking swap and vault activity
|
|
12
|
+
|
|
13
|
+
This package is intended for direct protocol integrations and for higher-level Atomiq SDK layers that need EVM chain support.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Install the package with its `ethers` peer dependency:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @atomiqlabs/chain-evm ethers
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Node-only Classes
|
|
24
|
+
|
|
25
|
+
The default package entrypoint stays browser-safe and does not export classes that depend on Node's `fs` module.
|
|
26
|
+
|
|
27
|
+
Import backend-only utilities from the dedicated `node` subpath:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import {EVMChainEvents, EVMPersistentSigner} from "@atomiqlabs/chain-evm/node";
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Supported Chains
|
|
34
|
+
|
|
35
|
+
The package currently exports chain initializers for:
|
|
36
|
+
|
|
37
|
+
- Botanix via `BotanixInitializer`
|
|
38
|
+
- Citrea via `CitreaInitializer`
|
|
39
|
+
- Alpen via `AlpenInitializer`
|
|
40
|
+
- GOAT Network via `GoatInitializer`
|
|
41
|
+
|
|
42
|
+
Canonical deployments currently defined in this package:
|
|
43
|
+
|
|
44
|
+
| Chain | Canonical deployments included |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| Botanix | `MAINNET`, `TESTNET` |
|
|
47
|
+
| Citrea | `MAINNET`, `TESTNET4` |
|
|
48
|
+
| Alpen | `TESTNET`, `TESTNET4` |
|
|
49
|
+
| GOAT Network | `TESTNET`, `TESTNET4` |
|
|
50
|
+
|
|
51
|
+
For Alpen and GOAT Network, `MAINNET` chain types exist in the API, but default mainnet contract addresses are not populated in this package yet. In those cases, pass explicit contract addresses if you want to use non-canonical deployments.
|
|
52
|
+
|
|
53
|
+
## SDK Example
|
|
54
|
+
|
|
55
|
+
Initialize the atomiq SDK with Citrea network support:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import {CitreaInitializer, CitreaInitializerType} from "@atomiqlabs/chain-evm";
|
|
59
|
+
import {BitcoinNetwork, SwapperFactory, TypedSwapper} from "@atomiqlabs/sdk";
|
|
60
|
+
|
|
61
|
+
//Define chains that you want to support here
|
|
62
|
+
const chains = [CitreaInitializer] as const;
|
|
63
|
+
type SupportedChains = typeof chains; //It's helpful that we also get the type of the chains array
|
|
64
|
+
|
|
65
|
+
const Factory = new SwapperFactory<SupportedChains>(chains); //Create swapper factory
|
|
66
|
+
|
|
67
|
+
const swapper: TypedSwapper<SupportedChains> = Factory.newSwapper({
|
|
68
|
+
chains: {
|
|
69
|
+
CITREA: {
|
|
70
|
+
rpcUrl: citreaRpc, //You can also pass JsonApiProvider object here
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
bitcoinNetwork: BitcoinNetwork.MAINNET //or BitcoinNetwork.TESTNET3, BitcoinNetwork.TESTNET4 - this also sets the deployment to use for EVM chains
|
|
74
|
+
});
|
|
75
|
+
```
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { JsonRpcApiProvider } from "ethers";
|
|
2
|
+
import { EVMConfiguration, EVMRetryPolicy } from "../evm/chain/EVMChainInterface";
|
|
3
|
+
import { ChainSwapType } from "@atomiqlabs/base";
|
|
4
|
+
import { EVMFees } from "../evm/chain/modules/EVMFees";
|
|
5
|
+
/**
|
|
6
|
+
* Generic options for an EVM chain
|
|
7
|
+
*
|
|
8
|
+
* @category Chain Interface
|
|
9
|
+
*/
|
|
10
|
+
export type EVMOptions<C extends string, F extends EVMFees = EVMFees> = {
|
|
11
|
+
/**
|
|
12
|
+
* EVM RPC URL or {@link JsonRpcApiProvider} object to use for EVM network access
|
|
13
|
+
*/
|
|
14
|
+
rpcUrl: string | JsonRpcApiProvider;
|
|
15
|
+
/**
|
|
16
|
+
* Retry policy for the RPC calls
|
|
17
|
+
*/
|
|
18
|
+
retryPolicy?: EVMRetryPolicy;
|
|
19
|
+
/**
|
|
20
|
+
* Network type for the EVM chain
|
|
21
|
+
*/
|
|
22
|
+
chainType?: C;
|
|
23
|
+
/**
|
|
24
|
+
* Contract address of the Escrow Manager contract, uses canonical deployment by default
|
|
25
|
+
*/
|
|
26
|
+
swapContract?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Optional Escrow Manager contract deployment height, which acts as genesis when querying events
|
|
29
|
+
*/
|
|
30
|
+
swapContractDeploymentHeight?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Contract address of the BTC Relay contract, uses canonical deployment by default
|
|
33
|
+
*/
|
|
34
|
+
btcRelayContract?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Optional BTC Relay contract deployment height, which acts as genesis when querying events
|
|
37
|
+
*/
|
|
38
|
+
btcRelayDeploymentHeight?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Contract address of the UTXO-controlled vault (SPV Vault manager) contract, uses canonical deployment by default
|
|
41
|
+
*/
|
|
42
|
+
spvVaultContract?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Optional UTXO-controlled vault (SPV Vault manager) contract deployment height, which acts as genesis when querying events
|
|
45
|
+
*/
|
|
46
|
+
spvVaultDeploymentHeight?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Contract addresses of the refund and claim handlers, uses canonical deployment by default
|
|
49
|
+
*/
|
|
50
|
+
handlerContracts?: {
|
|
51
|
+
refund?: {
|
|
52
|
+
timelock?: string;
|
|
53
|
+
};
|
|
54
|
+
claim?: {
|
|
55
|
+
[type in ChainSwapType]?: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* EVM network fee API
|
|
60
|
+
*/
|
|
61
|
+
fees?: F;
|
|
62
|
+
/**
|
|
63
|
+
* EVM configuration
|
|
64
|
+
*/
|
|
65
|
+
evmConfig?: Partial<Omit<EVMConfiguration, "safeBlockTag" | "finalizedBlockTag" | "finalityCheckStrategy">>;
|
|
66
|
+
};
|
|
@@ -1,43 +1,16 @@
|
|
|
1
|
-
import { BaseTokenType, BitcoinNetwork, BitcoinRpc, ChainData, ChainInitializer
|
|
2
|
-
import { JsonRpcApiProvider } from "ethers";
|
|
3
|
-
import { EVMConfiguration, EVMRetryPolicy } from "../../evm/chain/EVMChainInterface";
|
|
4
|
-
import { EVMFees } from "../../evm/chain/modules/EVMFees";
|
|
1
|
+
import { BaseTokenType, BitcoinNetwork, BitcoinRpc, ChainData, ChainInitializer } from "@atomiqlabs/base";
|
|
5
2
|
import { AlpenChainType } from "./AlpenChainType";
|
|
3
|
+
import { EVMOptions } from "../EVMOptions";
|
|
6
4
|
/**
|
|
7
5
|
* Token assets available on Alpen
|
|
8
6
|
* @category Networks/Alpen
|
|
9
7
|
*/
|
|
10
8
|
export type AlpenAssetsType = BaseTokenType<"BTC">;
|
|
11
|
-
/**
|
|
12
|
-
* Default Alpen token assets configuration
|
|
13
|
-
* @category Networks/Alpen
|
|
14
|
-
*/
|
|
15
|
-
export declare const AlpenAssets: AlpenAssetsType;
|
|
16
9
|
/**
|
|
17
10
|
* Configuration options for initializing Alpen chain
|
|
18
11
|
* @category Networks/Alpen
|
|
19
12
|
*/
|
|
20
|
-
export type AlpenOptions =
|
|
21
|
-
rpcUrl: string | JsonRpcApiProvider;
|
|
22
|
-
retryPolicy?: EVMRetryPolicy;
|
|
23
|
-
chainType?: "MAINNET" | "TESTNET" | "TESTNET4";
|
|
24
|
-
swapContract?: string;
|
|
25
|
-
swapContractDeploymentHeight?: number;
|
|
26
|
-
btcRelayContract?: string;
|
|
27
|
-
btcRelayDeploymentHeight?: number;
|
|
28
|
-
spvVaultContract?: string;
|
|
29
|
-
spvVaultDeploymentHeight?: number;
|
|
30
|
-
handlerContracts?: {
|
|
31
|
-
refund?: {
|
|
32
|
-
timelock?: string;
|
|
33
|
-
};
|
|
34
|
-
claim?: {
|
|
35
|
-
[type in ChainSwapType]?: string;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
fees?: EVMFees;
|
|
39
|
-
evmConfig?: Partial<Omit<EVMConfiguration, "safeBlockTag" | "finalizedBlockTag" | "finalityCheckStrategy">>;
|
|
40
|
-
};
|
|
13
|
+
export type AlpenOptions = EVMOptions<"MAINNET" | "TESTNET" | "TESTNET4">;
|
|
41
14
|
/**
|
|
42
15
|
* Initialize Alpen chain integration
|
|
43
16
|
* @category Networks/Alpen
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AlpenInitializer = exports.initializeAlpen =
|
|
3
|
+
exports.AlpenInitializer = exports.initializeAlpen = void 0;
|
|
4
4
|
const base_1 = require("@atomiqlabs/base");
|
|
5
5
|
const ethers_1 = require("ethers");
|
|
6
6
|
const EVMChainInterface_1 = require("../../evm/chain/EVMChainInterface");
|
|
@@ -88,7 +88,7 @@ const chainTypeMapping = {
|
|
|
88
88
|
* Default Alpen token assets configuration
|
|
89
89
|
* @category Networks/Alpen
|
|
90
90
|
*/
|
|
91
|
-
|
|
91
|
+
const AlpenAssets = {
|
|
92
92
|
BTC: {
|
|
93
93
|
address: "0x0000000000000000000000000000000000000000",
|
|
94
94
|
decimals: 18,
|
|
@@ -156,6 +156,6 @@ exports.AlpenInitializer = {
|
|
|
156
156
|
chainId: "ALPEN",
|
|
157
157
|
chainType: null,
|
|
158
158
|
initializer: initializeAlpen,
|
|
159
|
-
tokens:
|
|
159
|
+
tokens: AlpenAssets,
|
|
160
160
|
options: null
|
|
161
161
|
};
|
|
@@ -1,43 +1,16 @@
|
|
|
1
|
-
import { BaseTokenType, BitcoinNetwork, BitcoinRpc, ChainData, ChainInitializer
|
|
2
|
-
import { JsonRpcApiProvider } from "ethers";
|
|
3
|
-
import { EVMConfiguration, EVMRetryPolicy } from "../../evm/chain/EVMChainInterface";
|
|
4
|
-
import { EVMFees } from "../../evm/chain/modules/EVMFees";
|
|
1
|
+
import { BaseTokenType, BitcoinNetwork, BitcoinRpc, ChainData, ChainInitializer } from "@atomiqlabs/base";
|
|
5
2
|
import { BotanixChainType } from "./BotanixChainType";
|
|
3
|
+
import { EVMOptions } from "../EVMOptions";
|
|
6
4
|
/**
|
|
7
5
|
* Token assets available on Botanix
|
|
8
6
|
* @category Networks/Botanix
|
|
9
7
|
*/
|
|
10
8
|
export type BotanixAssetsType = BaseTokenType<"BTC">;
|
|
11
|
-
/**
|
|
12
|
-
* Default Botanix token assets configuration
|
|
13
|
-
* @category Networks/Botanix
|
|
14
|
-
*/
|
|
15
|
-
export declare const BotanixAssets: BotanixAssetsType;
|
|
16
9
|
/**
|
|
17
10
|
* Configuration options for initializing Botanix chain
|
|
18
11
|
* @category Networks/Botanix
|
|
19
12
|
*/
|
|
20
|
-
export type BotanixOptions =
|
|
21
|
-
rpcUrl: string | JsonRpcApiProvider;
|
|
22
|
-
retryPolicy?: EVMRetryPolicy;
|
|
23
|
-
chainType?: "MAINNET" | "TESTNET";
|
|
24
|
-
swapContract?: string;
|
|
25
|
-
swapContractDeploymentHeight?: number;
|
|
26
|
-
btcRelayContract?: string;
|
|
27
|
-
btcRelayDeploymentHeight?: number;
|
|
28
|
-
spvVaultContract?: string;
|
|
29
|
-
spvVaultDeploymentHeight?: number;
|
|
30
|
-
handlerContracts?: {
|
|
31
|
-
refund?: {
|
|
32
|
-
timelock?: string;
|
|
33
|
-
};
|
|
34
|
-
claim?: {
|
|
35
|
-
[type in ChainSwapType]?: string;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
fees?: EVMFees;
|
|
39
|
-
evmConfig?: Partial<Omit<EVMConfiguration, "safeBlockTag" | "finalizedBlockTag" | "finalityCheckStrategy">>;
|
|
40
|
-
};
|
|
13
|
+
export type BotanixOptions = EVMOptions<"MAINNET" | "TESTNET">;
|
|
41
14
|
/**
|
|
42
15
|
* Initialize Botanix chain integration
|
|
43
16
|
* @category Networks/Botanix
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BotanixInitializer = exports.initializeBotanix =
|
|
3
|
+
exports.BotanixInitializer = exports.initializeBotanix = void 0;
|
|
4
4
|
const base_1 = require("@atomiqlabs/base");
|
|
5
5
|
const ethers_1 = require("ethers");
|
|
6
6
|
const EVMChainInterface_1 = require("../../evm/chain/EVMChainInterface");
|
|
@@ -66,7 +66,7 @@ const chainTypeMapping = {
|
|
|
66
66
|
* Default Botanix token assets configuration
|
|
67
67
|
* @category Networks/Botanix
|
|
68
68
|
*/
|
|
69
|
-
|
|
69
|
+
const BotanixAssets = {
|
|
70
70
|
BTC: {
|
|
71
71
|
address: "0x0000000000000000000000000000000000000000",
|
|
72
72
|
decimals: 18,
|
|
@@ -138,6 +138,6 @@ exports.BotanixInitializer = {
|
|
|
138
138
|
chainId: "BOTANIX",
|
|
139
139
|
chainType: null,
|
|
140
140
|
initializer: initializeBotanix,
|
|
141
|
-
tokens:
|
|
141
|
+
tokens: BotanixAssets,
|
|
142
142
|
options: null
|
|
143
143
|
};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { EVMBtcRelay } from "../../evm/btcrelay/EVMBtcRelay";
|
|
2
2
|
import { BtcBlock } from "@atomiqlabs/base";
|
|
3
|
+
/**
|
|
4
|
+
* Citrea BTC relay wrapper with fee estimation that includes Citrea state-diff costs.
|
|
5
|
+
*
|
|
6
|
+
* @category Networks/Citrea
|
|
7
|
+
*/
|
|
3
8
|
export declare class CitreaBtcRelay<B extends BtcBlock> extends EVMBtcRelay<B> {
|
|
4
9
|
static StateDiffSize: {
|
|
5
10
|
STATE_DIFF_PER_BLOCKHEADER: number;
|
|
@@ -5,6 +5,11 @@ const EVMBtcRelay_1 = require("../../evm/btcrelay/EVMBtcRelay");
|
|
|
5
5
|
const Utils_1 = require("../../utils/Utils");
|
|
6
6
|
const CitreaFees_1 = require("./CitreaFees");
|
|
7
7
|
const logger = (0, Utils_1.getLogger)("CitreaBtcRelay: ");
|
|
8
|
+
/**
|
|
9
|
+
* Citrea BTC relay wrapper with fee estimation that includes Citrea state-diff costs.
|
|
10
|
+
*
|
|
11
|
+
* @category Networks/Citrea
|
|
12
|
+
*/
|
|
8
13
|
class CitreaBtcRelay extends EVMBtcRelay_1.EVMBtcRelay {
|
|
9
14
|
/**
|
|
10
15
|
* Estimate required synchronization fee (worst case) to synchronize btc relay to the required blockheight
|
|
@@ -23,7 +28,7 @@ class CitreaBtcRelay extends EVMBtcRelay_1.EVMBtcRelay {
|
|
|
23
28
|
return 0n;
|
|
24
29
|
const numTxs = Math.ceil(blockheightDelta / this.maxHeadersPerTx);
|
|
25
30
|
const synchronizationFee = (BigInt(blockheightDelta) * await this.getFeePerBlock(feeRate))
|
|
26
|
-
+ CitreaFees_1.CitreaFees.getGasFee(EVMBtcRelay_1.EVMBtcRelay.
|
|
31
|
+
+ CitreaFees_1.CitreaFees.getGasFee(EVMBtcRelay_1.EVMBtcRelay._GasCosts.GAS_BASE_MAIN * numTxs, feeRate, CitreaBtcRelay.StateDiffSize.STATE_DIFF_BASE * numTxs);
|
|
27
32
|
logger.debug("estimateSynchronizeFee(): required blockheight: " + requiredBlockheight +
|
|
28
33
|
" blockheight delta: " + blockheightDelta + " fee: " + synchronizationFee.toString(10));
|
|
29
34
|
return synchronizationFee;
|
|
@@ -35,7 +40,7 @@ class CitreaBtcRelay extends EVMBtcRelay_1.EVMBtcRelay {
|
|
|
35
40
|
*/
|
|
36
41
|
async getFeePerBlock(feeRate) {
|
|
37
42
|
feeRate ?? (feeRate = await this.Chain.Fees.getFeeRate());
|
|
38
|
-
return CitreaFees_1.CitreaFees.getGasFee(EVMBtcRelay_1.EVMBtcRelay.
|
|
43
|
+
return CitreaFees_1.CitreaFees.getGasFee(EVMBtcRelay_1.EVMBtcRelay._GasCosts.GAS_PER_BLOCKHEADER, feeRate, CitreaBtcRelay.StateDiffSize.STATE_DIFF_PER_BLOCKHEADER);
|
|
39
44
|
}
|
|
40
45
|
}
|
|
41
46
|
exports.CitreaBtcRelay = CitreaBtcRelay;
|
|
@@ -3,9 +3,9 @@ import { EVMFees } from "../../evm/chain/modules/EVMFees";
|
|
|
3
3
|
* @category Networks/Citrea
|
|
4
4
|
*/
|
|
5
5
|
export declare class CitreaFees extends EVMFees {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
9
|
protected readonly logger: import("../../utils/Utils").LoggerType;
|
|
10
10
|
private _blockFeeCache?;
|
|
11
11
|
/**
|
|
@@ -17,8 +17,6 @@ export declare class CitreaFees extends EVMFees {
|
|
|
17
17
|
private __getFeeRate;
|
|
18
18
|
/**
|
|
19
19
|
* Gets the gas price with caching, format: <gas price in Wei>;<transaction version: v1/v3>
|
|
20
|
-
*
|
|
21
|
-
* @private
|
|
22
20
|
*/
|
|
23
21
|
getFeeRate(): Promise<string>;
|
|
24
22
|
/**
|
|
@@ -9,6 +9,9 @@ const Utils_1 = require("../../utils/Utils");
|
|
|
9
9
|
class CitreaFees extends EVMFees_1.EVMFees {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
12
15
|
this.logger = (0, Utils_1.getLogger)("CitreaFees: ");
|
|
13
16
|
}
|
|
14
17
|
/**
|
|
@@ -26,8 +29,6 @@ class CitreaFees extends EVMFees_1.EVMFees {
|
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
28
31
|
* Gets the gas price with caching, format: <gas price in Wei>;<transaction version: v1/v3>
|
|
29
|
-
*
|
|
30
|
-
* @private
|
|
31
32
|
*/
|
|
32
33
|
async getFeeRate() {
|
|
33
34
|
if (this._blockFeeCache == null || Date.now() - this._blockFeeCache.timestamp > this.MAX_FEE_AGE) {
|
|
@@ -63,6 +64,3 @@ class CitreaFees extends EVMFees_1.EVMFees {
|
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
exports.CitreaFees = CitreaFees;
|
|
66
|
-
CitreaFees.StateDiffSize = {
|
|
67
|
-
APPROVE_DIFF_SIZE: 40,
|
|
68
|
-
};
|
|
@@ -1,43 +1,17 @@
|
|
|
1
|
-
import { BaseTokenType, BitcoinNetwork, BitcoinRpc, ChainData, ChainInitializer
|
|
2
|
-
import { JsonRpcApiProvider } from "ethers";
|
|
3
|
-
import { EVMConfiguration, EVMRetryPolicy } from "../../evm/chain/EVMChainInterface";
|
|
1
|
+
import { BaseTokenType, BitcoinNetwork, BitcoinRpc, ChainData, ChainInitializer } from "@atomiqlabs/base";
|
|
4
2
|
import { CitreaChainType } from "./CitreaChainType";
|
|
5
3
|
import { CitreaFees } from "./CitreaFees";
|
|
4
|
+
import { EVMOptions } from "../EVMOptions";
|
|
6
5
|
/**
|
|
7
6
|
* Token assets available on Citrea
|
|
8
7
|
* @category Networks/Citrea
|
|
9
8
|
*/
|
|
10
9
|
export type CitreaAssetsType = BaseTokenType<"CBTC" | "WBTC" | "USDC">;
|
|
11
|
-
/**
|
|
12
|
-
* Default Citrea token assets configuration
|
|
13
|
-
* @category Networks/Citrea
|
|
14
|
-
*/
|
|
15
|
-
export declare const CitreaAssets: CitreaAssetsType;
|
|
16
10
|
/**
|
|
17
11
|
* Configuration options for initializing Citrea chain
|
|
18
12
|
* @category Networks/Citrea
|
|
19
13
|
*/
|
|
20
|
-
export type CitreaOptions =
|
|
21
|
-
rpcUrl: string | JsonRpcApiProvider;
|
|
22
|
-
retryPolicy?: EVMRetryPolicy;
|
|
23
|
-
chainType?: "MAINNET" | "TESTNET4";
|
|
24
|
-
swapContract?: string;
|
|
25
|
-
swapContractDeploymentHeight?: number;
|
|
26
|
-
btcRelayContract?: string;
|
|
27
|
-
btcRelayDeploymentHeight?: number;
|
|
28
|
-
spvVaultContract?: string;
|
|
29
|
-
spvVaultDeploymentHeight?: number;
|
|
30
|
-
handlerContracts?: {
|
|
31
|
-
refund?: {
|
|
32
|
-
timelock?: string;
|
|
33
|
-
};
|
|
34
|
-
claim?: {
|
|
35
|
-
[type in ChainSwapType]?: string;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
fees?: CitreaFees;
|
|
39
|
-
evmConfig?: Partial<Omit<EVMConfiguration, "safeBlockTag" | "finalizedBlockTag" | "finalityCheckStrategy">>;
|
|
40
|
-
};
|
|
14
|
+
export type CitreaOptions = EVMOptions<"MAINNET" | "TESTNET4", CitreaFees>;
|
|
41
15
|
/**
|
|
42
16
|
* Initialize Citrea chain integration
|
|
43
17
|
* @category Networks/Citrea
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CitreaInitializer = exports.initializeCitrea =
|
|
3
|
+
exports.CitreaInitializer = exports.initializeCitrea = void 0;
|
|
4
4
|
const base_1 = require("@atomiqlabs/base");
|
|
5
5
|
const ethers_1 = require("ethers");
|
|
6
6
|
const EVMChainInterface_1 = require("../../evm/chain/EVMChainInterface");
|
|
@@ -67,7 +67,7 @@ const chainTypeMapping = {
|
|
|
67
67
|
* Default Citrea token assets configuration
|
|
68
68
|
* @category Networks/Citrea
|
|
69
69
|
*/
|
|
70
|
-
|
|
70
|
+
const CitreaAssets = {
|
|
71
71
|
CBTC: {
|
|
72
72
|
address: "0x0000000000000000000000000000000000000000",
|
|
73
73
|
decimals: 18,
|
|
@@ -148,6 +148,6 @@ exports.CitreaInitializer = {
|
|
|
148
148
|
chainId: "CITREA",
|
|
149
149
|
chainType: null,
|
|
150
150
|
initializer: initializeCitrea,
|
|
151
|
-
tokens:
|
|
151
|
+
tokens: CitreaAssets,
|
|
152
152
|
options: null
|
|
153
153
|
};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { EVMSpvVaultContract } from "../../evm/spv_swap/EVMSpvVaultContract";
|
|
2
2
|
import { EVMSpvWithdrawalData } from "../../evm/spv_swap/EVMSpvWithdrawalData";
|
|
3
3
|
import { EVMSpvVaultData } from "../../evm/spv_swap/EVMSpvVaultData";
|
|
4
|
+
/**
|
|
5
|
+
* Citrea SPV vault wrapper with fee estimation adjusted by expected state-diff size.
|
|
6
|
+
*
|
|
7
|
+
* @category Networks/Citrea
|
|
8
|
+
*/
|
|
4
9
|
export declare class CitreaSpvVaultContract extends EVMSpvVaultContract<"CITREA"> {
|
|
5
10
|
static readonly StateDiffSize: {
|
|
6
11
|
BASE_DIFF_SIZE: number;
|
|
@@ -6,6 +6,11 @@ const EVMSpvVaultData_1 = require("../../evm/spv_swap/EVMSpvVaultData");
|
|
|
6
6
|
const ethers_1 = require("ethers");
|
|
7
7
|
const CitreaFees_1 = require("./CitreaFees");
|
|
8
8
|
const EVMAddresses_1 = require("../../evm/chain/modules/EVMAddresses");
|
|
9
|
+
/**
|
|
10
|
+
* Citrea SPV vault wrapper with fee estimation adjusted by expected state-diff size.
|
|
11
|
+
*
|
|
12
|
+
* @category Networks/Citrea
|
|
13
|
+
*/
|
|
9
14
|
class CitreaSpvVaultContract extends EVMSpvVaultContract_1.EVMSpvVaultContract {
|
|
10
15
|
calculateStateDiff(signer, tokenStateChanges) {
|
|
11
16
|
let stateDiffSize = 0;
|
|
@@ -21,7 +26,7 @@ class CitreaSpvVaultContract extends EVMSpvVaultContract_1.EVMSpvVaultContract {
|
|
|
21
26
|
return stateDiffSize;
|
|
22
27
|
}
|
|
23
28
|
async getClaimFee(signer, vault, data, feeRate) {
|
|
24
|
-
vault ?? (vault = EVMSpvVaultData_1.EVMSpvVaultData.
|
|
29
|
+
vault ?? (vault = EVMSpvVaultData_1.EVMSpvVaultData._randomVault());
|
|
25
30
|
feeRate ?? (feeRate = await this.Chain.Fees.getFeeRate());
|
|
26
31
|
const tokenStateChanges = new Set();
|
|
27
32
|
let diffSize = CitreaSpvVaultContract.StateDiffSize.BASE_DIFF_SIZE;
|
|
@@ -49,7 +54,7 @@ class CitreaSpvVaultContract extends EVMSpvVaultContract_1.EVMSpvVaultContract {
|
|
|
49
54
|
return gasFee + CitreaFees_1.CitreaFees.getGasFee(0, feeRate, diffSize);
|
|
50
55
|
}
|
|
51
56
|
async getFrontFee(signer, vault, data, feeRate) {
|
|
52
|
-
vault ?? (vault = EVMSpvVaultData_1.EVMSpvVaultData.
|
|
57
|
+
vault ?? (vault = EVMSpvVaultData_1.EVMSpvVaultData._randomVault());
|
|
53
58
|
feeRate ?? (feeRate = await this.Chain.Fees.getFeeRate());
|
|
54
59
|
const tokenStateChanges = new Set();
|
|
55
60
|
let diffSize = CitreaSpvVaultContract.StateDiffSize.BASE_DIFF_SIZE;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { EVMSwapContract } from "../../evm/swaps/EVMSwapContract";
|
|
2
2
|
import { EVMSwapData } from "../../evm/swaps/EVMSwapData";
|
|
3
|
+
/**
|
|
4
|
+
* Citrea swap contract wrapper with fee estimation adjusted by expected state-diff size.
|
|
5
|
+
*
|
|
6
|
+
* @category Networks/Citrea
|
|
7
|
+
*/
|
|
3
8
|
export declare class CitreaSwapContract extends EVMSwapContract<"CITREA"> {
|
|
4
9
|
static readonly StateDiffSize: {
|
|
5
10
|
BASE_DIFF_SIZE: number;
|
|
@@ -11,12 +16,12 @@ export declare class CitreaSwapContract extends EVMSwapContract<"CITREA"> {
|
|
|
11
16
|
};
|
|
12
17
|
private calculateStateDiff;
|
|
13
18
|
/**
|
|
14
|
-
*
|
|
19
|
+
* Returns estimated fee of the commit transaction, including Citrea state-diff overhead.
|
|
15
20
|
*/
|
|
16
21
|
getCommitFee(signer: string, swapData: EVMSwapData, feeRate?: string): Promise<bigint>;
|
|
17
22
|
getClaimFee(signer: string, swapData: EVMSwapData, feeRate?: string): Promise<bigint>;
|
|
18
23
|
/**
|
|
19
|
-
*
|
|
24
|
+
* Returns estimated fee of the refund transaction, including Citrea state-diff overhead.
|
|
20
25
|
*/
|
|
21
26
|
getRefundFee(signer: string, swapData: EVMSwapData, feeRate?: string): Promise<bigint>;
|
|
22
27
|
}
|
|
@@ -3,6 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CitreaSwapContract = void 0;
|
|
4
4
|
const EVMSwapContract_1 = require("../../evm/swaps/EVMSwapContract");
|
|
5
5
|
const CitreaFees_1 = require("./CitreaFees");
|
|
6
|
+
/**
|
|
7
|
+
* Citrea swap contract wrapper with fee estimation adjusted by expected state-diff size.
|
|
8
|
+
*
|
|
9
|
+
* @category Networks/Citrea
|
|
10
|
+
*/
|
|
6
11
|
class CitreaSwapContract extends EVMSwapContract_1.EVMSwapContract {
|
|
7
12
|
calculateStateDiff(signer, tokenStateChanges) {
|
|
8
13
|
let stateDiffSize = 0;
|
|
@@ -18,7 +23,7 @@ class CitreaSwapContract extends EVMSwapContract_1.EVMSwapContract {
|
|
|
18
23
|
return stateDiffSize;
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
21
|
-
*
|
|
26
|
+
* Returns estimated fee of the commit transaction, including Citrea state-diff overhead.
|
|
22
27
|
*/
|
|
23
28
|
async getCommitFee(signer, swapData, feeRate) {
|
|
24
29
|
feeRate ?? (feeRate = await this.Chain.Fees.getFeeRate());
|
|
@@ -34,7 +39,7 @@ class CitreaSwapContract extends EVMSwapContract_1.EVMSwapContract {
|
|
|
34
39
|
tokenStateChanges.add(signer.toLowerCase() + ":" + swapData.getDepositToken().toLowerCase());
|
|
35
40
|
}
|
|
36
41
|
diffSize += this.calculateStateDiff(signer, tokenStateChanges);
|
|
37
|
-
const gasFee = await this.
|
|
42
|
+
const gasFee = await this._Init.getInitFee(swapData, feeRate);
|
|
38
43
|
return gasFee + CitreaFees_1.CitreaFees.getGasFee(0, feeRate, diffSize);
|
|
39
44
|
}
|
|
40
45
|
async getClaimFee(signer, swapData, feeRate) {
|
|
@@ -56,11 +61,11 @@ class CitreaSwapContract extends EVMSwapContract_1.EVMSwapContract {
|
|
|
56
61
|
tokenStateChanges.add(swapData.getClaimer().toLowerCase() + ":" + swapData.getDepositToken().toLowerCase());
|
|
57
62
|
}
|
|
58
63
|
diffSize += this.calculateStateDiff(signer, tokenStateChanges);
|
|
59
|
-
const gasFee = await this.
|
|
64
|
+
const gasFee = await this._Claim.getClaimFee(swapData, feeRate);
|
|
60
65
|
return gasFee + CitreaFees_1.CitreaFees.getGasFee(0, feeRate, diffSize);
|
|
61
66
|
}
|
|
62
67
|
/**
|
|
63
|
-
*
|
|
68
|
+
* Returns estimated fee of the refund transaction, including Citrea state-diff overhead.
|
|
64
69
|
*/
|
|
65
70
|
async getRefundFee(signer, swapData, feeRate) {
|
|
66
71
|
feeRate ?? (feeRate = await this.Chain.Fees.getFeeRate());
|
|
@@ -81,7 +86,7 @@ class CitreaSwapContract extends EVMSwapContract_1.EVMSwapContract {
|
|
|
81
86
|
tokenStateChanges.add(swapData.getClaimer().toLowerCase() + ":" + swapData.getDepositToken().toLowerCase());
|
|
82
87
|
}
|
|
83
88
|
diffSize += this.calculateStateDiff(signer, tokenStateChanges);
|
|
84
|
-
const gasFee = await this.
|
|
89
|
+
const gasFee = await this._Refund.getRefundFee(swapData, feeRate);
|
|
85
90
|
return gasFee + CitreaFees_1.CitreaFees.getGasFee(0, feeRate, diffSize);
|
|
86
91
|
}
|
|
87
92
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { EVMTokens } from "../../evm/chain/modules/EVMTokens";
|
|
2
|
+
/**
|
|
3
|
+
* Citrea-specific token module that augments fee estimation with state-diff costs.
|
|
4
|
+
*
|
|
5
|
+
* @category Networks/Citrea
|
|
6
|
+
*/
|
|
2
7
|
export declare class CitreaTokens extends EVMTokens {
|
|
3
8
|
static readonly StateDiffSize: {
|
|
4
9
|
APPROVE_DIFF_SIZE: number;
|
|
@@ -3,6 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CitreaTokens = void 0;
|
|
4
4
|
const EVMTokens_1 = require("../../evm/chain/modules/EVMTokens");
|
|
5
5
|
const CitreaFees_1 = require("./CitreaFees");
|
|
6
|
+
/**
|
|
7
|
+
* Citrea-specific token module that augments fee estimation with state-diff costs.
|
|
8
|
+
*
|
|
9
|
+
* @category Networks/Citrea
|
|
10
|
+
*/
|
|
6
11
|
class CitreaTokens extends EVMTokens_1.EVMTokens {
|
|
7
12
|
async getApproveFee(feeRate) {
|
|
8
13
|
feeRate ?? (feeRate = await this.root.Fees.getFeeRate());
|
|
@@ -1,43 +1,16 @@
|
|
|
1
|
-
import { BaseTokenType, BitcoinNetwork, BitcoinRpc, ChainData, ChainInitializer
|
|
2
|
-
import { JsonRpcApiProvider } from "ethers";
|
|
3
|
-
import { EVMConfiguration, EVMRetryPolicy } from "../../evm/chain/EVMChainInterface";
|
|
4
|
-
import { EVMFees } from "../../evm/chain/modules/EVMFees";
|
|
1
|
+
import { BaseTokenType, BitcoinNetwork, BitcoinRpc, ChainData, ChainInitializer } from "@atomiqlabs/base";
|
|
5
2
|
import { GoatChainType } from "./GoatChainType";
|
|
3
|
+
import { EVMOptions } from "../EVMOptions";
|
|
6
4
|
/**
|
|
7
5
|
* Token assets available on GOAT Network
|
|
8
6
|
* @category Networks/GOAT
|
|
9
7
|
*/
|
|
10
8
|
export type GoatAssetsType = BaseTokenType<"BTC" | "PBTC" | "_PBTC_DEV">;
|
|
11
|
-
/**
|
|
12
|
-
* Default GOAT Network token assets configuration
|
|
13
|
-
* @category Networks/GOAT
|
|
14
|
-
*/
|
|
15
|
-
export declare const GoatAssets: GoatAssetsType;
|
|
16
9
|
/**
|
|
17
10
|
* Configuration options for initializing GOAT Network chain
|
|
18
11
|
* @category Networks/GOAT
|
|
19
12
|
*/
|
|
20
|
-
export type GoatOptions =
|
|
21
|
-
rpcUrl: string | JsonRpcApiProvider;
|
|
22
|
-
retryPolicy?: EVMRetryPolicy;
|
|
23
|
-
chainType?: "MAINNET" | "TESTNET" | "TESTNET4";
|
|
24
|
-
swapContract?: string;
|
|
25
|
-
swapContractDeploymentHeight?: number;
|
|
26
|
-
btcRelayContract?: string;
|
|
27
|
-
btcRelayDeploymentHeight?: number;
|
|
28
|
-
spvVaultContract?: string;
|
|
29
|
-
spvVaultDeploymentHeight?: number;
|
|
30
|
-
handlerContracts?: {
|
|
31
|
-
refund?: {
|
|
32
|
-
timelock?: string;
|
|
33
|
-
};
|
|
34
|
-
claim?: {
|
|
35
|
-
[type in ChainSwapType]?: string;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
fees?: EVMFees;
|
|
39
|
-
evmConfig?: Partial<Omit<EVMConfiguration, "safeBlockTag" | "finalizedBlockTag" | "finalityCheckStrategy">>;
|
|
40
|
-
};
|
|
13
|
+
export type GoatOptions = EVMOptions<"MAINNET" | "TESTNET" | "TESTNET4">;
|
|
41
14
|
/**
|
|
42
15
|
* Initialize GOAT Network chain integration
|
|
43
16
|
* @category Networks/GOAT
|