@atomiqlabs/chain-evm 1.0.0-dev.100 → 1.0.0-dev.102
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/dist/chains/botanix/BotanixInitializer.js +1 -0
- package/dist/chains/citrea/CitreaInitializer.js +1 -0
- package/dist/evm/chain/EVMChainInterface.d.ts +1 -0
- package/dist/evm/chain/EVMChainInterface.js +3 -2
- package/dist/evm/spv_swap/EVMSpvVaultContract.d.ts +1 -1
- package/dist/evm/spv_swap/EVMSpvVaultContract.js +2 -2
- package/package.json +1 -1
- package/src/chains/botanix/BotanixInitializer.ts +1 -0
- package/src/chains/citrea/CitreaInitializer.ts +1 -0
- package/src/evm/chain/EVMChainInterface.ts +3 -1
- package/src/evm/spv_swap/EVMSpvVaultContract.ts +3 -3
|
@@ -84,6 +84,7 @@ function initializeBotanix(options, bitcoinRpc, network) {
|
|
|
84
84
|
const Fees = options.fees ?? new EVMFees_1.EVMFees(provider, 2n * 1000000000n, 1000000n);
|
|
85
85
|
const chainInterface = new EVMChainInterface_1.EVMChainInterface("BOTANIX", chainId, provider, {
|
|
86
86
|
safeBlockTag: "finalized",
|
|
87
|
+
finalizedBlockTag: "finalized",
|
|
87
88
|
maxLogsBlockRange: options?.evmConfig?.maxLogsBlockRange ?? 950,
|
|
88
89
|
maxLogTopics: options?.evmConfig?.maxLogTopics ?? 64,
|
|
89
90
|
maxParallelLogRequests: options?.evmConfig?.maxParallelLogRequests ?? 5,
|
|
@@ -90,6 +90,7 @@ function initializeCitrea(options, bitcoinRpc, network) {
|
|
|
90
90
|
const Fees = options.fees ?? new CitreaFees_1.CitreaFees(provider, 2n * 1000000000n, 1000000n);
|
|
91
91
|
const chainInterface = new EVMChainInterface_1.EVMChainInterface("CITREA", chainId, provider, {
|
|
92
92
|
safeBlockTag: "latest",
|
|
93
|
+
finalizedBlockTag: "safe",
|
|
93
94
|
maxLogsBlockRange: options?.evmConfig?.maxLogsBlockRange ?? 950,
|
|
94
95
|
maxLogTopics: options?.evmConfig?.maxLogTopics ?? 64,
|
|
95
96
|
maxParallelLogRequests: options?.evmConfig?.maxParallelLogRequests ?? 5,
|
|
@@ -14,13 +14,14 @@ const EVMSigner_1 = require("../wallet/EVMSigner");
|
|
|
14
14
|
const EVMBrowserSigner_1 = require("../wallet/EVMBrowserSigner");
|
|
15
15
|
class EVMChainInterface {
|
|
16
16
|
constructor(chainId, evmChainId, provider, config, retryPolicy, evmFeeEstimator = new EVMFees_1.EVMFees(provider)) {
|
|
17
|
-
var _a;
|
|
17
|
+
var _a, _b;
|
|
18
18
|
this.chainId = chainId;
|
|
19
19
|
this.evmChainId = evmChainId;
|
|
20
20
|
this.provider = provider;
|
|
21
21
|
this.retryPolicy = retryPolicy;
|
|
22
22
|
this.config = config;
|
|
23
23
|
(_a = this.config).safeBlockTag ?? (_a.safeBlockTag = "safe");
|
|
24
|
+
(_b = this.config).finalizedBlockTag ?? (_b.finalizedBlockTag = "finalized");
|
|
24
25
|
this.logger = (0, Utils_1.getLogger)("EVMChainInterface(" + this.evmChainId + "): ");
|
|
25
26
|
this.Fees = evmFeeEstimator;
|
|
26
27
|
this.Tokens = new EVMTokens_1.EVMTokens(this);
|
|
@@ -82,7 +83,7 @@ class EVMChainInterface {
|
|
|
82
83
|
return this.Transactions.getTxStatus(tx);
|
|
83
84
|
}
|
|
84
85
|
async getFinalizedBlock() {
|
|
85
|
-
const block = await this.Blocks.getBlock(
|
|
86
|
+
const block = await this.Blocks.getBlock(this.config.finalizedBlockTag);
|
|
86
87
|
return {
|
|
87
88
|
height: block.number,
|
|
88
89
|
blockHash: block.hash
|
|
@@ -72,7 +72,7 @@ export declare class EVMSpvVaultContract<ChainId extends string> extends EVMCont
|
|
|
72
72
|
getWithdrawalState(withdrawalTx: EVMSpvWithdrawalData, scStartHeight?: number): Promise<SpvWithdrawalState>;
|
|
73
73
|
getWithdrawalStates(withdrawalTxs: {
|
|
74
74
|
withdrawal: EVMSpvWithdrawalData;
|
|
75
|
-
|
|
75
|
+
scStartBlockheight?: number;
|
|
76
76
|
}[]): Promise<{
|
|
77
77
|
[btcTxId: string]: SpvWithdrawalState;
|
|
78
78
|
}>;
|
|
@@ -303,11 +303,11 @@ class EVMSpvVaultContract extends EVMContractBase_1.EVMContractBase {
|
|
|
303
303
|
const checkWithdrawalTxsMap = new Map(checkWithdrawalTxs.map(val => [val.withdrawal.getTxId(), val.withdrawal]));
|
|
304
304
|
let scStartHeight = null;
|
|
305
305
|
for (let val of checkWithdrawalTxs) {
|
|
306
|
-
if (val.
|
|
306
|
+
if (val.scStartBlockheight == null) {
|
|
307
307
|
scStartHeight = null;
|
|
308
308
|
break;
|
|
309
309
|
}
|
|
310
|
-
scStartHeight = Math.min(scStartHeight ?? Infinity, val.
|
|
310
|
+
scStartHeight = Math.min(scStartHeight ?? Infinity, val.scStartBlockheight);
|
|
311
311
|
}
|
|
312
312
|
const keys = [null, null, checkWithdrawalTxs.map(withdrawal => (0, ethers_1.hexlify)(buffer_1.Buffer.from(withdrawal.withdrawal.getTxId(), "hex").reverse()))];
|
|
313
313
|
if (scStartHeight == null) {
|
package/package.json
CHANGED
|
@@ -121,6 +121,7 @@ export function initializeBotanix(
|
|
|
121
121
|
|
|
122
122
|
const chainInterface = new EVMChainInterface("BOTANIX", chainId, provider, {
|
|
123
123
|
safeBlockTag: "finalized",
|
|
124
|
+
finalizedBlockTag: "finalized",
|
|
124
125
|
maxLogsBlockRange: options?.evmConfig?.maxLogsBlockRange ?? 950,
|
|
125
126
|
maxLogTopics: options?.evmConfig?.maxLogTopics ?? 64,
|
|
126
127
|
maxParallelLogRequests: options?.evmConfig?.maxParallelLogRequests ?? 5,
|
|
@@ -127,6 +127,7 @@ export function initializeCitrea(
|
|
|
127
127
|
|
|
128
128
|
const chainInterface = new EVMChainInterface("CITREA", chainId, provider, {
|
|
129
129
|
safeBlockTag: "latest",
|
|
130
|
+
finalizedBlockTag: "safe",
|
|
130
131
|
maxLogsBlockRange: options?.evmConfig?.maxLogsBlockRange ?? 950,
|
|
131
132
|
maxLogTopics: options?.evmConfig?.maxLogTopics ?? 64,
|
|
132
133
|
maxParallelLogRequests: options?.evmConfig?.maxParallelLogRequests ?? 5,
|
|
@@ -28,6 +28,7 @@ export type EVMRetryPolicy = {
|
|
|
28
28
|
|
|
29
29
|
export type EVMConfiguration = {
|
|
30
30
|
safeBlockTag: EVMBlockTag,
|
|
31
|
+
finalizedBlockTag: EVMBlockTag,
|
|
31
32
|
maxLogsBlockRange: number,
|
|
32
33
|
maxParallelLogRequests: number,
|
|
33
34
|
maxParallelCalls: number,
|
|
@@ -68,6 +69,7 @@ export class EVMChainInterface<ChainId extends string = string> implements Chain
|
|
|
68
69
|
this.retryPolicy = retryPolicy;
|
|
69
70
|
this.config = config;
|
|
70
71
|
this.config.safeBlockTag ??= "safe";
|
|
72
|
+
this.config.finalizedBlockTag ??= "finalized";
|
|
71
73
|
|
|
72
74
|
this.logger = getLogger("EVMChainInterface("+this.evmChainId+"): ");
|
|
73
75
|
|
|
@@ -155,7 +157,7 @@ export class EVMChainInterface<ChainId extends string = string> implements Chain
|
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
async getFinalizedBlock(): Promise<{ height: number; blockHash: string }> {
|
|
158
|
-
const block = await this.Blocks.getBlock(
|
|
160
|
+
const block = await this.Blocks.getBlock(this.config.finalizedBlockTag);
|
|
159
161
|
return {
|
|
160
162
|
height: block.number,
|
|
161
163
|
blockHash: block.hash
|
|
@@ -408,7 +408,7 @@ export class EVMSpvVaultContract<ChainId extends string>
|
|
|
408
408
|
return result;
|
|
409
409
|
}
|
|
410
410
|
|
|
411
|
-
async getWithdrawalStates(withdrawalTxs: {withdrawal: EVMSpvWithdrawalData,
|
|
411
|
+
async getWithdrawalStates(withdrawalTxs: {withdrawal: EVMSpvWithdrawalData, scStartBlockheight?: number}[]): Promise<{[btcTxId: string]: SpvWithdrawalState}> {
|
|
412
412
|
const result: {[btcTxId: string]: SpvWithdrawalState} = {};
|
|
413
413
|
|
|
414
414
|
const events: ["Fronted", "Claimed", "Closed"] = ["Fronted", "Claimed", "Closed"];
|
|
@@ -419,11 +419,11 @@ export class EVMSpvVaultContract<ChainId extends string>
|
|
|
419
419
|
|
|
420
420
|
let scStartHeight = null;
|
|
421
421
|
for(let val of checkWithdrawalTxs) {
|
|
422
|
-
if(val.
|
|
422
|
+
if(val.scStartBlockheight==null) {
|
|
423
423
|
scStartHeight = null;
|
|
424
424
|
break;
|
|
425
425
|
}
|
|
426
|
-
scStartHeight = Math.min(scStartHeight ?? Infinity, val.
|
|
426
|
+
scStartHeight = Math.min(scStartHeight ?? Infinity, val.scStartBlockheight);
|
|
427
427
|
}
|
|
428
428
|
|
|
429
429
|
const keys = [null, null, checkWithdrawalTxs.map(withdrawal => hexlify(Buffer.from(withdrawal.withdrawal.getTxId(), "hex").reverse()))];
|