api.client.Network - PolymeshAssociation/polymesh-sdk GitHub Wiki
@polymeshassociation/polymesh-sdk / api/client/Network
Defined in: api/client/Network.ts:42
Handles all Network related functionality, including querying for historical events from middleware
getEventByIndexedArgs(
opts):Promise<EventIdentifier|null>
Defined in: api/client/Network.ts:174
Retrieve a single event by any of its indexed arguments. Can be filtered using parameters
| Parameter | Type | Description |
|---|---|---|
opts |
{ eventArg0?: string; eventArg1?: string; eventArg2?: string; eventId: EventIdEnum; moduleId: ModuleIdEnum; } |
- |
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<EventIdentifier | null>
uses the middlewareV2
getEventsByIndexedArgs(
opts):Promise<EventIdentifier[] |null>
Defined in: api/client/Network.ts:360
Retrieve a list of events. Can be filtered using parameters
| Parameter | Type | Description |
|---|---|---|
opts |
{ eventArg0?: string; eventArg1?: string; eventArg2?: string; eventId: EventIdEnum; moduleId: ModuleIdEnum; size?: BigNumber; start?: BigNumber; } |
- |
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<EventIdentifier[] | null>
uses the middlewareV2
getLatestBlock():
Promise<BigNumber>
Defined in: api/client/Network.ts:60
Retrieve the number of the latest finalized block in the chain
Promise<BigNumber>
getMiddlewareLag():
Promise<BigNumber>
Defined in: api/client/Network.ts:514
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>
uses the middleware V2
getMiddlewareMetadata():
Promise<MiddlewareMetadata|null>
Defined in: api/client/Network.ts:503
Retrieve middleware metadata. Returns null if middleware is disabled
Promise<MiddlewareMetadata | null>
uses the middleware V2
getNetworkProperties():
Promise<NetworkProperties>
Defined in: api/client/Network.ts:81
Retrieve information for the current network
Promise<NetworkProperties>
getProtocolFees(
args):Promise<ProtocolFees[]>
Defined in: api/client/Network.ts:107
Retrieve the protocol fees associated with running specific transactions
| Parameter | Type | Description |
|---|---|---|
args |
{ tags: TxTag[]; } |
- |
args.tags |
TxTag[] |
list of transaction tags (e.g. [TxTags.asset.CreateAsset, TxTags.asset.RegisterUniqueTicker] or ["asset.createAsset", "asset.registerTicker"]) |
Promise<ProtocolFees[]>
getSs58Format():
BigNumber
Defined in: api/client/Network.ts:74
Retrieve the chain's SS58 format
BigNumber
getTransactionByHash(
opts):Promise<ExtrinsicDataWithFees|null>
Defined in: api/client/Network.ts:408
Retrieve a transaction by hash
| Parameter | Type | Description |
|---|---|---|
opts |
{ txHash: string; } |
- |
opts.txHash |
string |
hash of the transaction |
Promise<ExtrinsicDataWithFees | null>
uses the middlewareV2
getTreasuryAccount():
Account
Defined in: api/client/Network.ts:114
Get the treasury wallet address
getTreasuryBalance():
Promise<BigNumber>
Defined in: api/client/Network.ts:127
Get the Treasury POLYX balance
Promise<BigNumber>
Promise that resolves to the current Treasury balance
getTreasuryBalance(
callback):Promise<UnsubCallback>
Defined in: api/client/Network.ts:138
Get the Treasury POLYX balance (with subscription support)
| Parameter | Type | Description |
|---|---|---|
callback |
SubCallback<BigNumber> |
Callback function that receives balance updates |
Promise<UnsubCallback>
Promise that resolves to an unsubscribe function
can be subscribed to, if connected to node using a web socket
getVersion():
Promise<string>
Defined in: api/client/Network.ts:67
Fetch the current network version (e.g. 3.1.0)
Promise<string>
submitTransaction(
txPayload,signature):Promise<SubmissionDetails>
Defined in: api/client/Network.ts:212
Submits a transaction payload with its signature to the chain. signature should be hex encoded
| Parameter | Type |
|---|---|
txPayload |
TransactionPayloadInput |
signature |
string |
Promise<SubmissionDetails>
if the signature is not hex encoded
supportsConfidentialAssets():
boolean
Defined in: api/client/Network.ts:531
Returns whether or not the connected chain node as support for confidential assets
boolean
supportsSubscription():
boolean
Defined in: api/client/Network.ts:547
Returns if functions can be subscribed.
boolean
true if connected over ws(s)://, otherwise false
transferPolyx(
args,opts?):Promise<GenericPolymeshTransaction<void,void>>
Defined in: api/client/Network.ts:161
Transfer an amount of POLYX to a specified Account
| Parameter | Type |
|---|---|
args |
TransferPolyxParams |
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<void, void>>
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