import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core'; import { ApiPromise } from '@polkadot/api'; import { SigningManager } from '@polymeshassociation/signing-manager-types'; import { AccountManagement } from '../../api/client/AccountManagement'; import { Assets } from '../../api/client/Assets'; import { Claims } from '../../api/client/Claims'; import { Identities } from '../../api/client/Identities'; import { Network } from '../../api/client/Network'; import { Settlements } from '../../api/client/Settlements'; import { Staking } from '../../api/client/Staking'; import { Account, Context, Identity } from '../../internal'; import { CreateTransactionBatchProcedureMethod, MiddlewareConfig, PolkadotConfig, UnsubCallback } from '../../types'; export interface ConnectParams { /** * The websocket or http URL for the Polymesh node to connect to * * @note subscription features are not available if an http URL is provided */ nodeUrl: string; /** * Handles signing of transactions. Required to be set before submitting transactions */ signingManager?: SigningManager; /** * Allows for historical data to be queried. Required for some methods to work */ middlewareV2?: MiddlewareConfig; /** * Advanced options that will be used with the underling polkadot.js instance */ polkadot?: PolkadotConfig; } /** * Main entry point of the Polymesh SDK */ export declare class Polymesh { protected context: Context; /** * A set of methods to deal with Claims */ claims: Claims; /** * A set of methods to interact with the Polymesh network. This includes transferring POLYX, reading network properties and querying for historical events */ network: Network; /** * A set of methods for exchanging Assets */ settlements: Settlements; /** * A set of methods for staking POLYX */ staking: Staking; /** * A set of methods for managing a Polymesh Identity's Accounts and their permissions */ accountManagement: AccountManagement; /** * A set of methods for interacting with Polymesh Identities. */ identities: Identities; /** * A set of methods for interacting with Assets */ assets: Assets; /** * @hidden */ protected constructor(context: Context); /** * Create an SDK instance and connect to a Polymesh node * * @param params.nodeUrl - URL of the Polymesh node this instance will be connecting to * @param params.signingManager - object in charge of managing keys and signing transactions * (optional, if not passed the SDK will not be able to submit transactions). Can be set later with * `setSigningManager` * @param params.middlewareV2 - middleware V2 API URL (optional, used for historic queries) * @param params.polkadot - optional config for polkadot `ApiPromise` */ static connect(params: ConnectParams): Promise; /** * Retrieve the Identity associated to the signing Account (null if there is none) * * @throws if there is no signing Account associated to the SDK */ getSigningIdentity(): Promise; /** * Handle connection errors * * @returns an unsubscribe callback */ onConnectionError(callback: (...args: unknown[]) => unknown): UnsubCallback; /** * Handle disconnection * * @returns an unsubscribe callback */ onDisconnect(callback: (...args: unknown[]) => unknown): UnsubCallback; /** * Disconnect the client and close all open connections and subscriptions * * @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 {@link connect} */ disconnect(): Promise; /** * Set the SDK's signing Account to the provided one * * @throws if the passed Account is not present in the Signing Manager (or there is no Signing Manager) */ setSigningAccount(signer: string | Account): void; /** * Set the SDK's Signing Manager to the provided one. * * @note Pass `null` to unset the current signing manager */ setSigningManager(signingManager: SigningManager | null): Promise; /** * 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 * * @param args.transactions - list of {@link base/PolymeshTransaction!PolymeshTransaction} or {@link base/PolymeshTransactionBatch!PolymeshTransactionBatch} * * @example Batching 3 ticker reservation transactions * * ```typescript * 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(); * ``` * * @example Specifying the signer account for the whole batch * * ```typescript * 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) */ createTransactionBatch: CreateTransactionBatchProcedureMethod; /** * Polkadot client */ get _polkadotApi(): ApiPromise; /** * signing address (to manually submit transactions with the polkadot API) */ get _signingAddress(): string; /** * MiddlewareV2 client */ get _middlewareApiV2(): ApolloClient; } //# sourceMappingURL=Polymesh.d.ts.map