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 +2 -0
- package/dist/{clients-CJ820ePR.d.ts → clients-CD8MilSg.d.ts} +9 -5
- package/dist/{clients-BamlAEcy.d.cts → clients-puliY5_u.d.cts} +9 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/contracts/actions.ts +3 -3
- package/src/types/clients.ts +29 -24
package/CHANGELOG.md
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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-
|
|
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-
|
|
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';
|
package/dist/types/index.d.cts
CHANGED
|
@@ -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-
|
|
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
|
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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-
|
|
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
package/src/contracts/actions.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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);
|
package/src/types/clients.ts
CHANGED
|
@@ -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
|
-
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
};
|