PurseMethods<K, M>: {
    deposit: (<P>(payment: P, optAmountShape?: Pattern) => P extends Payment<K, M>
        ? Amount<K, M>
        : never);
    getAllegedBrand: (() => Brand<K>);
    getCurrentAmount: (() => Amount<K, M>);
    getCurrentAmountNotifier: (() => LatestTopic<Amount<K, M>>);
    getDepositFacet: (() => DepositFacet);
    getRecoverySet: (() => CopySet<Payment<K, M>>);
    recoverAll: (() => Amount<K, M>);
    withdraw: ((amount: Amount<K, M>) => Payment<K, M>);
}

The primary use for Purses and Payments is for currency-like and goods-like digital assets, but they can also be used to represent other kinds of rights, such as the right to participate in a particular contract.

Type Parameters

Type declaration

  • deposit: (<P>(payment: P, optAmountShape?: Pattern) => P extends Payment<K, M>
        ? Amount<K, M>
        : never)

    Deposit all the contents of payment into this purse, returning the amount. If the optional argument optAmount does not equal the amount of digital assets in the payment, throw an error.

    If payment is a promise, throw an error.

  • getAllegedBrand: (() => Brand<K>)

    Get the alleged Brand for this Purse

  • getCurrentAmount: (() => Amount<K, M>)

    Get the amount contained in this purse.

  • getCurrentAmountNotifier: (() => LatestTopic<Amount<K, M>>)

    Get a lossy notifier for changes to this purse's balance.

  • getDepositFacet: (() => DepositFacet)

    Return an object whose receive method deposits to the current Purse.

  • getRecoverySet: (() => CopySet<Payment<K, M>>)

    The set of payments withdrawn from this purse that are still live. These are the payments that can still be recovered in emergencies by, for example, depositing into this purse. Such a deposit action is like canceling an outstanding check because you're tired of waiting for it. Once your cancellation is acknowledged, you can spend the assets at stake on other things. Afterwards, if the recipient of the original check finally gets around to depositing it, their deposit fails.

    Returns an empty set if this issuer does not support recovery sets.

  • recoverAll: (() => Amount<K, M>)

    For use in emergencies, such as coming back from a traumatic crash and upgrade. This deposits all the payments in this purse's recovery set into the purse itself, returning the total amount of assets recovered.

    Returns an empty amount if this issuer does not support recovery sets.

  • withdraw: ((amount: Amount<K, M>) => Payment<K, M>)

    Withdraw amount from this purse into a new Payment.