Polymesh SDK API Reference
v3.0.0
v3.0.0
  • Introduction
  • Globals
  • Classes
    • Account
    • AuthorizationRequest
    • Authorizations
    • Claims
    • Compliance
    • Context
    • CurrentAccount
    • CurrentIdentity
    • DefaultPortfolio
    • DefaultTrustedClaimIssuer
    • Documents
    • Entity
    • Identity
    • IdentityAuthorizations
    • Instruction
    • Issuance
    • Middleware
    • NumberedPortfolio
    • Polymesh
    • PolymeshError
    • PolymeshTransaction
    • PolymeshTransactionBase
    • PolymeshTransactionBatch
    • Portfolio
    • Portfolios
    • Requirements
    • SecurityToken
    • Settlements
    • TickerReservation
    • TokenHolders
    • TransactionQueue
    • TrustedClaimIssuers
    • Venue
  • Enums
    • AffirmationStatus
    • AuthorizationType
    • ClaimType
    • ConditionTarget
    • ConditionType
    • CountryCode
    • ErrorCode
    • InstructionStatus
    • InstructionType
    • KnownTokenType
    • ProposalStage
    • RoleType
    • ScopeType
    • TickerReservationStatus
    • TokenIdentifierType
    • TransactionArgumentType
    • TransactionQueueStatus
    • TransactionStatus
    • TransferStatus
    • VenueType
  • Interfaces
    • AccountBalance
    • AccountData
    • AddBatchTransactionOpts
    • AddClaimsParams
    • AddInstructionParams
    • AddTransactionOpts
    • AddTransactionOptsBase
    • ArrayTransactionArgument
    • CddProviderRole
    • ClaimData
    • ClaimScope
    • ClaimTarget
    • ComplexTransactionArgument
    • ConditionCompliance
    • ConnectParamsBase
    • ConstructorParams
    • ConsumeParams
    • CreateSecurityTokenParams
    • CreateVenueParams
    • DeletePortfolioParams
    • EditClaimsParams
    • EventIdentifier
    • ExtrinsicData
    • Fees
    • IdentityBalance
    • IdentityWithClaims
    • InstructionAffirmation
    • InviteAccountParams
    • IssueTokensParams
    • KeyringPair
    • Leg
    • MiddlewareConfig
    • ModifyInstructionAffirmationParams
    • ModifyPrimaryIssuanceAgentParams
    • ModifySignerPermissionsParams
    • ModifyTokenTrustedClaimIssuersAddSetParams
    • ModifyTokenTrustedClaimIssuersRemoveParams
    • MoveFundsParams
    • NetworkProperties
    • PaginationOptions
    • Permissions
    • PermissionsLike
    • PlainTransactionArgument
    • PortfolioBalance
    • PortfolioCustodianRole
    • PortfolioMovement
    • ProposalDetails
    • ProposalTimeFrames
    • ProposalVote
    • RegisterIdentityParams
    • RemoveSecondaryKeysParams
    • RenamePortfolioParams
    • Requirement
    • RequirementCompliance
    • ReserveTickerParams
    • ResultSet
    • RevokeClaimsParams
    • Scope
    • SecondaryKey
    • SecurityTokenDetails
    • SetAssetRequirementsParams
    • SetCustodianParams
    • SetTokenDocumentsParams
    • SimpleEnumTransactionArgument
    • TickerOwnerRole
    • TickerReservationDetails
    • ToggleFreezeTransfersParams
    • TogglePauseRequirementsParams
    • TokenDocument
    • TokenHolderOptions
    • TokenHolderProperties
    • TokenIdentifier
    • TokenOwnerRole
    • TransferPolyXParams
    • TransferTokenOwnershipParams
    • TrustedClaimIssuer
    • UiKeyring
    • UniqueIdentifiers
    • VenueDetails
    • VenueOwnerRole
Powered by GitBook
On this page
  • Hierarchy
  • Index
  • Properties
  • Accessors
  • Methods
  • Properties
  • Optional currentPair
  • isArchiveNode
  • polymeshApi
  • Accessors
  • middlewareApi
  • Methods
  • accountBalance
  • getAccounts
  • getCurrentAccount
  • getCurrentIdentity
  • getCurrentPair
  • getInvalidDids
  • getLatestBlock
  • getSecondaryKeys
  • getSigner
  • getTransactionArguments
  • getTransactionFees
  • isMiddlewareAvailable
  • isMiddlewareEnabled
  • issuedClaims
  • queryMiddleware
  • setPair
  • Static create

