@atomiqlabs/chain-starknet 2.0.0-beta.9 → 2.0.1
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.
|
@@ -33,7 +33,7 @@ function initializeStarknet(options, bitcoinRpc, network) {
|
|
|
33
33
|
const provider = typeof (options.rpcUrl) === "string" ?
|
|
34
34
|
new RpcProviderWithRetries_1.RpcProviderWithRetries({ nodeUrl: options.rpcUrl }) :
|
|
35
35
|
options.rpcUrl;
|
|
36
|
-
const Fees = options.fees ?? new StarknetFees_1.StarknetFees(provider, "
|
|
36
|
+
const Fees = options.fees ?? new StarknetFees_1.StarknetFees(provider, "STRK");
|
|
37
37
|
const chainId = options.chainId ??
|
|
38
38
|
(network === base_1.BitcoinNetwork.MAINNET ? starknet_1.constants.StarknetChainId.SN_MAIN : starknet_1.constants.StarknetChainId.SN_SEPOLIA);
|
|
39
39
|
const chainInterface = new StarknetChainInterface_1.StarknetChainInterface(chainId, provider, options.retryPolicy, Fees);
|
|
@@ -28,12 +28,12 @@ class StarknetTransactions extends StarknetModule_1.StarknetModule {
|
|
|
28
28
|
console.error("Error on transaction re-send: ", e);
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
if (state
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
if (state === "rejected")
|
|
32
|
+
throw new Error("Transaction rejected!");
|
|
33
|
+
const nextAccountNonce = (0, Utils_1.toBigInt)(tx.details.nonce) + 1n;
|
|
34
|
+
const currentNonce = this.latestConfirmedNonces[tx.details.walletAddress];
|
|
35
|
+
if (currentNonce == null || nextAccountNonce > currentNonce) {
|
|
36
|
+
this.latestConfirmedNonces[tx.details.walletAddress] = nextAccountNonce;
|
|
37
37
|
}
|
|
38
38
|
if (state === "reverted")
|
|
39
39
|
throw new Error("Transaction reverted!");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomiqlabs/chain-starknet",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Starknet specific base implementation",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types:": "./dist/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"author": "adambor",
|
|
23
23
|
"license": "ISC",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@atomiqlabs/base": "^9.0.0
|
|
25
|
+
"@atomiqlabs/base": "^9.0.0",
|
|
26
26
|
"@noble/hashes": "^1.7.1",
|
|
27
27
|
"@scure/btc-signer": "1.6.0",
|
|
28
28
|
"abi-wan-kanabi": "2.2.4",
|
|
@@ -51,7 +51,7 @@ export function initializeStarknet(
|
|
|
51
51
|
new RpcProviderWithRetries({nodeUrl: options.rpcUrl}) :
|
|
52
52
|
options.rpcUrl;
|
|
53
53
|
|
|
54
|
-
const Fees = options.fees ?? new StarknetFees(provider, "
|
|
54
|
+
const Fees = options.fees ?? new StarknetFees(provider, "STRK");
|
|
55
55
|
|
|
56
56
|
const chainId = options.chainId ??
|
|
57
57
|
(network===BitcoinNetwork.MAINNET ? constants.StarknetChainId.SN_MAIN : constants.StarknetChainId.SN_SEPOLIA);
|
|
@@ -45,12 +45,11 @@ export class StarknetTransactions extends StarknetModule {
|
|
|
45
45
|
console.error("Error on transaction re-send: ", e);
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
if(state
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
48
|
+
if(state==="rejected") throw new Error("Transaction rejected!");
|
|
49
|
+
const nextAccountNonce = toBigInt(tx.details.nonce) + 1n;
|
|
50
|
+
const currentNonce = this.latestConfirmedNonces[tx.details.walletAddress];
|
|
51
|
+
if(currentNonce==null || nextAccountNonce > currentNonce) {
|
|
52
|
+
this.latestConfirmedNonces[tx.details.walletAddress] = nextAccountNonce;
|
|
54
53
|
}
|
|
55
54
|
if(state==="reverted") throw new Error("Transaction reverted!");
|
|
56
55
|
}
|