@atomiqlabs/chain-starknet 4.0.0-dev.37 → 4.0.0-dev.39
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/starknet/chain/modules/StarknetTransactions.js +2 -1
- package/dist/starknet/spv_swap/StarknetSpvVaultContract.d.ts +1 -1
- package/dist/starknet/spv_swap/StarknetSpvVaultContract.js +2 -2
- package/package.json +2 -2
- package/src/starknet/chain/modules/StarknetTransactions.ts +2 -1
- package/src/starknet/spv_swap/StarknetSpvVaultContract.ts +3 -3
|
@@ -4,6 +4,7 @@ exports.StarknetTransactions = exports.isStarknetTxDeployAccount = exports.isSta
|
|
|
4
4
|
const StarknetModule_1 = require("../StarknetModule");
|
|
5
5
|
const starknet_1 = require("starknet");
|
|
6
6
|
const Utils_1 = require("../../../utils/Utils");
|
|
7
|
+
const base_1 = require("@atomiqlabs/base");
|
|
7
8
|
function isStarknetTxInvoke(obj) {
|
|
8
9
|
return typeof (obj) === "object" &&
|
|
9
10
|
typeof (obj.details) === "object" &&
|
|
@@ -124,7 +125,7 @@ class StarknetTransactions extends StarknetModule_1.StarknetModule {
|
|
|
124
125
|
this.latestConfirmedNonces[(0, Utils_1.toHex)(tx.details.walletAddress)] = nextAccountNonce;
|
|
125
126
|
}
|
|
126
127
|
if (state === "reverted")
|
|
127
|
-
throw new
|
|
128
|
+
throw new base_1.TransactionRevertedError("Transaction reverted!");
|
|
128
129
|
return confirmedTxId;
|
|
129
130
|
}
|
|
130
131
|
/**
|
|
@@ -55,7 +55,7 @@ export declare class StarknetSpvVaultContract extends StarknetContractBase<typeo
|
|
|
55
55
|
private parseWithdrawalEvent;
|
|
56
56
|
getWithdrawalStates(withdrawalTxs: {
|
|
57
57
|
withdrawal: StarknetSpvWithdrawalData;
|
|
58
|
-
|
|
58
|
+
scStartBlockheight?: number;
|
|
59
59
|
}[]): Promise<{
|
|
60
60
|
[btcTxId: string]: SpvWithdrawalState;
|
|
61
61
|
}>;
|
|
@@ -236,11 +236,11 @@ class StarknetSpvVaultContract extends StarknetContractBase_1.StarknetContractBa
|
|
|
236
236
|
lows.push((0, Utils_1.toHex)(txHashU256.low));
|
|
237
237
|
highs.push((0, Utils_1.toHex)(txHashU256.high));
|
|
238
238
|
if (startHeight !== null) {
|
|
239
|
-
if (withdrawalTx.
|
|
239
|
+
if (withdrawalTx.scStartBlockheight == null) {
|
|
240
240
|
startHeight = null;
|
|
241
241
|
}
|
|
242
242
|
else {
|
|
243
|
-
startHeight = Math.min(startHeight ?? Infinity, withdrawalTx.
|
|
243
|
+
startHeight = Math.min(startHeight ?? Infinity, withdrawalTx.scStartBlockheight);
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomiqlabs/chain-starknet",
|
|
3
|
-
"version": "4.0.0-dev.
|
|
3
|
+
"version": "4.0.0-dev.39",
|
|
4
4
|
"description": "Starknet specific base implementation",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"url": "git+https://github.com/atomiqlabs/atomiq-chain-starknet.git"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@atomiqlabs/base": "^10.0.0-dev.
|
|
31
|
+
"@atomiqlabs/base": "^10.0.0-dev.21",
|
|
32
32
|
"@noble/hashes": "^1.7.1",
|
|
33
33
|
"@scure/btc-signer": "^1.6.0",
|
|
34
34
|
"abi-wan-kanabi": "2.2.4",
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from "starknet";
|
|
10
10
|
import {StarknetSigner} from "../../wallet/StarknetSigner";
|
|
11
11
|
import {timeoutPromise, toHex} from "../../../utils/Utils";
|
|
12
|
+
import {TransactionRevertedError} from "@atomiqlabs/base";
|
|
12
13
|
|
|
13
14
|
export type StarknetTxBase = {
|
|
14
15
|
details: InvocationsSignerDetails & {maxFee?: BigNumberish},
|
|
@@ -155,7 +156,7 @@ export class StarknetTransactions extends StarknetModule {
|
|
|
155
156
|
if(currentConfirmedNonce==null || nextAccountNonce > currentConfirmedNonce) {
|
|
156
157
|
this.latestConfirmedNonces[toHex(tx.details.walletAddress)] = nextAccountNonce;
|
|
157
158
|
}
|
|
158
|
-
if(state==="reverted") throw new
|
|
159
|
+
if(state==="reverted") throw new TransactionRevertedError("Transaction reverted!");
|
|
159
160
|
|
|
160
161
|
return confirmedTxId;
|
|
161
162
|
}
|
|
@@ -297,7 +297,7 @@ export class StarknetSpvVaultContract
|
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
-
async getWithdrawalStates(withdrawalTxs: {withdrawal: StarknetSpvWithdrawalData,
|
|
300
|
+
async getWithdrawalStates(withdrawalTxs: {withdrawal: StarknetSpvWithdrawalData, scStartBlockheight?: number}[]): Promise<{[btcTxId: string]: SpvWithdrawalState}> {
|
|
301
301
|
const result: {[btcTxId: string]: SpvWithdrawalState} = {};
|
|
302
302
|
withdrawalTxs.forEach(withdrawalTx => {
|
|
303
303
|
result[withdrawalTx.withdrawal.getTxId()] = {
|
|
@@ -319,10 +319,10 @@ export class StarknetSpvVaultContract
|
|
|
319
319
|
lows.push(toHex(txHashU256.low));
|
|
320
320
|
highs.push(toHex(txHashU256.high));
|
|
321
321
|
if(startHeight!==null) {
|
|
322
|
-
if(withdrawalTx.
|
|
322
|
+
if(withdrawalTx.scStartBlockheight==null) {
|
|
323
323
|
startHeight = null;
|
|
324
324
|
} else {
|
|
325
|
-
startHeight = Math.min(startHeight ?? Infinity, withdrawalTx.
|
|
325
|
+
startHeight = Math.min(startHeight ?? Infinity, withdrawalTx.scStartBlockheight);
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
});
|