@atomiqlabs/base 10.0.0-dev.17 → 10.0.0-dev.19

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.
@@ -30,6 +30,12 @@ export interface ChainInterface<TX = any, Signer extends AbstractSigner = Abstra
30
30
  * @param lenient Whether a lenient parsing should be used (i.e. don't strictly enforce the Starknet address lengths)
31
31
  */
32
32
  isValidAddress(address: string, lenient?: boolean): boolean;
33
+ /**
34
+ * Normalizes a given address i.e. pads it to the specific size
35
+ *
36
+ * @param address
37
+ */
38
+ normalizeAddress(address: string): string;
33
39
  /**
34
40
  * Checks if a given string is a valid token identifier
35
41
  *
@@ -80,6 +86,14 @@ export interface ChainInterface<TX = any, Signer extends AbstractSigner = Abstra
80
86
  * @param txId Transaction ID
81
87
  */
82
88
  getTxIdStatus(txId: string): Promise<"not_found" | "pending" | "success" | "reverted">;
89
+ /**
90
+ * Returns the latest known finalized block data (this is a block with 100% certainty of not getting re-org, i.e.
91
+ * a block already committed on L1)
92
+ */
93
+ getFinalizedBlock(): Promise<{
94
+ height: number;
95
+ blockHash: string;
96
+ }>;
83
97
  /**
84
98
  * Signs, sends a batch of transaction and optionally waits for their confirmation
85
99
  *
@@ -169,17 +169,21 @@ export interface SpvVaultContract<TX = any, Signer extends AbstractSigner = Abst
169
169
  */
170
170
  getAllVaults(owner?: string): Promise<Data[]>;
171
171
  /**
172
- * Returns current state of the withdrawal as specified by the bitcoin transaction ID
172
+ * Returns current state of the withdrawal as specified by the bitcoin transaction ID, optionally
173
+ * only check withdrawals from the provided block height
173
174
  *
174
175
  * @param btcTxId
176
+ * @param scStartBlockheight
175
177
  */
176
- getWithdrawalState(btcTxId: string): Promise<SpvWithdrawalState>;
178
+ getWithdrawalState(btcTxId: string, scStartBlockheight?: number): Promise<SpvWithdrawalState>;
177
179
  /**
178
- * Returns current state of the withdrawals as specified by the bitcoin transaction IDs
180
+ * Returns current state of the withdrawals as specified by the bitcoin transaction IDs, optionally
181
+ * only check withdrawals from the provided block height
179
182
  *
180
183
  * @param btcTxIds
184
+ * @param scStartBlockheight
181
185
  */
182
- getWithdrawalStates(btcTxIds: string[]): Promise<{
186
+ getWithdrawalStates(btcTxIds: string[], scStartBlockheight?: number): Promise<{
183
187
  [btcTxId: string]: SpvWithdrawalState;
184
188
  }>;
185
189
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlabs/base",
3
- "version": "10.0.0-dev.17",
3
+ "version": "10.0.0-dev.19",
4
4
  "description": "Base classes and interfaces for atomiq protocol",
5
5
  "main": "./dist/index.js",
6
6
  "types:": "./dist/index.d.ts",
@@ -45,6 +45,13 @@ export interface ChainInterface<
45
45
  */
46
46
  isValidAddress(address: string, lenient?: boolean): boolean;
47
47
 
48
+ /**
49
+ * Normalizes a given address i.e. pads it to the specific size
50
+ *
51
+ * @param address
52
+ */
53
+ normalizeAddress(address: string): string;
54
+
48
55
  /**
49
56
  * Checks if a given string is a valid token identifier
50
57
  *
@@ -102,6 +109,12 @@ export interface ChainInterface<
102
109
  */
103
110
  getTxIdStatus(txId: string): Promise<"not_found" | "pending" | "success" | "reverted">;
104
111
 
112
+ /**
113
+ * Returns the latest known finalized block data (this is a block with 100% certainty of not getting re-org, i.e.
114
+ * a block already committed on L1)
115
+ */
116
+ getFinalizedBlock(): Promise<{height: number, blockHash: string}>;
117
+
105
118
  /**
106
119
  * Signs, sends a batch of transaction and optionally waits for their confirmation
107
120
  *
@@ -180,18 +180,22 @@ export interface SpvVaultContract<
180
180
  getAllVaults(owner?: string): Promise<Data[]>;
181
181
 
182
182
  /**
183
- * Returns current state of the withdrawal as specified by the bitcoin transaction ID
183
+ * Returns current state of the withdrawal as specified by the bitcoin transaction ID, optionally
184
+ * only check withdrawals from the provided block height
184
185
  *
185
186
  * @param btcTxId
187
+ * @param scStartBlockheight
186
188
  */
187
- getWithdrawalState(btcTxId: string): Promise<SpvWithdrawalState>;
189
+ getWithdrawalState(btcTxId: string, scStartBlockheight?: number): Promise<SpvWithdrawalState>;
188
190
 
189
191
  /**
190
- * Returns current state of the withdrawals as specified by the bitcoin transaction IDs
192
+ * Returns current state of the withdrawals as specified by the bitcoin transaction IDs, optionally
193
+ * only check withdrawals from the provided block height
191
194
  *
192
195
  * @param btcTxIds
196
+ * @param scStartBlockheight
193
197
  */
194
- getWithdrawalStates(btcTxIds: string[]): Promise<{[btcTxId: string]: SpvWithdrawalState}>;
198
+ getWithdrawalStates(btcTxIds: string[], scStartBlockheight?: number): Promise<{[btcTxId: string]: SpvWithdrawalState}>;
195
199
 
196
200
  /**
197
201
  * Parses withdrawal data from the parsed bitcoin transaction