Skip to main content
Version: 24.2.x

Class: Network

api/client/Network.Network

Handles all Network related functionality, including querying for historical events from middleware

Methods

getEventByIndexedArgs

getEventByIndexedArgs(opts): Promise<null | EventIdentifier>

Retrieve a single event by any of its indexed arguments. Can be filtered using parameters

Parameters

NameTypeDescription
optsObject-
opts.eventArg0?stringevent parameter value to filter by in position 0
opts.eventArg1?stringevent parameter value to filter by in position 1
opts.eventArg2?stringevent parameter value to filter by in position 2
opts.eventIdEventIdEnumtype of the event to fetch
opts.moduleIdModuleIdEnumtype of the module to fetch

Returns

Promise<null | EventIdentifier>

Note

uses the middlewareV2

Defined in

api/client/Network.ts:165


getEventsByIndexedArgs

getEventsByIndexedArgs(opts): Promise<null | EventIdentifier[]>

Retrieve a list of events. Can be filtered using parameters

Parameters

NameTypeDescription
optsObject-
opts.eventArg0?stringevent parameter value to filter by in position 0
opts.eventArg1?stringevent parameter value to filter by in position 1
opts.eventArg2?stringevent parameter value to filter by in position 2
opts.eventIdEventIdEnumtype of the event to fetch
opts.moduleIdModuleIdEnumtype of the module to fetch
opts.size?BigNumberpage size
opts.start?BigNumberpage offset

Returns

Promise<null | EventIdentifier[]>

Note

uses the middlewareV2

Defined in

api/client/Network.ts:302


getLatestBlock

getLatestBlock(): Promise<BigNumber>

Retrieve the number of the latest finalized block in the chain

Returns

Promise<BigNumber>

Defined in

api/client/Network.ts:59


getMiddlewareLag

getMiddlewareLag(): Promise<BigNumber>

Get the number of blocks the middleware needs to process to be synced with chain. The lag can be around somewhere upto 15 blocks, but this can increase if the block size being processed by the Middleware is too large. If the lag is too large, its recommended to check the indexer health to make sure the Middleware is processing the blocks.

Returns

Promise<BigNumber>

Note

uses the middleware V2

Defined in

api/client/Network.ts:453


getMiddlewareMetadata

getMiddlewareMetadata(): Promise<null | MiddlewareMetadata>

Retrieve middleware metadata. Returns null if middleware is disabled

Returns

Promise<null | MiddlewareMetadata>

Note

uses the middleware V2

Defined in

api/client/Network.ts:442


getNetworkProperties

getNetworkProperties(): Promise<NetworkProperties>

Retrieve information for the current network

Returns

Promise<NetworkProperties>

Defined in

api/client/Network.ts:80


getProtocolFees

getProtocolFees(args): Promise<ProtocolFees[]>

Retrieve the protocol fees associated with running specific transactions

Parameters

NameTypeDescription
argsObject-
args.tagsTxTag[]list of transaction tags (e.g. [TxTags.asset.CreateAsset, TxTags.asset.RegisterTicker] or ["asset.createAsset", "asset.registerTicker"])

Returns

Promise<ProtocolFees[]>

Defined in

api/client/Network.ts:104


getSs58Format

getSs58Format(): BigNumber

Retrieve the chain's SS58 format

Returns

BigNumber

Defined in

api/client/Network.ts:73


getTransactionByHash

getTransactionByHash(opts): Promise<null | ExtrinsicDataWithFees>

Retrieve a transaction by hash

Parameters

NameTypeDescription
optsObject-
opts.txHashstringhash of the transaction

Returns

Promise<null | ExtrinsicDataWithFees>

Note

uses the middlewareV2

Defined in

api/client/Network.ts:350


getTreasuryAccount

getTreasuryAccount(): Account

Get the treasury wallet address

Returns

Account

Defined in

api/client/Network.ts:111


getTreasuryBalance

getTreasuryBalance(): Promise<BigNumber>

Get the Treasury POLYX balance

Returns

Promise<BigNumber>

Note

can be subscribed to

Defined in

api/client/Network.ts:124

getTreasuryBalance(callback): Promise<UnsubCallback>

Parameters

NameType
callbackSubCallback<BigNumber>

Returns

Promise<UnsubCallback>

Defined in

api/client/Network.ts:125


getVersion

getVersion(): Promise<string>

Fetch the current network version (e.g. 3.1.0)

Returns

Promise<string>

Defined in

api/client/Network.ts:66


submitTransaction

submitTransaction(txPayload, signature): Promise<SubmissionDetails>

Submits a transaction payload with its signature to the chain. signature should be hex encoded

Parameters

NameType
txPayloadTransactionPayload
signaturestring

Returns

Promise<SubmissionDetails>

Throws

if the signature is not hex encoded

Defined in

api/client/Network.ts:203


supportsConfidentialAssets

supportsConfidentialAssets(): boolean

Returns whether or not the connected chain node as support for confidential assets

Returns

boolean

Defined in

api/client/Network.ts:470


transferPolyx

transferPolyx(args, opts?): Promise<GenericPolymeshTransaction<void, void>>

Transfer an amount of POLYX to a specified Account

Parameters

NameType
argsTransferPolyxParams
opts?ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

this method is of type ProcedureMethod, which means you can call transferPolyx.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

Defined in

api/client/Network.ts:150