genlayer-js 0.3.4 → 0.4.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,14 @@
1
1
 
2
2
 
3
+ ## 0.4.1 (2024-11-20)
4
+
5
+ ## 0.4.0 (2024-11-14)
6
+
7
+
8
+ ### Features
9
+
10
+ * add contract schema methods ([#26](https://github.com/yeagerai/genlayer-js/issues/26)) ([7dc726f](https://github.com/yeagerai/genlayer-js/commit/7dc726fa4fc8769feaec07a50149956d7c2a2035))
11
+
3
12
  ## 0.3.4 (2024-11-14)
4
13
 
5
14
 
package/dist/index.cjs CHANGED
@@ -222,8 +222,9 @@ var overrideContractActions = (client) => {
222
222
  return result;
223
223
  };
224
224
  client.writeContract = async (args) => {
225
- const { account, address, functionName, args: params, value = 0n } = args;
226
- const encodedData = encodeAndSerialize({ method: functionName, args: params });
225
+ const { account, address, functionName, args: params, value = 0n, leader_only = false } = args;
226
+ const data = [encode({ method: functionName, args: params }), leader_only];
227
+ const serializedData = serialize(data);
227
228
  const senderAccount = account || client.account;
228
229
  if (!senderAccount) {
229
230
  throw new Error(
@@ -235,7 +236,7 @@ var overrideContractActions = (client) => {
235
236
  }
236
237
  const nonce = await client.getCurrentNonce({ address: senderAccount.address });
237
238
  const signedTransaction = await senderAccount.signTransaction({
238
- data: encodedData,
239
+ data: serializedData,
239
240
  to: address,
240
241
  value,
241
242
  type: "legacy",
@@ -248,8 +249,8 @@ var overrideContractActions = (client) => {
248
249
  return result;
249
250
  };
250
251
  client.deployContract = async (args) => {
251
- const { account, code, args: constructorArgs } = args;
252
- const data = [code, encode({ args: constructorArgs })];
252
+ const { account, code, args: constructorArgs, leader_only = false } = args;
253
+ const data = [code, encode({ args: constructorArgs }), leader_only];
253
254
  const serializedData = serialize(data);
254
255
  const senderAccount = account || client.account;
255
256
  if (!senderAccount) {
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as viem from 'viem';
2
2
  import { Account } from 'viem';
3
3
  import { S as SimulatorChain } from './chains-BV4Glo-M.cjs';
4
- import { G as GenLayerClient } from './clients-B5D5440g.cjs';
4
+ import { GenLayerClient } from './types/index.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 } from 'viem';
3
3
  import { S as SimulatorChain } from './chains-BV4Glo-M.js';
4
- import { G as GenLayerClient } from './clients-CRRMg5Gh.js';
4
+ import { GenLayerClient } from './types/index.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
@@ -222,8 +222,9 @@ var overrideContractActions = (client) => {
222
222
  return result;
223
223
  };
224
224
  client.writeContract = async (args) => {
225
- const { account, address, functionName, args: params, value = 0n } = args;
226
- const encodedData = encodeAndSerialize({ method: functionName, args: params });
225
+ const { account, address, functionName, args: params, value = 0n, leader_only = false } = args;
226
+ const data = [encode({ method: functionName, args: params }), leader_only];
227
+ const serializedData = serialize(data);
227
228
  const senderAccount = account || client.account;
228
229
  if (!senderAccount) {
229
230
  throw new Error(
@@ -235,7 +236,7 @@ var overrideContractActions = (client) => {
235
236
  }
236
237
  const nonce = await client.getCurrentNonce({ address: senderAccount.address });
237
238
  const signedTransaction = await senderAccount.signTransaction({
238
- data: encodedData,
239
+ data: serializedData,
239
240
  to: address,
240
241
  value,
241
242
  type: "legacy",
@@ -248,8 +249,8 @@ var overrideContractActions = (client) => {
248
249
  return result;
249
250
  };
250
251
  client.deployContract = async (args) => {
251
- const { account, code, args: constructorArgs } = args;
252
- const data = [code, encode({ args: constructorArgs })];
252
+ const { account, code, args: constructorArgs, leader_only = false } = args;
253
+ const data = [code, encode({ args: constructorArgs }), leader_only];
253
254
  const serializedData = serialize(data);
254
255
  const senderAccount = account || client.account;
255
256
  if (!senderAccount) {
@@ -1,7 +1,58 @@
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-B5D5440g.cjs';
2
- export { S as SimulatorChain } from '../chains-BV4Glo-M.cjs';
1
+ import { S as SimulatorChain } from '../chains-BV4Glo-M.cjs';
2
+ import { Client, Transport, PublicActions, Account } from 'viem';
3
3
  export { Account } from 'viem';
4
4
 
5
+ type Address$1 = `0x${string}` & {
6
+ length: 42;
7
+ };
8
+
9
+ declare class Address {
10
+ bytes: Uint8Array;
11
+ constructor(addr: Uint8Array);
12
+ }
13
+ type CalldataEncodable = null | boolean | Address | number | bigint | string | Uint8Array | Address | Array<CalldataEncodable> | Map<string, CalldataEncodable> | {
14
+ [key: string]: CalldataEncodable;
15
+ };
16
+ type MethodDescription = {
17
+ method: string;
18
+ args: Array<CalldataEncodable>;
19
+ };
20
+ type TransactionData = {
21
+ method: string;
22
+ args: CalldataEncodable[];
23
+ };
24
+
25
+ type TransactionHash = `0x${string}` & {
26
+ length: 66;
27
+ };
28
+ declare enum TransactionStatus {
29
+ PENDING = "PENDING",
30
+ CANCELED = "CANCELED",
31
+ PROPOSING = "PROPOSING",
32
+ COMMITTING = "COMMITTING",
33
+ REVEALING = "REVEALING",
34
+ ACCEPTED = "ACCEPTED",
35
+ FINALIZED = "FINALIZED",
36
+ UNDETERMINED = "UNDETERMINED"
37
+ }
38
+ type GenLayerTransaction = {
39
+ hash: TransactionHash;
40
+ status: TransactionStatus;
41
+ from_address?: string;
42
+ to_address?: string;
43
+ data?: Record<string, unknown>;
44
+ consensus_data?: Record<string, unknown>;
45
+ nonce?: number;
46
+ value?: number;
47
+ type?: number;
48
+ gaslimit?: bigint;
49
+ created_at?: Date;
50
+ r?: number;
51
+ s?: number;
52
+ v?: number;
53
+ };
54
+ type TransactionDataElement = string | number | bigint | boolean | Uint8Array;
55
+
5
56
  type ContractSchema = {
6
57
  abi: Array<{
7
58
  inputs?: Array<{
@@ -18,4 +69,69 @@ type ContractSchema = {
18
69
  class: string;
19
70
  };
20
71
 
21
- export type { ContractSchema };
72
+ type GenLayerMethod = {
73
+ method: "sim_fundAccount";
74
+ params: [address: string, amount: number];
75
+ } | {
76
+ method: "eth_getTransactionByHash";
77
+ params: [hash: TransactionHash];
78
+ } | {
79
+ method: "eth_call";
80
+ params: [requestParams: any, blockNumberOrHash: string];
81
+ } | {
82
+ method: "eth_sedRawTransaction";
83
+ params: [signedTransaction: string];
84
+ } | {
85
+ method: "gen_getContractSchema";
86
+ params: [address: string];
87
+ } | {
88
+ method: "gen_getContractSchemaForCode";
89
+ params: [contractCode: string];
90
+ } | {
91
+ method: "sim_getTransactionsForAddress";
92
+ params: [address: string, filter?: "all" | "from" | "to"];
93
+ } | {
94
+ method: "eth_getTransactionCount";
95
+ params: [address: string];
96
+ };
97
+ type GenLayerClient<TSimulatorChain extends SimulatorChain> = Omit<Client<Transport, TSimulatorChain>, "transport" | "getTransaction" | "readContract"> & Omit<PublicActions<Transport, TSimulatorChain>, "readContract" | "getTransaction"> & {
98
+ request: Client<Transport, TSimulatorChain>["request"] & {
99
+ <TMethod extends GenLayerMethod>(args: Extract<GenLayerMethod, {
100
+ method: TMethod["method"];
101
+ }>): Promise<unknown>;
102
+ };
103
+ readContract: (args: {
104
+ account?: Account;
105
+ address: Address$1;
106
+ functionName: string;
107
+ args: CalldataEncodable[];
108
+ }) => Promise<any>;
109
+ writeContract: (args: {
110
+ account?: Account;
111
+ address: Address$1;
112
+ functionName: string;
113
+ args: CalldataEncodable[];
114
+ value: bigint;
115
+ leader_only?: boolean;
116
+ }) => Promise<any>;
117
+ deployContract: (args: {
118
+ account?: Account;
119
+ code: string;
120
+ args: CalldataEncodable[];
121
+ leader_only?: boolean;
122
+ }) => Promise<any>;
123
+ getTransaction: (args: {
124
+ hash: TransactionHash;
125
+ }) => Promise<GenLayerTransaction>;
126
+ getCurrentNonce: (args: {
127
+ address: string;
128
+ }) => Promise<number>;
129
+ waitForTransactionReceipt: (args: {
130
+ hash: TransactionHash;
131
+ status?: TransactionStatus;
132
+ }) => Promise<GenLayerTransaction>;
133
+ getContractSchema: (address: string) => Promise<ContractSchema>;
134
+ getContractSchemaForCode: (contractCode: string) => Promise<ContractSchema>;
135
+ };
136
+
137
+ export { type Address$1 as Address, type CalldataEncodable, type ContractSchema, type GenLayerClient, type GenLayerMethod, type GenLayerTransaction, type MethodDescription, SimulatorChain, type TransactionData, type TransactionDataElement, type TransactionHash, TransactionStatus };
@@ -1,7 +1,58 @@
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-CRRMg5Gh.js';
2
- export { S as SimulatorChain } from '../chains-BV4Glo-M.js';
1
+ import { S as SimulatorChain } from '../chains-BV4Glo-M.js';
2
+ import { Client, Transport, PublicActions, Account } from 'viem';
3
3
  export { Account } from 'viem';
4
4
 
5
+ type Address$1 = `0x${string}` & {
6
+ length: 42;
7
+ };
8
+
9
+ declare class Address {
10
+ bytes: Uint8Array;
11
+ constructor(addr: Uint8Array);
12
+ }
13
+ type CalldataEncodable = null | boolean | Address | number | bigint | string | Uint8Array | Address | Array<CalldataEncodable> | Map<string, CalldataEncodable> | {
14
+ [key: string]: CalldataEncodable;
15
+ };
16
+ type MethodDescription = {
17
+ method: string;
18
+ args: Array<CalldataEncodable>;
19
+ };
20
+ type TransactionData = {
21
+ method: string;
22
+ args: CalldataEncodable[];
23
+ };
24
+
25
+ type TransactionHash = `0x${string}` & {
26
+ length: 66;
27
+ };
28
+ declare enum TransactionStatus {
29
+ PENDING = "PENDING",
30
+ CANCELED = "CANCELED",
31
+ PROPOSING = "PROPOSING",
32
+ COMMITTING = "COMMITTING",
33
+ REVEALING = "REVEALING",
34
+ ACCEPTED = "ACCEPTED",
35
+ FINALIZED = "FINALIZED",
36
+ UNDETERMINED = "UNDETERMINED"
37
+ }
38
+ type GenLayerTransaction = {
39
+ hash: TransactionHash;
40
+ status: TransactionStatus;
41
+ from_address?: string;
42
+ to_address?: string;
43
+ data?: Record<string, unknown>;
44
+ consensus_data?: Record<string, unknown>;
45
+ nonce?: number;
46
+ value?: number;
47
+ type?: number;
48
+ gaslimit?: bigint;
49
+ created_at?: Date;
50
+ r?: number;
51
+ s?: number;
52
+ v?: number;
53
+ };
54
+ type TransactionDataElement = string | number | bigint | boolean | Uint8Array;
55
+
5
56
  type ContractSchema = {
6
57
  abi: Array<{
7
58
  inputs?: Array<{
@@ -18,4 +69,69 @@ type ContractSchema = {
18
69
  class: string;
19
70
  };
20
71
 
21
- export type { ContractSchema };
72
+ type GenLayerMethod = {
73
+ method: "sim_fundAccount";
74
+ params: [address: string, amount: number];
75
+ } | {
76
+ method: "eth_getTransactionByHash";
77
+ params: [hash: TransactionHash];
78
+ } | {
79
+ method: "eth_call";
80
+ params: [requestParams: any, blockNumberOrHash: string];
81
+ } | {
82
+ method: "eth_sedRawTransaction";
83
+ params: [signedTransaction: string];
84
+ } | {
85
+ method: "gen_getContractSchema";
86
+ params: [address: string];
87
+ } | {
88
+ method: "gen_getContractSchemaForCode";
89
+ params: [contractCode: string];
90
+ } | {
91
+ method: "sim_getTransactionsForAddress";
92
+ params: [address: string, filter?: "all" | "from" | "to"];
93
+ } | {
94
+ method: "eth_getTransactionCount";
95
+ params: [address: string];
96
+ };
97
+ type GenLayerClient<TSimulatorChain extends SimulatorChain> = Omit<Client<Transport, TSimulatorChain>, "transport" | "getTransaction" | "readContract"> & Omit<PublicActions<Transport, TSimulatorChain>, "readContract" | "getTransaction"> & {
98
+ request: Client<Transport, TSimulatorChain>["request"] & {
99
+ <TMethod extends GenLayerMethod>(args: Extract<GenLayerMethod, {
100
+ method: TMethod["method"];
101
+ }>): Promise<unknown>;
102
+ };
103
+ readContract: (args: {
104
+ account?: Account;
105
+ address: Address$1;
106
+ functionName: string;
107
+ args: CalldataEncodable[];
108
+ }) => Promise<any>;
109
+ writeContract: (args: {
110
+ account?: Account;
111
+ address: Address$1;
112
+ functionName: string;
113
+ args: CalldataEncodable[];
114
+ value: bigint;
115
+ leader_only?: boolean;
116
+ }) => Promise<any>;
117
+ deployContract: (args: {
118
+ account?: Account;
119
+ code: string;
120
+ args: CalldataEncodable[];
121
+ leader_only?: boolean;
122
+ }) => Promise<any>;
123
+ getTransaction: (args: {
124
+ hash: TransactionHash;
125
+ }) => Promise<GenLayerTransaction>;
126
+ getCurrentNonce: (args: {
127
+ address: string;
128
+ }) => Promise<number>;
129
+ waitForTransactionReceipt: (args: {
130
+ hash: TransactionHash;
131
+ status?: TransactionStatus;
132
+ }) => Promise<GenLayerTransaction>;
133
+ getContractSchema: (address: string) => Promise<ContractSchema>;
134
+ getContractSchemaForCode: (contractCode: string) => Promise<ContractSchema>;
135
+ };
136
+
137
+ export { type Address$1 as Address, type CalldataEncodable, type ContractSchema, type GenLayerClient, type GenLayerMethod, type GenLayerTransaction, type MethodDescription, SimulatorChain, type TransactionData, type TransactionDataElement, type TransactionHash, TransactionStatus };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "genlayer-js",
3
3
  "type": "module",
4
- "version": "0.3.4",
4
+ "version": "0.4.1",
5
5
  "description": "GenLayer JavaScript SDK",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -48,9 +48,11 @@ export const overrideContractActions = (client: GenLayerClient<SimulatorChain>)
48
48
  functionName: string;
49
49
  args: CalldataEncodable[];
50
50
  value: bigint;
51
+ leader_only?: boolean;
51
52
  }): Promise<any> => {
52
- const {account, address, functionName, args: params, value = 0n} = args;
53
- const encodedData = encodeAndSerialize({method: functionName, args: params});
53
+ const {account, address, functionName, args: params, value = 0n, leader_only = false} = args;
54
+ const data = [encode({method: functionName, args: params}), leader_only];
55
+ const serializedData = serialize(data);
54
56
 
55
57
  const senderAccount = account || client.account;
56
58
  if (!senderAccount) {
@@ -66,7 +68,7 @@ export const overrideContractActions = (client: GenLayerClient<SimulatorChain>)
66
68
  const nonce = await client.getCurrentNonce({address: senderAccount.address});
67
69
 
68
70
  const signedTransaction = await senderAccount.signTransaction({
69
- data: encodedData,
71
+ data: serializedData,
70
72
  to: address,
71
73
  value,
72
74
  type: "legacy",
@@ -79,9 +81,14 @@ export const overrideContractActions = (client: GenLayerClient<SimulatorChain>)
79
81
  return result;
80
82
  };
81
83
 
82
- client.deployContract = async (args: {account?: Account; code: string; args: CalldataEncodable[]}) => {
83
- const {account, code, args: constructorArgs} = args;
84
- const data = [code, encode({args: constructorArgs})];
84
+ client.deployContract = async (args: {
85
+ account?: Account;
86
+ code: string;
87
+ args: CalldataEncodable[];
88
+ leader_only?: boolean;
89
+ }) => {
90
+ const {account, code, args: constructorArgs, leader_only = false} = args;
91
+ const data = [code, encode({args: constructorArgs}), leader_only];
85
92
  const serializedData = serialize(data);
86
93
 
87
94
  const senderAccount = account || client.account;
@@ -3,6 +3,7 @@ import {GenLayerTransaction, TransactionHash, TransactionStatus} from "./transac
3
3
  import {SimulatorChain} from "./chains";
4
4
  import {Address, Account} from "./accounts";
5
5
  import {CalldataEncodable} from "./calldata";
6
+ import {ContractSchema} from "./contracts";
6
7
 
7
8
  export type GenLayerMethod =
8
9
  | {method: "sim_fundAccount"; params: [address: string, amount: number]}
@@ -42,12 +43,20 @@ export type GenLayerClient<TSimulatorChain extends SimulatorChain> = Omit<
42
43
  functionName: string;
43
44
  args: CalldataEncodable[];
44
45
  value: bigint;
46
+ leader_only?: boolean;
47
+ }) => Promise<any>;
48
+ deployContract: (args: {
49
+ account?: Account;
50
+ code: string;
51
+ args: CalldataEncodable[];
52
+ leader_only?: boolean;
45
53
  }) => Promise<any>;
46
- deployContract: (args: {account?: Account; code: string; args: CalldataEncodable[]}) => Promise<any>;
47
54
  getTransaction: (args: {hash: TransactionHash}) => Promise<GenLayerTransaction>;
48
55
  getCurrentNonce: (args: {address: string}) => Promise<number>;
49
56
  waitForTransactionReceipt: (args: {
50
57
  hash: TransactionHash;
51
58
  status?: TransactionStatus;
52
59
  }) => Promise<GenLayerTransaction>;
60
+ getContractSchema: (address: string) => Promise<ContractSchema>;
61
+ getContractSchemaForCode: (contractCode: string) => Promise<ContractSchema>;
53
62
  };
@@ -8,26 +8,32 @@ test("type checks", () => {
8
8
  account: createAccount(generatePrivateKey()),
9
9
  });
10
10
 
11
+ const exampleAddress = "0x1234567890123456789012345678901234567890";
12
+
11
13
  // This should fail type checking - "whatever" is not a valid filter
12
14
  // @ts-expect-error "whatever" is not a valid filter type
13
15
  void client.request({
14
16
  method: "sim_getTransactionsForAddress",
15
- params: ["0x1234567890123456789012345678901234567890", "whatever"],
17
+ params: [exampleAddress, "whatever"],
16
18
  });
17
19
 
18
20
  // This should pass type checking - "all", "to" and "from" are valid filters
19
21
  void client.request({
20
22
  method: "sim_getTransactionsForAddress",
21
- params: ["0x1234567890123456789012345678901234567890", "all"],
23
+ params: [exampleAddress, "all"],
22
24
  });
23
25
 
24
26
  void client.request({
25
27
  method: "sim_getTransactionsForAddress",
26
- params: ["0x1234567890123456789012345678901234567890", "to"],
28
+ params: [exampleAddress, "to"],
27
29
  });
28
30
 
29
31
  void client.request({
30
32
  method: "sim_getTransactionsForAddress",
31
- params: ["0x1234567890123456789012345678901234567890", "from"],
33
+ params: [exampleAddress, "from"],
32
34
  });
35
+
36
+ void client.getContractSchema(exampleAddress);
37
+
38
+ void client.getContractSchemaForCode("class SomeContract...");
33
39
  });
@@ -1,116 +0,0 @@
1
- import { Client, Transport, PublicActions, Account } from 'viem';
2
- import { S as SimulatorChain } from './chains-BV4Glo-M.cjs';
3
-
4
- type Address$1 = `0x${string}` & {
5
- length: 42;
6
- };
7
-
8
- declare class Address {
9
- bytes: Uint8Array;
10
- constructor(addr: Uint8Array);
11
- }
12
- type CalldataEncodable = null | boolean | Address | number | bigint | string | Uint8Array | Address | Array<CalldataEncodable> | Map<string, CalldataEncodable> | {
13
- [key: string]: CalldataEncodable;
14
- };
15
- type MethodDescription = {
16
- method: string;
17
- args: Array<CalldataEncodable>;
18
- };
19
- type TransactionData = {
20
- method: string;
21
- args: CalldataEncodable[];
22
- };
23
-
24
- type TransactionHash = `0x${string}` & {
25
- length: 66;
26
- };
27
- declare enum TransactionStatus {
28
- PENDING = "PENDING",
29
- CANCELED = "CANCELED",
30
- PROPOSING = "PROPOSING",
31
- COMMITTING = "COMMITTING",
32
- REVEALING = "REVEALING",
33
- ACCEPTED = "ACCEPTED",
34
- FINALIZED = "FINALIZED",
35
- UNDETERMINED = "UNDETERMINED"
36
- }
37
- type GenLayerTransaction = {
38
- hash: TransactionHash;
39
- status: TransactionStatus;
40
- from_address?: string;
41
- to_address?: string;
42
- data?: Record<string, unknown>;
43
- consensus_data?: Record<string, unknown>;
44
- nonce?: number;
45
- value?: number;
46
- type?: number;
47
- gaslimit?: bigint;
48
- created_at?: Date;
49
- r?: number;
50
- s?: number;
51
- v?: number;
52
- };
53
- type TransactionDataElement = string | number | bigint | boolean | Uint8Array;
54
-
55
- type GenLayerMethod = {
56
- method: "sim_fundAccount";
57
- params: [address: string, amount: number];
58
- } | {
59
- method: "eth_getTransactionByHash";
60
- params: [hash: TransactionHash];
61
- } | {
62
- method: "eth_call";
63
- params: [requestParams: any, blockNumberOrHash: string];
64
- } | {
65
- method: "eth_sedRawTransaction";
66
- params: [signedTransaction: string];
67
- } | {
68
- method: "gen_getContractSchema";
69
- params: [address: string];
70
- } | {
71
- method: "gen_getContractSchemaForCode";
72
- params: [contractCode: string];
73
- } | {
74
- method: "sim_getTransactionsForAddress";
75
- params: [address: string, filter?: "all" | "from" | "to"];
76
- } | {
77
- method: "eth_getTransactionCount";
78
- params: [address: string];
79
- };
80
- type GenLayerClient<TSimulatorChain extends SimulatorChain> = Omit<Client<Transport, TSimulatorChain>, "transport" | "getTransaction" | "readContract"> & Omit<PublicActions<Transport, TSimulatorChain>, "readContract" | "getTransaction"> & {
81
- request: Client<Transport, TSimulatorChain>["request"] & {
82
- <TMethod extends GenLayerMethod>(args: Extract<GenLayerMethod, {
83
- method: TMethod["method"];
84
- }>): Promise<unknown>;
85
- };
86
- readContract: (args: {
87
- account?: Account;
88
- address: Address$1;
89
- functionName: string;
90
- args: CalldataEncodable[];
91
- }) => Promise<any>;
92
- writeContract: (args: {
93
- account?: Account;
94
- address: Address$1;
95
- functionName: string;
96
- args: CalldataEncodable[];
97
- value: bigint;
98
- }) => Promise<any>;
99
- deployContract: (args: {
100
- account?: Account;
101
- code: string;
102
- args: CalldataEncodable[];
103
- }) => Promise<any>;
104
- getTransaction: (args: {
105
- hash: TransactionHash;
106
- }) => Promise<GenLayerTransaction>;
107
- getCurrentNonce: (args: {
108
- address: string;
109
- }) => Promise<number>;
110
- waitForTransactionReceipt: (args: {
111
- hash: TransactionHash;
112
- status?: TransactionStatus;
113
- }) => Promise<GenLayerTransaction>;
114
- };
115
-
116
- 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,116 +0,0 @@
1
- import { Client, Transport, PublicActions, Account } from 'viem';
2
- import { S as SimulatorChain } from './chains-BV4Glo-M.js';
3
-
4
- type Address$1 = `0x${string}` & {
5
- length: 42;
6
- };
7
-
8
- declare class Address {
9
- bytes: Uint8Array;
10
- constructor(addr: Uint8Array);
11
- }
12
- type CalldataEncodable = null | boolean | Address | number | bigint | string | Uint8Array | Address | Array<CalldataEncodable> | Map<string, CalldataEncodable> | {
13
- [key: string]: CalldataEncodable;
14
- };
15
- type MethodDescription = {
16
- method: string;
17
- args: Array<CalldataEncodable>;
18
- };
19
- type TransactionData = {
20
- method: string;
21
- args: CalldataEncodable[];
22
- };
23
-
24
- type TransactionHash = `0x${string}` & {
25
- length: 66;
26
- };
27
- declare enum TransactionStatus {
28
- PENDING = "PENDING",
29
- CANCELED = "CANCELED",
30
- PROPOSING = "PROPOSING",
31
- COMMITTING = "COMMITTING",
32
- REVEALING = "REVEALING",
33
- ACCEPTED = "ACCEPTED",
34
- FINALIZED = "FINALIZED",
35
- UNDETERMINED = "UNDETERMINED"
36
- }
37
- type GenLayerTransaction = {
38
- hash: TransactionHash;
39
- status: TransactionStatus;
40
- from_address?: string;
41
- to_address?: string;
42
- data?: Record<string, unknown>;
43
- consensus_data?: Record<string, unknown>;
44
- nonce?: number;
45
- value?: number;
46
- type?: number;
47
- gaslimit?: bigint;
48
- created_at?: Date;
49
- r?: number;
50
- s?: number;
51
- v?: number;
52
- };
53
- type TransactionDataElement = string | number | bigint | boolean | Uint8Array;
54
-
55
- type GenLayerMethod = {
56
- method: "sim_fundAccount";
57
- params: [address: string, amount: number];
58
- } | {
59
- method: "eth_getTransactionByHash";
60
- params: [hash: TransactionHash];
61
- } | {
62
- method: "eth_call";
63
- params: [requestParams: any, blockNumberOrHash: string];
64
- } | {
65
- method: "eth_sedRawTransaction";
66
- params: [signedTransaction: string];
67
- } | {
68
- method: "gen_getContractSchema";
69
- params: [address: string];
70
- } | {
71
- method: "gen_getContractSchemaForCode";
72
- params: [contractCode: string];
73
- } | {
74
- method: "sim_getTransactionsForAddress";
75
- params: [address: string, filter?: "all" | "from" | "to"];
76
- } | {
77
- method: "eth_getTransactionCount";
78
- params: [address: string];
79
- };
80
- type GenLayerClient<TSimulatorChain extends SimulatorChain> = Omit<Client<Transport, TSimulatorChain>, "transport" | "getTransaction" | "readContract"> & Omit<PublicActions<Transport, TSimulatorChain>, "readContract" | "getTransaction"> & {
81
- request: Client<Transport, TSimulatorChain>["request"] & {
82
- <TMethod extends GenLayerMethod>(args: Extract<GenLayerMethod, {
83
- method: TMethod["method"];
84
- }>): Promise<unknown>;
85
- };
86
- readContract: (args: {
87
- account?: Account;
88
- address: Address$1;
89
- functionName: string;
90
- args: CalldataEncodable[];
91
- }) => Promise<any>;
92
- writeContract: (args: {
93
- account?: Account;
94
- address: Address$1;
95
- functionName: string;
96
- args: CalldataEncodable[];
97
- value: bigint;
98
- }) => Promise<any>;
99
- deployContract: (args: {
100
- account?: Account;
101
- code: string;
102
- args: CalldataEncodable[];
103
- }) => Promise<any>;
104
- getTransaction: (args: {
105
- hash: TransactionHash;
106
- }) => Promise<GenLayerTransaction>;
107
- getCurrentNonce: (args: {
108
- address: string;
109
- }) => Promise<number>;
110
- waitForTransactionReceipt: (args: {
111
- hash: TransactionHash;
112
- status?: TransactionStatus;
113
- }) => Promise<GenLayerTransaction>;
114
- };
115
-
116
- 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 };