import { Context } from '../context'; import { ContractAbstraction } from '../contract/contract'; import type { ContractStorageType, DefaultWalletType } from '../contract/contract'; import { SendParams } from '../contract/contract-methods/contract-method-interface'; import type { ContractMethodObject } from '../contract/contract-methods/contract-method-object-param'; import { OpKind, withKind } from '../operations/types'; import { OriginationWalletOperation } from './origination-operation'; import { WalletDelegateParams, WalletFailingNoopParams, WalletIncreasePaidStorageParams, WalletOriginateParams, WalletProvider, WalletTransferParams, WalletStakeParams, WalletUnstakeParams, WalletFinalizeUnstakeParams, WalletTransferTicketParams, WalletRegisterGlobalConstantParams } from './interface'; import { BlockIdentifier } from '../read-provider/interface'; export interface PKHOption { forceRefetch?: boolean; } export type WalletParamsWithKind = withKind | withKind | withKind | withKind | withKind | withKind; export declare class WalletOperationBatch { private walletProvider; private context; private operations; constructor(walletProvider: WalletProvider, context: Context); /** * Add a transaction operation to the batch * @param params Transfer operation parameter */ withTransfer(params: WalletTransferParams): this; /** * Add a contract call to the batch * @param params Call a contract method * @param options Generic operation parameters */ withContractCall(params: ContractMethodObject, options?: Partial): this; /** * Add a delegation operation to the batch * @param params Delegation operation parameter */ withDelegation(params: WalletDelegateParams): this; /** * Add an origination operation to the batch * @param params Origination operation parameter */ withOrigination(params: WalletOriginateParams>): this; /** * Add an IncreasePaidStorage operation to the batch * @param params IncreasePaidStorage operation parameter */ withIncreasePaidStorage(params: WalletIncreasePaidStorageParams): this; /** * Add an TransferTicket operation to the batch * @param params TransferTicket operation parameter */ withTransferTicket(params: WalletTransferTicketParams): this; /** * Add a RegisterGlobalConstant operation to the batch * @param params RegisterGlobalConstant operation parameter */ withRegisterGlobalConstant(params: WalletRegisterGlobalConstantParams): this; private mapOperation; /** * Add a group operation to the batch. Operation will be applied in the order they are in the params array * @param params Operations parameter * @throws InvalidOperationKindError */ with(params: WalletParamsWithKind[]): this; /** * Submit batch operation to wallet */ send(): Promise; } export declare class Wallet { private context; constructor(context: Context); private get walletProvider(); private _pkh?; private _pk?; /** * Retrieve the PKH of the account that is currently in use by the wallet * @param option Option to use while fetching the PKH. * If forceRefetch is specified the wallet provider implementation will refetch the PKH from the wallet */ pkh({ forceRefetch }?: PKHOption): Promise; /** * Retrieve the PK of the account that is currently in use by the wallet * @param option Option to use while fetching the PK. * If forceRefetch is specified the wallet provider implementation will refetch the PK from the wallet */ pk({ forceRefetch }?: PKHOption): Promise; private walletCommand; /** * Originate a new contract according to the script in parameters. * @returns a OriginationWalletOperation promise object when followed by .send() * @param params Originate operation parameter */ originate(params: WalletOriginateParams>): { send: () => Promise>; }; /** * Set the delegate for a contract. * @returns a WalletDelegateParams promise object when followed by .send() * @param params operation parameter */ setDelegate(params: WalletDelegateParams): { send: () => Promise; }; /** * failing_noop operation that is guaranteed to fail. DISCLAIMER: Not all wallets support signing failing_noop operations. * @returns Signature for a failing_noop * @param params operation parameter */ signFailingNoop(params: WalletFailingNoopParams): Promise<{ signature: string; bytes: string; signedContent: { branch: string; contents: { kind: OpKind; arbitrary: string; }[]; }; }>; /** * Register the current address as delegate. * @returns a DelegationWalletOperation promise object when followed by .send() */ registerDelegate(): { send: () => Promise; }; /** * Transfer tezos tokens from current address to a specific address or call a smart contract. * @returns a TransactionWalletOperation promise object when followed by .send() * @param params operation parameter */ transfer(params: WalletTransferParams): { send: () => Promise; }; /** * Transfer tezos tickets from current address to a specific address or a smart contract * @returns a TransferTicketWalletOperation promise object when followed by .send() * @param params operation parameter */ transferTicket(params: WalletTransferTicketParams): { send: () => Promise; }; /** * Stake a given amount for the source address * @returns a TransactionWalletOperation promise object when followed by .send() * @param params Stake pseudo-operation parameter */ stake(params: WalletStakeParams): { send: () => Promise; }; /** * Unstake the given amount. If "everything" is given as amount, unstakes everything from the staking balance. * Unstaked tez remains frozen for a set amount of cycles (the slashing period) after the operation. Once this period is over, * the operation "finalize unstake" must be called for the funds to appear in the liquid balance. * @returns a TransactionWalletOperation promise object when followed by .send() * @param params Unstake pseudo-operation parameter */ unstake(params: WalletUnstakeParams): { send: () => Promise; }; /** * Transfer all the finalizable unstaked funds of the source to their liquid balance * @returns a TransactionWalletOperation promise object when followed by .send() * @param params Finalize_unstake pseudo-operation parameter */ finalizeUnstake(params: WalletFinalizeUnstakeParams): { send: () => Promise; }; /** * Increase the paid storage of a smart contract. * @returns a IncreasePaidStorageWalletOperation promise object when followed by .send() * @param params operation parameter */ increasePaidStorage(params: WalletIncreasePaidStorageParams): { send: () => Promise; }; /** * Register a Micheline expression in a global table of constants. * @returns a RegisterGlobalConstantWalletOperation promise object when followed by .send() * @param params operation parameter */ registerGlobalConstant(params: WalletRegisterGlobalConstantParams): { send: () => Promise; }; /** * Create a batch of operation * @returns A batch object from which we can add more operation or send a command to the wallet to execute the batch * @param params List of operation to initialize the batch with */ batch(params?: Parameters[0]): WalletOperationBatch; /** * Create an smart contract abstraction for the address specified. Calling entrypoints with the returned * smart contract abstraction will leverage the wallet provider to make smart contract calls * @param address Smart contract address * @throws InvalidContractAddressError If the contract address is not valid */ at>(address: string, contractAbstractionComposer?: (abs: ContractAbstraction, context: Context) => T, block?: BlockIdentifier): Promise; atExactBlock>(address: string, contractAbstractionComposer: ((abs: ContractAbstraction, context: Context) => T) | undefined, block: BlockIdentifier): Promise; }