Context
Last updated
Was this helpful?
Last updated
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
Context
Optional
currentPair• isArchiveNode: boolean = false
Whether the current node is an archive node (contains a full history from genesis onward) or not
• polymeshApi: ApiPromise
• ss58Format: number = DEFAULT_SS58_FORMAT
• get middlewareApi(): ApolloClient‹NormalizedCacheObject›
Retrieve the middleware client
throws
if the middleware is not enabled
Returns: ApolloClient‹NormalizedCacheObject›
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
▸ disconnect(): Promise‹void›
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›
Retrieve a list of addresses associated with the account
Retrieve current Account
throws
if there is no current account associated to the SDK instance
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)
Retrieve current Keyring Pair
throws
if there is no Account associated to the SDK instance
Check whether Identities exist
Parameters:
Name
Type
identities
Returns: Promise‹string[]›
▸ getLatestBlock(): Promise‹BigNumber›
Retrieve the latest block number
Returns: Promise‹BigNumber›
Retrieve the list of secondary keys related to the Account
note
can be subscribed to
Parameters:
Name
Type
callback
â–¸ getSigner(): AddressOrPair
Retrieve the signer address (or keyring pair)
Returns: AddressOrPair
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(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(): Promise‹boolean›
Return whether the middleware is enabled and online
Returns: Promise‹boolean›
â–¸ isMiddlewareEnabled(): boolean
Return whether the middleware was enabled at startup
Returns: boolean
Retrieve a list of claims. Can be filtered using parameters
note
uses the middleware (optional)
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‹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(address
: string): Promise‹void›
Set a pair as the current account keyring pair
Parameters:
Name
Type
address
string
Returns: Promise‹void›
Static
createCreate the Context instance
Parameters:
â–ª params: object
Name
Type
accountMnemonic?
undefined | string
accountSeed?
undefined | string
accountUri?
undefined | string
keyring?
middlewareApi
ApolloClient‹NormalizedCacheObject› | null
polymeshApi
ApiPromise
• currentPair? :
Defined in
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‹›
Defined in
▸ 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‹›