Skip to content

api.client.Polymesh

polymesh-bot edited this page Jul 20, 2026 · 3 revisions

@polymeshassociation/polymesh-sdk / api/client/Polymesh

api/client/Polymesh

Classes

Polymesh

Defined in: api/client/Polymesh.ts:88

Main entry point of the Polymesh SDK

Properties

accountManagement

accountManagement: AccountManagement

Defined in: api/client/Polymesh.ts:112

A set of methods for managing a Polymesh Identity's Accounts and their permissions

assets

assets: Assets

Defined in: api/client/Polymesh.ts:120

A set of methods for interacting with Assets

claims

claims: Claims

Defined in: api/client/Polymesh.ts:96

A set of methods to deal with Claims

identities

identities: Identities

Defined in: api/client/Polymesh.ts:116

A set of methods for interacting with Polymesh Identities.

network

network: Network

Defined in: api/client/Polymesh.ts:100

A set of methods to interact with the Polymesh network. This includes transferring POLYX, reading network properties and querying for historical events

settlements

settlements: Settlements

Defined in: api/client/Polymesh.ts:104

A set of methods for exchanging Assets

staking

staking: Staking

Defined in: api/client/Polymesh.ts:108

A set of methods for staking POLYX

Accessors

_middlewareApiV2
Get Signature

get _middlewareApiV2(): ApolloClient<NormalizedCacheObject>

Defined in: api/client/Polymesh.ts:357

MiddlewareV2 client

Returns

ApolloClient<NormalizedCacheObject>

_polkadotApi
Get Signature

get _polkadotApi(): ApiPromise

Defined in: api/client/Polymesh.ts:341

Polkadot client

Returns

ApiPromise

_signingAddress
Get Signature

get _signingAddress(): string

Defined in: api/client/Polymesh.ts:349

signing address (to manually submit transactions with the polkadot API)

Returns

string

Methods

createTransactionBatch()

createTransactionBatch<ReturnValues>(args, opts?): Promise<GenericPolymeshTransaction<ReturnValues, ReturnValues>>

Defined in: api/client/Polymesh.ts:334

Create a batch transaction from a list of separate transactions. The list can contain batch transactions as well. The result of running this transaction will be an array of the results of each transaction in the list, in the same order. Transactions with no return value will produce undefined in the resulting array

Type Parameters
Type Parameter
ReturnValues extends readonly unknown[]
Parameters
Parameter Type
args CreateTransactionBatchParams<ReturnValues>
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<ReturnValues, ReturnValues>>

Examples

Batching 3 ticker reservation transactions

const tx1 = await sdk.assets.reserveTicker({ ticker: 'FOO' });
const tx2 = await sdk.assets.reserveTicker({ ticker: 'BAR' });
const tx3 = await sdk.assets.reserveTicker({ ticker: 'BAZ' });

const batch = sdk.createTransactionBatch({ transactions: [tx1, tx2, tx3] as const });

const [res1, res2, res3] = await batch.run();

Specifying the signer account for the whole batch

const batch = sdk.createTransactionBatch({ transactions: [tx1, tx2, tx3] as const }, { signingAccount: 'someAddress' });

const [res1, res2, res3] = await batch.run();
Note

it is mandatory to use the as const type assertion when passing in the transaction array to the method in order to get the correct types for the results of running the batch

Note

if a signing Account is not specified, the default one will be used (the one returned by sdk.accountManagement.getSigningAccount())

Note

all fees in the resulting batch must be paid by the calling Account, regardless of any exceptions that would normally be made for the individual transactions (such as subsidies or accepting invitations to join an Identity)

Note

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

disconnect()

disconnect(): Promise<void>

Defined in: api/client/Polymesh.ts:279

Disconnect the client and close all open connections and subscriptions

Returns

Promise<void>

Note

the SDK will become unusable after this operation. It will throw an error when attempting to access any chain or middleware data. If you wish to continue using the SDK, you must create a new instance by calling connect

getSigningIdentity()

getSigningIdentity(): Promise<Identity | null>

Defined in: api/client/Polymesh.ts:234

Retrieve the Identity associated to the signing Account (null if there is none)

Returns

Promise<Identity | null>

Throws

if there is no signing Account associated to the SDK

onConnectionError()

onConnectionError(callback): UnsubCallback

Defined in: api/client/Polymesh.ts:243

Handle connection errors

Parameters
Parameter Type
callback (...args) => unknown
Returns

UnsubCallback

an unsubscribe callback

onDisconnect()

onDisconnect(callback): UnsubCallback

Defined in: api/client/Polymesh.ts:260

Handle disconnection

Parameters
Parameter Type
callback (...args) => unknown
Returns

UnsubCallback

an unsubscribe callback

setSigningAccount()

setSigningAccount(signer): void

Defined in: api/client/Polymesh.ts:288

Set the SDK's signing Account to the provided one

Parameters
Parameter Type
signer string | Account
Returns

void

Throws

if the passed Account is not present in the Signing Manager (or there is no Signing Manager)

setSigningManager()

setSigningManager(signingManager): Promise<void>

Defined in: api/client/Polymesh.ts:297

Set the SDK's Signing Manager to the provided one.

Parameters
Parameter Type
signingManager SigningManager | null
Returns

Promise<void>

Note

Pass null to unset the current signing manager

connect()

static connect(params): Promise<Polymesh>

Defined in: api/client/Polymesh.ts:154

Create an SDK instance and connect to a Polymesh node

Parameters
Parameter Type
params ConnectParams
Returns

Promise<Polymesh>

Interfaces

ConnectParams

Defined in: api/client/Polymesh.ts:37

Properties

middlewareV2?

optional middlewareV2?: MiddlewareConfig

Defined in: api/client/Polymesh.ts:51

Allows for historical data to be queried. Required for some methods to work

nodeUrl

nodeUrl: string

Defined in: api/client/Polymesh.ts:43

The websocket or http URL for the Polymesh node to connect to

Note

subscription features are not available if an http URL is provided

polkadot?

optional polkadot?: PolkadotConfig

Defined in: api/client/Polymesh.ts:55

Advanced options that will be used with the underling polkadot.js instance

signingManager?

optional signingManager?: SigningManager

Defined in: api/client/Polymesh.ts:47

Handles signing of transactions. Required to be set before submitting transactions

@polymeshassociation/polymesh-sdk

Modules

Types
- [Utils](../wiki/base.utils)

Clone this wiki locally