genlayer-js 0.18.11 → 0.18.13
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/package.json +6 -1
- package/.eslintignore +0 -3
- package/.eslintrc.cjs +0 -59
- package/.github/pull_request_template.md +0 -43
- package/.github/workflows/publish.yml +0 -98
- package/.github/workflows/smoke.yml +0 -27
- package/.github/workflows/test.yml +0 -33
- package/.prettierignore +0 -19
- package/.prettierrc +0 -12
- package/.release-it.json +0 -66
- package/CHANGELOG.md +0 -306
- package/CLAUDE.md +0 -66
- package/CONTRIBUTING.md +0 -87
- package/renovate.json +0 -20
- package/src/abi/calldata/consts.ts +0 -14
- package/src/abi/calldata/decoder.ts +0 -86
- package/src/abi/calldata/encoder.ts +0 -178
- package/src/abi/calldata/index.ts +0 -3
- package/src/abi/calldata/string.ts +0 -83
- package/src/abi/index.ts +0 -6
- package/src/abi/staking.ts +0 -1501
- package/src/abi/transactions.ts +0 -11
- package/src/accounts/IAccountActions.ts +0 -5
- package/src/accounts/account.ts +0 -9
- package/src/accounts/actions.ts +0 -34
- package/src/chains/actions.ts +0 -40
- package/src/chains/index.ts +0 -4
- package/src/chains/localnet.ts +0 -4016
- package/src/chains/studionet.ts +0 -4017
- package/src/chains/testnetAsimov.ts +0 -4013
- package/src/client/client.ts +0 -139
- package/src/config/snapID.ts +0 -4
- package/src/config/transactions.ts +0 -9
- package/src/contracts/actions.ts +0 -387
- package/src/global.d.ts +0 -9
- package/src/index.ts +0 -12
- package/src/staking/actions.ts +0 -690
- package/src/staking/index.ts +0 -2
- package/src/staking/utils.ts +0 -22
- package/src/transactions/ITransactionActions.ts +0 -15
- package/src/transactions/actions.ts +0 -113
- package/src/transactions/decoders.ts +0 -275
- package/src/types/accounts.ts +0 -1
- package/src/types/calldata.ts +0 -31
- package/src/types/chains.ts +0 -22
- package/src/types/clients.ts +0 -106
- package/src/types/contracts.ts +0 -32
- package/src/types/index.ts +0 -9
- package/src/types/metamaskClientResult.ts +0 -5
- package/src/types/network.ts +0 -1
- package/src/types/snapSource.ts +0 -1
- package/src/types/staking.ts +0 -220
- package/src/types/transactions.ts +0 -312
- package/src/utils/async.ts +0 -3
- package/src/utils/jsonifier.ts +0 -119
- package/src/wallet/actions.ts +0 -10
- package/src/wallet/connect.ts +0 -67
- package/src/wallet/metamaskClient.ts +0 -50
- package/tests/client.test-d.ts +0 -67
- package/tests/client.test.ts +0 -197
- package/tests/smoke.test.ts +0 -291
- package/tests/transactions.test.ts +0 -142
- package/tsconfig.json +0 -119
- package/tsconfig.vitest-temp.json +0 -41
- package/vitest.config.ts +0 -19
- package/vitest.smoke.config.ts +0 -16
package/src/abi/transactions.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {toHex, toRlp} from "viem";
|
|
2
|
-
|
|
3
|
-
import type {TransactionDataElement} from "../types/calldata";
|
|
4
|
-
|
|
5
|
-
export function serializeOne(data: TransactionDataElement): `0x${string}` {
|
|
6
|
-
return toHex(data)
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function serialize(data: TransactionDataElement[]): `0x${string}` {
|
|
10
|
-
return toRlp(data.map(serializeOne));
|
|
11
|
-
}
|
package/src/accounts/account.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import {generatePrivateKey as _generatePrivateKey, privateKeyToAccount} from "viem/accounts";
|
|
2
|
-
|
|
3
|
-
export const generatePrivateKey = () => _generatePrivateKey();
|
|
4
|
-
|
|
5
|
-
export const createAccount = (accountPrivateKey?: `0x${string}`) => {
|
|
6
|
-
const privateKey = accountPrivateKey || generatePrivateKey();
|
|
7
|
-
const account = privateKeyToAccount(privateKey);
|
|
8
|
-
return account;
|
|
9
|
-
};
|
package/src/accounts/actions.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import {GenLayerClient, TransactionHash, GenLayerChain, Address} from "../types";
|
|
2
|
-
import {localnet} from "../chains";
|
|
3
|
-
|
|
4
|
-
export function accountActions(client: GenLayerClient<GenLayerChain>) {
|
|
5
|
-
return {
|
|
6
|
-
fundAccount: async ({address, amount}: {address: Address; amount: number}): Promise<TransactionHash> => {
|
|
7
|
-
if (client.chain?.id !== localnet.id) {
|
|
8
|
-
throw new Error("Client is not connected to the localnet");
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return client.request({
|
|
12
|
-
method: "sim_fundAccount",
|
|
13
|
-
params: [address, amount],
|
|
14
|
-
}) as Promise<TransactionHash>;
|
|
15
|
-
},
|
|
16
|
-
getCurrentNonce: async ({
|
|
17
|
-
address,
|
|
18
|
-
block = "latest",
|
|
19
|
-
}: {
|
|
20
|
-
address: Address;
|
|
21
|
-
block?: string;
|
|
22
|
-
}): Promise<number> => {
|
|
23
|
-
const addressToUse = address || client.account?.address;
|
|
24
|
-
|
|
25
|
-
if (!addressToUse) {
|
|
26
|
-
throw new Error("No address provided and no account is connected");
|
|
27
|
-
}
|
|
28
|
-
return client.request({
|
|
29
|
-
method: "eth_getTransactionCount",
|
|
30
|
-
params: [addressToUse, block],
|
|
31
|
-
}) as Promise<number>;
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
package/src/chains/actions.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {GenLayerClient, GenLayerChain} from "@/types";
|
|
2
|
-
import {testnetAsimov} from "./testnetAsimov";
|
|
3
|
-
|
|
4
|
-
export function chainActions(client: GenLayerClient<GenLayerChain>) {
|
|
5
|
-
return {
|
|
6
|
-
initializeConsensusSmartContract: async (forceReset: boolean = false): Promise<void> => {
|
|
7
|
-
if (client.chain?.id === testnetAsimov.id) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
!forceReset &&
|
|
13
|
-
client.chain.consensusMainContract?.address &&
|
|
14
|
-
client.chain.consensusMainContract?.abi
|
|
15
|
-
) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const contractsResponse = await fetch(client.chain.rpcUrls.default.http[0], {
|
|
20
|
-
method: "POST",
|
|
21
|
-
headers: {
|
|
22
|
-
"Content-Type": "application/json",
|
|
23
|
-
},
|
|
24
|
-
body: JSON.stringify({
|
|
25
|
-
jsonrpc: "2.0",
|
|
26
|
-
id: Date.now(),
|
|
27
|
-
method: "sim_getConsensusContract",
|
|
28
|
-
params: ["ConsensusMain"],
|
|
29
|
-
}),
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
if (!contractsResponse.ok) {
|
|
33
|
-
throw new Error("Failed to fetch ConsensusMain contract");
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const consensusMainContract = await contractsResponse.json();
|
|
37
|
-
client.chain.consensusMainContract = consensusMainContract.result;
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
}
|
package/src/chains/index.ts
DELETED