Options
All
  • Public
  • Public/Protected
  • All
Menu

Module entry point for the wallet when used as a node module.

Hierarchy

  • Wallet

Index

Constructors

constructor

  • new Wallet(db: Database<{ backupProviders: BackupProvidersStore; bankWithdrawUris: BankWithdrawUrisStore; coins: CoinsStore; config: ConfigStore; currencies: CurrenciesStore; denominations: DenominationsStore; depositGroups: DepositGroupsStore; exchanges: ExchangesStore; ghostDepositGroups: Store<"ghostDepositGroups", GhostDepositGroupRecord>; planchets: PlanchetsStore; proposals: ProposalsStore; purchases: PurchasesStore; recoupGroups: Store<"recoupGroups", RecoupGroupRecord>; refreshGroups: Store<"refreshGroups", RefreshGroupRecord>; reserves: ReservesStore; tips: TipsStore; withdrawalGroups: WithdrawalGroupsStore }>, http: HttpRequestLibrary, cryptoWorkerFactory: CryptoWorkerFactory): Wallet
  • Parameters

    • db: Database<{ backupProviders: BackupProvidersStore; bankWithdrawUris: BankWithdrawUrisStore; coins: CoinsStore; config: ConfigStore; currencies: CurrenciesStore; denominations: DenominationsStore; depositGroups: DepositGroupsStore; exchanges: ExchangesStore; ghostDepositGroups: Store<"ghostDepositGroups", GhostDepositGroupRecord>; planchets: PlanchetsStore; proposals: ProposalsStore; purchases: PurchasesStore; recoupGroups: Store<"recoupGroups", RecoupGroupRecord>; refreshGroups: Store<"refreshGroups", RefreshGroupRecord>; reserves: ReservesStore; tips: TipsStore; withdrawalGroups: WithdrawalGroupsStore }>
    • http: HttpRequestLibrary
    • cryptoWorkerFactory: CryptoWorkerFactory

    Returns Wallet

Properties

Private latch

latch: AsyncCondition = ...

Private memoRunRetryLoop

memoRunRetryLoop: AsyncOpMemoSingle<void> = ...

Private stopped

stopped: boolean = false

Private timerGroup

timerGroup: TimerGroup = ...

Private ws

ws: InternalWalletState

Accessors

db

  • get db(): Database<{ backupProviders: BackupProvidersStore; bankWithdrawUris: BankWithdrawUrisStore; coins: CoinsStore; config: ConfigStore; currencies: CurrenciesStore; denominations: DenominationsStore; depositGroups: DepositGroupsStore; exchanges: ExchangesStore; ghostDepositGroups: Store<"ghostDepositGroups", GhostDepositGroupRecord>; planchets: PlanchetsStore; proposals: ProposalsStore; purchases: PurchasesStore; recoupGroups: Store<"recoupGroups", RecoupGroupRecord>; refreshGroups: Store<"refreshGroups", RefreshGroupRecord>; reserves: ReservesStore; tips: TipsStore; withdrawalGroups: WithdrawalGroupsStore }>
  • Returns Database<{ backupProviders: BackupProvidersStore; bankWithdrawUris: BankWithdrawUrisStore; coins: CoinsStore; config: ConfigStore; currencies: CurrenciesStore; denominations: DenominationsStore; depositGroups: DepositGroupsStore; exchanges: ExchangesStore; ghostDepositGroups: Store<"ghostDepositGroups", GhostDepositGroupRecord>; planchets: PlanchetsStore; proposals: ProposalsStore; purchases: PurchasesStore; recoupGroups: Store<"recoupGroups", RecoupGroupRecord>; refreshGroups: Store<"refreshGroups", RefreshGroupRecord>; reserves: ReservesStore; tips: TipsStore; withdrawalGroups: WithdrawalGroupsStore }>

Methods

abortFailedPayWithRefund

  • abortFailedPayWithRefund(proposalId: string): Promise<void>
  • Parameters

    • proposalId: string

    Returns Promise<void>

acceptExchangeTermsOfService

  • acceptExchangeTermsOfService(exchangeBaseUrl: string, etag: undefined | string): Promise<void>
  • Parameters

    • exchangeBaseUrl: string
    • etag: undefined | string

    Returns Promise<void>

