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
Optional
currentPair• currentPair? : KeyringPair
Defined in src/base/Context.ts:76
isArchiveNode
• isArchiveNode: boolean = false
Defined in src/base/Context.ts:81
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:74
Accessors
middlewareApi
• get middlewareApi(): ApolloClient‹NormalizedCacheObject›
Defined in src/base/Context.ts:657
Retrieve the middleware client
throws
if cred entials are not set
Returns: ApolloClient‹NormalizedCacheObject›
Methods
accountBalance
▸ accountBalance(account?
: string | Account): Promise‹AccountBalance›
Defined in src/base/Context.ts:233
Retrieve the account level POLYX balance
note
can be subscribed to
Parameters:
Name
Type
account?
string | Account
Returns: Promise‹AccountBalance›
▸ accountBalance(account
: string | Account | undefined, callback
: SubCallback‹AccountBalance›): Promise‹UnsubCallback›
Defined in src/base/Context.ts:234
Retrieve the account level POLYX balance
note
can be subscribed to
Parameters:
Returns: Promise‹UnsubCallback›
getAccounts
▸ getAccounts(): Array‹AccountData›
Defined in src/base/Context.ts:206
Retrieve a list of addresses associated with the account
Returns: Array‹AccountData›
getCurrentAccount
▸ getCurrentAccount(): CurrentAccount
Defined in src/base/Context.ts:292
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:312
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:332
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:347
Check whether Identities exist
Parameters:
Name
Type
identities
(string | Identity‹›)[]
Returns: Promise‹string[]›
getLatestBlock
▸ getLatestBlock(): Promise‹BigNumber›
Defined in src/base/Context.ts:715
Retrieve the latest block number
Returns: Promise‹BigNumber›
getSecondaryKeys
▸ getSecondaryKeys(): Promise‹SecondaryKey[]›
Defined in src/base/Context.ts:545
Retrieve the list of secondary keys related to the Account
note
can be subscribed to
Returns: Promise‹SecondaryKey[]›
▸ getSecondaryKeys(callback
: SubCallback‹SecondaryKey[]›): Promise‹UnsubCallback›
Defined in src/base/Context.ts:546
Parameters:
Name
Type
callback
Returns: Promise‹UnsubCallback›
getTransactionArguments
▸ getTransactionArguments(args
: object): TransactionArgument[]
Defined in src/base/Context.ts:397
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
Returns: TransactionArgument[]
getTransactionFees
▸ getTransactionFees(tag
: TxTag): Promise‹BigNumber›
Defined in src/base/Context.ts:370
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›
Defined in src/base/Context.ts:702
Return whether the middleware is enabled and online
Returns: Promise‹boolean›
isMiddlewareEnabled
▸ isMiddlewareEnabled(): boolean
Defined in src/base/Context.ts:695
Return whether the middleware was enabled at startup
Returns: boolean
issuedClaims
▸ issuedClaims(opts
: object): Promise‹ResultSet‹ClaimData››
Defined in src/base/Context.ts:587
Retrieve a list of claims. Can be filtered using parameters
note
uses the middleware
Parameters:
▪Default value
opts: object= {}
Name
Type
Description
includeExpired?
undefined | false | true
whether to include expired claims. Defaults to true
size?
undefined | number
page size
start?
undefined | number
page offset
targets?
(string | Identity‹›)[]
identities (or Identity IDs) for which to fetch claims (targets). Defaults to all targets
trustedClaimIssuers?
(string | Identity‹›)[]
identity IDs of claim issuers. Defaults to all claim issuers
Returns: Promise‹ResultSet‹ClaimData››
queryMiddleware
▸ queryMiddleware‹Result›(query
: GraphqlQuery‹unknown›): Promise‹ApolloQueryResult‹Result››
Defined in src/base/Context.ts:673
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›
Defined in src/base/Context.ts:216
Set a pair as the current account keyring pair
Parameters:
Name
Type
address
string
Returns: Promise‹void›
Static
create
Static
create▸ create(params
: object): Promise‹Context›
Defined in src/base/Context.ts:112
Create the Context instance
Parameters:
▪ params: object
Name
Type
middlewareApi
ApolloClient‹NormalizedCacheObject› | null
polymeshApi
ApiPromise
seed
string
Returns: Promise‹Context›
▸ create(params
: object): Promise‹Context›
Defined in src/base/Context.ts:118
Create the Context instance
Parameters:
▪ params: object
Name
Type
keyring
middlewareApi
ApolloClient‹NormalizedCacheObject› | null
polymeshApi
ApiPromise
Returns: Promise‹Context›
▸ create(params
: object): Promise‹Context›
Defined in src/base/Context.ts:124
Create the Context instance
Parameters:
▪ params: object
Name
Type
middlewareApi
ApolloClient‹NormalizedCacheObject› | null
polymeshApi
ApiPromise
uri
string
Returns: Promise‹Context›
▸ create(params
: object): Promise‹Context›
Defined in src/base/Context.ts:130
Create the Context instance
Parameters:
▪ params: object
Name
Type
middlewareApi
ApolloClient‹NormalizedCacheObject› | null
polymeshApi
ApiPromise
Returns: Promise‹Context›
Last updated