genlayer-js 0.9.4 → 0.9.5

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.9.5 (2025-05-21)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * update readContract with TransactionHashVariant ([#86](https://github.com/yeagerai/genlayer-js/issues/86)) ([7cbeb04](https://github.com/yeagerai/genlayer-js/commit/7cbeb040b55c4bc3acf173bdae51da51deef7a83))
9
+
3
10
  ## 0.9.4 (2025-05-20)
4
11
 
5
12
 
@@ -323,12 +323,12 @@ type GenLayerClient<TGenLayerChain extends GenLayerChain> = Omit<Client<Transpor
323
323
  account?: Account;
324
324
  address: Address;
325
325
  functionName: string;
326
- stateStatus?: TransactionStatus;
327
326
  args?: CalldataEncodable[];
328
327
  kwargs?: Map<string, CalldataEncodable> | {
329
328
  [key: string]: CalldataEncodable;
330
329
  };
331
330
  rawReturn?: RawReturn;
331
+ transactionHashVariant?: TransactionHashVariant;
332
332
  }) => Promise<RawReturn extends true ? `0x${string}` : CalldataEncodable>;
333
333
  writeContract: (args: {
334
334
  account?: Account;
@@ -323,12 +323,12 @@ type GenLayerClient<TGenLayerChain extends GenLayerChain> = Omit<Client<Transpor
323
323
  account?: Account;
324
324
  address: Address;
325
325
  functionName: string;
326
- stateStatus?: TransactionStatus;
327
326
  args?: CalldataEncodable[];
328
327
  kwargs?: Map<string, CalldataEncodable> | {
329
328
  [key: string]: CalldataEncodable;
330
329
  };
331
330
  rawReturn?: RawReturn;
331
+ transactionHashVariant?: TransactionHashVariant;
332
332
  }) => Promise<RawReturn extends true ? `0x${string}` : CalldataEncodable>;
