genlayer-js 0.7.0 → 0.8.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
 
2
2
 
3
+ ## 0.8.0 (2025-03-12)
4
+
5
+
6
+ ### Features
7
+
8
+ * overwrite defaultConsensusMaxRotations ([#75](https://github.com/yeagerai/genlayer-js/issues/75)) ([8d64b42](https://github.com/yeagerai/genlayer-js/commit/8d64b428d8232394cfe1ac5b56edba7c1837d0e5))
9
+
3
10
  ## 0.7.0 (2025-03-05)
4
11
 
5
12
 
@@ -153,6 +153,7 @@ type GenLayerClient<TSimulatorChain extends SimulatorChain> = Omit<Client<Transp
153
153
  };
154
154
  value: bigint;
155
155
  leaderOnly?: boolean;
156
+ consensusMaxRotations?: number;
156
157
  }) => Promise<any>;
157
158
  deployContract: (args: {
158
159
  account?: Account;
@@ -162,6 +163,7 @@ type GenLayerClient<TSimulatorChain extends SimulatorChain> = Omit<Client<Transp
162
163
  [key: string]: CalldataEncodable;
163
164
  };
164
165
  leaderOnly?: boolean;
166
+ consensusMaxRotations?: number;
165
167
  }) => Promise<`0x${string}`>;
166
168
  getTransaction: (args: {
167
169
  hash: TransactionHash;
@@ -153,6 +153,7 @@ type GenLayerClient<TSimulatorChain extends SimulatorChain> = Omit<Client<Transp
153
153
  };
154
154
  value: bigint;
155
155
  leaderOnly?: boolean;
156
+ consensusMaxRotations?: number;
156
157
  }) => Promise<any>;
157
158
  deployContract: (args: {
158
159
  account?: Account;
@@ -162,6 +163,7 @@ type GenLayerClient<TSimulatorChain extends SimulatorChain> = Omit<Client<Transp
162
163
  [key: string]: CalldataEncodable;
163
164
  };
164
165
  leaderOnly?: boolean;
166
+ consensusMaxRotations?: number;
165
167
  }) => Promise<`0x${string}`>;
