@agoric/smart-wallet 0.5.4-dev-24fb1f5.0 → 0.5.4-dev-2c28414.0
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 +14 -14
- package/src/offerWatcher.d.ts +6 -4
- package/src/offerWatcher.d.ts.map +1 -1
- package/src/offerWatcher.js +41 -29
- package/src/smartWallet.d.ts.map +1 -1
- package/src/smartWallet.js +8 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/smart-wallet",
|
|
3
|
-
"version": "0.5.4-dev-
|
|
3
|
+
"version": "0.5.4-dev-2c28414.0+2c28414",
|
|
4
4
|
"description": "Wallet contract",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -16,9 +16,8 @@
|
|
|
16
16
|
"lint:eslint": "eslint ."
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
20
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
21
|
-
"@agoric/zone": "0.2.3-dev-24fb1f5.0+24fb1f5",
|
|
19
|
+
"@agoric/cosmic-proto": "0.4.1-dev-2c28414.0+2c28414",
|
|
20
|
+
"@agoric/swingset-vat": "0.32.3-dev-2c28414.0+2c28414",
|
|
22
21
|
"@endo/bundle-source": "^3.2.3",
|
|
23
22
|
"@endo/captp": "^4.2.0",
|
|
24
23
|
"@endo/init": "^1.1.2",
|
|
@@ -26,15 +25,16 @@
|
|
|
26
25
|
"import-meta-resolve": "^2.2.1"
|
|
27
26
|
},
|
|
28
27
|
"dependencies": {
|
|
29
|
-
"@agoric/casting": "0.4.3-dev-
|
|
30
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
31
|
-
"@agoric/internal": "0.3.3-dev-
|
|
32
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
33
|
-
"@agoric/store": "0.9.3-dev-
|
|
34
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
35
|
-
"@agoric/vats": "0.15.2-dev-
|
|
36
|
-
"@agoric/vow": "0.1.1-dev-
|
|
37
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
28
|
+
"@agoric/casting": "0.4.3-dev-2c28414.0+2c28414",
|
|
29
|
+
"@agoric/ertp": "0.16.3-dev-2c28414.0+2c28414",
|
|
30
|
+
"@agoric/internal": "0.3.3-dev-2c28414.0+2c28414",
|
|
31
|
+
"@agoric/notifier": "0.6.3-dev-2c28414.0+2c28414",
|
|
32
|
+
"@agoric/store": "0.9.3-dev-2c28414.0+2c28414",
|
|
33
|
+
"@agoric/vat-data": "0.5.3-dev-2c28414.0+2c28414",
|
|
34
|
+
"@agoric/vats": "0.15.2-dev-2c28414.0+2c28414",
|
|
35
|
+
"@agoric/vow": "0.1.1-dev-2c28414.0+2c28414",
|
|
36
|
+
"@agoric/zoe": "0.26.3-dev-2c28414.0+2c28414",
|
|
37
|
+
"@agoric/zone": "0.2.3-dev-2c28414.0+2c28414",
|
|
38
38
|
"@endo/errors": "^1.2.2",
|
|
39
39
|
"@endo/eventual-send": "^1.2.2",
|
|
40
40
|
"@endo/far": "^1.1.2",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"typeCoverage": {
|
|
72
72
|
"atLeast": 94.36
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "2c28414a0ab2dd4c05bb9f6955b8d658b484253d"
|
|
75
75
|
}
|
package/src/offerWatcher.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export function
|
|
2
|
-
export function prepareOfferWatcher(baggage:
|
|
1
|
+
export function makeWatchOfferOutcomes(vowTools: VowTools): (watchers: OutcomeWatchers, seat: UserSeat) => Promise<any>;
|
|
2
|
+
export function prepareOfferWatcher(baggage: Baggage, vowTools: VowTools): (walletHelper: any, deposit: any, offerSpec: OfferSpec, address: string, invitationAmount: import("@agoric/ertp/src/types.js").SetAmount<import("@endo/patterns").Key>, seatRef: UserSeat<unknown>) => import("@endo/exo").GuardedKit<{
|
|
3
3
|
helper: {
|
|
4
4
|
/**
|
|
5
5
|
* @param {Record<string, unknown>} offerStatusUpdates
|
|
@@ -41,8 +41,10 @@ export type OutcomeWatchers = {
|
|
|
41
41
|
};
|
|
42
42
|
export type MakeOfferWatcher = ReturnType<typeof prepareOfferWatcher>;
|
|
43
43
|
export type OfferWatcher = ReturnType<MakeOfferWatcher>;
|
|
44
|
-
import type {
|
|
44
|
+
import type { VowTools } from '@agoric/vow';
|
|
45
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
46
|
+
import type { OfferSpec } from './offers.js';
|
|
45
47
|
import type { Passable } from '@endo/pass-style';
|
|
46
|
-
import type { ContinuingOfferResult } from
|
|
48
|
+
import type { ContinuingOfferResult } from './types.js';
|
|
47
49
|
import type { PromiseWatcher } from '@agoric/swingset-liveslots';
|
|
48
50
|
//# sourceMappingURL=offerWatcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offerWatcher.d.ts","sourceRoot":"","sources":["offerWatcher.js"],"names":[],"mappings":"AAwEO,
|
|
1
|
+
{"version":3,"file":"offerWatcher.d.ts","sourceRoot":"","sources":["offerWatcher.js"],"names":[],"mappings":"AAwEO,iDADK,QAAQ,cAKP,eAAe,QACf,QAAQ,kBAYpB;AAmCM,6CAHI,OAAO,YACP,QAAQ,iNAsG2B,WAAU;;QA5EhD;;WAEG;yCADQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;QAQlC;;;;;WAKG;sCAJQ,MAAM,oBACN,MAAM,CAAC,KAAK,CAAC,oBACb,OAAO,YAAY,EAAE,gBAAgB,qBACrC,OAAO,YAAY,EAAE,iBAAiB;QAkBjD,uDAAuD;8BAA3C,QAAQ,GAAG,qBAAqB;QAoC5C;;;;;;WAMG;yBADQ,KAAK;;IAclB,gDAAgD;oBAArC,eAAe,CAAC,gBAAgB,CAAC;IA+B5C,+CAA+C;mBAApC,eAAe,CAAC,eAAe,CAAC;IA0B3C,iDAAiD;qBAAtC,eAAe,CAAC,iBAAiB,CAAC;GA2BlD;;;;gCAtSkB,CAAC,oBACP,eAAe,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;8BAI7B;IACZ,aAAiB,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACjD,eAAmB,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACjD,cAAkB,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;CAC5D;+BAgSU,UAAU,CAAC,OAAO,mBAAmB,CAAC;2BACtC,UAAU,CAAC,gBAAgB,CAAC;8BA9SV,aAAa;6BADnB,kBAAkB;+BAJhB,aAAa;8BAEd,kBAAkB;2CADL,YAAY;oCAEnB,4BAA4B"}
|
package/src/offerWatcher.js
CHANGED
|
@@ -9,17 +9,16 @@ import {
|
|
|
9
9
|
} from '@agoric/zoe/src/typeGuards.js';
|
|
10
10
|
import { AmountShape } from '@agoric/ertp/src/typeGuards.js';
|
|
11
11
|
import { deeplyFulfilledObject, objectMap } from '@agoric/internal';
|
|
12
|
-
import { heapVowTools } from '@agoric/vow/vat.js';
|
|
13
12
|
|
|
14
13
|
import { UNPUBLISHED_RESULT } from './offers.js';
|
|
15
14
|
|
|
16
|
-
const { when, allVows } = heapVowTools;
|
|
17
|
-
|
|
18
15
|
/**
|
|
19
|
-
* @import {OfferSpec} from
|
|
20
|
-
* @import {ContinuingOfferResult} from
|
|
16
|
+
* @import {OfferSpec} from './offers.js';
|
|
17
|
+
* @import {ContinuingOfferResult} from './types.js';
|
|
21
18
|
* @import {Passable} from '@endo/pass-style';
|
|
22
19
|
* @import {PromiseWatcher} from '@agoric/swingset-liveslots';
|
|
20
|
+
* @import {Baggage} from '@agoric/vat-data';
|
|
21
|
+
* @import {Vow, VowTools} from '@agoric/vow';
|
|
23
22
|
*/
|
|
24
23
|
|
|
25
24
|
/**
|
|
@@ -35,15 +34,19 @@ const { when, allVows } = heapVowTools;
|
|
|
35
34
|
* }} OutcomeWatchers
|
|
36
35
|
*/
|
|
37
36
|
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
/** @param {VowTools} vowTools */
|
|
38
|
+
const makeWatchForOfferResult = ({ watch }) => {
|
|
39
|
+
/**
|
|
40
|
+
* @param {OutcomeWatchers} watchers
|
|
41
|
+
* @param {UserSeat} seat
|
|
42
|
+
* @returns {Vow<void>} Vow that resolves when offer result has been processed
|
|
43
|
+
* by the resultWatcher
|
|
44
|
+
*/
|
|
45
|
+
const watchForOfferResult = ({ resultWatcher }, seat) => {
|
|
46
|
+
// Offer result may be anything, including a Vow, so watch it durably.
|
|
47
|
+
return watch(E(seat).getOfferResult(), resultWatcher, seat);
|
|
48
|
+
};
|
|
49
|
+
return watchForOfferResult;
|
|
47
50
|
};
|
|
48
51
|
|
|
49
52
|
/**
|
|
@@ -66,19 +69,24 @@ const watchForPayout = ({ paymentWatcher }, seat) => {
|
|
|
66
69
|
return p;
|
|
67
70
|
};
|
|
68
71
|
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
/** @param {VowTools} vowTools */
|
|
73
|
+
export const makeWatchOfferOutcomes = vowTools => {
|
|
74
|
+
const watchForOfferResult = makeWatchForOfferResult(vowTools);
|
|
75
|
+
const { asPromise, allVows } = vowTools;
|
|
76
|
+
/**
|
|
77
|
+
* @param {OutcomeWatchers} watchers
|
|
78
|
+
* @param {UserSeat} seat
|
|
79
|
+
*/
|
|
80
|
+
const watchOfferOutcomes = (watchers, seat) => {
|
|
81
|
+
return asPromise(
|
|
82
|
+
allVows([
|
|
83
|
+
watchForOfferResult(watchers, seat),
|
|
84
|
+
watchForNumWants(watchers, seat),
|
|
85
|
+
watchForPayout(watchers, seat),
|
|
86
|
+
]),
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
return watchOfferOutcomes;
|
|
82
90
|
};
|
|
83
91
|
|
|
84
92
|
const offerWatcherGuard = harden({
|
|
@@ -111,9 +119,11 @@ const offerWatcherGuard = harden({
|
|
|
111
119
|
});
|
|
112
120
|
|
|
113
121
|
/**
|
|
114
|
-
* @param {
|
|
122
|
+
* @param {Baggage} baggage
|
|
123
|
+
* @param {VowTools} vowTools
|
|
115
124
|
*/
|
|
116
|
-
export const prepareOfferWatcher = baggage => {
|
|
125
|
+
export const prepareOfferWatcher = (baggage, vowTools) => {
|
|
126
|
+
const watchForOfferResult = makeWatchForOfferResult(vowTools);
|
|
117
127
|
return prepareExoClassKit(
|
|
118
128
|
baggage,
|
|
119
129
|
'OfferWatcher',
|
|
@@ -274,6 +284,8 @@ export const prepareOfferWatcher = baggage => {
|
|
|
274
284
|
} else {
|
|
275
285
|
facets.helper.handleError(reason);
|
|
276
286
|
}
|
|
287
|
+
// throw so the vow watcher propagates the rejection
|
|
288
|
+
throw reason;
|
|
277
289
|
},
|
|
278
290
|
},
|
|
279
291
|
|
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":"AA6PA,kDAAmD;AAiB5C,4CAHI,OAAO,kBAAkB,EAAE,OAAO,UAClC,YAAY,6BA48BV,IAAI,CACd,YAAgB,EAChB,oBAAwB,GAAG,mBAAmB,CAC3C,GAAG;IACN,iBAAqB,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;CACtC;IA9HE;;;;;;;;OAQG;sCAJQ,OAAO,eAAe,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38
|
PaymentPKeywordRecordShape,
|
|
39
39
|
} from '@agoric/zoe/src/typeGuards.js';
|
|
40
|
+
import { prepareVowTools } from '@agoric/vow';
|
|
41
|
+
import { makeDurableZone } from '@agoric/zone/durable.js';
|
|
40
42
|
|
|
41
43
|
import { makeInvitationsHelper } from './invitations.js';
|
|
42
44
|
import { shape } from './typeGuards.js';
|
|
43
45
|
import { objectMapStoragePath } from './utils.js';
|
|
44
|
-
import { prepareOfferWatcher,
|
|
46
|
+
import { prepareOfferWatcher, makeWatchOfferOutcomes } from './offerWatcher.js';
|
|
45
47
|
|
|
46
48
|
/** @import {OfferId, OfferStatus} from './offers.js'; */
|
|
47
49
|
|
|
@@ -285,7 +287,7 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
285
287
|
secretWalletFactoryKey: M.any(),
|
|
286
288
|
}),
|
|
287
289
|
);
|
|
288
|
-
|
|
290
|
+
const zone = makeDurableZone(baggage);
|
|
289
291
|
const makeRecorderKit = prepareRecorderKit(baggage, shared.publicMarshaller);
|
|
290
292
|
|
|
291
293
|
const walletPurses = provide(baggage, BRAND_TO_PURSES_KEY, () => {
|
|
@@ -297,7 +299,10 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
297
299
|
return store;
|
|
298
300
|
});
|
|
299
301
|
|
|
300
|
-
const
|
|
302
|
+
const vowTools = prepareVowTools(zone.subZone('vow'));
|
|
303
|
+
|
|
304
|
+
const makeOfferWatcher = prepareOfferWatcher(baggage, vowTools);
|
|
305
|
+
const watchOfferOutcomes = makeWatchOfferOutcomes(vowTools);
|
|
301
306
|
|
|
302
307
|
const updateShape = {
|
|
303
308
|
value: AmountShape,
|