Was this helpful?

  1. Classes

Context

PreviousComplianceNextCurrentAccount

Last updated 4 years ago

Was this helpful?

Context in which the SDK is being used

  • Holds the current low level API

  • Holds the current keyring pair

  • Holds the current Identity

Hierarchy

  • Context

Index

Properties

Accessors

Methods

Properties

Optional currentPair

isArchiveNode

• isArchiveNode: boolean = false

Whether the current node is an archive node (contains a full history from genesis onward) or not

polymeshApi

• polymeshApi: ApiPromise

Accessors

middlewareApi

• get middlewareApi(): ApolloClient‹NormalizedCacheObject›

Retrieve the middleware client

throws if cred entials are not set

Returns: ApolloClient‹NormalizedCacheObject›

Methods

accountBalance

Retrieve the account level POLYX balance

note can be subscribed to

Parameters:

Name

Type

account?

Retrieve the account level POLYX balance

note can be subscribed to

Parameters:

Name

Type

account

callback

getAccounts

Retrieve a list of addresses associated with the account

getCurrentAccount

Retrieve current Account

throws if there is no current account associated to the SDK instance

getCurrentIdentity

Retrieve current Identity

throws if there is no Identity associated to the current Account (or there is no current Account associated to the SDK instance)

getCurrentPair

Retrieve current Keyring Pair

throws if there is no Account associated to the SDK instance

getInvalidDids

Check whether Identities exist

Parameters:

Name

Type

identities

Returns: Promise‹string[]›

getLatestBlock

▸ getLatestBlock(): Promise‹BigNumber›

Retrieve the latest block number

Returns: Promise‹BigNumber›

getSecondaryKeys

Retrieve the list of secondary keys related to the Account

note can be subscribed to

Parameters:

Name

Type

callback

getSigner

â–¸ getSigner(): AddressOrPair

Retrieve the signer address (or keyring pair)

Returns: AddressOrPair

getTransactionArguments

Retrieve the types of arguments that a certain transaction requires to be run

Parameters:

â–ª args: object

Name

Type

Description

tag

TxTag

tag associated with the transaction that will be executed if the proposal passes

getTransactionFees

▸ getTransactionFees(tag: TxTag): Promise‹BigNumber›

Retrieve the protocol fees associated with running a specific transaction

Parameters:

Name

Type

Description

tag

TxTag

transaction tag (i.e. TxTags.asset.CreateAsset or "asset.createAsset")

Returns: Promise‹BigNumber›

isMiddlewareAvailable

▸ isMiddlewareAvailable(): Promise‹boolean›

Return whether the middleware is enabled and online

Returns: Promise‹boolean›

isMiddlewareEnabled

â–¸ isMiddlewareEnabled(): boolean

Return whether the middleware was enabled at startup

Returns: boolean

issuedClaims

Retrieve a list of claims. Can be filtered using parameters

note uses the middleware

Parameters:

â–ªDefault value opts: object= {}

Name

Type

Description

claimTypes?

types of the claims to fetch. Defaults to any type

includeExpired?

undefined | false | true

whether to include expired claims. Defaults to true

size?

undefined | number

page size

start?

undefined | number

page offset

targets?

identities (or Identity IDs) for which to fetch claims (targets). Defaults to all targets

trustedClaimIssuers?

identity IDs of claim issuers. Defaults to all claim issuers

queryMiddleware

▸ queryMiddleware‹Result›(query: GraphqlQuery‹unknown›): Promise‹ApolloQueryResult‹Result››

Make a query to the middleware server using the apollo client

Type parameters:

▪ Result: Partial‹Query›

Parameters:

Name

Type

query

GraphqlQuery‹unknown›

Returns: Promise‹ApolloQueryResult‹Result››

setPair

▸ setPair(address: string): Promise‹void›

Set a pair as the current account keyring pair

Parameters:

Name

Type

address

string

Returns: Promise‹void›

Static create

Create the Context instance

Parameters:

â–ª params: object

Name