acceptManualWithdrawal

  • acceptManualWithdrawal(exchangeBaseUrl: string, amount: AmountJson): Promise<AcceptManualWithdrawalResult>
  • Create a reserve, but do not flag it as confirmed yet.

    Adds the corresponding exchange as a trusted exchange if it is neither audited nor trusted already.

    Parameters

    • exchangeBaseUrl: string
    • amount: AmountJson

    Returns Promise<AcceptManualWithdrawalResult>

acceptTip

  • acceptTip(talerTipUri: string): Promise<void>
  • Parameters

    • talerTipUri: string

    Returns Promise<void>

acceptWithdrawal

  • acceptWithdrawal(talerWithdrawUri: string, selectedExchange: string): Promise<AcceptWithdrawalResponse>
  • Parameters

    • talerWithdrawUri: string
    • selectedExchange: string

    Returns Promise<AcceptWithdrawalResponse>

addBackupProvider

  • addBackupProvider(req: AddBackupProviderRequest): Promise<void>
  • Parameters

    • req: AddBackupProviderRequest

    Returns Promise<void>

addNotificationListener

  • addNotificationListener(f: (n: WalletNotification) => void): void
  • Parameters

    • f: (n: WalletNotification) => void
        • (n: WalletNotification): void
        • Parameters

          • n: WalletNotification

          Returns void

    Returns void

applyRefund

  • applyRefund(talerRefundUri: string): Promise<ApplyRefundResponse>
  • Accept a refund, return the contract hash for the contract that was involved in the refund.

    Parameters

    • talerRefundUri: string

    Returns Promise<ApplyRefundResponse>

benchmarkCrypto

  • benchmarkCrypto(repetitions: number): Promise<BenchmarkResult>
  • Parameters

    • repetitions: number

    Returns Promise<BenchmarkResult>

collectGarbage

  • collectGarbage(): Promise<void>
  • Remove unreferenced / expired data from the wallet's database based on the current system time.

    Returns Promise<void>

confirmPay

  • confirmPay(proposalId: string, sessionIdOverride: undefined | string): Promise<ConfirmPayResult>
  • Add a contract to the wallet and sign coins, and send them.

    Parameters

    • proposalId: string
    • sessionIdOverride: undefined | string

    Returns Promise<ConfirmPayResult>

createDepositGroup

  • createDepositGroup(req: CreateDepositGroupRequest): Promise<CreateDepositGroupResponse>
  • Parameters

    • req: CreateDepositGroupRequest

    Returns Promise<CreateDepositGroupResponse>

Private dispatchRequestInternal

  • dispatchRequestInternal(operation: string, payload: unknown): Promise<Record<string, any>>
  • Implementation of the "wallet-core" API.

    Parameters

    • operation: string
    • payload: unknown

    Returns Promise<Record<string, any>>

dumpCoins

  • dumpCoins(): Promise<CoinDumpJson>
  • Dump the public information of coins we have in an easy-to-process format.

    Returns Promise<CoinDumpJson>

exportBackupEncrypted

  • exportBackupEncrypted(): Promise<Uint8Array>
  • Returns Promise<Uint8Array>

exportBackupPlain

  • exportBackupPlain(): Promise<WalletBackupContentV1>
  • Returns Promise<WalletBackupContentV1>

fillDefaults

  • fillDefaults(): Promise<void>
  • Insert the hard-coded defaults for exchanges, coins and auditors into the database, unless these defaults have already been applied.

    Returns Promise<void>

findExchange

  • findExchange(exchangeBaseUrl: string): Promise<undefined | ExchangeRecord>
  • Parameters

    • exchangeBaseUrl: string

    Returns Promise<undefined | ExchangeRecord>

getBackupRecovery

  • getBackupRecovery(): Promise<BackupRecovery>
  • Returns Promise<BackupRecovery>

getBackupStatus

  • getBackupStatus(): Promise<BackupInfo>
  • Returns Promise<BackupInfo>

getBalances

  • getBalances(): Promise<BalancesResponse>
  • Get detailed balance information, sliced by exchange and by currency.

    Returns Promise<BalancesResponse>

