API documentation of Agoric SDK / Exports / @agoric/smart-wallet / smartWallet
Module: smartWallet
Table of contents
Type Aliases
- BrandDescriptor
- BrandDescriptorRegistry
- BridgeAction
- CurrentWalletRecord
- ExecuteOfferAction
- ExecutorPowers
- ImmutableState
- MutableState
- OfferId
- OfferSpec
- PurseRecord
- SharedParams
- SmartWallet
- State
- TryExitOfferAction
- UniqueParams
- UpdateRecord
Variables
Functions
Type Aliases
BrandDescriptor
Ƭ BrandDescriptor: Object
For use by clients to describe brands to users. Includes displayInfo
to save a remote call.
Type declaration
Name | Type |
---|---|
brand | Brand |
displayInfo | DisplayInfo |
issuer | Issuer |
petname | types |
Defined in
BrandDescriptorRegistry
Ƭ BrandDescriptorRegistry: Pick
<MapStore
<Brand
, BrandDescriptor
>, "has"
| "get"
| "values"
>
Defined in
BridgeAction
Ƭ BridgeAction: ExecuteOfferAction
| TryExitOfferAction
Defined in
CurrentWalletRecord
Ƭ CurrentWalletRecord: Object
Type declaration
Name | Type |
---|---|
liveOffers | [OfferId , offers ][] |
offerToPublicSubscriberPaths | [offerId: string, publicTopics: Object][] |
offerToUsedInvitation | [offerId: string, usedInvitation: Amount][] |
purses | { balance : Amount ; brand : Brand }[] |
Defined in
ExecuteOfferAction
Ƭ ExecuteOfferAction: Object
Type declaration
Name | Type |
---|---|
method | "executeOffer" |
offer | OfferSpec |
Defined in
ExecutorPowers
Ƭ ExecutorPowers: Object
Type declaration
Name | Type |
---|---|
invitationFromSpec | ERef <Invitation > |
logger | { error : (...args : any []) => void ; info : (...args : any []) => void } |
logger.error | (...args : any []) => void |
logger.info | (...args : any []) => void |
makeOfferWatcher | MakeOfferWatcher |
Defined in
ImmutableState
Ƭ ImmutableState: Readonly
<UniqueParams
& { currentRecorderKit
: RecorderKit
; liveOfferPayments
: MapStore
<OfferId
, MapStore
<Brand
, Payment
>> ; liveOfferSeats
: MapStore
<OfferId
, UserSeat
<unknown
>> ; liveOffers
: MapStore
<OfferId
, offers
> ; offerToInvitationMakers
: MapStore
<string
, types
> ; offerToPublicSubscriberPaths
: MapStore
<string
, Record
<string
, string
>> ; offerToUsedInvitation
: MapStore
<string
, Amount
<"set"
>> ; paymentQueues
: MapStore
<Brand
, Payment
[]> ; purseBalances
: MapStore
<Purse
, Amount
> ; updateRecorderKit
: RecorderKit
}>
Defined in
MutableState
Ƭ MutableState: Object
Defined in
OfferId
Ƭ OfferId: number
| string
Defined in
OfferSpec
Ƭ OfferSpec: Object
Type declaration
Name | Type |
---|---|
id | OfferId |
invitationSpec | invitations |
offerArgs? | unknown |
proposal | Proposal |
Defined in
PurseRecord
Ƭ PurseRecord: BrandDescriptor
& { purse
: Purse
}
Defined in
SharedParams
Ƭ SharedParams: Object
Type declaration
Name | Type |
---|---|
agoricNames | ERef <index > |
invitationBrand | Brand <"set" > |
invitationDisplayInfo | DisplayInfo |
invitationIssuer | Issuer <"set" > |
publicMarshaller | Marshaller |
registry | BrandDescriptorRegistry |
secretWalletFactoryKey | any |
zoe | ERef <ZoeService > |
Defined in
SmartWallet
Ƭ SmartWallet: Awaited
<ReturnType
<ReturnType
<typeof prepareSmartWallet
>>>
Defined in
State
Ƭ State: ImmutableState
& MutableState
brandPurses
is precious and closely held. defined as late as possible to reduce its scope.
offerToInvitationMakers
is precious and closely held.offerToPublicSubscriberPaths
is precious and closely held.purseBalances
is a cache of what we've received from purses. Held so we can publish all balances on change.
Defined in
TryExitOfferAction
Ƭ TryExitOfferAction: Object
Type declaration
Name | Type |
---|---|
method | "tryExitOffer" |
offerId | OfferId |
Defined in
UniqueParams
Ƭ UniqueParams: Object
Type declaration
Name | Type |
---|---|
address | string |
bank | ERef <Bank > |
currentStorageNode | StorageNode |
invitationPurse | Purse <"set" > |
walletStorageNode | StorageNode |
Defined in
UpdateRecord
Ƭ UpdateRecord: { status
: offers
; updated
: "offerStatus"
} | { currentAmount
: Amount
; updated
: "balance"
} | { status
: { error
: string
} ; updated
: "walletAction"
}
Record of an update to the state of this wallet.
Client is responsible for coalescing updates into a current state. See coalesceUpdates
utility.
The reason for this burden on the client is that publishing the full history of offers with each change is untenable.
balance
update supports forward-compatibility for more than one purse per brand. An additional key will be needed to disambiguate. For now the brand in the amount suffices.
Defined in
Variables
BRAND_TO_PURSES_KEY
• Const
BRAND_TO_PURSES_KEY: "brandToPurses"
Defined in
Functions
prepareSmartWallet
▸ prepareSmartWallet(baggage
, shared
): (uniqueWithoutChildNodes
: Omit
<UniqueParams
, "currentStorageNode"
| "walletStorageNode"
> & { walletStorageNode
: ERef
<StorageNode
> }) => Promise
<Guarded
<{ getCurrentSubscriber
: () => Subscriber
<CurrentWalletRecord
> ; getDepositFacet
: () => Guarded
<{ receive
: (payment
: Payment
<AssetKind
>) => Promise
<Amount
<AssetKind
>> }> ; getOffersFacet
: () => Guarded
<{ executeOffer
: (offerSpec
: OfferSpec
) => Promise
<void
> ; tryExitOffer
: (offerId
: OfferId
) => Promise
<void
> }> ; getPublicTopics
: () => { current
: { description
: string
= 'Current state of wallet'; storagePath
: Promise
<string
> ; subscriber
: Subscriber
<CurrentWalletRecord
> = currentRecorderKit.subscriber } ; updates
: { description
: string
= 'Changes to wallet'; storagePath
: Promise
<string
> ; subscriber
: Subscriber
<UpdateRecord
> = updateRecorderKit.subscriber } } ; getUpdatesSubscriber
: () => Subscriber
<UpdateRecord
> ; handleBridgeAction
: (actionCapData
: CapData
<null
| string
>, canSpend?
: boolean
) => Promise
<void
> ; repairWalletForIncarnation2
: (key
: any
) => void
}>>
Parameters
Name | Type |
---|---|
baggage | Baggage |
shared | SharedParams |
Returns
fn
▸ (uniqueWithoutChildNodes
): Promise
<Guarded
<{ getCurrentSubscriber
: () => Subscriber
<CurrentWalletRecord
> ; getDepositFacet
: () => Guarded
<{ receive
: (payment
: Payment
<AssetKind
>) => Promise
<Amount
<AssetKind
>> }> ; getOffersFacet
: () => Guarded
<{ executeOffer
: (offerSpec
: OfferSpec
) => Promise
<void
> ; tryExitOffer
: (offerId
: OfferId
) => Promise
<void
> }> ; getPublicTopics
: () => { current
: { description
: string
= 'Current state of wallet'; storagePath
: Promise
<string
> ; subscriber
: Subscriber
<CurrentWalletRecord
> = currentRecorderKit.subscriber } ; updates
: { description
: string
= 'Changes to wallet'; storagePath
: Promise
<string
> ; subscriber
: Subscriber
<UpdateRecord
> = updateRecorderKit.subscriber } } ; getUpdatesSubscriber
: () => Subscriber
<UpdateRecord
> ; handleBridgeAction
: (actionCapData
: CapData
<null
| string
>, canSpend?
: boolean
) => Promise
<void
> ; repairWalletForIncarnation2
: (key
: any
) => void
}>>
Parameters
Name | Type |
---|---|
uniqueWithoutChildNodes | Omit <UniqueParams , "currentStorageNode" | "walletStorageNode" > & { walletStorageNode : ERef <StorageNode > } |
Returns
Promise
<Guarded
<{ getCurrentSubscriber
: () => Subscriber
<CurrentWalletRecord
> ; getDepositFacet
: () => Guarded
<{ receive
: (payment
: Payment
<AssetKind
>) => Promise
<Amount
<AssetKind
>> }> ; getOffersFacet
: () => Guarded
<{ executeOffer
: (offerSpec
: OfferSpec
) => Promise
<void
> ; tryExitOffer
: (offerId
: OfferId
) => Promise
<void
> }> ; getPublicTopics
: () => { current
: { description
: string
= 'Current state of wallet'; storagePath
: Promise
<string
> ; subscriber
: Subscriber
<CurrentWalletRecord
> = currentRecorderKit.subscriber } ; updates
: { description
: string
= 'Changes to wallet'; storagePath
: Promise
<string
> ; subscriber
: Subscriber
<UpdateRecord
> = updateRecorderKit.subscriber } } ; getUpdatesSubscriber
: () => Subscriber
<UpdateRecord
> ; handleBridgeAction
: (actionCapData
: CapData
<null
| string
>, canSpend?
: boolean
) => Promise
<void
> ; repairWalletForIncarnation2
: (key
: any
) => void
}>>