open-index/open-npm huggingface dataset:
npm package: @pendulum-chain/api
Description: Pendulum JS API
Author: Pendulum
Latest version: 1.1.1

![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)

# @pendulum-chain api

This library provides additional typing information for user to access Pendulum's modules by using [polkadot.js](https://github.com/polkadot-js/api)

# Getting Started

More documentation and examples on [wiki](https://github.com/pendulumNetwork/pendulum.js/wiki)

- Install dependencies

```bash
yarn add @polkadot/api @pendulum-chain/api@beta
```

- Create API instance

```ts
import { ApiPromise } from '@polkadot/api';
import { WsProvider } from '@polkadot/rpc-provider';
import { options } from '@pendulum-chain/api';

async function main() {
    const provider = new WsProvider('wss://localhost:9944');
    const api = new ApiPromise(options({ provider }));
    await api.isReady;

    // use the api
    //..
}

main()
```

- Use api to interact with node

```ts
// query and display account data
const data = await api.query.system.account('5F98oWfz2r5rcRVnP9VCndg33DAAsky3iuoBSpaPUbgN9AJn');
console.log(data.toHuman())
```

# Packages

- [api](./packages/api)
  - Contains necessary options to create a polkadot.js API instance
- [type-definitions](./packages/type-definitions)
  - Polkadot.js type definitions for Pendulum Network.
- [types](./packages/types)
  - Polkadot.js auto-generated types for Pendulum Network.
npm package: @pendulum-chain/api-derive
Description: Pendulum JS API
Author: Pendulum
Latest version: 1.1.1

![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)

# @pendulum-chain/api-derive

Derived API calls that combine several queries to provide convinient results. This package is part of the Pendulum SDK.

## Example

```ts
import { ApiPromise, WsProvider } from '@polkadot/api';
import { options } from '@pendulum-chain/api';
import '@pendulum-chain/api-derive/augmentDerives';

const getAddressEnum = (address: string) => ({ Evm: address });

const endpoint = 'wss://shiden.api.onfinality.io/public-ws';
const provider = new WsProvider(endpoint);
const address = '0x072416b9df2382a62Df34956DffB7B0aDdf668F9';
const api = new ApiPromise(options({ provider }));

(async function main() {
  await api.isReadyOrError;
  const stakers = await api.derive.dappStaking.stakers(getAddressEnum(address));
  console.log({ stakers: stakers.map((s: any) => s.toHuman()) });
})()
  .then(() => api.disconnect())
  .then(() => process.exit());
```

## Development

Clone the repo, run `yarn` and you should be good to go.

## Issues

Please see the COMMUNITY docs for contact and communication channels.