getCoins

  • Returns Promise<CoinRecord[]>

getCoinsForExchange

  • getCoinsForExchange(exchangeBaseUrl: string): Promise<CoinRecord[]>
  • Parameters

    • exchangeBaseUrl: string

    Returns Promise<CoinRecord[]>

getCurrencies

  • Returns Promise<CurrencyRecord[]>

getDenoms

  • Parameters

    • exchangeUrl: string

    Returns Promise<DenominationRecord[]>

getExchangePaytoUri

  • getExchangePaytoUri(exchangeBaseUrl: string, supportedTargetTypes: string[]): Promise<string>
  • Parameters

    • exchangeBaseUrl: string
    • supportedTargetTypes: string[]

    Returns Promise<string>

getExchangeRecords

  • Get all exchanges known to the exchange.

    deprecated

    Use getExchanges instead

    Returns Promise<ExchangeRecord[]>

getExchangeTos

  • getExchangeTos(exchangeBaseUrl: string): Promise<GetExchangeTosResult>
  • Parameters

    • exchangeBaseUrl: string

    Returns Promise<GetExchangeTosResult>

getExchangeTrust

  • getExchangeTrust(exchangeInfo: ExchangeRecord): Promise<{ isAudited: boolean; isTrusted: boolean }>
  • Check if and how an exchange is trusted and/or audited.

    Parameters

    Returns Promise<{ isAudited: boolean; isTrusted: boolean }>

getExchanges

  • getExchanges(): Promise<ExchangesListRespose>
  • Returns Promise<ExchangesListRespose>

getPendingOperations

  • Parameters

    • __namedParameters: { onlyDue: any } = {}

    Returns Promise<PendingOperationsResponse>

getPurchase

  • getPurchase(contractTermsHash: string): Promise<undefined | PurchaseRecord>
  • Parameters

    • contractTermsHash: string

    Returns Promise<undefined | PurchaseRecord>

getPurchaseDetails

  • getPurchaseDetails(proposalId: string): Promise<PurchaseDetails>
  • Parameters

    • proposalId: string

    Returns Promise<PurchaseDetails>

getReserve

  • getReserve(reservePub: string): Promise<undefined | ReserveRecord>
  • Parameters

    • reservePub: string

    Returns Promise<undefined | ReserveRecord>

getReserves

  • getReserves(exchangeBaseUrl?: string): Promise<ReserveRecord[]>
  • Parameters

    • Optional exchangeBaseUrl: string

    Returns Promise<ReserveRecord[]>

getTransactions

  • getTransactions(request: TransactionsRequest): Promise<TransactionsResponse>
  • Parameters

    • request: TransactionsRequest

    Returns Promise<TransactionsResponse>

getWithdrawalDetailsForAmount

  • getWithdrawalDetailsForAmount(exchangeBaseUrl: string, amount: AmountJson): Promise<ManualWithdrawalDetails>
  • Parameters

    • exchangeBaseUrl: string
    • amount: AmountJson

    Returns Promise<ManualWithdrawalDetails>

getWithdrawalDetailsForUri

  • getWithdrawalDetailsForUri(talerWithdrawUri: string): Promise<WithdrawUriInfoResponse>
  • Parameters

    • talerWithdrawUri: string

    Returns Promise<WithdrawUriInfoResponse>

handleCoreApiRequest

  • handleCoreApiRequest(operation: string, id: string, payload: unknown): Promise<CoreApiResponse>
  • Handle a request to the wallet-core API.

    Parameters

    • operation: string
    • id: string
    • payload: unknown

    Returns Promise<CoreApiResponse>

handleNotifyReserve

  • handleNotifyReserve(): Promise<void>
  • Inform the wallet that the status of a reserve has changed (e.g. due to a confirmation from the bank.).

    Returns Promise<void>

importBackupEncrypted

  • importBackupEncrypted(backup: Uint8Array): Promise<void>
  • Parameters

    • backup: Uint8Array

    Returns Promise<void>

importBackupPlain

  • importBackupPlain(backup: any): Promise<void>
  • Parameters

    • backup: any

    Returns Promise<void>

