stellar-plus
Version:
beta version of stellar-plus, an all-in-one sdk for the Stellar blockchain
97 lines (96 loc) • 4.65 kB
TypeScript
import { FeeBumpTransaction, Transaction, xdr } from '@stellar/stellar-sdk';
import { FreighterAccHandlerPayload, FreighterAccountHandler, FreighterCallback } from '../../../../stellar-plus/account/account-handler/freighter/types';
import { AccountBase } from '../../../../stellar-plus/account/base';
import { NetworkConfig } from '../../../../stellar-plus/types';
export declare class FreighterAccountHandlerClient extends AccountBase implements FreighterAccountHandler {
protected networkConfig: NetworkConfig;
/**
*
* @args payload - The payload for the Freighter account handler. Additional parameters may be provided to enable different helpers.
*
* @param {NetworkConfig} payload.networkConfig The network to use.
*
* @description - The Freighter account handler is used for handling and creating new accounts by integrating with the browser extension Freighter App.
*/
constructor(payload: FreighterAccHandlerPayload);
/**
*
* @returns {string} The public key of the account.
*/
getPublicKey(): string;
/**
*
* @param {function(string): void} onPublicKeyReceived - The callback to be called with the public key if successful.
*
* @returns {Promise<void>}
*
* @description - Perform all necessary verification to connect to Freighter and trigger the connection, calling the callback with the public key if successful.
*/
connect(onPublicKeyReceived?: FreighterCallback): Promise<void>;
/**
* @returns {void}
*
* @description - Disconnect from Freighter.
*/
disconnect(): void;
/**
*
* @param {function(string):void} onPublicKeyReceived - The callback to be called with the public key if successful.
* @param {boolean} enforceConnection - If true, it will perform all necessary verification to connect to Freighter and trigger the connection. Defaults to false.
*
* @returns {Promise<void>}
*
* @description - Get the public key from Freighter and call the callback with the public key if successful. When enforceConnection is true, it will perform all necessary verification to connect to Freighter and trigger the connection.
*
* */
loadPublicKey(onPublicKeyReceived?: FreighterCallback, enforceConnection?: boolean): Promise<void>;
/**
*
* @param {Transaction} tx - The transaction to sign.
*
* @returns {Promise<string>
* }
* @description - Sign a transaction with Freighter and return the signed transaction. If signerpublicKey is provided, it will be used to specifically request Freighter to sign with that account.
*
*/
sign(tx: Transaction | FeeBumpTransaction): Promise<string>;
/**
*
* @param {xdr.SorobanAuthorizationEntry} entry - The soroban authorization entry to sign.
* @param {number} validUntilLedgerSeq - The ledger sequence number until which the entry signature is valid.
* @param {string} networkPassphrase - The network passphrase for the network to sign the entry for.
* @description - Signs the given Soroban authorization entry with the account's secret key.
*
* @returns {xdr.SorobanAuthorizationEntry} The signed entry.
*/
signSorobanAuthEntry(entry: xdr.SorobanAuthorizationEntry, validUntilLedgerSeq: number, networkPassphrase: string): Promise<xdr.SorobanAuthorizationEntry>;
/**
*
* @param {boolean} enforceConnection - If true, it will perform all necessary verification to connect to Freighter and trigger the connection. Defaults to false.
* @param {function(string):void} callback - The callback to be called with the public key if successful.
*
* @returns {Promise<boolean>}
*
* @description - Perform all necessary verification to connect to Freighter. If enforceConnection is true, it will trigger the connection and call the callback with the public key if successful.
*
*/
isFreighterConnected(enforceConnection?: boolean, callback?: FreighterCallback): Promise<boolean>;
/**
*
* @returns {Promise<boolean>}
* @description - Verify is Freighter extension is installed
*/
isFreighterInstalled(): Promise<boolean>;
/**
*
* @returns {Promise<boolean>}
* @description - Verify if the application is authorized to connect to Freighter
*/
isApplicationAuthorized(): Promise<boolean>;
/**
*
* @returns {Promise<boolean>}
* @description - Verify if the network selected on Freighter is the same as the network selected on this handler
*/
isNetworkCorrect(): Promise<boolean>;
}