@atomiqlabs/chain-evm 1.0.0-dev.101 → 1.0.0-dev.103

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.
@@ -4,6 +4,7 @@ exports.EVMTransactions = void 0;
4
4
  const EVMModule_1 = require("../EVMModule");
5
5
  const ethers_1 = require("ethers");
6
6
  const Utils_1 = require("../../../utils/Utils");
7
+ const base_1 = require("@atomiqlabs/base");
7
8
  const MAX_UNCONFIRMED_TXNS = 10;
8
9
  class EVMTransactions extends EVMModule_1.EVMModule {
9
10
  constructor() {
@@ -68,7 +69,7 @@ class EVMTransactions extends EVMModule_1.EVMModule {
68
69
  this.latestConfirmedNonces[tx.from] = nextAccountNonce;
69
70
  }
70
71
  if (state === "reverted")
71
- throw new Error("Transaction reverted!");
72
+ throw new base_1.TransactionRevertedError("Transaction reverted!");
72
73
  return confirmedTxId;
73
74
  }
74
75
  /**
@@ -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
- scStartHeight?: number;
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.scStartHeight == null) {
306
+ if (val.scStartBlockheight == null) {
307
307
  scStartHeight = null;
308
308
  break;
309
309
  }
310
- scStartHeight = Math.min(scStartHeight ?? Infinity, val.scStartHeight);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlabs/chain-evm",
3
- "version": "1.0.0-dev.101",
3
+ "version": "1.0.0-dev.103",
4
4
  "description": "EVM specific base implementation",
5
5
  "main": "./dist/index.js",
6
6
  "types:": "./dist/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  "author": "adambor",
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@atomiqlabs/base": "^10.0.0-dev.20",
26
+ "@atomiqlabs/base": "^10.0.0-dev.21",
27
27
  "@noble/hashes": "^1.8.0",
28
28
  "@scure/btc-signer": "^1.6.0",
29
29
  "buffer": "6.0.3",
@@ -2,6 +2,7 @@ import {EVMModule} from "../EVMModule";
2
2
  import {Transaction, TransactionRequest, TransactionResponse} from "ethers";
3
3
  import {timeoutPromise} from "../../../utils/Utils";
4
4
  import {EVMSigner} from "../../wallet/EVMSigner";
5
+ import {TransactionRevertedError} from "@atomiqlabs/base";
5
6
 
6
7
  export type EVMTx = TransactionRequest;
7
8
 
@@ -87,7 +88,7 @@ export class EVMTransactions extends EVMModule<any> {
87
88
  if(currentConfirmedNonce==null || nextAccountNonce > currentConfirmedNonce) {
88
89
  this.latestConfirmedNonces[tx.from] = nextAccountNonce;
89
90
  }
90
- if(state==="reverted") throw new Error("Transaction reverted!");
91
+ if(state==="reverted") throw new TransactionRevertedError("Transaction reverted!");
91
92
 
92
93
  return confirmedTxId;
93
94
  }
@@ -408,7 +408,7 @@ export class EVMSpvVaultContract<ChainId extends string>
408
408
  return result;
409
409
  }
410
410
 
411
- async getWithdrawalStates(withdrawalTxs: {withdrawal: EVMSpvWithdrawalData, scStartHeight?: number}[]): Promise<{[btcTxId: string]: SpvWithdrawalState}> {
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.scStartHeight==null) {
422
+ if(val.scStartBlockheight==null) {
423
423
  scStartHeight = null;
424
424
  break;
425
425
  }
426
- scStartHeight = Math.min(scStartHeight ?? Infinity, val.scStartHeight);
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()))];