genlayer-js 0.9.0 → 0.9.2
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 +4 -0
- package/dist/chains/index.cjs +2 -2
- package/dist/chains/index.d.cts +2 -2
- package/dist/chains/index.d.ts +2 -2
- package/dist/chains/index.js +3 -3
- package/dist/chains-BYSCF33g.d.cts +18 -0
- package/dist/chains-BYSCF33g.d.ts +18 -0
- package/dist/chunk-4FVQ3G7J.js +8039 -0
- package/dist/chunk-GACCNOPJ.js +138 -0
- package/dist/chunk-H4ZYXVV2.cjs +138 -0
- package/dist/chunk-SMCXL465.cjs +8039 -0
- package/dist/index-B52a6DSr.d.cts +13 -0
- package/dist/index-B_gpaVzJ.d.cts +374 -0
- package/dist/index-DNvW8slT.d.ts +13 -0
- package/dist/index-to6d0Hzj.d.ts +374 -0
- package/dist/index.cjs +4508 -290
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +4507 -289
- package/dist/types/index.cjs +20 -2
- package/dist/types/index.d.cts +3 -3
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.js +21 -3
- package/package.json +2 -2
- package/src/accounts/IAccountActions.ts +2 -2
- package/src/accounts/actions.ts +10 -4
- package/src/chains/actions.ts +5 -5
- package/src/chains/index.ts +1 -1
- package/src/chains/localnet.ts +3989 -5
- package/src/chains/studionet.ts +4015 -0
- package/src/chains/testnetAsimov.ts +4015 -0
- package/src/client/client.ts +64 -21
- package/src/contracts/actions.ts +198 -127
- package/src/transactions/actions.ts +158 -23
- package/src/types/accounts.ts +1 -2
- package/src/types/chains.ts +8 -2
- package/src/types/clients.ts +14 -13
- package/src/types/network.ts +1 -1
- package/src/types/transactions.ts +254 -8
- package/src/wallet/actions.ts +4 -4
- package/src/wallet/connect.ts +18 -16
- package/tests/client.test.ts +105 -45
- package/dist/chains-C5PI_Nr_.d.cts +0 -13
- package/dist/chains-C5PI_Nr_.d.ts +0 -13
- package/dist/chunk-I6HC44KD.cjs +0 -72
- package/dist/chunk-K72OSU5N.js +0 -28
- package/dist/chunk-WEXFFND6.js +0 -72
- package/dist/chunk-YDFRDDP5.cjs +0 -28
- package/dist/index-B8E0qiOq.d.cts +0 -13
- package/dist/index-BCbofn6t.d.cts +0 -188
- package/dist/index-Ctmshvtv.d.ts +0 -188
- package/dist/index-ZoW0HQ_m.d.ts +0 -13
- package/src/chains/simulator.ts +0 -30
package/src/wallet/connect.ts
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import {localnet} from "@/chains/localnet";
|
|
2
|
+
import {studionet} from "@/chains/studionet";
|
|
3
|
+
import {testnetAsimov} from "@/chains/testnetAsimov";
|
|
4
|
+
import {GenLayerClient, GenLayerChain} from "@/types";
|
|
5
|
+
import {Network} from "@/types/network";
|
|
6
|
+
import {SnapSource} from "@/types/snapSource";
|
|
7
|
+
import {snapID} from "@/config/snapID";
|
|
6
8
|
|
|
7
9
|
const networks = {
|
|
8
10
|
localnet,
|
|
11
|
+
studionet,
|
|
12
|
+
testnetAsimov,
|
|
9
13
|
};
|
|
10
14
|
|
|
11
15
|
export const connect = async (
|
|
12
|
-
client: GenLayerClient<
|
|
13
|
-
network: Network = "
|
|
14
|
-
snapSource: SnapSource =
|
|
16
|
+
client: GenLayerClient<GenLayerChain>,
|
|
17
|
+
network: Network = "studionet",
|
|
18
|
+
snapSource: SnapSource = "npm",
|
|
15
19
|
): Promise<void> => {
|
|
16
20
|
if (!window.ethereum) {
|
|
17
21
|
throw new Error("MetaMask is not installed.");
|
|
18
22
|
}
|
|
19
|
-
if (network === "
|
|
23
|
+
if (network === "mainnet") {
|
|
20
24
|
throw new Error(`${network} is not available yet. Please use localnet.`);
|
|
21
25
|
}
|
|
22
26
|
|
|
@@ -34,7 +38,7 @@ export const connect = async (
|
|
|
34
38
|
blockExplorerUrls: [selectedNetwork.blockExplorers?.default.url],
|
|
35
39
|
};
|
|
36
40
|
|
|
37
|
-
const currentChainId = await window.ethereum.request({
|
|
41
|
+
const currentChainId = await window.ethereum.request({method: "eth_chainId"});
|
|
38
42
|
if (currentChainId !== chainIdHex) {
|
|
39
43
|
await window.ethereum.request({
|
|
40
44
|
method: "wallet_addEthereumChain",
|
|
@@ -42,15 +46,13 @@ export const connect = async (
|
|
|
42
46
|
});
|
|
43
47
|
await window.ethereum.request({
|
|
44
48
|
method: "wallet_switchEthereumChain",
|
|
45
|
-
params: [{
|
|
49
|
+
params: [{chainId: chainIdHex}],
|
|
46
50
|
});
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
const id = snapSource ===
|
|
50
|
-
const installedSnaps: any = await window.ethereum.request({
|
|
51
|
-
const isGenLayerSnapInstalled = Object.values(installedSnaps).some(
|
|
52
|
-
(snap: any) => snap.id === id
|
|
53
|
-
);
|
|
53
|
+
const id = snapSource === "local" ? snapID.local : snapID.npm;
|
|
54
|
+
const installedSnaps: any = await window.ethereum.request({method: "wallet_getSnaps"});
|
|
55
|
+
const isGenLayerSnapInstalled = Object.values(installedSnaps).some((snap: any) => snap.id === id);
|
|
54
56
|
|
|
55
57
|
if (!isGenLayerSnapInstalled) {
|
|
56
58
|
await window.ethereum.request({
|
package/tests/client.test.ts
CHANGED
|
@@ -6,6 +6,13 @@ import {createAccount, generatePrivateKey} from "../src/accounts/account";
|
|
|
6
6
|
import {vi} from "vitest";
|
|
7
7
|
import {TransactionStatus} from "../src/types/transactions";
|
|
8
8
|
|
|
9
|
+
// Setup fetch mock
|
|
10
|
+
const mockFetch = vi.fn();
|
|
11
|
+
vi.stubGlobal("fetch", mockFetch);
|
|
12
|
+
|
|
13
|
+
// Store for gen_call parameters received by mockFetch
|
|
14
|
+
let lastGenCallParams: any = null;
|
|
15
|
+
|
|
9
16
|
describe("Client Creation", () => {
|
|
10
17
|
it("should create a client for the localnet", () => {
|
|
11
18
|
const client = createClient({chain: localnet});
|
|
@@ -15,6 +22,65 @@ describe("Client Creation", () => {
|
|
|
15
22
|
});
|
|
16
23
|
|
|
17
24
|
describe("Client Overrides", () => {
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
mockFetch.mockReset();
|
|
27
|
+
lastGenCallParams = null; // Reset for each test
|
|
28
|
+
|
|
29
|
+
mockFetch.mockImplementation(async (url, options) => {
|
|
30
|
+
let body = {};
|
|
31
|
+
const bodyString = typeof options?.body === "string" ? options.body : null;
|
|
32
|
+
|
|
33
|
+
if (bodyString) {
|
|
34
|
+
try {
|
|
35
|
+
body = JSON.parse(bodyString);
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.error("[TESTS] mockFetch: Failed to parse bodyString:", bodyString, "Error:", e);
|
|
38
|
+
// Return a generic error if body parsing fails
|
|
39
|
+
return {
|
|
40
|
+
ok: false,
|
|
41
|
+
status: 500,
|
|
42
|
+
json: async () => ({error: {message: "mockFetch body parse error"}}),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const method = (body as any).method;
|
|
48
|
+
// console.log(`[TESTS] mockFetch called: URL=${url}, Method=${method}, Body=`, body); // Optional: keep for debugging
|
|
49
|
+
|
|
50
|
+
if (method === "sim_getConsensusContract") {
|
|
51
|
+
// console.log("[TESTS] mockFetch: Handling sim_getConsensusContract");
|
|
52
|
+
return {
|
|
53
|
+
ok: true,
|
|
54
|
+
json: async () => ({
|
|
55
|
+
result: {
|
|
56
|
+
address: "0x0000000000000000000000000000000000000001",
|
|
57
|
+
abi: [],
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
};
|
|
61
|
+
} else if (method === "gen_call") {
|
|
62
|
+
// console.log("[TESTS] mockFetch: Handling gen_call");
|
|
63
|
+
lastGenCallParams = (body as any).params; // Store the params for gen_call
|
|
64
|
+
return {
|
|
65
|
+
ok: true,
|
|
66
|
+
json: async () => ({result: "0"}),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
console.warn(`[TESTS] mockFetch: Unhandled method - URL=${url}, Method=${method}, Body=`, body);
|
|
71
|
+
return {
|
|
72
|
+
ok: false,
|
|
73
|
+
status: 404, // Not Found for unhandled methods
|
|
74
|
+
json: async () => ({error: {message: `Unexpected fetch mock call to method: ${method}`}}),
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
afterEach(() => {
|
|
80
|
+
// Restore any spies if they weren't restored in tests
|
|
81
|
+
vi.restoreAllMocks();
|
|
82
|
+
});
|
|
83
|
+
|
|
18
84
|
it("should default to client account if no account is provided", async () => {
|
|
19
85
|
const account = createAccount(generatePrivateKey());
|
|
20
86
|
const client = createClient({
|
|
@@ -22,41 +88,37 @@ describe("Client Overrides", () => {
|
|
|
22
88
|
account: account,
|
|
23
89
|
});
|
|
24
90
|
|
|
25
|
-
//
|
|
26
|
-
vi.spyOn(client, "request").mockResolvedValue("0x00");
|
|
91
|
+
// const requestSpy = vi.spyOn(client, "request"); // Removed spy
|
|
27
92
|
|
|
28
93
|
const contractAddress = "0x1234567890123456789012345678901234567890";
|
|
29
94
|
await client.readContract({
|
|
30
95
|
address: contractAddress as Address,
|
|
31
96
|
functionName: "testFunction",
|
|
32
97
|
args: ["arg1", "arg2"],
|
|
33
|
-
stateStatus: TransactionStatus.ACCEPTED,
|
|
98
|
+
stateStatus: TransactionStatus.ACCEPTED, // Kept as is, matches type, ignored by current gen_call impl.
|
|
34
99
|
});
|
|
35
100
|
|
|
36
|
-
expect(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
],
|
|
46
|
-
});
|
|
101
|
+
expect(lastGenCallParams).toEqual([
|
|
102
|
+
{
|
|
103
|
+
type: "read",
|
|
104
|
+
to: contractAddress,
|
|
105
|
+
from: account.address,
|
|
106
|
+
data: expect.any(String), // The data is complex, checking type is often sufficient
|
|
107
|
+
transaction_hash_variant: "latest-final",
|
|
108
|
+
},
|
|
109
|
+
]);
|
|
47
110
|
});
|
|
48
111
|
|
|
49
112
|
it("should override client account if account is provided", async () => {
|
|
50
|
-
const
|
|
113
|
+
const clientInternalAccount = createAccount(generatePrivateKey()); // Renamed for clarity
|
|
51
114
|
const client = createClient({
|
|
52
115
|
chain: localnet,
|
|
53
|
-
account,
|
|
116
|
+
account: clientInternalAccount,
|
|
54
117
|
});
|
|
55
118
|
|
|
56
119
|
const overrideAccount = createAccount(generatePrivateKey());
|
|
57
120
|
|
|
58
|
-
//
|
|
59
|
-
vi.spyOn(client, "request").mockResolvedValue("0x00");
|
|
121
|
+
// const requestSpy = vi.spyOn(client, "request"); // Removed spy
|
|
60
122
|
|
|
61
123
|
const contractAddress = "0x1234567890123456789012345678901234567890";
|
|
62
124
|
await client.readContract({
|
|
@@ -67,45 +129,43 @@ describe("Client Overrides", () => {
|
|
|
67
129
|
stateStatus: TransactionStatus.ACCEPTED,
|
|
68
130
|
});
|
|
69
131
|
|
|
70
|
-
expect(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
],
|
|
80
|
-
});
|
|
132
|
+
expect(lastGenCallParams).toEqual([
|
|
133
|
+
{
|
|
134
|
+
type: "read",
|
|
135
|
+
to: contractAddress,
|
|
136
|
+
from: overrideAccount.address,
|
|
137
|
+
data: expect.any(String),
|
|
138
|
+
transaction_hash_variant: "latest-final",
|
|
139
|
+
},
|
|
140
|
+
]);
|
|
81
141
|
});
|
|
82
|
-
|
|
83
|
-
|
|
142
|
+
|
|
143
|
+
it("should use client account if account is an address string and no override", async () => {
|
|
144
|
+
// Clarified title
|
|
145
|
+
const accountAddressString = "0x65e03a3e916CF1dC92d3C8E8186a89CfAB0D2bc2";
|
|
84
146
|
const client = createClient({
|
|
85
147
|
chain: localnet,
|
|
86
|
-
account,
|
|
148
|
+
account: accountAddressString, // Client's account is an address string
|
|
87
149
|
});
|
|
88
150
|
|
|
89
|
-
//
|
|
90
|
-
vi.spyOn(client, "request").mockResolvedValue("0x00");
|
|
151
|
+
// const requestSpy = vi.spyOn(client, "request"); // Removed spy
|
|
91
152
|
|
|
92
153
|
const contractAddress = "0x1234567890123456789012345678901234567890";
|
|
93
154
|
await client.readContract({
|
|
94
155
|
address: contractAddress as Address,
|
|
95
156
|
functionName: "testFunction",
|
|
96
157
|
args: ["arg1", "arg2"],
|
|
158
|
+
// No stateStatus, no account override in this specific call to readContract
|
|
97
159
|
});
|
|
98
160
|
|
|
99
|
-
expect(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
],
|
|
109
|
-
});
|
|
161
|
+
expect(lastGenCallParams).toEqual([
|
|
162
|
+
{
|
|
163
|
+
type: "read",
|
|
164
|
+
to: contractAddress,
|
|
165
|
+
from: accountAddressString, // Expecting the address string directly
|
|
166
|
+
data: expect.any(String),
|
|
167
|
+
transaction_hash_variant: "latest-final",
|
|
168
|
+
},
|
|
169
|
+
]);
|
|
110
170
|
});
|
|
111
171
|
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Chain } from 'viem';
|
|
2
|
-
|
|
3
|
-
type SimulatorChain = Chain & {
|
|
4
|
-
consensusMainContract: {
|
|
5
|
-
address: string;
|
|
6
|
-
abi: any[];
|
|
7
|
-
bytecode: string;
|
|
8
|
-
} | null;
|
|
9
|
-
defaultNumberOfInitialValidators: number;
|
|
10
|
-
defaultConsensusMaxRotations: number;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type { SimulatorChain as S };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Chain } from 'viem';
|
|
2
|
-
|
|
3
|
-
type SimulatorChain = Chain & {
|
|
4
|
-
consensusMainContract: {
|
|
5
|
-
address: string;
|
|
6
|
-
abi: any[];
|
|
7
|
-
bytecode: string;
|
|
8
|
-
} | null;
|
|
9
|
-
defaultNumberOfInitialValidators: number;
|
|
10
|
-
defaultConsensusMaxRotations: number;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type { SimulatorChain as S };
|
package/dist/chunk-I6HC44KD.cjs
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunk75ZPJI57cjs = require('./chunk-75ZPJI57.cjs');
|
|
4
|
-
|
|
5
|
-
// src/chains/index.ts
|
|
6
|
-
var chains_exports = {};
|
|
7
|
-
_chunk75ZPJI57cjs.__export.call(void 0, chains_exports, {
|
|
8
|
-
localnet: () => localnet,
|
|
9
|
-
simulator: () => simulator
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
// src/chains/localnet.ts
|
|
13
|
-
var _viem = require('viem');
|
|
14
|
-
var SIMULATOR_JSON_RPC_URL = "http://127.0.0.1:4000/api";
|
|
15
|
-
var localnet = _viem.defineChain.call(void 0, {
|
|
16
|
-
id: 61999,
|
|
17
|
-
name: "Genlayer Localnet",
|
|
18
|
-
rpcUrls: {
|
|
19
|
-
default: {
|
|
20
|
-
http: [SIMULATOR_JSON_RPC_URL]
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
nativeCurrency: {
|
|
24
|
-
name: "GEN Token",
|
|
25
|
-
symbol: "GEN",
|
|
26
|
-
decimals: 18
|
|
27
|
-
},
|
|
28
|
-
blockExplorers: {
|
|
29
|
-
default: {
|
|
30
|
-
name: "GenLayer Explorer",
|
|
31
|
-
url: SIMULATOR_JSON_RPC_URL
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
testnet: true,
|
|
35
|
-
consensusMainContract: null,
|
|
36
|
-
defaultNumberOfInitialValidators: 5,
|
|
37
|
-
defaultConsensusMaxRotations: 3
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// src/chains/simulator.ts
|
|
41
|
-
|
|
42
|
-
var SIMULATOR_JSON_RPC_URL2 = "http://127.0.0.1:4000/api";
|
|
43
|
-
var simulator = _viem.defineChain.call(void 0, {
|
|
44
|
-
id: 61999,
|
|
45
|
-
name: "GenLayer Simulator",
|
|
46
|
-
rpcUrls: {
|
|
47
|
-
default: {
|
|
48
|
-
http: [SIMULATOR_JSON_RPC_URL2]
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
nativeCurrency: {
|
|
52
|
-
name: "GEN Token",
|
|
53
|
-
symbol: "GEN",
|
|
54
|
-
decimals: 18
|
|
55
|
-
},
|
|
56
|
-
blockExplorers: {
|
|
57
|
-
default: {
|
|
58
|
-
name: "GenLayer Explorer",
|
|
59
|
-
url: SIMULATOR_JSON_RPC_URL2
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
testnet: true,
|
|
63
|
-
consensusMainContract: null,
|
|
64
|
-
defaultNumberOfInitialValidators: 5,
|
|
65
|
-
defaultConsensusMaxRotations: 3
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
exports.localnet = localnet; exports.simulator = simulator; exports.chains_exports = chains_exports;
|
package/dist/chunk-K72OSU5N.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// src/types/calldata.ts
|
|
2
|
-
var CalldataAddress = class {
|
|
3
|
-
bytes;
|
|
4
|
-
constructor(addr) {
|
|
5
|
-
if (addr.length != 20) {
|
|
6
|
-
throw new Error(`invalid address length ${addr}`);
|
|
7
|
-
}
|
|
8
|
-
this.bytes = addr;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
// src/types/transactions.ts
|
|
13
|
-
var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
|
|
14
|
-
TransactionStatus2["PENDING"] = "PENDING";
|
|
15
|
-
TransactionStatus2["CANCELED"] = "CANCELED";
|
|
16
|
-
TransactionStatus2["PROPOSING"] = "PROPOSING";
|
|
17
|
-
TransactionStatus2["COMMITTING"] = "COMMITTING";
|
|
18
|
-
TransactionStatus2["REVEALING"] = "REVEALING";
|
|
19
|
-
TransactionStatus2["ACCEPTED"] = "ACCEPTED";
|
|
20
|
-
TransactionStatus2["FINALIZED"] = "FINALIZED";
|
|
21
|
-
TransactionStatus2["UNDETERMINED"] = "UNDETERMINED";
|
|
22
|
-
return TransactionStatus2;
|
|
23
|
-
})(TransactionStatus || {});
|
|
24
|
-
|
|
25
|
-
export {
|
|
26
|
-
CalldataAddress,
|
|
27
|
-
TransactionStatus
|
|
28
|
-
};
|
package/dist/chunk-WEXFFND6.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__export
|
|
3
|
-
} from "./chunk-MLKGABMK.js";
|
|
4
|
-
|
|
5
|
-
// src/chains/index.ts
|
|
6
|
-
var chains_exports = {};
|
|
7
|
-
__export(chains_exports, {
|
|
8
|
-
localnet: () => localnet,
|
|
9
|
-
simulator: () => simulator
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
// src/chains/localnet.ts
|
|
13
|
-
import { defineChain } from "viem";
|
|
14
|
-
var SIMULATOR_JSON_RPC_URL = "http://127.0.0.1:4000/api";
|
|
15
|
-
var localnet = defineChain({
|
|
16
|
-
id: 61999,
|
|
17
|
-
name: "Genlayer Localnet",
|
|
18
|
-
rpcUrls: {
|
|
19
|
-
default: {
|
|
20
|
-
http: [SIMULATOR_JSON_RPC_URL]
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
nativeCurrency: {
|
|
24
|
-
name: "GEN Token",
|
|
25
|
-
symbol: "GEN",
|
|
26
|
-
decimals: 18
|
|
27
|
-
},
|
|
28
|
-
blockExplorers: {
|
|
29
|
-
default: {
|
|
30
|
-
name: "GenLayer Explorer",
|
|
31
|
-
url: SIMULATOR_JSON_RPC_URL
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
testnet: true,
|
|
35
|
-
consensusMainContract: null,
|
|
36
|
-
defaultNumberOfInitialValidators: 5,
|
|
37
|
-
defaultConsensusMaxRotations: 3
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// src/chains/simulator.ts
|
|
41
|
-
import { defineChain as defineChain2 } from "viem";
|
|
42
|
-
var SIMULATOR_JSON_RPC_URL2 = "http://127.0.0.1:4000/api";
|
|
43
|
-
var simulator = defineChain2({
|
|
44
|
-
id: 61999,
|
|
45
|
-
name: "GenLayer Simulator",
|
|
46
|
-
rpcUrls: {
|
|
47
|
-
default: {
|
|
48
|
-
http: [SIMULATOR_JSON_RPC_URL2]
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
nativeCurrency: {
|
|
52
|
-
name: "GEN Token",
|
|
53
|
-
symbol: "GEN",
|
|
54
|
-
decimals: 18
|
|
55
|
-
},
|
|
56
|
-
blockExplorers: {
|
|
57
|
-
default: {
|
|
58
|
-
name: "GenLayer Explorer",
|
|
59
|
-
url: SIMULATOR_JSON_RPC_URL2
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
testnet: true,
|
|
63
|
-
consensusMainContract: null,
|
|
64
|
-
defaultNumberOfInitialValidators: 5,
|
|
65
|
-
defaultConsensusMaxRotations: 3
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
export {
|
|
69
|
-
localnet,
|
|
70
|
-
simulator,
|
|
71
|
-
chains_exports
|
|
72
|
-
};
|
package/dist/chunk-YDFRDDP5.cjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/types/calldata.ts
|
|
2
|
-
var CalldataAddress = class {
|
|
3
|
-
|
|
4
|
-
constructor(addr) {
|
|
5
|
-
if (addr.length != 20) {
|
|
6
|
-
throw new Error(`invalid address length ${addr}`);
|
|
7
|
-
}
|
|
8
|
-
this.bytes = addr;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
// src/types/transactions.ts
|
|
13
|
-
var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
|
|
14
|
-
TransactionStatus2["PENDING"] = "PENDING";
|
|
15
|
-
TransactionStatus2["CANCELED"] = "CANCELED";
|
|
16
|
-
TransactionStatus2["PROPOSING"] = "PROPOSING";
|
|
17
|
-
TransactionStatus2["COMMITTING"] = "COMMITTING";
|
|
18
|
-
TransactionStatus2["REVEALING"] = "REVEALING";
|
|
19
|
-
TransactionStatus2["ACCEPTED"] = "ACCEPTED";
|
|
20
|
-
TransactionStatus2["FINALIZED"] = "FINALIZED";
|
|
21
|
-
TransactionStatus2["UNDETERMINED"] = "UNDETERMINED";
|
|
22
|
-
return TransactionStatus2;
|
|
23
|
-
})(TransactionStatus || {});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
exports.CalldataAddress = CalldataAddress; exports.TransactionStatus = TransactionStatus;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { S as SimulatorChain } from './chains-C5PI_Nr_.cjs';
|
|
2
|
-
|
|
3
|
-
declare const localnet: SimulatorChain;
|
|
4
|
-
|
|
5
|
-
declare const simulator: SimulatorChain;
|
|
6
|
-
|
|
7
|
-
declare const index_localnet: typeof localnet;
|
|
8
|
-
declare const index_simulator: typeof simulator;
|
|
9
|
-
declare namespace index {
|
|
10
|
-
export { index_localnet as localnet, index_simulator as simulator };
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export { index as i, localnet as l, simulator as s };
|