@agoric/smart-wallet 0.5.4-dev-14b75b9.0.14b75b9 → 0.5.4-dev-64cee5a.0.64cee5a
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/invitations.d.ts +7 -3
- package/src/invitations.d.ts.map +1 -1
- package/src/invitations.js +12 -8
- package/src/offerWatcher.d.ts +5 -3
- package/src/offerWatcher.d.ts.map +1 -1
- package/src/offerWatcher.js +8 -8
- package/src/offers.d.ts +4 -2
- package/src/offers.d.ts.map +1 -1
- package/src/offers.js +2 -1
- package/src/proposals/upgrade-walletFactory-proposal.js +7 -2
- package/src/smartWallet.d.ts +18 -11
- package/src/smartWallet.d.ts.map +1 -1
- package/src/smartWallet.js +24 -20
- package/src/utils.d.ts +15 -5
- package/src/utils.d.ts.map +1 -1
- package/src/utils.js +11 -7
- package/src/walletFactory.d.ts +22 -16
- package/src/walletFactory.d.ts.map +1 -1
- package/src/walletFactory.js +25 -27
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-64cee5a.0.64cee5a",
|
|
4
4
|
"description": "Wallet contract",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"lint:eslint": "yarn run -T eslint ."
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@agoric/casting": "0.4.3-dev-
|
|
22
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
23
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
21
|
+
"@agoric/casting": "0.4.3-dev-64cee5a.0.64cee5a",
|
|
22
|
+
"@agoric/cosmic-proto": "0.4.1-dev-64cee5a.0.64cee5a",
|
|
23
|
+
"@agoric/swingset-vat": "0.32.3-dev-64cee5a.0.64cee5a",
|
|
24
24
|
"@endo/bundle-source": "^4.1.2",
|
|
25
25
|
"@endo/captp": "^4.4.8",
|
|
26
26
|
"@endo/init": "^1.1.12",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"import-meta-resolve": "^4.1.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
32
|
-
"@agoric/internal": "0.3.3-dev-
|
|
33
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
34
|
-
"@agoric/store": "0.9.3-dev-
|
|
35
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
36
|
-
"@agoric/vats": "0.15.2-dev-
|
|
37
|
-
"@agoric/vow": "0.1.1-dev-
|
|
38
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
39
|
-
"@agoric/zone": "0.2.3-dev-
|
|
31
|
+
"@agoric/ertp": "0.16.3-dev-64cee5a.0.64cee5a",
|
|
32
|
+
"@agoric/internal": "0.3.3-dev-64cee5a.0.64cee5a",
|
|
33
|
+
"@agoric/notifier": "0.6.3-dev-64cee5a.0.64cee5a",
|
|
34
|
+
"@agoric/store": "0.9.3-dev-64cee5a.0.64cee5a",
|
|
35
|
+
"@agoric/vat-data": "0.5.3-dev-64cee5a.0.64cee5a",
|
|
36
|
+
"@agoric/vats": "0.15.2-dev-64cee5a.0.64cee5a",
|
|
37
|
+
"@agoric/vow": "0.1.1-dev-64cee5a.0.64cee5a",
|
|
38
|
+
"@agoric/zoe": "0.26.3-dev-64cee5a.0.64cee5a",
|
|
39
|
+
"@agoric/zone": "0.2.3-dev-64cee5a.0.64cee5a",
|
|
40
40
|
"@endo/errors": "^1.2.13",
|
|
41
41
|
"@endo/eventual-send": "^1.3.4",
|
|
42
42
|
"@endo/far": "^1.1.14",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"engines": {
|
|
78
78
|
"node": "^20.9 || ^22.11"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "64cee5ae5d1a3488a30ce042d6f3f561ac2a6e82"
|
|
81
81
|
}
|
package/src/invitations.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function makeInvitationsHelper(zoe: ERef<ZoeService>, agoricNames: ERef<
|
|
1
|
+
export function makeInvitationsHelper(zoe: ERef<ZoeService>, agoricNames: ERef<NameHub>, invitationBrand: Brand<"set">, invitationsPurse: Purse<"set", InvitationDetails>, getInvitationContinuation: (fromOfferId: string) => InvitationMakers): (spec: InvitationSpec) => ERef<Invitation>;
|
|
2
2
|
/**
|
|
3
3
|
* Specify how to produce an invitation. See each type in the union for details.
|
|
4
4
|
*/
|
|
@@ -41,9 +41,13 @@ export type PurseInvitationSpec = {
|
|
|
41
41
|
*/
|
|
42
42
|
export type ContinuingInvitationSpec = {
|
|
43
43
|
source: "continuing";
|
|
44
|
-
previousOffer:
|
|
44
|
+
previousOffer: OfferId;
|
|
45
45
|
invitationMakerName: string;
|
|
46
46
|
invitationArgs?: any[];
|
|
47
47
|
};
|
|
48
|
-
export type InvitationsPurseQuery = Pick<
|
|
48
|
+
export type InvitationsPurseQuery = Pick<InvitationDetails, "description" | "instance">;
|
|
49
|
+
import type { NameHub } from '@agoric/vats';
|
|
50
|
+
import type { InvitationDetails } from '@agoric/zoe';
|
|
51
|
+
import type { InvitationMakers } from './types.js';
|
|
52
|
+
import type { OfferId } from './offers.js';
|
|
49
53
|
//# sourceMappingURL=invitations.d.ts.map
|
package/src/invitations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["invitations.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["invitations.js"],"names":[],"mappings":"AA8EO,2CANI,IAAI,CAAC,UAAU,CAAC,eAChB,IAAI,CAAC,OAAO,CAAC,mBACb,KAAK,CAAC,KAAK,CAAC,oBACZ,KAAK,CAAC,KAAK,EAAE,iBAAiB,CAAC,6BAC/B,CAAC,WAAW,EAAE,MAAM,KAAK,gBAAgB,UAoFhC,cAAc,KAAK,IAAI,CAAC,UAAU,CAAC,CAgBtD;;;;6BA9JY,4BAA4B,GAClC,sBAAsB,GACtB,mBAAmB,GACnB,wBAAwB;;;;;;;;2CAKlB;IACR,MAAM,EAAE,gBAAgB,CAAC;IACzB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;CACtD;;;;qCAQS;IACR,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC;CACxB;;;;;;;kCAGS;IACR,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;;;;;uCAOS;IACR,MAAM,EAAE,YAAY,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC;CACxB;oCAMS,IAAI,CAAC,iBAAiB,EAAE,aAAa,GAAG,UAAU,CAAC;6BA1DtC,cAAc;uCADJ,aAAa;sCAEd,YAAY;6BAHrB,aAAa"}
|
package/src/invitations.js
CHANGED
|
@@ -5,6 +5,13 @@ import { Fail } from '@endo/errors';
|
|
|
5
5
|
import { E } from '@endo/far';
|
|
6
6
|
import { shape } from './typeGuards.js';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @import {OfferId} from './offers.js';
|
|
10
|
+
* @import {InvitationDetails} from '@agoric/zoe';
|
|
11
|
+
* @import {NameHub} from '@agoric/vats';
|
|
12
|
+
* @import {InvitationMakers} from './types.js';
|
|
13
|
+
*/
|
|
14
|
+
|
|
8
15
|
// A safety limit
|
|
9
16
|
const MAX_PIPE_LENGTH = 2;
|
|
10
17
|
|
|
@@ -50,7 +57,7 @@ const MAX_PIPE_LENGTH = 2;
|
|
|
50
57
|
*
|
|
51
58
|
* @typedef {{
|
|
52
59
|
* source: 'continuing';
|
|
53
|
-
* previousOffer:
|
|
60
|
+
* previousOffer: OfferId;
|
|
54
61
|
* invitationMakerName: string;
|
|
55
62
|
* invitationArgs?: any[];
|
|
56
63
|
* }} ContinuingInvitationSpec
|
|
@@ -59,18 +66,15 @@ const MAX_PIPE_LENGTH = 2;
|
|
|
59
66
|
*/
|
|
60
67
|
|
|
61
68
|
/**
|
|
62
|
-
* @typedef {Pick<
|
|
63
|
-
* import('@agoric/zoe').InvitationDetails,
|
|
64
|
-
* 'description' | 'instance'
|
|
65
|
-
* >} InvitationsPurseQuery
|
|
69
|
+
* @typedef {Pick<InvitationDetails, 'description' | 'instance'>} InvitationsPurseQuery
|
|
66
70
|
*/
|
|
67
71
|
|
|
68
72
|
/**
|
|
69
73
|
* @param {ERef<ZoeService>} zoe
|
|
70
|
-
* @param {ERef<
|
|
74
|
+
* @param {ERef<NameHub>} agoricNames
|
|
71
75
|
* @param {Brand<'set'>} invitationBrand
|
|
72
|
-
* @param {Purse<'set',
|
|
73
|
-
* @param {(fromOfferId: string) =>
|
|
76
|
+
* @param {Purse<'set', InvitationDetails>} invitationsPurse
|
|
77
|
+
* @param {(fromOfferId: string) => InvitationMakers} getInvitationContinuation
|
|
74
78
|
*/
|
|
75
79
|
export const makeInvitationsHelper = (
|
|
76
80
|
zoe,
|
package/src/offerWatcher.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ export function prepareOfferWatcher(baggage: Baggage, vowTools: VowTools): (wall
|
|
|
10
10
|
/**
|
|
11
11
|
* @param {string} offerId
|
|
12
12
|
* @param {Amount<'set'>} invitationAmount
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {
|
|
13
|
+
* @param {InvitationMakers} invitationMakers
|
|
14
|
+
* @param {PublicSubscribers} publicSubscribers
|
|
15
15
|
*/
|
|
16
|
-
onNewContinuingOffer(offerId: string, invitationAmount: Amount<"set">, invitationMakers:
|
|
16
|
+
onNewContinuingOffer(offerId: string, invitationAmount: Amount<"set">, invitationMakers: InvitationMakers, publicSubscribers: PublicSubscribers): void;
|
|
17
17
|
/** @param {Passable | ContinuingOfferResult} result */
|
|
18
18
|
publishResult(result: Passable | ContinuingOfferResult): void;
|
|
19
19
|
/**
|
|
@@ -47,6 +47,8 @@ import type { VowTools } from '@agoric/vow';
|
|
|
47
47
|
import type { UserSeat } from '@agoric/zoe';
|
|
48
48
|
import type { Baggage } from '@agoric/vat-data';
|
|
49
49
|
import type { OfferSpec } from './offers.js';
|
|
50
|
+
import type { InvitationMakers } from './types.js';
|
|
51
|
+
import type { PublicSubscribers } from './types.js';
|
|
50
52
|
import type { Passable } from '@endo/pass-style';
|
|
51
53
|
import type { ContinuingOfferResult } from './types.js';
|
|
52
54
|
import type { PromiseWatcher } from '@agoric/swingset-liveslots';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offerWatcher.d.ts","sourceRoot":"","sources":["offerWatcher.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"offerWatcher.d.ts","sourceRoot":"","sources":["offerWatcher.js"],"names":[],"mappings":"AA4EO,iDADK,QAAQ,cAKP,eAAe,QACf,QAAQ,oBAiBpB;AAmCM,6CAHI,OAAO,YACP,QAAQ;aAWO,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC;;;QAgBvD;;WAEG;yCADQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;QAQlC;;;;;WAKG;sCAJQ,MAAM,oBACN,MAAM,CAAC,KAAK,CAAC,oBACb,gBAAgB,qBAChB,iBAAiB;QAkB5B,uDAAuD;8BAA3C,QAAQ,GAAG,qBAAqB;QAoC5C;;;;;;WAMG;yBADQ,KAAK;;IAclB,gDAAgD;oBAArC,eAAe,CAAC,gBAAgB,CAAC;IA8B5C,+CAA+C;mBAApC,eAAe,CAAC,eAAe,CAAC;IAsC3C,iDAAiD;qBAAtC,eAAe,CAAC,iBAAiB,CAAC;GA0BlD;;;;gCAtTkB,CAAC,oBACP,eAAe,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;8BAI7B;IACR,aAAa,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAC7C,eAAe,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC7C,cAAc,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;CAC5D;+BAgTU,UAAU,CAAC,OAAO,mBAAmB,CAAC;2BACtC,UAAU,CAAC,gBAAgB,CAAC;8BAlUV,aAAa;8BAC2B,aAAa;6BAF3D,kBAAkB;+BAJhB,aAAa;sCAON,YAAY;uCACX,YAAY;8BANrB,kBAAkB;2CADL,YAAY;oCAEnB,4BAA4B;2CAGW,aAAa"}
|
package/src/offerWatcher.js
CHANGED
|
@@ -20,6 +20,9 @@ import { UNPUBLISHED_RESULT } from './offers.js';
|
|
|
20
20
|
* @import {Baggage} from '@agoric/vat-data';
|
|
21
21
|
* @import {Vow, VowTools} from '@agoric/vow';
|
|
22
22
|
* @import {PaymentPKeywordRecord, Proposal, UserSeat, ZoeService} from '@agoric/zoe';
|
|
23
|
+
* @import {InvitationMakers} from './types.js';
|
|
24
|
+
* @import {PublicSubscribers} from './types.js';
|
|
25
|
+
* @import {UpgradeDisconnection} from '@agoric/internal/src/upgrade-api.js';
|
|
23
26
|
*/
|
|
24
27
|
|
|
25
28
|
/**
|
|
@@ -165,8 +168,8 @@ export const prepareOfferWatcher = (baggage, vowTools) => {
|
|
|
165
168
|
/**
|
|
166
169
|
* @param {string} offerId
|
|
167
170
|
* @param {Amount<'set'>} invitationAmount
|
|
168
|
-
* @param {
|
|
169
|
-
* @param {
|
|
171
|
+
* @param {InvitationMakers} invitationMakers
|
|
172
|
+
* @param {PublicSubscribers} publicSubscribers
|
|
170
173
|
*/
|
|
171
174
|
onNewContinuingOffer(
|
|
172
175
|
offerId,
|
|
@@ -256,8 +259,7 @@ export const prepareOfferWatcher = (baggage, vowTools) => {
|
|
|
256
259
|
* If promise disconnected, watch again. Or if there's an Error, handle
|
|
257
260
|
* it.
|
|
258
261
|
*
|
|
259
|
-
* @param {Error
|
|
260
|
-
* | import('@agoric/internal/src/upgrade-api.js').UpgradeDisconnection} reason
|
|
262
|
+
* @param {Error | UpgradeDisconnection} reason
|
|
261
263
|
* @param {UserSeat} seat
|
|
262
264
|
*/
|
|
263
265
|
onRejected(reason, seat) {
|
|
@@ -293,8 +295,7 @@ export const prepareOfferWatcher = (baggage, vowTools) => {
|
|
|
293
295
|
* If promise disconnected, watch again. Or if there's an Error, handle
|
|
294
296
|
* it.
|
|
295
297
|
*
|
|
296
|
-
* @param {Error
|
|
297
|
-
* | import('@agoric/internal/src/upgrade-api.js').UpgradeDisconnection} reason
|
|
298
|
+
* @param {Error | UpgradeDisconnection} reason
|
|
298
299
|
* @param {UserSeat} seat
|
|
299
300
|
*/
|
|
300
301
|
onRejected(reason, seat) {
|
|
@@ -323,8 +324,7 @@ export const prepareOfferWatcher = (baggage, vowTools) => {
|
|
|
323
324
|
* and getPayouts() settle the same (they await the same promise and
|
|
324
325
|
* then synchronously return a local value).
|
|
325
326
|
*
|
|
326
|
-
* @param {Error
|
|
327
|
-
* | import('@agoric/internal/src/upgrade-api.js').UpgradeDisconnection} reason
|
|
327
|
+
* @param {Error | UpgradeDisconnection} reason
|
|
328
328
|
* @param {UserSeat} seat
|
|
329
329
|
*/
|
|
330
330
|
onRejected(reason, seat) {
|
package/src/offers.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @import {Proposal} from '@agoric/zoe';
|
|
3
3
|
* @import {Passable} from '@endo/pass-style';
|
|
4
|
+
* @import {InvitationSpec} from './invitations.js';
|
|
4
5
|
*/
|
|
5
6
|
/**
|
|
6
7
|
* @typedef {number | string} OfferId
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
/**
|
|
25
26
|
* @typedef {{
|
|
26
27
|
* id: OfferId;
|
|
27
|
-
* invitationSpec:
|
|
28
|
+
* invitationSpec: InvitationSpec;
|
|
28
29
|
* proposal: Proposal;
|
|
29
30
|
* offerArgs?: any;
|
|
30
31
|
* saveResult?: ResultPlan;
|
|
@@ -62,7 +63,7 @@ export type InvokeEntryMessage = {
|
|
|
62
63
|
*/
|
|
63
64
|
export type OfferSpec = {
|
|
64
65
|
id: OfferId;
|
|
65
|
-
invitationSpec:
|
|
66
|
+
invitationSpec: InvitationSpec;
|
|
66
67
|
proposal: Proposal;
|
|
67
68
|
offerArgs?: any;
|
|
68
69
|
saveResult?: ResultPlan;
|
|
@@ -77,5 +78,6 @@ export type OfferStatus = OfferSpec & {
|
|
|
77
78
|
payouts?: AmountKeywordRecord;
|
|
78
79
|
};
|
|
79
80
|
import type { Passable } from '@endo/pass-style';
|
|
81
|
+
import type { InvitationSpec } from './invitations.js';
|
|
80
82
|
import type { Proposal } from '@agoric/zoe';
|
|
81
83
|
//# sourceMappingURL=offers.d.ts.map
|
package/src/offers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offers.d.ts","sourceRoot":"","sources":["offers.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"offers.d.ts","sourceRoot":"","sources":["offers.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AAEH;;;;;;GAMG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;GAWG;AAEH,kEAAkE;AAClE,iCAAkC,aAAa,CAAC;sBAnCnC,MAAM,GAAG,MAAM;;;;;UAKd,MAAM;;;;;;;;iCAOP;IACR,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACtB;;;;;;wBAIS;IACR,EAAE,EAAE,OAAO,CAAC;IACZ,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;0BAUS,SAAS,GAAG;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EACH,OAAO,GACP,OAAO,kBAAkB,GACzB;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;8BAnDuB,kBAAkB;oCACZ,kBAAkB;8BAFxB,aAAa"}
|
package/src/offers.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @import {Proposal} from '@agoric/zoe';
|
|
3
3
|
* @import {Passable} from '@endo/pass-style';
|
|
4
|
+
* @import {InvitationSpec} from './invitations.js';
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
/**
|
|
29
30
|
* @typedef {{
|
|
30
31
|
* id: OfferId;
|
|
31
|
-
* invitationSpec:
|
|
32
|
+
* invitationSpec: InvitationSpec;
|
|
32
33
|
* proposal: Proposal;
|
|
33
34
|
* offerArgs?: any;
|
|
34
35
|
* saveResult?: ResultPlan;
|
|
@@ -4,6 +4,11 @@ import { E } from '@endo/far';
|
|
|
4
4
|
import { makeMarshal } from '@endo/marshal';
|
|
5
5
|
import { allValues } from '@agoric/internal';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @import {NameHub} from '@agoric/vats';
|
|
9
|
+
* @import {BootstrapManifest} from '@agoric/vats/src/core/lib-boot.js';
|
|
10
|
+
*/
|
|
11
|
+
|
|
7
12
|
console.warn('upgrade-walletFactory-proposal.js module evaluating');
|
|
8
13
|
|
|
9
14
|
// vstorage paths under published.*
|
|
@@ -88,7 +93,7 @@ export const publishAgoricBrandsDisplayInfo = async ({
|
|
|
88
93
|
await E(node).setValue(JSON.stringify(aux));
|
|
89
94
|
};
|
|
90
95
|
|
|
91
|
-
/** @type {ERef<
|
|
96
|
+
/** @type {ERef<NameHub>} */
|
|
92
97
|
const brandHub = E(agoricNames).lookup('brand');
|
|
93
98
|
const brands = await E(brandHub).values();
|
|
94
99
|
// tolerate failure; in particular, for the timer brand
|
|
@@ -96,7 +101,7 @@ export const publishAgoricBrandsDisplayInfo = async ({
|
|
|
96
101
|
};
|
|
97
102
|
harden(publishAgoricBrandsDisplayInfo);
|
|
98
103
|
|
|
99
|
-
/** @type {
|
|
104
|
+
/** @type {BootstrapManifest} */
|
|
100
105
|
const manifest = {
|
|
101
106
|
[upgradeWalletFactory.name]: {
|
|
102
107
|
// include rationale for closely-held, high authority capabilities
|
package/src/smartWallet.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
export const BRAND_TO_PURSES_KEY: "brandToPurses";
|
|
2
|
-
export function prepareSmartWallet(baggage:
|
|
2
|
+
export function prepareSmartWallet(baggage: Baggage, shared: SharedParams): (uniqueWithoutChildNodes: Omit<UniqueParams, "currentStorageNode" | "walletStorageNode"> & {
|
|
3
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.
|
|
@@ -74,7 +73,7 @@ export type ExecutorPowers = {
|
|
|
74
73
|
info: (...args: any[]) => void;
|
|
75
74
|
error: (...args: any[]) => void;
|
|
76
75
|
};
|
|
77
|
-
makeOfferWatcher:
|
|
76
|
+
makeOfferWatcher: MakeOfferWatcher;
|
|
78
77
|
invitationFromSpec: ERef<Invitation>;
|
|
79
78
|
};
|
|
80
79
|
export type ExecuteOfferAction = {
|
|
@@ -171,18 +170,18 @@ export type BrandDescriptor = {
|
|
|
171
170
|
brand: Brand;
|
|
172
171
|
displayInfo: DisplayInfo;
|
|
173
172
|
issuer: Issuer;
|
|
174
|
-
petname:
|
|
173
|
+
petname: Petname;
|
|
175
174
|
};
|
|
176
175
|
export type UniqueParams = {
|
|
177
176
|
address: string;
|
|
178
|
-
bank: ERef<
|
|
177
|
+
bank: ERef<Bank>;
|
|
179
178
|
currentStorageNode: Remote<StorageNode>;
|
|
180
179
|
invitationPurse: Purse<"set", InvitationDetails>;
|
|
181
180
|
walletStorageNode: Remote<StorageNode>;
|
|
182
181
|
};
|
|
183
182
|
export type BrandDescriptorRegistry = Pick<MapStore<Brand, BrandDescriptor>, "has" | "get" | "values">;
|
|
184
183
|
export type SharedParams = {
|
|
185
|
-
agoricNames: ERef<
|
|
184
|
+
agoricNames: ERef<NameHub>;
|
|
186
185
|
registry: BrandDescriptorRegistry;
|
|
187
186
|
invitationIssuer: Issuer<"set">;
|
|
188
187
|
invitationBrand: Brand<"set">;
|
|
@@ -202,12 +201,12 @@ export type SharedParams = {
|
|
|
202
201
|
export type State = ImmutableState & MutableState;
|
|
203
202
|
export type ImmutableState = Readonly<UniqueParams & {
|
|
204
203
|
paymentQueues: MapStore<Brand, Payment[]>;
|
|
205
|
-
offerToInvitationMakers: MapStore<string,
|
|
204
|
+
offerToInvitationMakers: MapStore<string, InvitationMakers>;
|
|
206
205
|
offerToPublicSubscriberPaths: MapStore<string, Record<string, string>>;
|
|
207
206
|
offerToUsedInvitation: MapStore<string, Amount<"set">>;
|
|
208
207
|
purseBalances: MapStore<Purse, Amount>;
|
|
209
|
-
updateRecorderKit:
|
|
210
|
-
currentRecorderKit:
|
|
208
|
+
updateRecorderKit: RecorderKit<UpdateRecord>;
|
|
209
|
+
currentRecorderKit: RecorderKit<CurrentWalletRecord>;
|
|
211
210
|
liveOffers: MapStore<OfferId, OfferStatus>;
|
|
212
211
|
liveOfferSeats: MapStore<OfferId, UserSeat<unknown>>;
|
|
213
212
|
liveOfferPayments: MapStore<OfferId, MapStore<Brand, Payment>>;
|
|
@@ -218,20 +217,28 @@ export type PurseRecord = BrandDescriptor & {
|
|
|
218
217
|
};
|
|
219
218
|
export type MutableState = {};
|
|
220
219
|
export type SmartWallet = EReturn<EReturn<typeof prepareSmartWallet>>;
|
|
220
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
221
221
|
import type { ERemote } from '@agoric/internal';
|
|
222
|
+
import type { CapData } from '@endo/marshal';
|
|
222
223
|
import type { Payment } from '@agoric/ertp';
|
|
223
224
|
import type { Amount } from '@agoric/ertp';
|
|
224
225
|
import type { InvokeEntryMessage } from './offers.js';
|
|
225
226
|
import type { OfferSpec } from './offers.js';
|
|
226
227
|
import type { OfferId } from './offers.js';
|
|
228
|
+
import type { MakeOfferWatcher } from './offerWatcher.js';
|
|
227
229
|
import type { Brand } from '@agoric/ertp';
|
|
228
230
|
import type { OfferStatus } from './offers.js';
|
|
229
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';
|
|
230
234
|
import type { Remote } from '@agoric/internal';
|
|
231
235
|
import type { InvitationDetails } from '@agoric/zoe';
|
|
232
236
|
import type { Purse } from '@agoric/ertp';
|
|
233
237
|
import type { MapStore } from '@agoric/store';
|
|
238
|
+
import type { NameHub } from '@agoric/vats';
|
|
234
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';
|
|
235
242
|
import type { UserSeat } from '@agoric/zoe';
|
|
236
243
|
import type { EReturn } from '@endo/far';
|
|
237
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":"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"}
|
package/src/smartWallet.js
CHANGED
|
@@ -55,6 +55,15 @@ import { prepareOfferWatcher, makeWatchOfferOutcomes } from './offerWatcher.js';
|
|
|
55
55
|
* @import {CopyRecord} from '@endo/pass-style';
|
|
56
56
|
* @import {EReturn} from '@endo/far';
|
|
57
57
|
* @import {OfferId, OfferStatus, OfferSpec, InvokeEntryMessage, ResultPlan} from './offers.js';
|
|
58
|
+
* @import {MakeOfferWatcher} from './offerWatcher.js';
|
|
59
|
+
* @import {Petname} from './types.js';
|
|
60
|
+
* @import {Bank} from '@agoric/vats/src/vat-bank.js';
|
|
61
|
+
* @import {NameHub} from '@agoric/vats';
|
|
62
|
+
* @import {InvitationMakers} from './types.js';
|
|
63
|
+
* @import {RecorderKit} from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
64
|
+
* @import {Baggage} from '@agoric/vat-data';
|
|
65
|
+
* @import {PublicSubscribers} from './types.js';
|
|
66
|
+
* @import {CapData} from '@endo/marshal';
|
|
58
67
|
*/
|
|
59
68
|
|
|
60
69
|
const trace = makeTracer('SmrtWlt');
|
|
@@ -70,7 +79,7 @@ const trace = makeTracer('SmrtWlt');
|
|
|
70
79
|
* info: (...args: any[]) => void;
|
|
71
80
|
* error: (...args: any[]) => void;
|
|
72
81
|
* };
|
|
73
|
-
* makeOfferWatcher:
|
|
82
|
+
* makeOfferWatcher: MakeOfferWatcher;
|
|
74
83
|
* invitationFromSpec: ERef<Invitation>;
|
|
75
84
|
* }} ExecutorPowers
|
|
76
85
|
*/
|
|
@@ -162,7 +171,7 @@ const trace = makeTracer('SmrtWlt');
|
|
|
162
171
|
* brand: Brand;
|
|
163
172
|
* displayInfo: DisplayInfo;
|
|
164
173
|
* issuer: Issuer;
|
|
165
|
-
* petname:
|
|
174
|
+
* petname: Petname;
|
|
166
175
|
* }} BrandDescriptor
|
|
167
176
|
* For use by clients to describe brands to users. Includes `displayInfo` to
|
|
168
177
|
* save a remote call.
|
|
@@ -171,7 +180,7 @@ const trace = makeTracer('SmrtWlt');
|
|
|
171
180
|
/**
|
|
172
181
|
* @typedef {{
|
|
173
182
|
* address: string;
|
|
174
|
-
* bank: ERef<
|
|
183
|
+
* bank: ERef<Bank>;
|
|
175
184
|
* currentStorageNode: Remote<StorageNode>;
|
|
176
185
|
* invitationPurse: Purse<'set', InvitationDetails>;
|
|
177
186
|
* walletStorageNode: Remote<StorageNode>;
|
|
@@ -182,7 +191,7 @@ const trace = makeTracer('SmrtWlt');
|
|
|
182
191
|
*
|
|
183
192
|
*
|
|
184
193
|
* @typedef {{
|
|
185
|
-
* agoricNames: ERef<
|
|
194
|
+
* agoricNames: ERef<NameHub>;
|
|
186
195
|
* registry: BrandDescriptorRegistry;
|
|
187
196
|
* invitationIssuer: Issuer<'set'>;
|
|
188
197
|
* invitationBrand: Brand<'set'>;
|
|
@@ -204,15 +213,12 @@ const trace = makeTracer('SmrtWlt');
|
|
|
204
213
|
* @typedef {Readonly<
|
|
205
214
|
* UniqueParams & {
|
|
206
215
|
* paymentQueues: MapStore<Brand, Payment[]>;
|
|
207
|
-
* offerToInvitationMakers: MapStore<
|
|
208
|
-
* string,
|
|
209
|
-
* import('./types.js').InvitationMakers
|
|
210
|
-
* >;
|
|
216
|
+
* offerToInvitationMakers: MapStore<string, InvitationMakers>;
|
|
211
217
|
* offerToPublicSubscriberPaths: MapStore<string, Record<string, string>>;
|
|
212
218
|
* offerToUsedInvitation: MapStore<string, Amount<'set'>>;
|
|
213
219
|
* purseBalances: MapStore<Purse, Amount>;
|
|
214
|
-
* updateRecorderKit:
|
|
215
|
-
* currentRecorderKit:
|
|
220
|
+
* updateRecorderKit: RecorderKit<UpdateRecord>;
|
|
221
|
+
* currentRecorderKit: RecorderKit<CurrentWalletRecord>;
|
|
216
222
|
* liveOffers: MapStore<OfferId, OfferStatus>;
|
|
217
223
|
* liveOfferSeats: MapStore<OfferId, UserSeat<unknown>>;
|
|
218
224
|
* liveOfferPayments: MapStore<OfferId, MapStore<Brand, Payment>>;
|
|
@@ -232,7 +238,7 @@ const trace = makeTracer('SmrtWlt');
|
|
|
232
238
|
* TODO: consider moving to nameHub.js?
|
|
233
239
|
*
|
|
234
240
|
* @param {unknown} target - passable Key
|
|
235
|
-
* @param {ERef<
|
|
241
|
+
* @param {ERef<NameHub>} nameHub
|
|
236
242
|
*/
|
|
237
243
|
const namesOf = async (target, nameHub) => {
|
|
238
244
|
const entries = await E(nameHub).entries();
|
|
@@ -276,7 +282,7 @@ const getBrandToPurses = (walletPurses, key) => {
|
|
|
276
282
|
};
|
|
277
283
|
|
|
278
284
|
/**
|
|
279
|
-
* @param {
|
|
285
|
+
* @param {Baggage} baggage
|
|
280
286
|
* @param {SharedParams} shared
|
|
281
287
|
*/
|
|
282
288
|
export const prepareSmartWallet = (baggage, shared) => {
|
|
@@ -439,12 +445,12 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
439
445
|
myStore: zone.detached().mapStore('my items'),
|
|
440
446
|
};
|
|
441
447
|
|
|
442
|
-
/** @type {
|
|
448
|
+
/** @type {RecorderKit<UpdateRecord>} */
|
|
443
449
|
const updateRecorderKit = makeRecorderKit(unique.walletStorageNode);
|
|
444
450
|
// NB: state size must not grow monotonically
|
|
445
451
|
// This is the node that UIs subscribe to for everything they need.
|
|
446
452
|
// e.g. agoric follow :published.wallet.agoric1nqxg4pye30n3trct0hf7dclcwfxz8au84hr3ht
|
|
447
|
-
/** @type {
|
|
453
|
+
/** @type {RecorderKit<CurrentWalletRecord>} */
|
|
448
454
|
const currentRecorderKit = makeRecorderKit(unique.currentStorageNode);
|
|
449
455
|
|
|
450
456
|
const nonpreciousState = {
|
|
@@ -646,8 +652,7 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
646
652
|
* transition to decentralized introductions.
|
|
647
653
|
*
|
|
648
654
|
* @param {Brand} brand
|
|
649
|
-
* @param {ERef<
|
|
650
|
-
* brand, issuer branches
|
|
655
|
+
* @param {ERef<NameHub>} known - namehub with brand, issuer branches
|
|
651
656
|
* @returns {Promise<Purse | undefined>} undefined if brand is not known
|
|
652
657
|
*/
|
|
653
658
|
async getPurseIfKnownBrand(brand, known) {
|
|
@@ -726,8 +731,8 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
726
731
|
/**
|
|
727
732
|
* @param {string} offerId
|
|
728
733
|
* @param {Amount<'set'>} invitationAmount
|
|
729
|
-
* @param {
|
|
730
|
-
* @param {
|
|
734
|
+
* @param {InvitationMakers} invitationMakers
|
|
735
|
+
* @param {PublicSubscribers} publicSubscribers
|
|
731
736
|
*/
|
|
732
737
|
async addContinuingOffer(
|
|
733
738
|
offerId,
|
|
@@ -1179,8 +1184,7 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
1179
1184
|
* Umarshals the actionCapData and delegates to the appropriate action
|
|
1180
1185
|
* handler.
|
|
1181
1186
|
*
|
|
1182
|
-
* @param {
|
|
1183
|
-
* of type BridgeAction
|
|
1187
|
+
* @param {CapData<string | null>} actionCapData of type BridgeAction
|
|
1184
1188
|
* @param {boolean} [canSpend]
|
|
1185
1189
|
* @returns {Promise<void>}
|
|
1186
1190
|
*/
|
package/src/utils.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* @import {OfferId, OfferStatus} from './offers.js';
|
|
3
|
+
* @import {UpdateRecord} from './smartWallet.js';
|
|
4
|
+
* @import {Follower} from '@agoric/casting';
|
|
5
|
+
* @import {PublicSubscribers} from './types.js';
|
|
6
|
+
* @import {TopicsRecord} from '@agoric/zoe/src/contractSupport/index.js';
|
|
7
|
+
*/
|
|
2
8
|
export const NO_SMART_WALLET_ERROR: "no smart wallet";
|
|
3
9
|
export function makeWalletStateCoalescer(invitationBrand?: Brand<"set">): {
|
|
4
10
|
state: {
|
|
@@ -10,9 +16,9 @@ export function makeWalletStateCoalescer(invitationBrand?: Brand<"set">): {
|
|
|
10
16
|
offerStatuses: Map<OfferId, OfferStatus>;
|
|
11
17
|
balances: Map<globalThis.Brand, globalThis.Amount>;
|
|
12
18
|
};
|
|
13
|
-
update: (updateRecord:
|
|
19
|
+
update: (updateRecord: UpdateRecord | {}) => void;
|
|
14
20
|
};
|
|
15
|
-
export function coalesceUpdates(updates: ERef<Subscriber<
|
|
21
|
+
export function coalesceUpdates(updates: ERef<Subscriber<UpdateRecord>>, invitationBrand?: Brand<"set">): {
|
|
16
22
|
invitationsReceived: Map<string, {
|
|
17
23
|
acceptedIn: OfferId;
|
|
18
24
|
description: string;
|
|
@@ -21,9 +27,13 @@ export function coalesceUpdates(updates: ERef<Subscriber<import("./smartWallet.j
|
|
|
21
27
|
offerStatuses: Map<OfferId, OfferStatus>;
|
|
22
28
|
balances: Map<globalThis.Brand, globalThis.Amount>;
|
|
23
29
|
};
|
|
24
|
-
export function assertHasData(follower:
|
|
25
|
-
export function objectMapStoragePath(subscribers?:
|
|
30
|
+
export function assertHasData(follower: Follower<any>): Promise<void>;
|
|
31
|
+
export function objectMapStoragePath(subscribers?: PublicSubscribers | TopicsRecord): ERef<Record<string, string>> | null;
|
|
26
32
|
export type CoalescedWalletState = ReturnType<typeof makeWalletStateCoalescer>["state"];
|
|
27
33
|
import type { OfferId } from './offers.js';
|
|
28
34
|
import type { OfferStatus } from './offers.js';
|
|
35
|
+
import type { UpdateRecord } from './smartWallet.js';
|
|
36
|
+
import type { Follower } from '@agoric/casting';
|
|
37
|
+
import type { PublicSubscribers } from './types.js';
|
|
38
|
+
import type { TopicsRecord } from '@agoric/zoe/src/contractSupport/index.js';
|
|
29
39
|
//# sourceMappingURL=utils.d.ts.map
|
package/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH,oCAAqC,iBAAiB,CAAC;AAKhD,2DADK,KAAK,CAAC,KAAK,CAAC;;;wBAaH,OAAO;yBACN,MAAM;sBACT,QAAQ;;;;;2BAOd,YAAY,GAAG,EAAE;EA+D7B;AAaM,yCAHI,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,oBAC9B,KAAK,CAAC,KAAK,CAAC;;oBAnFF,OAAO;qBACN,MAAM;kBACT,QAAQ;;;;EA4F1B;AAMM,wCAHI,SAAS,GAAG,CAAC,iBAYvB;AAQM,mDAHI,iBAAiB,GAAG,YAAY,GAC9B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAY/C;mCAtDa,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,OAAO,CAAC;6BAjG3B,aAAa;iCAAb,aAAa;kCACrB,kBAAkB;8BACtB,iBAAiB;uCACR,YAAY;kCACjB,0CAA0C"}
|
package/src/utils.js
CHANGED
|
@@ -2,7 +2,13 @@ import { deeplyFulfilledObject, objectMap, makeTracer } from '@agoric/internal';
|
|
|
2
2
|
import { observeIteration, subscribeEach } from '@agoric/notifier';
|
|
3
3
|
import { E } from '@endo/far';
|
|
4
4
|
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* @import {OfferId, OfferStatus} from './offers.js';
|
|
7
|
+
* @import {UpdateRecord} from './smartWallet.js';
|
|
8
|
+
* @import {Follower} from '@agoric/casting';
|
|
9
|
+
* @import {PublicSubscribers} from './types.js';
|
|
10
|
+
* @import {TopicsRecord} from '@agoric/zoe/src/contractSupport/index.js';
|
|
11
|
+
*/
|
|
6
12
|
|
|
7
13
|
export const NO_SMART_WALLET_ERROR = 'no smart wallet';
|
|
8
14
|
|
|
@@ -30,8 +36,7 @@ export const makeWalletStateCoalescer = (invitationBrand = undefined) => {
|
|
|
30
36
|
const invitationsReceived = new Map();
|
|
31
37
|
|
|
32
38
|
/**
|
|
33
|
-
* @param {
|
|
34
|
-
* than previous
|
|
39
|
+
* @param {UpdateRecord | {}} updateRecord newer than previous
|
|
35
40
|
*/
|
|
36
41
|
const update = updateRecord => {
|
|
37
42
|
if (!('updated' in updateRecord)) {
|
|
@@ -104,7 +109,7 @@ export const makeWalletStateCoalescer = (invitationBrand = undefined) => {
|
|
|
104
109
|
* If this proves to be a problem we can add an option to this or a related
|
|
105
110
|
* utility to reset state from RPC.
|
|
106
111
|
*
|
|
107
|
-
* @param {ERef<Subscriber<
|
|
112
|
+
* @param {ERef<Subscriber<UpdateRecord>>} updates
|
|
108
113
|
* @param {Brand<'set'>} [invitationBrand]
|
|
109
114
|
*/
|
|
110
115
|
export const coalesceUpdates = (updates, invitationBrand) => {
|
|
@@ -119,7 +124,7 @@ export const coalesceUpdates = (updates, invitationBrand) => {
|
|
|
119
124
|
};
|
|
120
125
|
|
|
121
126
|
/**
|
|
122
|
-
* @param {
|
|
127
|
+
* @param {Follower<any>} follower
|
|
123
128
|
* @throws if there is no first height
|
|
124
129
|
*/
|
|
125
130
|
export const assertHasData = async follower => {
|
|
@@ -136,8 +141,7 @@ export const assertHasData = async follower => {
|
|
|
136
141
|
/**
|
|
137
142
|
* Handles the case of falsy argument so the caller can consistently await.
|
|
138
143
|
*
|
|
139
|
-
* @param {
|
|
140
|
-
* | import('@agoric/zoe/src/contractSupport/index.js').TopicsRecord} [subscribers]
|
|
144
|
+
* @param {PublicSubscribers | TopicsRecord} [subscribers]
|
|
141
145
|
* @returns {ERef<Record<string, string>> | null}
|
|
142
146
|
*/
|
|
143
147
|
export const objectMapStoragePath = subscribers => {
|
package/src/walletFactory.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export namespace customTermsShape {
|
|
|
4
4
|
let assetPublisher: Pattern;
|
|
5
5
|
}
|
|
6
6
|
export const privateArgsShape: import("@endo/patterns").Matcher;
|
|
7
|
-
export function publishDepositFacet(address: string, wallet:
|
|
7
|
+
export function publishDepositFacet(address: string, wallet: SmartWallet, namesByAddressAdmin: ERef<NameAdmin>): Promise<unknown>;
|
|
8
8
|
export function makeAssetRegistry(assetPublisher: AssetPublisher): {
|
|
9
9
|
/** @param {Brand} brand */
|
|
10
10
|
has: (brand: Brand) => boolean;
|
|
@@ -13,49 +13,55 @@ export function makeAssetRegistry(assetPublisher: AssetPublisher): {
|
|
|
13
13
|
brand: Brand;
|
|
14
14
|
displayInfo: DisplayInfo;
|
|
15
15
|
issuer: Issuer;
|
|
16
|
-
petname:
|
|
16
|
+
petname: Petname;
|
|
17
17
|
};
|
|
18
18
|
values: () => Iterable<{
|
|
19
19
|
brand: Brand;
|
|
20
20
|
displayInfo: DisplayInfo;
|
|
21
21
|
issuer: Issuer;
|
|
22
|
-
petname:
|
|
22
|
+
petname: Petname;
|
|
23
23
|
}>;
|
|
24
24
|
};
|
|
25
25
|
export function prepare(zcf: ZCF<SmartWalletContractTerms>, privateArgs: {
|
|
26
26
|
storageNode: ERemote<StorageNode>;
|
|
27
|
-
walletBridgeManager?: ERef<
|
|
27
|
+
walletBridgeManager?: ERef<ScopedBridgeManager<"wallet">>;
|
|
28
28
|
walletReviver?: ERef<WalletReviver>;
|
|
29
|
-
}, baggage:
|
|
29
|
+
}, baggage: Baggage): Promise<{
|
|
30
30
|
creatorFacet: import("@endo/exo").Guarded<{
|
|
31
31
|
/**
|
|
32
32
|
* @param {string} address
|
|
33
|
-
* @param {ERef<
|
|
34
|
-
* @param {ERef<
|
|
35
|
-
* @returns {Promise<
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* wallet along with a flag to distinguish between looking up an existing
|
|
39
|
-
* wallet and creating a new one.
|
|
33
|
+
* @param {ERef<Bank>} bank
|
|
34
|
+
* @param {ERef<NameAdmin>} namesByAddressAdmin
|
|
35
|
+
* @returns {Promise<[wallet: SmartWallet, isNew: boolean]>} wallet along
|
|
36
|
+
* with a flag to distinguish between looking up an existing wallet and
|
|
37
|
+
* creating a new one.
|
|
40
38
|
*/
|
|
41
|
-
provideSmartWallet(address: string, bank: ERef<
|
|
39
|
+
provideSmartWallet(address: string, bank: ERef<Bank>, namesByAddressAdmin: ERef<NameAdmin>): Promise<[wallet: SmartWallet, isNew: boolean]>;
|
|
42
40
|
}>;
|
|
43
41
|
}>;
|
|
44
42
|
export type SmartWalletContractTerms = {
|
|
45
43
|
agoricNames: ERef<NameHub>;
|
|
46
|
-
board: ERef<
|
|
44
|
+
board: ERef<Board>;
|
|
47
45
|
assetPublisher: AssetPublisher;
|
|
48
46
|
};
|
|
49
47
|
export type AssetPublisher = {
|
|
50
|
-
getAssetSubscription: () => ERef<IterableEachTopic<
|
|
48
|
+
getAssetSubscription: () => ERef<IterableEachTopic<AssetDescriptor>>;
|
|
51
49
|
};
|
|
52
50
|
export type IsRevive = boolean;
|
|
53
51
|
export type WalletReviver = {
|
|
54
|
-
reviveWallet: (address: string) => Promise<
|
|
52
|
+
reviveWallet: (address: string) => Promise<SmartWallet>;
|
|
55
53
|
ackWallet: (address: string) => IsRevive;
|
|
56
54
|
};
|
|
57
55
|
export type start = typeof prepare;
|
|
56
|
+
import type { SmartWallet } from './smartWallet.js';
|
|
57
|
+
import type { NameAdmin } from '@agoric/vats';
|
|
58
|
+
import type { Petname } from './types.js';
|
|
58
59
|
import type { StorageNode } from '@agoric/internal/src/lib-chainStorage.js';
|
|
59
60
|
import type { ERemote } from '@agoric/internal';
|
|
61
|
+
import type { ScopedBridgeManager } from '@agoric/vats';
|
|
62
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
63
|
+
import type { Bank } from '@agoric/vats/src/vat-bank.js';
|
|
60
64
|
import type { NameHub } from '@agoric/vats';
|
|
65
|
+
import type { Board } from '@agoric/vats';
|
|
66
|
+
import type { AssetDescriptor } from '@agoric/vats/src/vat-bank.js';
|
|
61
67
|
//# sourceMappingURL=walletFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walletFactory.d.ts","sourceRoot":"","sources":["walletFactory.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"walletFactory.d.ts","sourceRoot":"","sources":["walletFactory.js"],"names":[],"mappings":";;;;;AA4CA,gEAKE;AAYK,6CAJI,MAAM,UACN,WAAW,uBACX,IAAI,CAAC,SAAS,CAAC,oBAezB;AAWM,kDAFI,cAAc;IAyCrB,2BAA2B;iBAAf,KAAK;IAEjB,2BAA2B;iBAAf,KAAK;eArCP,KAAK;qBACC,WAAW;gBAChB,MAAM;iBACL,OAAO;;;eAHT,KAAK;qBACC,WAAW;gBAChB,MAAM;iBACL,OAAO;;EAuCtB;AAmCM,6BARI,GAAG,CAAC,wBAAwB,CAAC,eAC7B;IACN,WAAW,EAAE,QAAQ,WAAW,CAAC,CAAC;IAClC,mBAAmB,CAAC,EAAE,IAAI,CAAC,oBAAoB,QAAQ,CAAC,CAAC,CAAC;IAC1D,aAAa,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;CACrC,WACO,OAAO;;QAkHZ;;;;;;;WAOG;oCANQ,MAAM,QACN,IAAI,CAAC,IAAI,CAAC,uBACV,IAAI,CAAC,SAAS,CAAC,GACb,OAAO,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;;GAqDhE;uCAzMY;IACR,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACnB,cAAc,EAAE,cAAc,CAAC;CAChC;6BAGS;IACR,oBAAoB,EAAE,MAAM,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC,CAAC;CACtE;uBAGS,OAAO;4BAEP;IACR,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IACxD,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,QAAQ,CAAC;CAC1C;oBA6LU,OAAO,OAAO;iCA3TE,kBAAkB;+BACpB,cAAc;6BAChB,YAAY;iCALR,0CAA0C;6BAD9C,kBAAkB;yCASN,cAAc;6BAC1B,kBAAkB;0BAErB,8BAA8B;6BAT3B,cAAc;2BAIhB,cAAc;qCACJ,8BAA8B"}
|
package/src/walletFactory.js
CHANGED
|
@@ -23,6 +23,15 @@ import { shape } from './typeGuards.js';
|
|
|
23
23
|
* @import {StorageNode} from '@agoric/internal/src/lib-chainStorage.js';
|
|
24
24
|
* @import {MapStore} from '@agoric/swingset-liveslots';
|
|
25
25
|
* @import {NameHub} from '@agoric/vats';
|
|
26
|
+
* @import {SmartWallet} from './smartWallet.js';
|
|
27
|
+
* @import {NameAdmin} from '@agoric/vats';
|
|
28
|
+
* @import {Petname} from './types.js';
|
|
29
|
+
* @import {Board} from '@agoric/vats';
|
|
30
|
+
* @import {AssetDescriptor} from '@agoric/vats/src/vat-bank.js';
|
|
31
|
+
* @import {ScopedBridgeManager} from '@agoric/vats';
|
|
32
|
+
* @import {Baggage} from '@agoric/vat-data';
|
|
33
|
+
* @import {WalletBridgeMsg} from './types.js';
|
|
34
|
+
* @import {Bank} from '@agoric/vats/src/vat-bank.js';
|
|
26
35
|
*/
|
|
27
36
|
|
|
28
37
|
const trace = makeTracer('WltFct');
|
|
@@ -47,8 +56,8 @@ const WALLETS_BY_ADDRESS = 'walletsByAddress';
|
|
|
47
56
|
* already done.
|
|
48
57
|
*
|
|
49
58
|
* @param {string} address
|
|
50
|
-
* @param {
|
|
51
|
-
* @param {ERef<
|
|
59
|
+
* @param {SmartWallet} wallet
|
|
60
|
+
* @param {ERef<NameAdmin>} namesByAddressAdmin
|
|
52
61
|
*/
|
|
53
62
|
export const publishDepositFacet = async (
|
|
54
63
|
address,
|
|
@@ -81,7 +90,7 @@ export const makeAssetRegistry = assetPublisher => {
|
|
|
81
90
|
* brand: Brand;
|
|
82
91
|
* displayInfo: DisplayInfo;
|
|
83
92
|
* issuer: Issuer;
|
|
84
|
-
* petname:
|
|
93
|
+
* petname: Petname;
|
|
85
94
|
* }} BrandDescriptor
|
|
86
95
|
* For use by clients to describe brands to users. Includes `displayInfo` to
|
|
87
96
|
* save a remote call.
|
|
@@ -125,24 +134,20 @@ export const makeAssetRegistry = assetPublisher => {
|
|
|
125
134
|
/**
|
|
126
135
|
* @typedef {{
|
|
127
136
|
* agoricNames: ERef<NameHub>;
|
|
128
|
-
* board: ERef<
|
|
137
|
+
* board: ERef<Board>;
|
|
129
138
|
* assetPublisher: AssetPublisher;
|
|
130
139
|
* }} SmartWalletContractTerms
|
|
131
140
|
*
|
|
132
141
|
*
|
|
133
142
|
* @typedef {{
|
|
134
|
-
* getAssetSubscription: () => ERef<
|
|
135
|
-
* IterableEachTopic<import('@agoric/vats/src/vat-bank.js').AssetDescriptor>
|
|
136
|
-
* >;
|
|
143
|
+
* getAssetSubscription: () => ERef<IterableEachTopic<AssetDescriptor>>;
|
|
137
144
|
* }} AssetPublisher
|
|
138
145
|
*
|
|
139
146
|
*
|
|
140
147
|
* @typedef {boolean} IsRevive
|
|
141
148
|
*
|
|
142
149
|
* @typedef {{
|
|
143
|
-
* reviveWallet: (
|
|
144
|
-
* address: string,
|
|
145
|
-
* ) => Promise<import('./smartWallet.js').SmartWallet>;
|
|
150
|
+
* reviveWallet: (address: string) => Promise<SmartWallet>;
|
|
146
151
|
* ackWallet: (address: string) => IsRevive;
|
|
147
152
|
* }} WalletReviver
|
|
148
153
|
*/
|
|
@@ -154,12 +159,10 @@ export const makeAssetRegistry = assetPublisher => {
|
|
|
154
159
|
* @param {ZCF<SmartWalletContractTerms>} zcf
|
|
155
160
|
* @param {{
|
|
156
161
|
* storageNode: ERemote<StorageNode>;
|
|
157
|
-
* walletBridgeManager?: ERef<
|
|
158
|
-
* import('@agoric/vats').ScopedBridgeManager<'wallet'>
|
|
159
|
-
* >;
|
|
162
|
+
* walletBridgeManager?: ERef<ScopedBridgeManager<'wallet'>>;
|
|
160
163
|
* walletReviver?: ERef<WalletReviver>;
|
|
161
164
|
* }} privateArgs
|
|
162
|
-
* @param {
|
|
165
|
+
* @param {Baggage} baggage
|
|
163
166
|
*/
|
|
164
167
|
export const prepare = async (zcf, privateArgs, baggage) => {
|
|
165
168
|
const upgrading = baggage.has(WALLETS_BY_ADDRESS);
|
|
@@ -168,7 +171,7 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
168
171
|
const zoe = zcf.getZoeService();
|
|
169
172
|
const { storageNode, walletBridgeManager, walletReviver } = privateArgs;
|
|
170
173
|
|
|
171
|
-
/** @type {MapStore<string,
|
|
174
|
+
/** @type {MapStore<string, SmartWallet>} */
|
|
172
175
|
const walletsByAddress = provideDurableMapStore(baggage, WALLETS_BY_ADDRESS);
|
|
173
176
|
const provider = makeAtomicProvider(walletsByAddress);
|
|
174
177
|
|
|
@@ -193,8 +196,7 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
193
196
|
* Once the owner is known, this calls handleBridgeAction which ensures
|
|
194
197
|
* that all errors are published in the owner wallet's vstorage path.
|
|
195
198
|
*
|
|
196
|
-
* @param {
|
|
197
|
-
* shape.WalletBridgeMsg
|
|
199
|
+
* @param {WalletBridgeMsg} obj validated by shape.WalletBridgeMsg
|
|
198
200
|
* @returns {Promise<void>}
|
|
199
201
|
*/
|
|
200
202
|
fromBridge: async obj => {
|
|
@@ -276,21 +278,17 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
276
278
|
{
|
|
277
279
|
/**
|
|
278
280
|
* @param {string} address
|
|
279
|
-
* @param {ERef<
|
|
280
|
-
* @param {ERef<
|
|
281
|
-
* @returns {Promise<
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
* wallet along with a flag to distinguish between looking up an existing
|
|
285
|
-
* wallet and creating a new one.
|
|
281
|
+
* @param {ERef<Bank>} bank
|
|
282
|
+
* @param {ERef<NameAdmin>} namesByAddressAdmin
|
|
283
|
+
* @returns {Promise<[wallet: SmartWallet, isNew: boolean]>} wallet along
|
|
284
|
+
* with a flag to distinguish between looking up an existing wallet and
|
|
285
|
+
* creating a new one.
|
|
286
286
|
*/
|
|
287
287
|
provideSmartWallet(address, bank, namesByAddressAdmin) {
|
|
288
288
|
let isNew = false;
|
|
289
289
|
|
|
290
290
|
/**
|
|
291
|
-
* @type {(
|
|
292
|
-
* address: string,
|
|
293
|
-
* ) => Promise<import('./smartWallet.js').SmartWallet>}
|
|
291
|
+
* @type {(address: string) => Promise<SmartWallet>}
|
|
294
292
|
*/
|
|
295
293
|
const maker = async _address => {
|
|
296
294
|
const invitationPurse = await E(invitationIssuer).makeEmptyPurse();
|