Skip to content

hashed-io/hashed-polkadot-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hashed Polkadot API

This client api is used to interacting with gatedMarketplace pallet, this allows quick connection, queries and calls to TX on this pallet.

To install the hashed polkadot api, run the following command:

npm i --save @jmgayosso/hashed-polkadot-api or yarn add --save @jmgayosso/hashed-polkadot-api

To connect to 'hashed chain' we can use an instance of PolkadotApi that handles the connection and provides methods to sign tx, requestUsers from polkadotJS and sign and verify messages.

import { PolkadotApi } from '@jmgayosso/hashed-polkadot-api'

const polkadotApi = new PolkadotApi({
  chainURI: 'wss://n1.hashed.systems',
  appName: 'Hashed portal'
})
await polkadotApi.connect()

PolkadotApi is requeried to create an instance of MarketplaceApi, this class provides all methods to interact with gatedMarketplace pallet.

import { PolkadotApi, MarketplaceApi } from '@jmgayosso/hashed-polkadot-api'

const polkadotApi = new PolkadotApi('wss://n1.hashed.systems')
await polkadotApi.connect()

const marketplaceApi = new MarketplaceApi(polkadotApi)

Once an instance of MarketplaceApi is created, the following methods can be accessed.

MarketplaceApi

await marketplaceApi.getMarketplaceById({
  marketId: '0xa54035afb49b42cdacbe27c830dd1b66078069886e80cdd8bab3d139caa0489e'
})
await marketplaceApi.getAuthoritiesByMarketplace({
  marketId: '0xa54035afb49b42cdacbe27c830dd1b66078069886e80cdd8bab3d139caa0489e'
})
await marketplaceApi.getAllMarketplaces({
  startKey,
  pageSize
})
await marketplaceApi.getMyMarketplaces({
   accountId
})
await marketplaceApi.getParticipantsByMarket({
  marketId: '0xa54035afb49b42cdacbe27c830dd1b66078069886e80cdd8bab3d139caa0489e'
})
  • applyFor: This function calls to 'apply' extrinsic
await marketplaceApi.applyFor({
  marketId,
  user,
  fields,
  custodianFields
})
  • reapplyFor: This function call reapply extrinsic
await marketplaceApi.reapplyFor({
    marketId,
    user,
    fields,
    custodianFields
})
await marketplaceApi.createMarketplace({
  admin,
  user,
  label
})
await marketplaceApi.enrollApplicant({
  marketId,
  user,
  accountOrApplication,
  approved,
  feedback
})
await marketplaceApi.getApplicationStatusByAccount({
  marketId,
  account
})
await marketplaceApi.getMarketplacesByAuthority({
  accountId,
  marketplaceId
})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published