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.
Files changed (66) hide show
  1. package/package.json +6 -1
  2. package/.eslintignore +0 -3
  3. package/.eslintrc.cjs +0 -59
  4. package/.github/pull_request_template.md +0 -43
  5. package/.github/workflows/publish.yml +0 -98
  6. package/.github/workflows/smoke.yml +0 -27
  7. package/.github/workflows/test.yml +0 -33
  8. package/.prettierignore +0 -19
  9. package/.prettierrc +0 -12
  10. package/.release-it.json +0 -66
  11. package/CHANGELOG.md +0 -306
  12. package/CLAUDE.md +0 -66
  13. package/CONTRIBUTING.md +0 -87
  14. package/renovate.json +0 -20
  15. package/src/abi/calldata/consts.ts +0 -14
  16. package/src/abi/calldata/decoder.ts +0 -86
  17. package/src/abi/calldata/encoder.ts +0 -178
  18. package/src/abi/calldata/index.ts +0 -3
  19. package/src/abi/calldata/string.ts +0 -83
  20. package/src/abi/index.ts +0 -6
  21. package/src/abi/staking.ts +0 -1501
  22. package/src/abi/transactions.ts +0 -11
  23. package/src/accounts/IAccountActions.ts +0 -5
  24. package/src/accounts/account.ts +0 -9
  25. package/src/accounts/actions.ts +0 -34
  26. package/src/chains/actions.ts +0 -40
  27. package/src/chains/index.ts +0 -4
  28. package/src/chains/localnet.ts +0 -4016
  29. package/src/chains/studionet.ts +0 -4017
  30. package/src/chains/testnetAsimov.ts +0 -4013
  31. package/src/client/client.ts +0 -139
  32. package/src/config/snapID.ts +0 -4
  33. package/src/config/transactions.ts +0 -9
  34. package/src/contracts/actions.ts +0 -387
  35. package/src/global.d.ts +0 -9
  36. package/src/index.ts +0 -12
  37. package/src/staking/actions.ts +0 -690
  38. package/src/staking/index.ts +0 -2
  39. package/src/staking/utils.ts +0 -22
  40. package/src/transactions/ITransactionActions.ts +0 -15
  41. package/src/transactions/actions.ts +0 -113
  42. package/src/transactions/decoders.ts +0 -275
  43. package/src/types/accounts.ts +0 -1
  44. package/src/types/calldata.ts +0 -31
  45. package/src/types/chains.ts +0 -22
  46. package/src/types/clients.ts +0 -106
  47. package/src/types/contracts.ts +0 -32
  48. package/src/types/index.ts +0 -9
  49. package/src/types/metamaskClientResult.ts +0 -5
  50. package/src/types/network.ts +0 -1
  51. package/src/types/snapSource.ts +0 -1
  52. package/src/types/staking.ts +0 -220
  53. package/src/types/transactions.ts +0 -312
  54. package/src/utils/async.ts +0 -3
  55. package/src/utils/jsonifier.ts +0 -119
  56. package/src/wallet/actions.ts +0 -10
  57. package/src/wallet/connect.ts +0 -67
  58. package/src/wallet/metamaskClient.ts +0 -50
  59. package/tests/client.test-d.ts +0 -67
  60. package/tests/client.test.ts +0 -197
  61. package/tests/smoke.test.ts +0 -291
  62. package/tests/transactions.test.ts +0 -142
  63. package/tsconfig.json +0 -119
  64. package/tsconfig.vitest-temp.json +0 -41
  65. package/vitest.config.ts +0 -19
  66. package/vitest.smoke.config.ts +0 -16
@@ -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
- }
@@ -1,5 +0,0 @@
1
- import {Address, TransactionHash} from "@/types";
2
-
3
- export type IAccountActions = {
4
- fundAccount: ({address, amount}: {address: Address; amount: number}) => Promise<TransactionHash>;
5
- };
@@ -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
- };
@@ -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
- }
@@ -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
- }
@@ -1,4 +0,0 @@
1
- // src/chains/index.ts
2
- export {localnet} from "./localnet";
3
- export {studionet} from "./studionet";
4
- export {testnetAsimov} from "./testnetAsimov";