@agoric/smart-wallet 0.5.4-other-dev-3eb1a1d.0 → 0.5.4-other-dev-d15096d.0.d15096d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +35 -30
- package/src/index.js +4 -0
- package/src/invitations.d.ts +6 -2
- package/src/invitations.d.ts.map +1 -1
- package/src/invitations.js +10 -3
- package/src/marshal-contexts.d.ts +2 -1
- package/src/marshal-contexts.d.ts.map +1 -1
- package/src/marshal-contexts.js +1 -0
- package/src/offerWatcher.d.ts +8 -4
- package/src/offerWatcher.d.ts.map +1 -1
- package/src/offerWatcher.js +23 -9
- package/src/offers.d.ts +59 -3
- package/src/offers.d.ts.map +1 -1
- package/src/offers.js +33 -2
- package/src/proposals/upgrade-wallet-factory2-proposal.js +3 -2
- package/src/proposals/upgrade-walletFactory-proposal.js +7 -2
- package/src/smartWallet.d.ts +63 -24
- package/src/smartWallet.d.ts.map +1 -1
- package/src/smartWallet.js +229 -51
- package/src/typeGuards.js +29 -1
- package/src/types.d.ts +3 -2
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +4 -4
- package/src/utils.d.ts +18 -8
- package/src/utils.d.ts.map +1 -1
- package/src/utils.js +12 -8
- package/src/walletFactory.d.ts +28 -20
- package/src/walletFactory.d.ts.map +1 -1
- package/src/walletFactory.js +37 -31
- package/src/proposals/upgrade-wallet-factory2-proposal.d.ts +0 -23
- package/src/proposals/upgrade-wallet-factory2-proposal.d.ts.map +0 -1
- package/src/proposals/upgrade-walletFactory-proposal.d.ts +0 -17
- package/src/proposals/upgrade-walletFactory-proposal.d.ts.map +0 -1
package/src/smartWallet.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
export const BRAND_TO_PURSES_KEY: "brandToPurses";
|
|
2
|
-
export function prepareSmartWallet(baggage:
|
|
3
|
-
walletStorageNode:
|
|
2
|
+
export function prepareSmartWallet(baggage: Baggage, shared: SharedParams): (uniqueWithoutChildNodes: Omit<UniqueParams, "currentStorageNode" | "walletStorageNode"> & {
|
|
3
|
+
walletStorageNode: ERemote<StorageNode>;
|
|
4
4
|
}) => Promise<import("@endo/exo").Guarded<{
|
|
5
5
|
/**
|
|
6
6
|
* Umarshals the actionCapData and delegates to the appropriate action
|
|
7
7
|
* handler.
|
|
8
8
|
*
|
|
9
|
-
* @param {
|
|
10
|
-
* of type BridgeAction
|
|
9
|
+
* @param {CapData<string | null>} actionCapData of type BridgeAction
|
|
11
10
|
* @param {boolean} [canSpend]
|
|
12
11
|
* @returns {Promise<void>}
|
|
13
12
|
*/
|
|
14
|
-
handleBridgeAction(actionCapData:
|
|
13
|
+
handleBridgeAction(actionCapData: CapData<string | null>, canSpend?: boolean): Promise<void>;
|
|
15
14
|
getDepositFacet(): import("@endo/exo").Guarded<{
|
|
16
15
|
/**
|
|
17
16
|
* Put the assets from the payment into the appropriate purse.
|
|
@@ -25,6 +24,12 @@ export function prepareSmartWallet(baggage: import("@agoric/vat-data").Baggage,
|
|
|
25
24
|
*/
|
|
26
25
|
receive(payment: Payment): Promise<Amount>;
|
|
27
26
|
}>;
|
|
27
|
+
getInvokeFacet(): import("@endo/exo").Guarded<{
|
|
28
|
+
/**
|
|
29
|
+
* @param {InvokeEntryMessage} message
|
|
30
|
+
*/
|
|
31
|
+
invokeEntry(message: InvokeEntryMessage): Promise<void>;
|
|
32
|
+
}>;
|
|
28
33
|
getOffersFacet(): import("@endo/exo").Guarded<{
|
|
29
34
|
/**
|
|
30
35
|
* Take an offer description provided in capData, augment it with
|
|
@@ -63,19 +68,12 @@ export function prepareSmartWallet(baggage: import("@agoric/vat-data").Baggage,
|
|
|
63
68
|
};
|
|
64
69
|
};
|
|
65
70
|
}>>;
|
|
66
|
-
export type OfferId = number | string;
|
|
67
|
-
export type OfferSpec = {
|
|
68
|
-
id: OfferId;
|
|
69
|
-
invitationSpec: import("./invitations").InvitationSpec;
|
|
70
|
-
proposal: Proposal;
|
|
71
|
-
offerArgs?: any;
|
|
72
|
-
};
|
|
73
71
|
export type ExecutorPowers = {
|
|
74
72
|
logger: {
|
|
75
73
|
info: (...args: any[]) => void;
|
|
76
74
|
error: (...args: any[]) => void;
|
|
77
75
|
};
|
|
78
|
-
makeOfferWatcher:
|
|
76
|
+
makeOfferWatcher: MakeOfferWatcher;
|
|
79
77
|
invitationFromSpec: ERef<Invitation>;
|
|
80
78
|
};
|
|
81
79
|
export type ExecuteOfferAction = {
|
|
@@ -86,7 +84,17 @@ export type TryExitOfferAction = {
|
|
|
86
84
|
method: "tryExitOffer";
|
|
87
85
|
offerId: OfferId;
|
|
88
86
|
};
|
|
89
|
-
export type
|
|
87
|
+
export type InvokeStoreEntryAction = {
|
|
88
|
+
/**
|
|
89
|
+
* BridgeAction discriminator
|
|
90
|
+
*/
|
|
91
|
+
method: "invokeEntry";
|
|
92
|
+
/**
|
|
93
|
+
* object method call to make
|
|
94
|
+
*/
|
|
95
|
+
message: InvokeEntryMessage;
|
|
96
|
+
};
|
|
97
|
+
export type BridgeAction = ExecuteOfferAction | TryExitOfferAction | InvokeStoreEntryAction;
|
|
90
98
|
/**
|
|
91
99
|
* Purses is an array to support a future requirement of multiple purses per
|
|
92
100
|
* brand.
|
|
@@ -145,6 +153,14 @@ export type UpdateRecord = {
|
|
|
145
153
|
status: {
|
|
146
154
|
error: string;
|
|
147
155
|
};
|
|
156
|
+
} | {
|
|
157
|
+
updated: "invocation";
|
|
158
|
+
id: string | number;
|
|
159
|
+
error?: string;
|
|
160
|
+
result?: {
|
|
161
|
+
name?: string;
|
|
162
|
+
passStyle: string;
|
|
163
|
+
};
|
|
148
164
|
};
|
|
149
165
|
/**
|
|
150
166
|
* For use by clients to describe brands to users. Includes `displayInfo` to
|
|
@@ -154,23 +170,23 @@ export type BrandDescriptor = {
|
|
|
154
170
|
brand: Brand;
|
|
155
171
|
displayInfo: DisplayInfo;
|
|
156
172
|
issuer: Issuer;
|
|
157
|
-
petname:
|
|
173
|
+
petname: Petname;
|
|
158
174
|
};
|
|
159
175
|
export type UniqueParams = {
|
|
160
176
|
address: string;
|
|
161
|
-
bank: ERef<
|
|
162
|
-
currentStorageNode: StorageNode
|
|
177
|
+
bank: ERef<Bank>;
|
|
178
|
+
currentStorageNode: Remote<StorageNode>;
|
|
163
179
|
invitationPurse: Purse<"set", InvitationDetails>;
|
|
164
|
-
walletStorageNode: StorageNode
|
|
180
|
+
walletStorageNode: Remote<StorageNode>;
|
|
165
181
|
};
|
|
166
182
|
export type BrandDescriptorRegistry = Pick<MapStore<Brand, BrandDescriptor>, "has" | "get" | "values">;
|
|
167
183
|
export type SharedParams = {
|
|
168
|
-
agoricNames: ERef<
|
|
184
|
+
agoricNames: ERef<NameHub>;
|
|
169
185
|
registry: BrandDescriptorRegistry;
|
|
170
186
|
invitationIssuer: Issuer<"set">;
|
|
171
187
|
invitationBrand: Brand<"set">;
|
|
172
188
|
invitationDisplayInfo: DisplayInfo;
|
|
173
|
-
publicMarshaller:
|
|
189
|
+
publicMarshaller: ERemote<EMarshaller>;
|
|
174
190
|
zoe: ERef<ZoeService>;
|
|
175
191
|
};
|
|
176
192
|
/**
|
|
@@ -185,21 +201,44 @@ export type SharedParams = {
|
|
|
185
201
|
export type State = ImmutableState & MutableState;
|
|
186
202
|
export type ImmutableState = Readonly<UniqueParams & {
|
|
187
203
|
paymentQueues: MapStore<Brand, Payment[]>;
|
|
188
|
-
offerToInvitationMakers: MapStore<string,
|
|
204
|
+
offerToInvitationMakers: MapStore<string, InvitationMakers>;
|
|
189
205
|
offerToPublicSubscriberPaths: MapStore<string, Record<string, string>>;
|
|
190
206
|
offerToUsedInvitation: MapStore<string, Amount<"set">>;
|
|
191
207
|
purseBalances: MapStore<Purse, Amount>;
|
|
192
|
-
updateRecorderKit:
|
|
193
|
-
currentRecorderKit:
|
|
208
|
+
updateRecorderKit: RecorderKit<UpdateRecord>;
|
|
209
|
+
currentRecorderKit: RecorderKit<CurrentWalletRecord>;
|
|
194
210
|
liveOffers: MapStore<OfferId, OfferStatus>;
|
|
195
211
|
liveOfferSeats: MapStore<OfferId, UserSeat<unknown>>;
|
|
196
212
|
liveOfferPayments: MapStore<OfferId, MapStore<Brand, Payment>>;
|
|
213
|
+
myStore: MapStore;
|
|
197
214
|
}>;
|
|
198
215
|
export type PurseRecord = BrandDescriptor & {
|
|
199
216
|
purse: Purse;
|
|
200
217
|
};
|
|
201
218
|
export type MutableState = {};
|
|
202
|
-
export type SmartWallet =
|
|
219
|
+
export type SmartWallet = EReturn<EReturn<typeof prepareSmartWallet>>;
|
|
220
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
221
|
+
import type { ERemote } from '@agoric/internal';
|
|
222
|
+
import type { CapData } from '@endo/marshal';
|
|
223
|
+
import type { Payment } from '@agoric/ertp';
|
|
224
|
+
import type { Amount } from '@agoric/ertp';
|
|
225
|
+
import type { InvokeEntryMessage } from './offers.js';
|
|
226
|
+
import type { OfferSpec } from './offers.js';
|
|
203
227
|
import type { OfferId } from './offers.js';
|
|
228
|
+
import type { MakeOfferWatcher } from './offerWatcher.js';
|
|
229
|
+
import type { Brand } from '@agoric/ertp';
|
|
204
230
|
import type { OfferStatus } from './offers.js';
|
|
231
|
+
import type { Issuer } from '@agoric/ertp';
|
|
232
|
+
import type { Petname } from './types.js';
|
|
233
|
+
import type { Bank } from '@agoric/vats/src/vat-bank.js';
|
|
234
|
+
import type { Remote } from '@agoric/internal';
|
|
235
|
+
import type { InvitationDetails } from '@agoric/zoe';
|
|
236
|
+
import type { Purse } from '@agoric/ertp';
|
|
237
|
+
import type { MapStore } from '@agoric/store';
|
|
238
|
+
import type { NameHub } from '@agoric/vats';
|
|
239
|
+
import type { EMarshaller } from '@agoric/internal/src/marshal/wrap-marshaller.js';
|
|
240
|
+
import type { InvitationMakers } from './types.js';
|
|
241
|
+
import type { RecorderKit } from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
242
|
+
import type { UserSeat } from '@agoric/zoe';
|
|
243
|
+
import type { EReturn } from '@endo/far';
|
|
205
244
|
//# sourceMappingURL=smartWallet.d.ts.map
|
package/src/smartWallet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smartWallet.d.ts","sourceRoot":"","sources":["smartWallet.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"smartWallet.d.ts","sourceRoot":"","sources":["smartWallet.js"],"names":[],"mappings":"AA8QA,kCAAmC,eAAe,CAAC;AAiB5C,4CAHI,OAAO,UACP,YAAY,6BAk/BV,IAAI,CACV,YAAY,EAChB,oBAAwB,GAAG,mBAAmB,CAC3C,GAAG;IACF,iBAAiB,EAAE,QAAQ,WAAW,CAAC,CAAC;CACzC;IAtHE;;;;;;;OAOG;sCAHQ,QAAQ,MAAM,GAAG,IAAI,CAAC,aACtB,OAAO,GACL,OAAO,CAAC,IAAI,CAAC;;QA3V1B;;;;;;;;;WASG;yBAJQ,OAAO,GACL,OAAO,CAAC,MAAM,CAAC;;;QAwQ5B;;WAEG;6BADQ,kBAAkB;;;QA3I7B;;;;;;;;;WASG;gCALQ,SAAS,GACP,OAAO,CAAC,IAAI,CAAC;QA0G1B;;;;;;WAMG;8BAHQ,OAAO,GACL,OAAO,CAAC,IAAI,CAAC;;IAuK1B,sCAAsC;;IAKtC,sCAAsC;;;;;;;;;;;;;;IAyD7C;6BAztCY;IACR,MAAM,EAAE;QACN,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;QAC/B,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;KACjC,CAAC;IACF,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,kBAAkB,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;CACtC;iCAIS;IACR,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,EAAE,SAAS,CAAC;CAClB;iCAIS;IACR,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;CAClB;;;;;Y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