genlayer-js 1.1.0 → 1.1.2

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/index.cjs CHANGED
@@ -41,9 +41,20 @@ function accountActions(client) {
41
41
  params: [address, amount]
42
42
  });
43
43
  },
44
+ /**
45
+ * Returns the transaction count (next nonce) for an address.
46
+ *
47
+ * Defaults to `"pending"` so that rapid sequential submissions from the
48
+ * same account receive distinct nonces. Two submissions issued before the
49
+ * first confirms would otherwise both see the same `"latest"` count and
50
+ * collide with an "already known" or "replacement underpriced" error.
51
+ *
52
+ * Pass `block: "latest"` explicitly for confirmed-only state
53
+ * (e.g. reconciliation tooling comparing against on-chain finality).
54
+ */
44
55
  getCurrentNonce: async ({
45
56
  address,
46
- block = "latest"
57
+ block = "pending"
47
58
  }) => {
48
59
  const addressToUse = address || _optionalChain([client, 'access', _3 => _3.account, 'optionalAccess', _4 => _4.address]);
49
60
  if (!addressToUse) {
@@ -943,10 +954,11 @@ var _encodeAddTransactionData = ({
943
954
  functionName: "addTransaction",
944
955
  args: addTransactionArgs
945
956
  });
957
+ const validUntil = BigInt(Math.floor(Date.now() / 1e3) + 3600);
946
958
  const encodedDataV6 = _viem.encodeFunctionData.call(void 0, {
947
959
  abi: ADD_TRANSACTION_ABI_V6,
948
960
  functionName: "addTransaction",
949
- args: [...addTransactionArgs, 0n]
961
+ args: [...addTransactionArgs, validUntil]
950
962
  });
951
963
  if (getAddTransactionInputCount(_optionalChain([client, 'access', _42 => _42.chain, 'access', _43 => _43.consensusMainContract, 'optionalAccess', _44 => _44.abi])) >= 6) {
952
964
  return {
package/dist/index.js CHANGED
@@ -41,9 +41,20 @@ function accountActions(client) {
41
41
  params: [address, amount]
42
42
  });
43
43
  },
44
+ /**
45
+ * Returns the transaction count (next nonce) for an address.
46
+ *
47
+ * Defaults to `"pending"` so that rapid sequential submissions from the
48
+ * same account receive distinct nonces. Two submissions issued before the
49
+ * first confirms would otherwise both see the same `"latest"` count and
50
+ * collide with an "already known" or "replacement underpriced" error.
51
+ *
52
+ * Pass `block: "latest"` explicitly for confirmed-only state
53
+ * (e.g. reconciliation tooling comparing against on-chain finality).
54
+ */
44
55
  getCurrentNonce: async ({
45
56
  address,
46
- block = "latest"
57
+ block = "pending"
47
58
  }) => {
48
59
  const addressToUse = address || client.account?.address;
49
60
  if (!addressToUse) {
@@ -943,10 +954,11 @@ var _encodeAddTransactionData = ({
943
954
  functionName: "addTransaction",
944
955
  args: addTransactionArgs
945
956
  });
957
+ const validUntil = BigInt(Math.floor(Date.now() / 1e3) + 3600);
946
958
  const encodedDataV6 = encodeFunctionData({
947
959
  abi: ADD_TRANSACTION_ABI_V6,
948
960
  functionName: "addTransaction",
949
- args: [...addTransactionArgs, 0n]
961
+ args: [...addTransactionArgs, validUntil]
950
962
  });
951
963
  if (getAddTransactionInputCount(client.chain.consensusMainContract?.abi) >= 6) {
952
964
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "genlayer-js",
3
3
  "type": "module",
4
- "version": "1.1.0",
4
+ "version": "1.1.2",
5
5
  "description": "GenLayer JavaScript SDK",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",