genlayer-js 0.3.0 → 0.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
 
2
2
 
3
+ ## 0.3.1 (2024-10-28)
4
+
3
5
  ## 0.3.0 (2024-10-25)
4
6
 
5
7
 
@@ -1,4 +1,4 @@
1
- import { Transport, Account, Client } from 'viem';
1
+ import { Transport, Account, Client, PublicActions } from 'viem';
2
2
  import { S as SimulatorChain } from './chains-CtZJFz4Q.js';
3
3
 
4
4
  type Address$1 = `0x${string}` & {
@@ -74,27 +74,27 @@ type GenLayerMethod = {
74
74
  method: "eth_getTransactionCount";
75
75
  params: [address: string];
76
76
  };
77
- type GenLayerClient<TTransport extends Transport, TSimulatorChain extends SimulatorChain, TAccount extends Account> = Client<TTransport, TSimulatorChain, TAccount> & {
77
+ type GenLayerClient<TTransport extends Transport, TSimulatorChain extends SimulatorChain, TAccount extends Account> = Client<TTransport, TSimulatorChain, TAccount> & PublicActions<TTransport, TSimulatorChain, TAccount> & {
78
78
  request: Client<TTransport, TSimulatorChain, TAccount>["request"] & {
79
79
  <TMethod extends GenLayerMethod>(args: Extract<GenLayerMethod, {
80
80
  method: TMethod["method"];
81
81
  }>): Promise<unknown>;
82
82
  };
83
83
  readContract: (args: {
84
- account: Account;
84
+ account?: Account;
85
85
  address: Address$1;
86
86
  functionName: string;
87
87
  args: any[];
88
88
  }) => Promise<any>;
89
89
  writeContract: (args: {
90
- account: Account;
90
+ account?: Account;
91
91
  address: Address$1;
92
92
  functionName: string;
93
93
  args: any[];
94
94
  value: bigint;
95
95
  }) => Promise<any>;
96
96
  deployContract: (args: {
97
- account: Account;
97
+ account?: Account;
98
98
  code: string;
99
99
  args: CalldataEncodable[];
100
100
  }) => Promise<any>;
@@ -104,6 +104,10 @@ type GenLayerClient<TTransport extends Transport, TSimulatorChain extends Simula
104
104
  getCurrentNonce: (args: {
105
105
  address: string;
106
106
  }) => Promise<number>;
107
+ waitForTransactionReceipt: (args: {
108
+ hash: TransactionHash;
109
+ status?: TransactionStatus;
110
+ }) => Promise<GenLayerTransaction>;
107
111
  };
108
112
 
109
113
  export { type Address$1 as A, type CalldataEncodable as C, type GenLayerClient as G, type MethodDescription as M, type TransactionData as T, type GenLayerMethod as a, type TransactionHash as b, TransactionStatus as c, type GenLayerTransaction as d, type TransactionDataElement as e };
@@ -1,4 +1,4 @@
1
- import { Transport, Account, Client } from 'viem';
1
+ import { Transport, Account, Client, PublicActions } from 'viem';
2
2
  import { S as SimulatorChain } from './chains-CtZJFz4Q.cjs';
3
3
 
4
4
  type Address$1 = `0x${string}` & {
@@ -74,27 +74,27 @@ type GenLayerMethod = {
74
74
  method: "eth_getTransactionCount";
75
75
  params: [address: string];
76
76
  };
77
- type GenLayerClient<TTransport extends Transport, TSimulatorChain extends SimulatorChain, TAccount extends Account> = Client<TTransport, TSimulatorChain, TAccount> & {
77
+ type GenLayerClient<TTransport extends Transport, TSimulatorChain extends SimulatorChain, TAccount extends Account> = Client<TTransport, TSimulatorChain, TAccount> & PublicActions<TTransport, TSimulatorChain, TAccount> & {
78
78
  request: Client<TTransport, TSimulatorChain, TAccount>["request"] & {
79
79
  <TMethod extends GenLayerMethod>(args: Extract<GenLayerMethod, {
80
80
  method: TMethod["method"];
81
81
  }>): Promise<unknown>;
82
82
  };
83
83
  readContract: (args: {
84
- account: Account;
84
+ account?: Account;
85
85
  address: Address$1;
86
86
  functionName: string;
87
87
  args: any[];
88
88
  }) => Promise<any>;
89
89
  writeContract: (args: {
90
- account: Account;
90
+ account?: Account;
91
91
  address: Address$1;
92
92
  functionName: string;
93
93
  args: any[];
94
94
  value: bigint;
95
95
  }) => Promise<any>;
96
96
  deployContract: (args: {
97
- account: Account;
97
+ account?: Account;
98
98
  code: string;
99
99
  args: CalldataEncodable[];
100
100
  }) => Promise<any>;
@@ -104,6 +104,10 @@ type GenLayerClient<TTransport extends Transport, TSimulatorChain extends Simula
104
104
  getCurrentNonce: (args: {
105
105
  address: string;
106
106
  }) => Promise<number>;
107
+ waitForTransactionReceipt: (args: {
108
+ hash: TransactionHash;
109
+ status?: TransactionStatus;
110
+ }) => Promise<GenLayerTransaction>;
107
111
  };
108
112
 
109
113
  export { type Address$1 as A, type CalldataEncodable as C, type GenLayerClient as G, type MethodDescription as M, type TransactionData as T, type GenLayerMethod as a, type TransactionHash as b, TransactionStatus as c, type GenLayerTransaction as d, type TransactionDataElement as e };
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as viem from 'viem';
2
2
  import { Transport, Account } from 'viem';
3
3
  import { S as SimulatorChain } from './chains-CtZJFz4Q.cjs';
4
- import { G as GenLayerClient } from './clients-BamlAEcy.cjs';
4
+ import { G as GenLayerClient } from './clients-puliY5_u.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 { Transport, Account } from 'viem';
3
3
  import { S as SimulatorChain } from './chains-CtZJFz4Q.js';
4
- import { G as GenLayerClient } from './clients-CJ820ePR.js';
4
+ import { G as GenLayerClient } from './clients-CD8MilSg.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';
@@ -1,4 +1,4 @@
1
- export { A as Address, C as CalldataEncodable, G as GenLayerClient, a as GenLayerMethod, d as GenLayerTransaction, M as MethodDescription, T as TransactionData, e as TransactionDataElement, b as TransactionHash, c as TransactionStatus } from '../clients-BamlAEcy.cjs';
1
+ export { A as Address, C as CalldataEncodable, G as GenLayerClient, a as GenLayerMethod, d as GenLayerTransaction, M as MethodDescription, T as TransactionData, e as TransactionDataElement, b as TransactionHash, c as TransactionStatus } from '../clients-puliY5_u.cjs';
2
2
  export { S as SimulatorChain } from '../chains-CtZJFz4Q.cjs';
3
3
  export { Account } from 'viem';
4
4
 
@@ -1,4 +1,4 @@
1
- export { A as Address, C as CalldataEncodable, G as GenLayerClient, a as GenLayerMethod, d as GenLayerTransaction, M as MethodDescription, T as TransactionData, e as TransactionDataElement, b as TransactionHash, c as TransactionStatus } from '../clients-CJ820ePR.js';
1
+ export { A as Address, C as CalldataEncodable, G as GenLayerClient, a as GenLayerMethod, d as GenLayerTransaction, M as MethodDescription, T as TransactionData, e as TransactionDataElement, b as TransactionHash, c as TransactionStatus } from '../clients-CD8MilSg.js';
2
2
  export { S as SimulatorChain } from '../chains-CtZJFz4Q.js';
3
3
  export { Account } from 'viem';
4
4
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "genlayer-js",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.3.1",
5
5
  "description": "GenLayer JavaScript SDK",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -24,7 +24,7 @@ export const contractActions = (client: GenLayerClient<Transport, SimulatorChain
24
24
 
25
25
  export const overrideContractActions = (client: GenLayerClient<Transport, SimulatorChain, Account>) => {
26
26
  client.readContract = async (args: {
27
- account: Account;
27
+ account?: Account;
28
28
  address: Address;
29
29
  functionName: string;
30
30
  args: CalldataEncodable[];
@@ -45,7 +45,7 @@ export const overrideContractActions = (client: GenLayerClient<Transport, Simula
45
45
  };
46
46
 
47
47
  client.writeContract = async (args: {
48
- account: Account;
48
+ account?: Account;
49
49
  address: Address;
50
50
  functionName: string;
51
51
  args: CalldataEncodable[];
@@ -81,7 +81,7 @@ export const overrideContractActions = (client: GenLayerClient<Transport, Simula
81
81
  return result;
82
82
  };
83
83
 
84
- client.deployContract = async (args: {account: Account; code: string; args: CalldataEncodable[]}) => {
84
+ client.deployContract = async (args: {account?: Account; code: string; args: CalldataEncodable[]}) => {
85
85
  const {account, code, args: constructorArgs} = args;
86
86
  const data = [code, encode({args: constructorArgs})];
87
87
  const serializedData = serialize(data);
@@ -1,5 +1,5 @@
1
- import {Account, Transport, Client} from "viem";
2
- import {GenLayerTransaction, TransactionHash} from "./transactions";
1
+ import {Account, Transport, Client, PublicActions} from "viem";
2
+ import {GenLayerTransaction, TransactionHash, TransactionStatus} from "./transactions";
3
3
  import {SimulatorChain} from "./chains";
4
4
  import {Address} from "./accounts";
5
5
  import {CalldataEncodable} from "./calldata";
@@ -17,26 +17,31 @@ export type GenLayerClient<
17
17
  TTransport extends Transport,
18
18
  TSimulatorChain extends SimulatorChain,
19
19
  TAccount extends Account,
20
- > = Client<TTransport, TSimulatorChain, TAccount> & {
21
- request: Client<TTransport, TSimulatorChain, TAccount>["request"] & {
22
- <TMethod extends GenLayerMethod>(
23
- args: Extract<GenLayerMethod, {method: TMethod["method"]}>,
24
- ): Promise<unknown>;
20
+ > = Client<TTransport, TSimulatorChain, TAccount> &
21
+ PublicActions<TTransport, TSimulatorChain, TAccount> & {
22
+ request: Client<TTransport, TSimulatorChain, TAccount>["request"] & {
23
+ <TMethod extends GenLayerMethod>(
24
+ args: Extract<GenLayerMethod, {method: TMethod["method"]}>,
25
+ ): Promise<unknown>;
26
+ };
27
+ readContract: (args: {
28
+ account?: Account;
29
+ address: Address;
30
+ functionName: string;
31
+ args: any[];
32
+ }) => Promise<any>;
33
+ writeContract: (args: {
34
+ account?: Account;
35
+ address: Address;
36
+ functionName: string;
37
+ args: any[];
38
+ value: bigint;
39
+ }) => Promise<any>;
40
+ deployContract: (args: {account?: Account; code: string; args: CalldataEncodable[]}) => Promise<any>;
41
+ getTransaction: (args: {hash: TransactionHash}) => Promise<GenLayerTransaction>;
42
+ getCurrentNonce: (args: {address: string}) => Promise<number>;
43
+ waitForTransactionReceipt: (args: {
44
+ hash: TransactionHash;
45
+ status?: TransactionStatus;
46
+ }) => Promise<GenLayerTransaction>;
25
47
  };
26
- readContract: (args: {
27
- account: Account;
28
- address: Address;
29
- functionName: string;
30
- args: any[];
31
- }) => Promise<any>;
32
- writeContract: (args: {
33
- account: Account;
34
- address: Address;
35
- functionName: string;
36
- args: any[];
37
- value: bigint;
38
- }) => Promise<any>;
39
- deployContract: (args: {account: Account; code: string; args: CalldataEncodable[]}) => Promise<any>;
40
- getTransaction: (args: {hash: TransactionHash}) => Promise<GenLayerTransaction>;
41
- getCurrentNonce: (args: {address: string}) => Promise<number>;
42
- };