2.1.27 • Published 4 months ago

everscale-standalone-client v2.1.27

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
4 months ago

Everscale standalone client Latest Version Docs badge

About

Standalone client to the Everscale blockchain to use with everscale-inpage-provider.

Usage

Install

npm install --save everscale-inpage-provider everscale-standalone-client

Example

import { Address, ProviderRpcClient, TvmException } from 'everscale-inpage-provider';

// For browser environment:
import { EverscaleStandaloneClient } from 'everscale-standalone-client';
// Or for nodejs environment:
// import { EverscaleStandaloneClient } from 'everscale-standalone-client/nodejs';

const ever = new ProviderRpcClient({
  fallback: () =>
    EverscaleStandaloneClient.create({
      connection: {
        id: 2, // network id
        type: 'graphql',
        data: {
          // create your own project at https://dashboard.evercloud.dev
          endpoints: ['https://devnet-sandbox.evercloud.dev/graphql'],
        },
      },
    }),
});

async function myApp() {
  await ever.ensureInitialized();

  await ever.requestPermissions({
    permissions: ['basic'],
  });

  const dePoolAddress = new Address('0:2e0ea1716eb93db16077d30e51d092b075ce7f0eb1c08ca5bea67ef48a79368e');

  const dePool = new ever.Contract(DePoolAbi, dePoolAddress);

  try {
    const output = await dePool.methods.getDePoolInfo({}).call();
    console.log(output);
  } catch (e) {
    if (e instanceof TvmException) {
      console.error(e.code);
    }
  }
}

const DePoolAbi = {
  'ABI version': 2,
  header: ['time', 'expire'],
  functions: [
    {
      name: 'getDePoolInfo',
      inputs: [],
      outputs: [
        { name: 'poolClosed', type: 'bool' },
        { name: 'minStake', type: 'uint64' },
        { name: 'validatorAssurance', type: 'uint64' },
        { name: 'participantRewardFraction', type: 'uint8' },
        { name: 'validatorRewardFraction', type: 'uint8' },
        { name: 'balanceThreshold', type: 'uint64' },
        { name: 'validatorWallet', type: 'address' },
        { name: 'proxies', type: 'address[]' },
        { name: 'stakeFee', type: 'uint64' },
        { name: 'retOrReinvFee', type: 'uint64' },
        { name: 'proxyFee', type: 'uint64' },
      ],
    },
  ],
  data: [],
  events: [],
} as const; // NOTE: `as const` is very important here

myApp().catch(console.error);

Build with Vite

Using Vite you might stuck with this issue. As a workaround, you can try this:

Install the dev-server plugin:

npm install --save-dev nekoton-wasm-vite

And add it to the vite.config.ts:

import { defineConfig } from 'vite'
import { nekotonWasmVite } from 'nekoton-wasm-vite'

export default defineConfig({
  plugins: [
    nekotonWasmVite(), // <-- add to plugins section
    // ...
  ],
  // ...
});

Contributing

We welcome contributions to the project! If you notice any issues or errors, feel free to open an issue or submit a pull request.

License

Licensed under GPL-3.0 license (LICENSE or https://opensource.org/license/gpl-3-0/).

2.1.28-beta.11

4 months ago

2.1.28-beta.10

4 months ago

2.1.28-beta.8

6 months ago

2.1.28-beta.9

6 months ago

2.1.28-beta.4

6 months ago

2.1.28-beta.5

6 months ago

2.1.28-beta.6

6 months ago

2.1.28-beta.7

6 months ago

2.1.28-beta.0

6 months ago

2.1.28-beta.1

6 months ago

2.1.28-beta.2

6 months ago

2.1.28-beta.3

6 months ago

2.1.27

8 months ago

2.1.25

1 year ago

2.1.26

1 year ago

2.1.24

1 year ago

2.1.23

2 years ago

2.1.22

2 years ago

2.1.21

2 years ago

2.1.20

2 years ago

2.1.19

2 years ago

2.1.16

2 years ago

2.1.17

2 years ago

2.1.15

2 years ago

2.1.18

2 years ago

2.1.9

2 years ago

2.1.14

2 years ago

2.1.12

2 years ago

2.1.13

2 years ago

2.1.10

2 years ago

2.1.11

2 years ago

2.1.2

3 years ago

2.1.4

3 years ago

2.1.3

3 years ago

2.1.6

2 years ago

2.1.5

3 years ago

2.1.8

2 years ago

2.1.7

2 years ago

2.0.28

3 years ago

2.0.29

3 years ago

2.1.1

3 years ago

2.0.31

3 years ago

2.0.30

3 years ago

2.1.0

3 years ago

2.0.30-beta.0

3 years ago

1.0.4

3 years ago

2.0.15

3 years ago

2.0.3

3 years ago

2.0.16

3 years ago

2.0.2

3 years ago

2.0.13

3 years ago

2.0.5

3 years ago

2.0.14

3 years ago

2.0.4

3 years ago

2.0.11

3 years ago

2.0.7

3 years ago

2.0.12

3 years ago

2.0.6

3 years ago

2.0.9

3 years ago

2.0.10

3 years ago

2.0.8

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

2.0.19

3 years ago

2.0.17

3 years ago

2.0.18

3 years ago

2.0.26

3 years ago

2.0.27

3 years ago

2.0.24

3 years ago

2.0.25

3 years ago

2.0.22

3 years ago

2.0.23

3 years ago

2.0.20

3 years ago

2.0.21

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago