UNPKG

@signumjs/wallets

Version:

Wallets communication package for DApps in the Signum Network

86 lines (85 loc) 2.87 kB
/** * Original work Copyright (c) 2022, 2026 Signum Network */ import { Amount } from '@signumjs/util'; import { Address } from '@signumjs/core'; /** * The options for the Desktop Wallet (Phoenix) */ export interface DesktopWalletOpts { /** * If true in browser environment, the method calls will try to open the deep link. * If set to false, the methods just return the generated deeplink. * In NodeJS this flag will be ignored */ openInBrowser?: boolean; /** * Browsers do not support custom URI protocols, i.e. `signum://`, so they need * a redirect proxy instead. Here you can customize your proxy, but its default is * set to https://burst-balance-alert.vercel.app/api/redirect?url= */ redirectProxy?: string; } /** * Arguments for the pay method * {@link DesktopWallet.pay} */ export interface DesktopWalletPayArgs { /** * Amount to send. */ amount?: Amount; /** * Fee */ fee?: Amount; /** * If true, the message will be encrypted with the recipient's public key.' * This requires that the recipient has a public key. Smart Contracts cannot process encrypted messages. */ encrypt?: boolean; /** * Text message - for binary message use hexMessage */ message?: string; /** * Hex encoded message (binary message) */ hexMessage?: string; /** * Id or Address */ recipient?: Address; /** * Deadline in minutes (Maximum time is kept in mem-pool until it gets removed). Default is 24 hours. */ deadline?: number; /** * If true, the transaction will be marked as read-only, i.e. application should not make allow any changes to it. */ readonly?: boolean; } /** * This wallet (proxy) allows interacting with SIP22 compatible deep linkable desktop wallets (Phoenix Wallet). */ export declare class DesktopWallet { readonly redirectProxy: string; private readonly openInBrowser; constructor(options?: DesktopWalletOpts); eventuallyOpenInBrowser(url: string): Promise<string>; mountDeeplink(action: string, payload: object): string; /** * Confirms a transaction by opening a deeplink for signing. * * @param {string} unsignedTransactionBytes - The unsigned transaction data in bytes to be confirmed. * @return {Promise<string>} A promise that resolves to a string indicating the result of the process. */ confirm(unsignedTransactionBytes: string): Promise<string>; /** * Initiates a payment operation with the specified parameters. * * @param args - An object containing the parameters for the payment. See {@link DesktopWalletPayArgs}. * @return A promise that resolves to a string representing the final payment deeplink. */ pay(args: DesktopWalletPayArgs): Promise<string>; }