genlayer-js 0.9.0 → 0.9.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/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-7YZQQWJZ.js +4056 -0
- package/dist/chunk-AZSICIZ3.cjs +132 -0
- package/dist/chunk-FPFZLPXI.cjs +4056 -0
- package/dist/chunk-RS7NCSOQ.js +132 -0
- package/dist/index-BM9hOtGg.d.cts +13 -0
- package/dist/index-C7Colsnk.d.ts +13 -0
- package/dist/index-DvSbRKD5.d.ts +370 -0
- package/dist/index-kDM_9wW1.d.cts +370 -0
- package/dist/index.cjs +315 -130
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +306 -121
- package/dist/types/index.cjs +18 -2
- package/dist/types/index.d.cts +3 -3
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.js +19 -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 +4 -3
- package/src/chains/testnet.ts +4015 -0
- package/src/client/client.ts +64 -21
- package/src/contracts/actions.ts +185 -137
- package/src/transactions/actions.ts +145 -21
- package/src/types/accounts.ts +1 -2
- package/src/types/chains.ts +8 -2
- package/src/types/clients.ts +14 -13
- package/src/types/transactions.ts +249 -8
- package/src/wallet/actions.ts +4 -4
- package/src/wallet/connect.ts +12 -14
- 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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genlayer-js",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.1",
|
|
5
5
|
"description": "GenLayer JavaScript SDK",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -50,6 +50,6 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"eslint-plugin-import": "^2.30.0",
|
|
52
52
|
"typescript-parsec": "^0.3.4",
|
|
53
|
-
"viem": "^2.
|
|
53
|
+
"viem": "^2.29.0"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {TransactionHash} from "@/types";
|
|
1
|
+
import {Address, TransactionHash} from "@/types";
|
|
2
2
|
|
|
3
3
|
export type IAccountActions = {
|
|
4
|
-
fundAccount: ({address, amount}: {address:
|
|
4
|
+
fundAccount: ({address, amount}: {address: Address; amount: number}) => Promise<TransactionHash>;
|
|
5
5
|
};
|
package/src/accounts/actions.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {GenLayerClient, TransactionHash,
|
|
1
|
+
import {GenLayerClient, TransactionHash, GenLayerChain, Address} from "../types";
|
|
2
2
|
import {localnet} from "../chains";
|
|
3
3
|
|
|
4
|
-
export function accountActions(client: GenLayerClient<
|
|
4
|
+
export function accountActions(client: GenLayerClient<GenLayerChain>) {
|
|
5
5
|
return {
|
|
6
|
-
fundAccount: async ({address, amount}: {address:
|
|
6
|
+
fundAccount: async ({address, amount}: {address: Address; amount: number}): Promise<TransactionHash> => {
|
|
7
7
|
if (client.chain?.id !== localnet.id) {
|
|
8
8
|
throw new Error("Client is not connected to the localnet");
|
|
9
9
|
}
|
|
@@ -13,7 +13,13 @@ export function accountActions(client: GenLayerClient<SimulatorChain>) {
|
|
|
13
13
|
params: [address, amount],
|
|
14
14
|
}) as Promise<TransactionHash>;
|
|
15
15
|
},
|
|
16
|
-
getCurrentNonce: async ({
|
|
16
|
+
getCurrentNonce: async ({
|
|
17
|
+
address,
|
|
18
|
+
block = "latest",
|
|
19
|
+
}: {
|
|
20
|
+
address: Address;
|
|
21
|
+
block?: string;
|
|
22
|
+
}): Promise<number> => {
|
|
17
23
|
const addressToUse = address || client.account?.address;
|
|
18
24
|
|
|
19
25
|
if (!addressToUse) {
|
package/src/chains/actions.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {GenLayerClient,
|
|
2
|
-
import {
|
|
1
|
+
import {GenLayerClient, GenLayerChain} from "@/types";
|
|
2
|
+
import {testnet} from "./testnet";
|
|
3
3
|
|
|
4
|
-
export function chainActions(client: GenLayerClient<
|
|
4
|
+
export function chainActions(client: GenLayerClient<GenLayerChain>) {
|
|
5
5
|
return {
|
|
6
6
|
initializeConsensusSmartContract: async (forceReset: boolean = false): Promise<void> => {
|
|
7
|
-
if (client.chain?.id !==
|
|
8
|
-
|
|
7
|
+
if (client.chain?.id !== testnet.id) {
|
|
8
|
+
return;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
if (
|
package/src/chains/index.ts
CHANGED
package/src/chains/localnet.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {defineChain} from "viem";
|
|
2
|
-
import {
|
|
2
|
+
import {GenLayerChain} from "@/types";
|
|
3
3
|
|
|
4
4
|
// chains/localnet.ts
|
|
5
5
|
const SIMULATOR_JSON_RPC_URL = "http://127.0.0.1:4000/api";
|
|
6
6
|
|
|
7
|
-
export const localnet:
|
|
7
|
+
export const localnet: GenLayerChain = defineChain({
|
|
8
8
|
id: 61_999,
|
|
9
9
|
name: "Genlayer Localnet",
|
|
10
10
|
rpcUrls: {
|
|
@@ -25,6 +25,7 @@ export const localnet: SimulatorChain = defineChain({
|
|
|
25
25
|
},
|
|
26
26
|
testnet: true,
|
|
27
27
|
consensusMainContract: null,
|
|
28
|
+
consensusDataContract: null,
|
|
28
29
|
defaultNumberOfInitialValidators: 5,
|
|
29
30
|
defaultConsensusMaxRotations: 3,
|
|
30
|
-
});
|
|
31
|
+
});
|