@dfinity/oisy-wallet-signer
Version:
A library designed to facilitate communication between a dApp and the OISY Wallet on the Internet Computer.
39 lines (38 loc) • 2.21 kB
TypeScript
import type { PrincipalText } from '@dfinity/zod-schemas';
import { type BlockHeight, type Icrc1TransferRequest, type Icrc2ApproveRequest } from '@icp-sdk/canisters/ledger/icp';
import { RelyingParty } from './relying-party';
import type { IcrcAccount } from './types/icrc-accounts';
import type { RelyingPartyOptions } from './types/relying-party-options';
import type { RelyingPartyRequestOptions } from './types/relying-party-requests';
export declare class IcpWallet extends RelyingParty {
/**
* Establishes a connection with an ICP Wallet.
*
* @override
* @static
* @param {RelyingPartyOptions} options - The options to initialize the ICP Wallet signer.
* @returns {Promise<IcpWallet>} A promise that resolves to an object, which can be used to interact with the ICP Wallet when it is connected.
*/
static connect({ onDisconnect, host, ...rest }: RelyingPartyOptions): Promise<IcpWallet>;
/**
* Transfer ICP to the destination Account. Returns the index of the block containing the tx if it was successful.
*
* @param {Object} params - The transfer parameters.
* @param {Icrc1TransferRequest} params.request - The request object containing transfer details.
* @param {string} params.owner - The owner of the wallet
* @param {PrincipalText} [params.ledgerCanisterId] - Optional ledger canister ID, if not provided, uses the default ICP ledger canister ID.
* @param {RelyingPartyRequestOptions} [params.options] - Optional parameters for the request, such as request ID, authorization, or timeout.
*
* @returns {Promise<BlockHeight>} The block height of the transfer transaction if successful.
*/
icrc1Transfer: ({ request, owner, ledgerCanisterId, options }: {
options?: RelyingPartyRequestOptions;
request: Icrc1TransferRequest;
ledgerCanisterId?: PrincipalText;
} & Pick<IcrcAccount, "owner">) => Promise<BlockHeight>;
icrc2Approve: ({ request, owner, ledgerCanisterId, options }: {
options?: RelyingPartyRequestOptions;
request: Icrc2ApproveRequest;
ledgerCanisterId?: PrincipalText;
} & Pick<IcrcAccount, "owner">) => Promise<BlockHeight>;
}