Class: Network
Defined in: src/api/client/Network.ts:42
Handles all Network related functionality, including querying for historical events from middleware
Methods
getEventByIndexedArgs()
getEventByIndexedArgs(
opts:object):Promise<EventIdentifier|null>
Defined in: src/api/client/Network.ts:174
Retrieve a single event by any of its indexed arguments. Can be filtered using parameters
Parameters
| Parameter | Type | Description |
|---|---|---|
| { | ‐ |
|
| event parameter value to filter by in position 0 |
|
| event parameter value to filter by in position 1 |
|
| event parameter value to filter by in position 2 |
| type of the event to fetch | |
| type of the module to fetch |
Returns
Promise<EventIdentifier | null>
Note
uses the middlewareV2
getEventsByIndexedArgs()
getEventsByIndexedArgs(
opts:object):Promise<EventIdentifier[] |null>
Defined in: src/api/client/Network.ts:361
Retrieve a list of events. Can be filtered using parameters
Parameters
| Parameter | Type | Description |
|---|---|---|
| { | ‐ |
|
| event parameter value to filter by in position 0 |
|
| event parameter value to filter by in position 1 |
|
| event parameter value to filter by in position 2 |
| type of the event to fetch | |
| type of the module to fetch | |
|
| page size |
|
| page offset |
Returns
Promise<EventIdentifier[] | null>
Deprecated
Note
uses the middlewareV2
getLatestBlock()
getLatestBlock():
Promise<BigNumber>
Defined in: src/api/client/Network.ts:60
Retrieve the number of the latest finalized block in the chain
Returns
Promise<BigNumber>
getMiddlewareLag()
getMiddlewareLag():
Promise<BigNumber>
Defined in: src/api/client/Network.ts:516
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
getMiddlewareMetadata()
getMiddlewareMetadata():
Promise<MiddlewareMetadata|null>
Defined in: src/api/client/Network.ts:505
Retrieve middleware metadata. Returns null if middleware is disabled
Returns
Promise<MiddlewareMetadata | null>
Note
uses the middleware V2
getNetworkProperties()
getNetworkProperties():
Promise<NetworkProperties>
Defined in: src/api/client/Network.ts:81
Retrieve information for the current network
Returns
Promise<NetworkProperties>
getProtocolFees()
getProtocolFees(
args:object):Promise<ProtocolFees[]>
Defined in: src/api/client/Network.ts:107
Retrieve the protocol fees associated with running specific transactions
Parameters
| Parameter | Type | Description |
|---|---|---|
| { | ‐ |
|
| list of transaction tags (e.g. [TxTags.asset.CreateAsset, TxTags.asset.RegisterUniqueTicker] or ["asset.createAsset", "asset.registerTicker"]) |
Returns
Promise<ProtocolFees[]>
getSs58Format()
getSs58Format():
BigNumber
Defined in: src/api/client/Network.ts:74
Retrieve the chain's SS58 format
Returns
BigNumber
getTransactionByHash()
getTransactionByHash(
opts:object):Promise<ExtrinsicDataWithFees|null>
Defined in: src/api/client/Network.ts:410
Retrieve a transaction by hash
Parameters
| Parameter | Type | Description |
|---|---|---|
| { | ‐ |
|
| hash of the transaction |
Returns
Promise<ExtrinsicDataWithFees | null>
Note
uses the middlewareV2
getTreasuryAccount()
getTreasuryAccount():
Account
Defined in: src/api/client/Network.ts:114
Get the treasury wallet address
Returns
getTreasuryBalance()
Call Signature
getTreasuryBalance():
Promise<BigNumber>
Defined in: src/api/client/Network.ts:127
Get the Treasury POLYX balance
Returns
Promise<BigNumber>
Promise that resolves to the current Treasury balance
Call Signature
getTreasuryBalance(
callback:SubCallback<BigNumber>):Promise<UnsubCallback>
Defined in: src/api/client/Network.ts:138
Get the Treasury POLYX balance (with subscription support)
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| Callback function that receives balance updates |
Returns
Promise<UnsubCallback>
Promise that resolves to an unsubscribe function
Note
can be subscribed to, if connected to node using a web socket
getVersion()
getVersion():
Promise<string>
Defined in: src/api/client/Network.ts:67
Fetch the current network version (e.g. 3.1.0)
Returns
Promise<string>
submitTransaction()
submitTransaction(
txPayload:TransactionPayloadInput,signature:string):Promise<SubmissionDetails>
Defined in: src/api/client/Network.ts:213
Submits a transaction payload with its signature to the chain. signature should be hex encoded
Parameters
| Parameter | Type |
|---|---|
| |
|
|
Returns
Promise<SubmissionDetails>
Throws
if the signature is not hex encoded
supportsConfidentialAssets()
supportsConfidentialAssets():
boolean
Defined in: src/api/client/Network.ts:533
Returns whether or not the connected chain node as support for confidential assets
Returns
boolean
supportsSubscription()
supportsSubscription():
boolean
Defined in: src/api/client/Network.ts:549
Returns if functions can be subscribed.
Returns
boolean
true if connected over ws(s)://, otherwise false
transferPolyx()
transferPolyx(
args:TransferPolyxParams,opts?:ProcedureOpts):Promise<GenericPolymeshTransaction<void,void>>
Defined in: src/api/client/Network.ts:161
Transfer an amount of POLYX to a specified Account
Parameters
| Parameter | Type |
|---|---|
| |
|
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