0.0.0-91278c • Published 3 years ago

@dsnp/frequency-api-augment v0.0.0-91278c

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

Javascript Custom RPC

Contributors Forks Stargazers Issues MIT License

Frequency Custom RPC and Types for Polkadot JS API

An easy way to get all the custom rpc and types config to be able to easily use Frequency with the Polkadot JS API library.

Getting Started

  • npm install @dsnp/frequency-api-augment (API Augmentation Library)
  • npm install @polkadot/api (Polkadot API Library)

Usage

For details on use, see the Polkadot API library documentation.

// es6 style imports
import { options } from "@dsnp/frequency-api-augment";
import { ApiPromise } from '@polkadot/api';
// ...

const api = await ApiPromise.create({
    ...options,
    // ...
});
// commonjs require
const { options } = require("@dsnp/frequency-api-augment");
const { ApiPromise } = require('@polkadot/api');
// ...

const api = await ApiPromise.create({
    ...options,
    // ...
});

Contributing

See CONTRIBUTING.md for more information.

Updating Definitions

  1. Update ./definitions
  2. Build and start the chain (does not need to be on-boarded)
  3. Run npm run fetch:local
  4. Commit changes

Helpful Notes

Option

Optional responses are not mapped to null and instead return an object with a few properties. For more details see the code for the Option class.

const optionalExample = await api.rpc.msa.getMsaId(account);
// Does the Option have a value?
if (!optionalExample.isEmpty) {
    // Get the value
    return optionalExample.value;
}
return null;

Vec

Vector responses are not mapped directly to a JavaScript Array. Instead they are mapped to the Vec class which does extend Array. Thus, you can still use map, forEach, etc... with responses or access the values directing via .values().

License

Distributed under the Apache 2.0 License. See LICENSE for more information.

0.0.0-55bcd9

3 years ago

0.0.0-369d4a

3 years ago

0.0.0-389a8b

3 years ago

0.0.0-45dacc

3 years ago

0.0.0-62a79b

3 years ago

0.0.0-dbc241

3 years ago

0.0.0-e20b67

3 years ago

0.0.0-924aaa

3 years ago

0.0.0-7368d1

3 years ago

0.0.0-f0e26b

3 years ago

0.0.0-5eb6cb

3 years ago

0.0.0-96a1ef

3 years ago

0.0.0-c0f002

3 years ago

0.0.0-1d907b

3 years ago

0.0.0-d9804c

3 years ago

0.0.0-25399a

3 years ago

0.0.0-cb5340

3 years ago

0.0.0-1114d6

3 years ago

0.0.0-89498f

3 years ago

0.0.0-2d95b1

3 years ago

0.0.0-91278c

3 years ago