@atomiqlabs/chain-starknet 3.0.0-beta.3 → 3.0.0-beta.4
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.
|
@@ -25,7 +25,7 @@ class StarknetTransactions extends StarknetModule_1.StarknetModule {
|
|
|
25
25
|
await this.sendSignedTransaction(tx).catch(e => {
|
|
26
26
|
if (e.baseError?.code === 59)
|
|
27
27
|
return; //Transaction already in the mempool
|
|
28
|
-
|
|
28
|
+
this.logger.error("confirmTransaction(): Error on transaction re-send: ", e);
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
if (state === "rejected")
|
|
@@ -49,7 +49,7 @@ class StarknetTransactions extends StarknetModule_1.StarknetModule {
|
|
|
49
49
|
let nonce = await signer.getNonce();
|
|
50
50
|
const latestConfirmedNonce = this.latestConfirmedNonces[signer.getAddress()];
|
|
51
51
|
if (latestConfirmedNonce != null && latestConfirmedNonce > nonce) {
|
|
52
|
-
|
|
52
|
+
this.logger.debug("prepareTransactions(): Using nonce from local cache!");
|
|
53
53
|
nonce = latestConfirmedNonce;
|
|
54
54
|
}
|
|
55
55
|
if (nonce === BigInt(0) && signer.isWalletAccount()) {
|
package/dist/utils/Utils.js
CHANGED
|
@@ -35,10 +35,14 @@ function onceAsync(executor) {
|
|
|
35
35
|
exports.onceAsync = onceAsync;
|
|
36
36
|
function getLogger(prefix) {
|
|
37
37
|
return {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
debug: (msg, ...args) => global.atomiqLogLevel >= 3 && console.debug(prefix + msg, ...args),
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
info: (msg, ...args) => global.atomiqLogLevel >= 2 && console.info(prefix + msg, ...args),
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
warn: (msg, ...args) => (global.atomiqLogLevel == null || global.atomiqLogLevel >= 1) && console.warn(prefix + msg, ...args),
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
error: (msg, ...args) => (global.atomiqLogLevel == null || global.atomiqLogLevel >= 0) && console.error(prefix + msg, ...args)
|
|
42
46
|
};
|
|
43
47
|
}
|
|
44
48
|
exports.getLogger = getLogger;
|
package/package.json
CHANGED
|
@@ -42,7 +42,7 @@ export class StarknetTransactions extends StarknetModule {
|
|
|
42
42
|
state = await this._getTxIdStatus(tx.txId);
|
|
43
43
|
if(state==="not_found" && tx.signed!=null) await this.sendSignedTransaction(tx).catch(e => {
|
|
44
44
|
if(e.baseError?.code === 59) return; //Transaction already in the mempool
|
|
45
|
-
|
|
45
|
+
this.logger.error("confirmTransaction(): Error on transaction re-send: ", e);
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
if(state==="rejected") throw new Error("Transaction rejected!");
|
|
@@ -65,7 +65,7 @@ export class StarknetTransactions extends StarknetModule {
|
|
|
65
65
|
let nonce: bigint = await signer.getNonce();
|
|
66
66
|
const latestConfirmedNonce = this.latestConfirmedNonces[signer.getAddress()];
|
|
67
67
|
if(latestConfirmedNonce!=null && latestConfirmedNonce > nonce) {
|
|
68
|
-
|
|
68
|
+
this.logger.debug("prepareTransactions(): Using nonce from local cache!");
|
|
69
69
|
nonce = latestConfirmedNonce;
|
|
70
70
|
}
|
|
71
71
|
if(nonce===BigInt(0) && signer.isWalletAccount()) {
|
package/src/utils/Utils.ts
CHANGED
|
@@ -34,10 +34,14 @@ export function onceAsync<T>(executor: () => Promise<T>): () => Promise<T> {
|
|
|
34
34
|
|
|
35
35
|
export function getLogger(prefix: string) {
|
|
36
36
|
return {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
debug: (msg, ...args) => global.atomiqLogLevel >= 3 && console.debug(prefix+msg, ...args),
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
info: (msg, ...args) => global.atomiqLogLevel >= 2 && console.info(prefix+msg, ...args),
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
warn: (msg, ...args) => (global.atomiqLogLevel==null || global.atomiqLogLevel >= 1) && console.warn(prefix+msg, ...args),
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
error: (msg, ...args) => (global.atomiqLogLevel==null || global.atomiqLogLevel >= 0) && console.error(prefix+msg, ...args)
|
|
41
45
|
};
|
|
42
46
|
}
|
|
43
47
|
|