genlayer-js 0.3.4 → 0.4.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 +7 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/types/index.d.cts +117 -3
- package/dist/types/index.d.ts +117 -3
- package/package.json +1 -1
- package/src/types/clients.ts +3 -0
- package/tests/client.test-d.ts +10 -4
- package/dist/clients-B5D5440g.d.cts +0 -116
- package/dist/clients-CRRMg5Gh.d.ts +0 -116
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
## 0.4.0 (2024-11-14)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add contract schema methods ([#26](https://github.com/yeagerai/genlayer-js/issues/26)) ([7dc726f](https://github.com/yeagerai/genlayer-js/commit/7dc726fa4fc8769feaec07a50149956d7c2a2035))
|
|
9
|
+
|
|
3
10
|
## 0.3.4 (2024-11-14)
|
|
4
11
|
|
|
5
12
|
|
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 {
|
|
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 {
|
|
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/types/index.d.cts
CHANGED
|
@@ -1,7 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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,67 @@ type ContractSchema = {
|
|
|
18
69
|
class: string;
|
|
19
70
|
};
|
|
20
71
|
|
|
21
|
-
|
|
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
|
+
}) => Promise<any>;
|
|
116
|
+
deployContract: (args: {
|
|
117
|
+
account?: Account;
|
|
118
|
+
code: string;
|
|
119
|
+
args: CalldataEncodable[];
|
|
120
|
+
}) => Promise<any>;
|
|
121
|
+
getTransaction: (args: {
|
|
122
|
+
hash: TransactionHash;
|
|
123
|
+
}) => Promise<GenLayerTransaction>;
|
|
124
|
+
getCurrentNonce: (args: {
|
|
125
|
+
address: string;
|
|
126
|
+
}) => Promise<number>;
|
|
127
|
+
waitForTransactionReceipt: (args: {
|
|
128
|
+
hash: TransactionHash;
|
|
129
|
+
status?: TransactionStatus;
|
|
130
|
+
}) => Promise<GenLayerTransaction>;
|
|
131
|
+
getContractSchema: (address: string) => Promise<ContractSchema>;
|
|
132
|
+
getContractSchemaForCode: (contractCode: string) => Promise<ContractSchema>;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
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/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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,67 @@ type ContractSchema = {
|
|
|
18
69
|
class: string;
|
|
19
70
|
};
|
|
20
71
|
|
|
21
|
-
|
|
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
|
+
}) => Promise<any>;
|
|
116
|
+
deployContract: (args: {
|
|
117
|
+
account?: Account;
|
|
118
|
+
code: string;
|
|
119
|
+
args: CalldataEncodable[];
|
|
120
|
+
}) => Promise<any>;
|
|
121
|
+
getTransaction: (args: {
|
|
122
|
+
hash: TransactionHash;
|
|
123
|
+
}) => Promise<GenLayerTransaction>;
|
|
124
|
+
getCurrentNonce: (args: {
|
|
125
|
+
address: string;
|
|
126
|
+
}) => Promise<number>;
|
|
127
|
+
waitForTransactionReceipt: (args: {
|
|
128
|
+
hash: TransactionHash;
|
|
129
|
+
status?: TransactionStatus;
|
|
130
|
+
}) => Promise<GenLayerTransaction>;
|
|
131
|
+
getContractSchema: (address: string) => Promise<ContractSchema>;
|
|
132
|
+
getContractSchemaForCode: (contractCode: string) => Promise<ContractSchema>;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
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
package/src/types/clients.ts
CHANGED
|
@@ -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]}
|
|
@@ -50,4 +51,6 @@ export type GenLayerClient<TSimulatorChain extends SimulatorChain> = Omit<
|
|
|
50
51
|
hash: TransactionHash;
|
|
51
52
|
status?: TransactionStatus;
|
|
52
53
|
}) => Promise<GenLayerTransaction>;
|
|
54
|
+
getContractSchema: (address: string) => Promise<ContractSchema>;
|
|
55
|
+
getContractSchemaForCode: (contractCode: string) => Promise<ContractSchema>;
|
|
53
56
|
};
|
package/tests/client.test-d.ts
CHANGED
|
@@ -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: [
|
|
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: [
|
|
23
|
+
params: [exampleAddress, "all"],
|
|
22
24
|
});
|
|
23
25
|
|
|
24
26
|
void client.request({
|
|
25
27
|
method: "sim_getTransactionsForAddress",
|
|
26
|
-
params: [
|
|
28
|
+
params: [exampleAddress, "to"],
|
|
27
29
|
});
|
|
28
30
|
|
|
29
31
|
void client.request({
|
|
30
32
|
method: "sim_getTransactionsForAddress",
|
|
31
|
-
params: [
|
|
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 };
|