# @andex/client

> ## About

Latest version **1.2.1** (published 2023-06-08) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install @andex/client
pnpm add @andex/client
yarn add @andex/client
bun add @andex/client
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2023-06-08 |
| First published | 2023-06-07 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 189.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | natedotv2 |

## Links

- npm: https://www.npmjs.com/package/@andex/client
- Repository: https://github.com/andex-fi/andex-client
- Homepage: https://github.com/andex-fi/andex-client#readme
- Issues: https://github.com/andex-fi/andex-client/issues
- npm.io page: https://npm.io/package/@andex/client

## Dependencies (6)

- [node-fetch](https://npm.io/package/node-fetch.md) ^3.3.1
- [bignumber.js](https://npm.io/package/bignumber.js.md) ^9.1.1
- [nekoton-wasm](https://npm.io/package/nekoton-wasm.md) ^1.1.7
- [@andex/provider](https://npm.io/package/@andex/provider.md) ^1.0.0
- [fast-safe-stringify](https://npm.io/package/fast-safe-stringify.md) ^2.1.1
- [@broxus/await-semaphore](https://npm.io/package/@broxus/await-semaphore.md) ^0.1.5

## Recent versions

- 1.2.1 (latest) — 2023-06-08
- 1.2.0 — 2023-06-07
- 1.0.6 — 2023-06-07
- 1.0.3 — 2023-06-07
- 1.0.2 — 2023-06-07
- 1.0.1 — 2023-06-07
- 1.0.0 — 2023-06-07

## README

# Venom standalone client &emsp;  [![Latest Version]][npmjs.com] [![Docs badge]][docs]

## About

Standalone client for the Venom blockchain to use with [`andex-provider`](https://github.com/andex-fi/andex-provider).

## Usage

### Install

```shell
yarn add @andex/provider @andex/client
```

### Example

```typescript
import { Address, ProviderRpcClient, TvmException } from '@andex/provider';

// For browser environment:
import { VenomStandaloneClient } from '@andex/client';
// Or for nodejs environment:
// import { VenomStandaloneClient } from '@andex/client/nodejs';

const venom = new ProviderRpcClient({
  fallback: () =>
    VenomStandaloneClient.create({
      connection: {
        id: 1002, // network id
        type: 'jrpc',
        data: {
          endpoints: ['https://jrpc-devnet.venom.foundation/'],
        },
      },
    }),
});

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

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

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

  const dePool = new venom.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](https://vitejs.dev) you will stuck with [issue](https://github.com/vitejs/vite/issues/8427). As workaround you may initialize provider like in the example below.

```js
import { Address, ProviderRpcClient } from '@andex/provider';
import { VenomStandaloneClient } from '@andex/client';

const client = new ProviderRpcClient({
  forceUseFallback: true,
  fallback: () =>
    VenomStandaloneClient.create({
      connection: {
        /*...*/
      },
      initInput: '../../node_modules/nekoton-wasm/nekoton_wasm_bg.wasm',
    }),
});
```

## 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](/LICENSE) or https://opensource.org/license/gpl-3-0/).

[latest version]: https://img.shields.io/npm/v/@andex/client
[npmjs.com]: https://www.npmjs.com/package/@andex/client
[docs badge]: https://img.shields.io/badge/docs-latest-brightgreen
[docs]: https://andex-fi.github.io/andex-client/index.html

---
_Source: https://npm.io/package/@andex/client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