Type

middlewareApi

ApolloClient‹NormalizedCacheObject› | null

polymeshApi

ApiPromise

seed

string

Create the Context instance

Parameters:

â–ª params: object

Name

Type

keyring

middlewareApi

ApolloClient‹NormalizedCacheObject› | null

polymeshApi

ApiPromise

Create the Context instance

Parameters:

â–ª params: object

Name

Type

middlewareApi

ApolloClient‹NormalizedCacheObject› | null

polymeshApi

ApiPromise

uri

string

Create the Context instance

Parameters:

â–ª params: object

Name

Type

middlewareApi

ApolloClient‹NormalizedCacheObject› | null

polymeshApi

ApiPromise

• currentPair? :

Defined in

Defined in

Defined in

Defined in

▸ accountBalance(account?: string | ): Promise‹›

Defined in

string |

Returns: Promise‹›

▸ accountBalance(account: string | | undefined, callback: ‹›): Promise‹›

Defined in

string | | undefined

‹›

Returns: Promise‹›

▸ getAccounts(): Array‹›

Defined in

Returns: Array‹›

â–¸ getCurrentAccount():

Defined in

Returns:

▸ getCurrentIdentity(): Promise‹›

Defined in

Returns: Promise‹›

â–¸ getCurrentPair():

Defined in

Returns:

▸ getInvalidDids(identities: (string | ‹›)[]): Promise‹string[]›

Defined in

(string | ‹›)[]

Defined in

▸ getSecondaryKeys(): Promise‹[]›

Defined in

Returns: Promise‹[]›

▸ getSecondaryKeys(callback: ‹[]›): Promise‹›

Defined in

‹[]›

Returns: Promise‹›

Defined in

â–¸ getTransactionArguments(args: object): []

Defined in

Returns: []

Defined in

Defined in

Defined in

▸ issuedClaims(opts: object): Promise‹‹››

Defined in

[]

(string | ‹›)[]

(string | ‹›)[]

Returns: Promise‹‹››

Defined in

Defined in

▸ create(params: object): Promise‹›

Defined in

Returns: Promise‹›

▸ create(params: object): Promise‹›

Defined in

Returns: Promise‹›

▸ create(params: object): Promise‹›

Defined in

Returns: Promise‹›

▸ create(params: object): Promise‹›

Defined in

Returns: Promise‹›

KeyringPair
src/base/Context.ts:76
src/base/Context.ts:81
src/base/Context.ts:74
src/base/Context.ts:670
Account
AccountBalance
src/base/Context.ts:233
AccountBalance
src/base/Context.ts:234
AccountData
src/base/Context.ts:206
AccountData
CurrentAccount
src/base/Context.ts:292
CurrentAccount
CurrentIdentity
src/base/Context.ts:312
CurrentIdentity
KeyringPair
src/base/Context.ts:332
KeyringPair
Identity
src/base/Context.ts:360
src/base/Context.ts:728
SecondaryKey
src/base/Context.ts:558
SecondaryKey
src/base/Context.ts:559
src/base/Context.ts:347
src/base/Context.ts:410
src/base/Context.ts:383
src/base/Context.ts:715
src/base/Context.ts:708
ResultSet
ClaimData
src/base/Context.ts:600
ResultSet
ClaimData
src/base/Context.ts:686
src/base/Context.ts:216
Context
src/base/Context.ts:112
Context
Context
src/base/Context.ts:118
Context
Context
src/base/Context.ts:124
Context
Context
src/base/Context.ts:130
Context
currentPair
isArchiveNode
polymeshApi
middlewareApi
accountBalance
getAccounts
getCurrentAccount
getCurrentIdentity
getCurrentPair
getInvalidDids
getLatestBlock
getSecondaryKeys
getSigner
getTransactionArguments
getTransactionFees
isMiddlewareAvailable
isMiddlewareEnabled
issuedClaims
queryMiddleware
setPair
create
Account
Account
Identity
ClaimType
Identity
Identity
Account
AccountBalance
SecondaryKey
AccountBalance
SecondaryKey
SubCallback
UnsubCallback
UnsubCallback
SubCallback
UnsubCallback
UnsubCallback
TransactionArgument
TransactionArgument
SubCallback
SubCallback
CommonKeyring