Context

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

currentPair? : KeyringPair

Defined in src/base/Context.ts:90

isArchiveNode

isArchiveNode: boolean = false

Defined in src/base/Context.ts:95

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

polymeshApi

polymeshApi: ApiPromise

Defined in src/base/Context.ts:88

ss58Format

ss58Format: number = DEFAULT_SS58_FORMAT

Defined in src/base/Context.ts:97

Accessors

middlewareApi

get middlewareApi(): ApolloClient‹NormalizedCacheObject›

Defined in src/base/Context.ts:826

Retrieve the middleware client

throws if the middleware is not enabled

Returns: ApolloClient‹NormalizedCacheObject›

Methods

accountBalance

accountBalance(account?: string | Account): Promise‹AccountBalance

Defined in src/base/Context.ts:272

Retrieve the account level POLYX balance

note can be subscribed to

Parameters:

Returns: Promise‹AccountBalance

accountBalance(account: string | Account | undefined, callback: SubCallbackAccountBalance›): Promise‹UnsubCallback

Defined in src/base/Context.ts:273

Retrieve the account level POLYX balance

note can be subscribed to

Parameters:

Returns: Promise‹UnsubCallback

disconnect

disconnect(): Promise‹void›

Defined in src/base/Context.ts:896

Disconnect the Polkadot API, middleware, and render this instance unusable

note after disconnecting, trying to access any property in this objecct will result in an error

Returns: Promise‹void›

getAccounts

getAccounts(): Array‹AccountData

Defined in src/base/Context.ts:244

Retrieve a list of addresses associated with the account

Returns: Array‹AccountData

getCurrentAccount

getCurrentAccount(): CurrentAccount

Defined in src/base/Context.ts:334

Retrieve current Account

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

Returns: CurrentAccount

getCurrentIdentity

getCurrentIdentity(): Promise‹CurrentIdentity

Defined in src/base/Context.ts:354

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)

Returns: Promise‹CurrentIdentity

getCurrentPair

getCurrentPair(): KeyringPair

Defined in src/base/Context.ts:374

Retrieve current Keyring Pair

throws if there is no Account associated to the SDK instance

Returns: KeyringPair

getInvalidDids

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

Defined in src/base/Context.ts:402

Check whether Identities exist

Parameters:

Returns: Promise‹string[]›

getLatestBlock

getLatestBlock(): Promise‹BigNumber›

Defined in src/base/Context.ts:884

Retrieve the latest block number

Returns: Promise‹BigNumber›

getSecondaryKeys

getSecondaryKeys(): Promise‹SecondaryKey[]›

Defined in src/base/Context.ts:600

Retrieve the list of secondary keys related to the Account

note can be subscribed to

Returns: Promise‹SecondaryKey[]›

getSecondaryKeys(callback: SubCallbackSecondaryKey[]›): Promise‹UnsubCallback

Defined in src/base/Context.ts:601

Parameters:

Returns: Promise‹UnsubCallback

getSigner

getSigner(): AddressOrPair

Defined in src/base/Context.ts:389

Retrieve the signer address (or keyring pair)

Returns: AddressOrPair

getTransactionArguments

getTransactionArguments(args: object): TransactionArgument[]

Defined in src/base/Context.ts:452

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

Parameters:

args: object

Returns: TransactionArgument[]

getTransactionFees

getTransactionFees(tag: TxTag): Promise‹BigNumber›

Defined in src/base/Context.ts:425

Retrieve the protocol fees associated with running a specific transaction

Parameters:

Returns: Promise‹BigNumber›

isMiddlewareAvailable

isMiddlewareAvailable(): Promise‹boolean›

Defined in src/base/Context.ts:871

Return whether the middleware is enabled and online

Returns: Promise‹boolean›

isMiddlewareEnabled

isMiddlewareEnabled(): boolean

Defined in src/base/Context.ts:864

Return whether the middleware was enabled at startup

Returns: boolean

issuedClaims

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

Defined in src/base/Context.ts:775

Retrieve a list of claims. Can be filtered using parameters

note uses the middleware (optional)

Parameters:

Default value opts: object= {}

Returns: Promise‹ResultSetClaimData››

queryMiddleware

queryMiddlewareResult›(query: GraphqlQuery‹unknown›): Promise‹ApolloQueryResult‹Result››

Defined in src/base/Context.ts:842

Make a query to the middleware server using the apollo client

Type parameters:

Result: Partial‹Query›

Parameters:

Returns: Promise‹ApolloQueryResult‹Result››

setPair

setPair(address: string): Promise‹void›

Defined in src/base/Context.ts:254

Set a pair as the current account keyring pair

Parameters:

Returns: Promise‹void›

Static create

create(params: object): Promise‹Context

Defined in src/base/Context.ts:145

Create the Context instance

Parameters:

params: object

Returns: Promise‹Context

Last updated