loadBackupRecovery

  • loadBackupRecovery(req: RecoveryLoadRequest): Promise<void>
  • Parameters

    • req: RecoveryLoadRequest

    Returns Promise<void>

preparePayForUri

  • preparePayForUri(talerPayUri: string): Promise<PreparePayResult>
  • Check if a payment for the given taler://pay/ URI is possible.

    If the payment is possible, the signature are already generated but not yet send to the merchant.

    Parameters

    • talerPayUri: string

    Returns Promise<PreparePayResult>

prepareTip

  • prepareTip(talerTipUri: string): Promise<PrepareTipResult>
  • Parameters

    • talerTipUri: string

    Returns Promise<PrepareTipResult>

processOnePendingOperation

  • Execute one operation based on the pending operation info record.

    Parameters

    Returns Promise<void>

processReserve

  • processReserve(reservePub: string): Promise<void>
  • First fetch information requred to withdraw from the reserve, then deplete the reserve, withdrawing coins until it is empty.

    The returned promise resolves once the reserve is set to the state DORMANT.

    Parameters

    • reservePub: string

    Returns Promise<void>

refresh

  • refresh(oldCoinPub: string): Promise<void>
  • Parameters

    • oldCoinPub: string

    Returns Promise<void>

refuseProposal

  • refuseProposal(proposalId: string): Promise<void>
  • Parameters

    • proposalId: string

    Returns Promise<void>

returnCoins

  • returnCoins(req: ReturnCoinsRequest): Promise<void>
  • Trigger paying coins back into the user's account.

    Parameters

    • req: ReturnCoinsRequest

    Returns Promise<void>

runBackupCycle

  • runBackupCycle(): Promise<void>
  • Returns Promise<void>

runIntegrationtest

  • runIntegrationtest(args: IntegrationTestArgs): Promise<void>
  • Parameters

    • args: IntegrationTestArgs

    Returns Promise<void>

runPending

  • runPending(forceNow?: boolean): Promise<void>
  • Process pending operations.

    Parameters

    • forceNow: boolean = false

    Returns Promise<void>

runRetryLoop

  • runRetryLoop(): Promise<void>
  • Process pending operations and wait for scheduled operations in a loop until the wallet is stopped explicitly.

    Returns Promise<void>

Private runRetryLoopImpl

  • runRetryLoopImpl(): Promise<void>
  • Returns Promise<void>

runUntilDone

  • runUntilDone(req?: { maxRetries?: number }): Promise<void>
  • Run the wallet until there are no more pending operations that give liveness left. The wallet will be in a stopped state when this function returns without resolving to an exception.

    Parameters

    • req: { maxRetries?: number } = {}
      • Optional maxRetries?: number

    Returns Promise<void>

setCoinSuspended

  • setCoinSuspended(coinPub: string, suspended: boolean): Promise<void>
  • Parameters

    • coinPub: string
    • suspended: boolean

    Returns Promise<void>

stop

  • stop(): void
  • Stop ongoing processing.

    Returns void

testPay

  • testPay(args: TestPayArgs): Promise<void>
  • Parameters

    • args: TestPayArgs

    Returns Promise<void>

trackDepositGroup

  • trackDepositGroup(req: TrackDepositGroupRequest): Promise<TrackDepositGroupResponse>
  • Parameters

    • req: TrackDepositGroupRequest

    Returns Promise<TrackDepositGroupResponse>

updateCurrency

  • Parameters

    Returns Promise<void>

updateExchangeFromUrl

  • updateExchangeFromUrl(baseUrl: string, force?: boolean): Promise<ExchangeRecord>
  • Update or add exchange DB entry by fetching the /keys and /wire information. Optionally link the reserve entry to the new or existing exchange entry in then DB.

    Parameters

    • baseUrl: string
    • force: boolean = false

    Returns Promise<ExchangeRecord>

updateReserve

  • updateReserve(reservePub: string): Promise<undefined | ReserveRecord>
  • Parameters

    • reservePub: string

    Returns Promise<undefined | ReserveRecord>

withdrawTestBalance

  • withdrawTestBalance(req: WithdrawTestBalanceRequest): Promise<void>
  • Parameters

    • req: WithdrawTestBalanceRequest

    Returns Promise<void>

Generated using TypeDoc