api.client.Network.Network - PolymeshAssociation/polymesh-sdk GitHub Wiki
api/client/Network.Network
Handles all Network related functionality, including querying for historical events from middleware
- getEventByIndexedArgs
- getEventsByIndexedArgs
- getLatestBlock
- getMiddlewareLag
- getMiddlewareMetadata
- getNetworkProperties
- getProtocolFees
- getSs58Format
- getTransactionByHash
- getTreasuryAccount
- getTreasuryBalance
- getVersion
- submitTransaction
- supportsConfidentialAssets
- supportsSubscription
- transferPolyx
▸ getEventByIndexedArgs(opts
): Promise
<null
| EventIdentifier
>
Retrieve a single event by any of its indexed arguments. Can be filtered using parameters
Name | Type | Description |
---|---|---|
opts |
Object |
- |
opts.eventArg0? |
string |
event parameter value to filter by in position 0 |
opts.eventArg1? |
string |
event parameter value to filter by in position 1 |
opts.eventArg2? |
string |
event parameter value to filter by in position 2 |
opts.eventId |
EventIdEnum |
type of the event to fetch |
opts.moduleId |
ModuleIdEnum |
type of the module to fetch |
Promise
<null
| EventIdentifier
>
Note
uses the middlewareV2
▸ getEventsByIndexedArgs(opts
): Promise
<null
| EventIdentifier
[]>
Retrieve a list of events. Can be filtered using parameters
Name | Type | Description |
---|---|---|
opts |
Object |
- |
opts.eventArg0? |
string |
event parameter value to filter by in position 0 |
opts.eventArg1? |
string |
event parameter value to filter by in position 1 |
opts.eventArg2? |
string |
event parameter value to filter by in position 2 |
opts.eventId |
EventIdEnum |
type of the event to fetch |
opts.moduleId |
ModuleIdEnum |
type of the module to fetch |
opts.size? |
BigNumber |
page size |
opts.start? |
BigNumber |
page offset |
Promise
<null
| EventIdentifier
[]>
Note
uses the middlewareV2
▸ getLatestBlock(): Promise
<BigNumber
>
Retrieve the number of the latest finalized block in the chain
Promise
<BigNumber
>
▸ 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.
Promise
<BigNumber
>
Note
uses the middleware V2
▸ getMiddlewareMetadata(): Promise
<null
| MiddlewareMetadata
>
Retrieve middleware metadata. Returns null if middleware is disabled
Promise
<null
| MiddlewareMetadata
>
Note
uses the middleware V2
▸ getNetworkProperties(): Promise
<NetworkProperties
>
Retrieve information for the current network
Promise
<NetworkProperties
>
▸ getProtocolFees(args
): Promise
<ProtocolFees
[]>
Retrieve the protocol fees associated with running specific transactions
Name | Type | Description |
---|---|---|
args |
Object |
- |
args.tags |
TxTag [] |
list of transaction tags (e.g. [TxTags.asset.CreateAsset, TxTags.asset.RegisterUniqueTicker] or ["asset.createAsset", "asset.registerTicker"]) |
Promise
<ProtocolFees
[]>
▸ getSs58Format(): BigNumber
Retrieve the chain's SS58 format
BigNumber
▸ getTransactionByHash(opts
): Promise
<null
| ExtrinsicDataWithFees
>
Retrieve a transaction by hash
Name | Type | Description |
---|---|---|
opts |
Object |
- |
opts.txHash |
string |
hash of the transaction |
Promise
<null
| ExtrinsicDataWithFees
>
Note
uses the middlewareV2
▸ getTreasuryAccount(): Account
Get the treasury wallet address
▸ getTreasuryBalance(): Promise
<BigNumber
>
Get the Treasury POLYX balance
Promise
<BigNumber
>
Note
can be subscribed to, if connected to node using a web socket
▸ getTreasuryBalance(callback
): Promise
<UnsubCallback
>
Name | Type |
---|---|
callback |
SubCallback <BigNumber > |
Promise
<UnsubCallback
>
▸ getVersion(): Promise
<string
>
Fetch the current network version (e.g. 3.1.0)
Promise
<string
>
▸ submitTransaction(txPayload
, signature
): Promise
<SubmissionDetails
>
Submits a transaction payload with its signature to the chain. signature
should be hex encoded
Name | Type |
---|---|
txPayload |
TransactionPayload |
signature |
string |
Promise
<SubmissionDetails
>
Throws
if the signature is not hex encoded
▸ supportsConfidentialAssets(): boolean
Returns whether or not the connected chain node as support for confidential assets
boolean
▸ supportsSubscription(): boolean
Returns if functions can be subscribed.
boolean
true
if connected over ws(s)://, otherwise false
▸ transferPolyx(args
, opts?
): Promise
<GenericPolymeshTransaction
<void
, void
>>
Transfer an amount of POLYX to a specified Account
Name | Type |
---|---|
args |
TransferPolyxParams |
opts? |
ProcedureOpts |
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