166
168
  getTransaction: (args: {
167
169
  hash: TransactionHash;
package/dist/index.cjs CHANGED
@@ -440,18 +440,18 @@ var overrideContractActions = (client) => {
440
440
  return decode(resultBinary);
441
441
  };
442
442
  client.writeContract = async (args) => {
443
- const { account, address, functionName, args: callArgs, kwargs, value = 0n, leaderOnly = false } = args;
443
+ const { account, address, functionName, args: callArgs, kwargs, value = 0n, leaderOnly = false, consensusMaxRotations = client.chain.defaultConsensusMaxRotations } = args;
444
444
  const data = [encode(makeCalldataObject(functionName, callArgs, kwargs)), leaderOnly];
445
445
  const serializedData = serialize(data);
446
- return _sendTransaction(address, serializedData, account || client.account, value);
446
+ return _sendTransaction(address, serializedData, account || client.account, consensusMaxRotations, value);
447
447
  };
448
448
  client.deployContract = async (args) => {
449
- const { account, code, args: constructorArgs, kwargs, leaderOnly = false } = args;
449
+ const { account, code, args: constructorArgs, kwargs, leaderOnly = false, consensusMaxRotations = client.chain.defaultConsensusMaxRotations } = args;
450
450
  const data = [code, encode(makeCalldataObject(void 0, constructorArgs, kwargs)), leaderOnly];
451
451
  const serializedData = serialize(data);
452
- return _sendTransaction(_viem.zeroAddress, serializedData, account || client.account);
452
+ return _sendTransaction(_viem.zeroAddress, serializedData, account || client.account, consensusMaxRotations);
453
453
  };
454
- const _sendTransaction = async (recipient, data, senderAccount, value) => {
454
+ const _sendTransaction = async (recipient, data, senderAccount, consensusMaxRotations, value) => {
455
455
  if (!senderAccount) {
456
456
  throw new Error(
457
457
  "No account set. Configure the client with an account or pass an account to this function."
@@ -469,7 +469,7 @@ var overrideContractActions = (client) => {
469
469
  senderAccount.address,
470
470
  recipient,
471
471
  client.chain.defaultNumberOfInitialValidators,
472
- client.chain.defaultConsensusMaxRotations,
472
+ consensusMaxRotations,
473
473
  data
474
474
  ]
475
475
  });
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as viem from 'viem';
2
2
  import { Account, Address } from 'viem';
3
3
  import { S as SimulatorChain } from './chains-C5PI_Nr_.cjs';
4
- import { G as GenLayerClient, C as CalldataEncodable, T as TransactionDataElement } from './index-DJTO3-o3.cjs';
4
+ import { G as GenLayerClient, C as CalldataEncodable, T as TransactionDataElement } from './index-BfeTR7rO.cjs';
5
5
  import * as abitype from 'abitype';
6
6
  import * as viem__types_experimental_eip7702_types_authorization from 'viem/_types/experimental/eip7702/types/authorization';
7
7
  import * as viem_accounts from 'viem/accounts';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as viem from 'viem';
2
2
  import { Account, Address } from 'viem';
3
3
  import { S as SimulatorChain } from './chains-C5PI_Nr_.js';
4
- import { G as GenLayerClient, C as CalldataEncodable, T as TransactionDataElement } from './index-CpcNUbXb.js';
4
+ import { G as GenLayerClient, C as CalldataEncodable, T as TransactionDataElement } from './index-CODAJePj.js';
5
5
  import * as abitype from 'abitype';
6
6
  import * as viem__types_experimental_eip7702_types_authorization from 'viem/_types/experimental/eip7702/types/authorization';
7
7
  import * as viem_accounts from 'viem/accounts';
package/dist/index.js CHANGED
@@ -440,18 +440,18 @@ var overrideContractActions = (client) => {
440
440
  return decode(resultBinary);
441
441
  };
442
442
  client.writeContract = async (args) => {
443
- const { account, address, functionName, args: callArgs, kwargs, value = 0n, leaderOnly = false } = args;
443
+ const { account, address, functionName, args: callArgs, kwargs, value = 0n, leaderOnly = false, consensusMaxRotations = client.chain.defaultConsensusMaxRotations } = args;
444
444
  const data = [encode(makeCalldataObject(functionName, callArgs, kwargs)), leaderOnly];
445
445
  const serializedData = serialize(data);
446
- return _sendTransaction(address, serializedData, account || client.account, value);
446
+ return _sendTransaction(address, serializedData, account || client.account, consensusMaxRotations, value);
447
447
  };
448
448
  client.deployContract = async (args) => {
449
- const { account, code, args: constructorArgs, kwargs, leaderOnly = false } = args;
449
+ const { account, code, args: constructorArgs, kwargs, leaderOnly = false, consensusMaxRotations = client.chain.defaultConsensusMaxRotations } = args;
450
450
  const data = [code, encode(makeCalldataObject(void 0, constructorArgs, kwargs)), leaderOnly];
451
451
  const serializedData = serialize(data);
452
- return _sendTransaction(zeroAddress, serializedData, account || client.account);
452
+ return _sendTransaction(zeroAddress, serializedData, account || client.account, consensusMaxRotations);
453
453
  };
454
- const _sendTransaction = async (recipient, data, senderAccount, value) => {
454
+ const _sendTransaction = async (recipient, data, senderAccount, consensusMaxRotations, value) => {
455
455
  if (!senderAccount) {
456
456
  throw new Error(
457
457
  "No account set. Configure the client with an account or pass an account to this function."
@@ -469,7 +469,7 @@ var overrideContractActions = (client) => {
469
469
  senderAccount.address,
470
470
  recipient,
471
471
  client.chain.defaultNumberOfInitialValidators,
472
- client.chain.defaultConsensusMaxRotations,
472
+ consensusMaxRotations,
473
473
  data
474
474
  ]
475
475
  });
@@ -1,3 +1,3 @@
1
- export { A as Address, a as CalldataAddress, C as CalldataEncodable, f as ContractMethod, e as ContractMethodBase, c as ContractParamsArraySchemaElement, d as ContractParamsSchema, g as ContractSchema, G as GenLayerClient, b as GenLayerMethod, j as GenLayerTransaction, M as MethodDescription, N as Network, S as SnapSource, k as TransactionDataElement, h as TransactionHash, i as TransactionStatus } from '../index-DJTO3-o3.cjs';
1
+ export { A as Address, a as CalldataAddress, C as CalldataEncodable, f as ContractMethod, e as ContractMethodBase, c as ContractParamsArraySchemaElement, d as ContractParamsSchema, g as ContractSchema, G as GenLayerClient, b as GenLayerMethod, j as GenLayerTransaction, M as MethodDescription, N as Network, S as SnapSource, k as TransactionDataElement, h as TransactionHash, i as TransactionStatus } from '../index-BfeTR7rO.cjs';
2
2
  export { S as SimulatorChain } from '../chains-C5PI_Nr_.cjs';
3
3
  export { Account } from 'viem';
@@ -1,3 +1,3 @@
1
- export { A as Address, a as CalldataAddress, C as CalldataEncodable, f as ContractMethod, e as ContractMethodBase, c as ContractParamsArraySchemaElement, d as ContractParamsSchema, g as ContractSchema, G as GenLayerClient, b as GenLayerMethod, j as GenLayerTransaction, M as MethodDescription, N as Network, S as SnapSource, k as TransactionDataElement, h as TransactionHash, i as TransactionStatus } from '../index-CpcNUbXb.js';
1
+ export { A as Address, a as CalldataAddress, C as CalldataEncodable, f as ContractMethod, e as ContractMethodBase, c as ContractParamsArraySchemaElement, d as ContractParamsSchema, g as ContractSchema, G as GenLayerClient, b as GenLayerMethod, j as GenLayerTransaction, M as MethodDescription, N as Network, S as SnapSource, k as TransactionDataElement, h as TransactionHash, i as TransactionStatus } from '../index-CODAJePj.js';
2
2
  export { S as SimulatorChain } from '../chains-C5PI_Nr_.js';
3
3
  export { Account } from 'viem';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "genlayer-js",
3
3
  "type": "module",
4
- "version": "0.7.0",
4
+ "version": "0.8.0",
5
5
  "description": "GenLayer JavaScript SDK",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -115,11 +115,12 @@ export const overrideContractActions = (client: GenLayerClient<SimulatorChain>)
115
115
  kwargs?: Map<string, CalldataEncodable> | {[key: string]: CalldataEncodable};
116
116
  value: bigint;
117
117
  leaderOnly?: boolean;
118
+ consensusMaxRotations?: number;
118
119
  }): Promise<`0x${string}`> => {
119
- const {account, address, functionName, args: callArgs, kwargs, value = 0n, leaderOnly = false} = args;
120
+ const {account, address, functionName, args: callArgs, kwargs, value = 0n, leaderOnly = false, consensusMaxRotations = client.chain.defaultConsensusMaxRotations} = args;
120
121
  const data = [calldata.encode(makeCalldataObject(functionName, callArgs, kwargs)), leaderOnly];
121
122
  const serializedData = serialize(data);
122
- return _sendTransaction(address, serializedData, account || client.account, value);
123
+ return _sendTransaction(address, serializedData, account || client.account, consensusMaxRotations, value);
123
124
  };
124
125
 
125
126
  client.deployContract = async (args: {
@@ -128,17 +129,19 @@ export const overrideContractActions = (client: GenLayerClient<SimulatorChain>)
128
129
  args?: CalldataEncodable[];
129
130
  kwargs?: Map<string, CalldataEncodable> | {[key: string]: CalldataEncodable};
130
131
  leaderOnly?: boolean;
132
+ consensusMaxRotations?: number;
131
133
  }) => {
132
- const {account, code, args: constructorArgs, kwargs, leaderOnly = false} = args;
134
+ const {account, code, args: constructorArgs, kwargs, leaderOnly = false, consensusMaxRotations = client.chain.defaultConsensusMaxRotations} = args;
133
135
  const data = [code, calldata.encode(makeCalldataObject(undefined, constructorArgs, kwargs)), leaderOnly];
134
136
  const serializedData = serialize(data);
135
- return _sendTransaction(zeroAddress, serializedData, account || client.account);
137
+ return _sendTransaction(zeroAddress, serializedData, account || client.account, consensusMaxRotations);
136
138
  };
137
139
 
138
140
  const _sendTransaction = async (
139
141
  recipient: `0x${string}`,
140
142
  data: `0x${string}`,
141
143
  senderAccount?: Account,
144
+ consensusMaxRotations?: number,
142
145
  value?: bigint,
143
146
  ) => {
144
147
  if (!senderAccount) {
@@ -160,7 +163,7 @@ export const overrideContractActions = (client: GenLayerClient<SimulatorChain>)
160
163
  senderAccount.address,
161
164
  recipient,
162
165
  client.chain.defaultNumberOfInitialValidators,
163
- client.chain.defaultConsensusMaxRotations,
166
+ consensusMaxRotations,
164
167
  data,
165
168
  ],
166
169
  });
@@ -55,6 +55,7 @@ export type GenLayerClient<TSimulatorChain extends SimulatorChain> = Omit<
55
55
  kwargs?: Map<string, CalldataEncodable> | {[key: string]: CalldataEncodable};
56
56
  value: bigint;
57
57
  leaderOnly?: boolean;
58
+ consensusMaxRotations?: number;
58
59
  }) => Promise<any>;
59
60
  deployContract: (args: {
60
61
  account?: Account;
@@ -62,6 +63,7 @@ export type GenLayerClient<TSimulatorChain extends SimulatorChain> = Omit<
62
63
  args?: CalldataEncodable[];
63
64
  kwargs?: Map<string, CalldataEncodable> | {[key: string]: CalldataEncodable};
64
65
  leaderOnly?: boolean;
66
+ consensusMaxRotations?: number;
65
67
  }) => Promise<`0x${string}`>;
66
68
  getTransaction: (args: {hash: TransactionHash}) => Promise<GenLayerTransaction>;
67
69
  getCurrentNonce: (args: {address: string}) => Promise<number>;