Skip to content

This library provides additional typing information for user to access Crust Network by using polkadot.js.

License

Notifications You must be signed in to change notification settings

crustio/crust.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

license npm

crust.js

This library provides additional typing information for users to access Crust Network by using polkadot.js

Getting Started

More documentation and examples on Crust Wiki

  1. Install dependencies
yarn add @polkadot/api @crustio/type-definitions
  1. Create API instance
import {ApiPromise, WsProvider} from '@polkadot/api';
import {typesBundleForPolkadot} from '@crustio/type-definitions';

async function main() {
    const api = new ApiPromise({
      provider: new WsProvider('wss://api.crust.network'),
      typesBundle: typesBundleForPolkadot,
    });
    await api.isReady;

    // Use api
}

main();
  1. Interact with chain
// Query file info
const fileInfo = await api.query.market.files('QmRaknS23vXEcdJezkrVC5WrApQNUkUDdTpbRdvh5fuJHc');
console.log(fileInfo.toHuman());

Crust Types

  • Use crust types
import {crustTypes} from '@crustio/type-definitions';

// Define FileInfo
export type FileInfo = typeof crustTypes.market.types.FileInfo;

// Use FileInfo as `interface`

Contribution

Please send a PR(Pull Request) to contribute this repo and read the following rules:

  1. No --force pushes or modifying the master branch history in any way. If you need to rebase, ensure you do it in your own repo.
  2. Non-main branches, prefixed with a short name moniker (e.g. zik/my-feature) must be used for ongoing work.
  3. All modifications must be made in pull-request to solicit feedback from other contributors.
  4. A pull-request must not be merged until CI has finished successfully.
  5. Contributors should adhere to the Google Typescript Style Guide.

About

This library provides additional typing information for user to access Crust Network by using polkadot.js.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published