333
333
  writeContract: (args: {
334
334
  account?: Account;
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 { G as GenLayerChain } from './chains-BYSCF33g.cjs';
4
- import { G as GenLayerClient, C as CalldataEncodable, T as TransactionDataElement } from './index-B_gpaVzJ.cjs';
4
+ import { G as GenLayerClient, C as CalldataEncodable, T as TransactionDataElement } from './index-CWYHlYb1.cjs';
5
5
  import * as abitype from 'abitype';
6
6
  import * as viem__types_types_authorization from 'viem/_types/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 { G as GenLayerChain } from './chains-BYSCF33g.js';
4
- import { G as GenLayerClient, C as CalldataEncodable, T as TransactionDataElement } from './index-to6d0Hzj.js';
4
+ import { G as GenLayerClient, C as CalldataEncodable, T as TransactionDataElement } from './index-CjM-U5oN.js';
5
5
  import * as abitype from 'abitype';
6
6
  import * as viem__types_types_authorization from 'viem/_types/types/authorization';
7
7
  import * as viem_accounts from 'viem/accounts';
@@ -1,3 +1,3 @@
1
1
  export { Account, Address } from 'viem';
2
- export { a as CalldataAddress, C as CalldataEncodable, f as ContractMethod, e as ContractMethodBase, c as ContractParamsArraySchemaElement, d as ContractParamsSchema, g as ContractSchema, q as DecodedCallData, D as DecodedDeployData, G as GenLayerClient, b as GenLayerMethod, s as GenLayerRawTransaction, r as GenLayerTransaction, H as Hash, M as MethodDescription, N as Network, S as SnapSource, h as TransactionHash, p as TransactionHashVariant, j as TransactionResult, m as TransactionResultNameToNumber, i as TransactionStatus, o as TransactionType, V as VoteType, l as transactionResultNumberToName, k as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, n as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-B_gpaVzJ.cjs';
2
+ export { a as CalldataAddress, C as CalldataEncodable, f as ContractMethod, e as ContractMethodBase, c as ContractParamsArraySchemaElement, d as ContractParamsSchema, g as ContractSchema, q as DecodedCallData, D as DecodedDeployData, G as GenLayerClient, b as GenLayerMethod, s as GenLayerRawTransaction, r as GenLayerTransaction, H as Hash, M as MethodDescription, N as Network, S as SnapSource, h as TransactionHash, p as TransactionHashVariant, j as TransactionResult, m as TransactionResultNameToNumber, i as TransactionStatus, o as TransactionType, V as VoteType, l as transactionResultNumberToName, k as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, n as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-CWYHlYb1.cjs';
3
3
  export { G as GenLayerChain } from '../chains-BYSCF33g.cjs';
@@ -1,3 +1,3 @@
1
1
  export { Account, Address } from 'viem';
2
- export { a as CalldataAddress, C as CalldataEncodable, f as ContractMethod, e as ContractMethodBase, c as ContractParamsArraySchemaElement, d as ContractParamsSchema, g as ContractSchema, q as DecodedCallData, D as DecodedDeployData, G as GenLayerClient, b as GenLayerMethod, s as GenLayerRawTransaction, r as GenLayerTransaction, H as Hash, M as MethodDescription, N as Network, S as SnapSource, h as TransactionHash, p as TransactionHashVariant, j as TransactionResult, m as TransactionResultNameToNumber, i as TransactionStatus, o as TransactionType, V as VoteType, l as transactionResultNumberToName, k as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, n as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-to6d0Hzj.js';
2
+ export { a as CalldataAddress, C as CalldataEncodable, f as ContractMethod, e as ContractMethodBase, c as ContractParamsArraySchemaElement, d as ContractParamsSchema, g as ContractSchema, q as DecodedCallData, D as DecodedDeployData, G as GenLayerClient, b as GenLayerMethod, s as GenLayerRawTransaction, r as GenLayerTransaction, H as Hash, M as MethodDescription, N as Network, S as SnapSource, h as TransactionHash, p as TransactionHashVariant, j as TransactionResult, m as TransactionResultNameToNumber, i as TransactionStatus, o as TransactionType, V as VoteType, l as transactionResultNumberToName, k as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, n as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-CjM-U5oN.js';
3
3
  export { G as GenLayerChain } from '../chains-BYSCF33g.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "genlayer-js",
3
3
  "type": "module",
4
- "version": "0.9.4",
4
+ "version": "0.9.5",
5
5
  "description": "GenLayer JavaScript SDK",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -1,5 +1,5 @@
1
1
  import {Transport, Client, PublicActions, WalletActions} from "viem";
2
- import {GenLayerTransaction, TransactionHash, TransactionStatus} from "./transactions";
2
+ import {GenLayerTransaction, TransactionHash, TransactionStatus, TransactionHashVariant} from "./transactions";
3
3
  import {GenLayerChain} from "./chains";
4
4
  import {Address, Account} from "./accounts";
5
5
  import {CalldataEncodable} from "./calldata";
@@ -43,10 +43,10 @@ export type GenLayerClient<TGenLayerChain extends GenLayerChain> = Omit<
43
43
  account?: Account;
44
44
  address: Address;
45
45
  functionName: string;
46
- stateStatus?: TransactionStatus;
47
46
  args?: CalldataEncodable[];
48
47
  kwargs?: Map<string, CalldataEncodable> | {[key: string]: CalldataEncodable};
49
48
  rawReturn?: RawReturn;
49
+ transactionHashVariant?: TransactionHashVariant;
50
50
  }) => Promise<RawReturn extends true ? `0x${string}` : CalldataEncodable>;
51
51
  writeContract: (args: {
52
52
  account?: Account;
@@ -4,7 +4,7 @@ import {localnet} from "@/chains/localnet";
4
4
  import {Address} from "../src/types/accounts";
5
5
  import {createAccount, generatePrivateKey} from "../src/accounts/account";
6
6
  import {vi} from "vitest";
7
- import {TransactionStatus} from "../src/types/transactions";
7
+ import {TransactionHashVariant} from "../src/types/transactions";
8
8
 
9
9
  // Setup fetch mock
10
10
  const mockFetch = vi.fn();
@@ -95,7 +95,7 @@ describe("Client Overrides", () => {
95
95
  address: contractAddress as Address,
96
96
  functionName: "testFunction",
97
97
  args: ["arg1", "arg2"],
98
- stateStatus: TransactionStatus.ACCEPTED, // Kept as is, matches type, ignored by current gen_call impl.
98
+ transactionHashVariant: TransactionHashVariant.LATEST_NONFINAL,
99
99
  });
100
100
 
101
101
  expect(lastGenCallParams).toEqual([
@@ -104,7 +104,7 @@ describe("Client Overrides", () => {
104
104
  to: contractAddress,
105
105
  from: account.address,
106
106
  data: expect.any(String), // The data is complex, checking type is often sufficient
107
- transaction_hash_variant: "latest-final",
107
+ transaction_hash_variant: TransactionHashVariant.LATEST_NONFINAL,
108
108
  },
109
109
  ]);
110
110
  });
@@ -126,7 +126,7 @@ describe("Client Overrides", () => {
126
126
  address: contractAddress as Address,
127
127
  functionName: "testFunction",
128
128
  args: ["arg1", "arg2"],
129
- stateStatus: TransactionStatus.ACCEPTED,
129
+ transactionHashVariant: TransactionHashVariant.LATEST_FINAL,
130
130
  });
131
131
 
132
132
  expect(lastGenCallParams).toEqual([
@@ -135,7 +135,7 @@ describe("Client Overrides", () => {
135
135
  to: contractAddress,
136
136
  from: overrideAccount.address,
137
137
  data: expect.any(String),
138
- transaction_hash_variant: "latest-final",
138
+ transaction_hash_variant: TransactionHashVariant.LATEST_FINAL,
139
139
  },
140
140
  ]);
141
141
  });
@@ -164,7 +164,7 @@ describe("Client Overrides", () => {
164
164
  to: contractAddress,
165
165
  from: accountAddressString, // Expecting the address string directly
166
166
  data: expect.any(String),
167
- transaction_hash_variant: "latest-final",
167
+ transaction_hash_variant: TransactionHashVariant.LATEST_FINAL,
168
168
  },
169
169
  ]);
170
170
  });