@agoric/smart-wallet 0.5.4-other-dev-3eb1a1d.0 → 0.5.4-other-dev-fbe72e7.0.fbe72e7
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 +2 -2
- package/src/invitations.d.ts.map +1 -1
- package/src/invitations.js +5 -2
- 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 +3 -1
- package/src/offerWatcher.d.ts.map +1 -1
- package/src/offerWatcher.js +15 -1
- package/src/offers.d.ts +55 -1
- package/src/offers.d.ts.map +1 -1
- package/src/offers.js +31 -1
- package/src/proposals/upgrade-wallet-factory2-proposal.js +2 -1
- package/src/smartWallet.d.ts +39 -10
- package/src/smartWallet.d.ts.map +1 -1
- package/src/smartWallet.js +160 -19
- 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 +3 -3
- package/src/utils.d.ts.map +1 -1
- package/src/walletFactory.d.ts +3 -3
- package/src/walletFactory.d.ts.map +1 -1
- package/src/walletFactory.js +4 -1
- 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/package.json
CHANGED
|
@@ -1,47 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/smart-wallet",
|
|
3
|
-
"version": "0.5.4-other-dev-
|
|
3
|
+
"version": "0.5.4-other-dev-fbe72e7.0.fbe72e7",
|
|
4
4
|
"description": "Wallet contract",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "yarn build:bundles",
|
|
9
9
|
"build:bundles": "node ./scripts/build-bundles.js",
|
|
10
|
-
"prepack": "tsc --build tsconfig.build.json",
|
|
11
|
-
"postpack": "git clean -f '*.d
|
|
10
|
+
"prepack": "yarn run -T tsc --build tsconfig.build.json",
|
|
11
|
+
"postpack": "git clean -f '*.d.*ts*' '*.tsbuildinfo'",
|
|
12
12
|
"test": "ava",
|
|
13
|
+
"test:c8": "c8 --all $C8_OPTIONS ava",
|
|
13
14
|
"test:xs": "exit 0",
|
|
14
|
-
"lint": "run-s --continue-on-error lint:*",
|
|
15
|
+
"lint": "yarn run -T run-s --continue-on-error 'lint:*'",
|
|
15
16
|
"lint-fix": "yarn lint:eslint --fix",
|
|
16
|
-
"lint:types": "tsc",
|
|
17
|
-
"lint:eslint": "eslint ."
|
|
17
|
+
"lint:types": "yarn run -T tsc",
|
|
18
|
+
"lint:eslint": "yarn run -T eslint ."
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
20
|
-
"@agoric/casting": "0.4.3-other-dev-
|
|
21
|
-
"@agoric/cosmic-proto": "0.4.1-other-dev-
|
|
22
|
-
"@agoric/swingset-vat": "0.32.3-other-dev-
|
|
23
|
-
"@endo/bundle-source": "^
|
|
24
|
-
"@endo/captp": "^4.4.
|
|
25
|
-
"@endo/init": "^1.1.
|
|
21
|
+
"@agoric/casting": "0.4.3-other-dev-fbe72e7.0.fbe72e7",
|
|
22
|
+
"@agoric/cosmic-proto": "0.4.1-other-dev-fbe72e7.0.fbe72e7",
|
|
23
|
+
"@agoric/swingset-vat": "0.32.3-other-dev-fbe72e7.0.fbe72e7",
|
|
24
|
+
"@endo/bundle-source": "^4.1.2",
|
|
25
|
+
"@endo/captp": "^4.4.8",
|
|
26
|
+
"@endo/init": "^1.1.12",
|
|
26
27
|
"ava": "^5.3.0",
|
|
27
|
-
"import-meta-resolve": "^
|
|
28
|
+
"import-meta-resolve": "^4.1.0"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
|
-
"@agoric/ertp": "0.16.3-other-dev-
|
|
31
|
-
"@agoric/internal": "0.3.3-other-dev-
|
|
32
|
-
"@agoric/notifier": "0.6.3-other-dev-
|
|
33
|
-
"@agoric/store": "0.9.3-other-dev-
|
|
34
|
-
"@agoric/vat-data": "0.5.3-other-dev-
|
|
35
|
-
"@agoric/vats": "0.15.2-other-dev-
|
|
36
|
-
"@agoric/vow": "0.1.1-other-dev-
|
|
37
|
-
"@agoric/zoe": "0.26.3-other-dev-
|
|
38
|
-
"@agoric/zone": "0.2.3-other-dev-
|
|
39
|
-
"@endo/errors": "^1.2.
|
|
40
|
-
"@endo/eventual-send": "^1.
|
|
41
|
-
"@endo/far": "^1.1.
|
|
42
|
-
"@endo/marshal": "^1.
|
|
43
|
-
"@endo/nat": "^5.
|
|
44
|
-
"@endo/
|
|
31
|
+
"@agoric/ertp": "0.16.3-other-dev-fbe72e7.0.fbe72e7",
|
|
32
|
+
"@agoric/internal": "0.3.3-other-dev-fbe72e7.0.fbe72e7",
|
|
33
|
+
"@agoric/notifier": "0.6.3-other-dev-fbe72e7.0.fbe72e7",
|
|
34
|
+
"@agoric/store": "0.9.3-other-dev-fbe72e7.0.fbe72e7",
|
|
35
|
+
"@agoric/vat-data": "0.5.3-other-dev-fbe72e7.0.fbe72e7",
|
|
36
|
+
"@agoric/vats": "0.15.2-other-dev-fbe72e7.0.fbe72e7",
|
|
37
|
+
"@agoric/vow": "0.1.1-other-dev-fbe72e7.0.fbe72e7",
|
|
38
|
+
"@agoric/zoe": "0.26.3-other-dev-fbe72e7.0.fbe72e7",
|
|
39
|
+
"@agoric/zone": "0.2.3-other-dev-fbe72e7.0.fbe72e7",
|
|
40
|
+
"@endo/errors": "^1.2.13",
|
|
41
|
+
"@endo/eventual-send": "^1.3.4",
|
|
42
|
+
"@endo/far": "^1.1.14",
|
|
43
|
+
"@endo/marshal": "^1.8.0",
|
|
44
|
+
"@endo/nat": "^5.1.3",
|
|
45
|
+
"@endo/patterns": "^1.7.0",
|
|
46
|
+
"@endo/promise-kit": "^1.1.13"
|
|
45
47
|
},
|
|
46
48
|
"files": [
|
|
47
49
|
"src/"
|
|
@@ -70,7 +72,10 @@
|
|
|
70
72
|
"access": "public"
|
|
71
73
|
},
|
|
72
74
|
"typeCoverage": {
|
|
73
|
-
"atLeast": 94.
|
|
75
|
+
"atLeast": 94.51
|
|
74
76
|
},
|
|
75
|
-
"
|
|
77
|
+
"engines": {
|
|
78
|
+
"node": "^20.9 || ^22.11"
|
|
79
|
+
},
|
|
80
|
+
"gitHead": "fbe72e72107f9997f788674e668c660d92ec4492"
|
|
76
81
|
}
|
package/src/index.js
CHANGED
package/src/invitations.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function makeInvitationsHelper(zoe: ERef<ZoeService>, agoricNames: ERef<import("@agoric/vats").NameHub>, invitationBrand: Brand<"set">, invitationsPurse: Purse<"set", InvitationDetails>, getInvitationContinuation: (fromOfferId: string) => import("./types.js").InvitationMakers): (spec: InvitationSpec) => ERef<Invitation>;
|
|
1
|
+
export function makeInvitationsHelper(zoe: ERef<ZoeService>, agoricNames: ERef<import("@agoric/vats").NameHub>, invitationBrand: Brand<"set">, invitationsPurse: Purse<"set", import("@agoric/zoe").InvitationDetails>, getInvitationContinuation: (fromOfferId: string) => import("./types.js").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
|
*/
|
|
@@ -45,5 +45,5 @@ export type ContinuingInvitationSpec = {
|
|
|
45
45
|
invitationMakerName: string;
|
|
46
46
|
invitationArgs?: any[];
|
|
47
47
|
};
|
|
48
|
-
export type InvitationsPurseQuery = Pick<InvitationDetails, "description" | "instance">;
|
|
48
|
+
export type InvitationsPurseQuery = Pick<import("@agoric/zoe").InvitationDetails, "description" | "instance">;
|
|
49
49
|
//# 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":"AA0EO,2CANI,IAAI,CAAC,UAAU,CAAC,eAChB,IAAI,CAAC,OAAO,cAAc,EAAE,OAAO,CAAC,mBACpC,KAAK,CAAC,KAAK,CAAC,oBACZ,KAAK,CAAC,KAAK,EAAE,OAAO,aAAa,EAAE,iBAAiB,CAAC,6BACrD,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,YAAY,EAAE,gBAAgB,UAoFrD,cAAc,KAAK,IAAI,CAAC,UAAU,CAAC,CAgBtD;;;;6BAjKY,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,aAAa,EAAE,OAAO,CAAC;IAC7C,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC;CACxB;oCAMS,IAAI,CAChB,OAAW,aAAa,EAAE,iBAAiB,EAC3C,aAAiB,GAAG,UAAU,CAC3B"}
|
package/src/invitations.js
CHANGED
|
@@ -59,14 +59,17 @@ const MAX_PIPE_LENGTH = 2;
|
|
|
59
59
|
*/
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* @typedef {Pick<
|
|
62
|
+
* @typedef {Pick<
|
|
63
|
+
* import('@agoric/zoe').InvitationDetails,
|
|
64
|
+
* 'description' | 'instance'
|
|
65
|
+
* >} InvitationsPurseQuery
|
|
63
66
|
*/
|
|
64
67
|
|
|
65
68
|
/**
|
|
66
69
|
* @param {ERef<ZoeService>} zoe
|
|
67
70
|
* @param {ERef<import('@agoric/vats').NameHub>} agoricNames
|
|
68
71
|
* @param {Brand<'set'>} invitationBrand
|
|
69
|
-
* @param {Purse<'set', InvitationDetails>} invitationsPurse
|
|
72
|
+
* @param {Purse<'set', import('@agoric/zoe').InvitationDetails>} invitationsPurse
|
|
70
73
|
* @param {(fromOfferId: string) => import('./types.js').InvitationMakers} getInvitationContinuation
|
|
71
74
|
*/
|
|
72
75
|
export const makeInvitationsHelper = (
|
|
@@ -22,7 +22,7 @@ export function makeExportContext(): {
|
|
|
22
22
|
*/
|
|
23
23
|
ensureBoardId: (id: BoardId, val: RemotableObject) => void;
|
|
24
24
|
};
|
|
25
|
-
export function makeImportContext(makePresence?: (
|
|
25
|
+
export function makeImportContext(makePresence?: (iface: string) => PassableCap): {
|
|
26
26
|
/**
|
|
27
27
|
* @param {BoardId} id
|
|
28
28
|
* @param {PassableCap} val
|
|
@@ -88,4 +88,5 @@ import type { BoardId } from '@agoric/vats/src/lib-board.js';
|
|
|
88
88
|
import type { RemotableObject } from '@endo/marshal';
|
|
89
89
|
import type { PassableCap } from '@endo/marshal';
|
|
90
90
|
import type { Key } from '@endo/patterns';
|
|
91
|
+
import type { MapStore } from '@agoric/swingset-liveslots';
|
|
91
92
|
//# sourceMappingURL=marshal-contexts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marshal-contexts.d.ts","sourceRoot":"","sources":["marshal-contexts.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"marshal-contexts.d.ts","sourceRoot":"","sources":["marshal-contexts.js"],"names":[],"mappings":"AAwHO;;;;;;;IAoFH;;;OAGG;sBAFQ,MAAM,SACN,KAAK;;IAMhB;;;OAGG;sBAFQ,OAAO,OACP,eAAe;IAK1B;;;OAGG;wBAFQ,OAAO,OACP,eAAe;EAW7B;AAcM,iDAFI,CAAC,KAAK,EAAE,MAAM,KAAK,WAAW;IA8FrC;;;OAGG;sBAFQ,OAAO,OACP,WAAW;IAKtB;;;OAGG;wBAFQ,OAAO,OACP,WAAW;;;;;;;;;;;;;;;;;;;;;;;EAYzB;AA4BM,2CAHI,MAAM,OACN,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,OAapC;;;;uBAlXgD,CAAC,SAApC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAE,IACnC,GAAG,MAAM,GAAG,MAAM,CAAC,IAAI,MAAM,EAAE;;;;qBAGtB,CAAC,SAAV,MAAQ,IACR,GAAG,CAAC,IAAI,MAAM,EAAE;;;;;sBA0CoB,CAAC,SAApC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAE,IACnC,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO;;;;;qBAGvB,GAAG,GAAG,IAAI,GAAG,KAAK;;;;oBAKZ,IAAI,SAAV,GAAK,EACS,GAAG,SAAjB,WAAa,IACb;IACR,MAAM,EAAE,SAAS,IAAI,EAAE,GAAG,CAAC,CAAC;IAC5B,KAAK,EAAE,SAAS,GAAG,EAAE,IAAI,CAAC,CAAC;CAC5B;4BAgJU,UAAU,CAAC,OAAO,iBAAiB,CAAC;4BA+HpC,UAAU,CAAC,OAAO,iBAAiB,CAAC;6BA5VxB,+BAA+B;qCAHV,eAAe;iCAAf,eAAe;yBACxC,gBAAgB;8BACX,4BAA4B"}
|
package/src/marshal-contexts.js
CHANGED
|
@@ -9,6 +9,7 @@ import { DEFAULT_PREFIX } from '@agoric/vats/src/lib-board.js';
|
|
|
9
9
|
/**
|
|
10
10
|
* @import {PassableCap, RemotableObject} from '@endo/marshal';
|
|
11
11
|
* @import {Key} from '@endo/patterns';
|
|
12
|
+
* @import {MapStore} from '@agoric/swingset-liveslots';
|
|
12
13
|
* @import {BoardId} from '@agoric/vats/src/lib-board.js';
|
|
13
14
|
*/
|
|
14
15
|
|
package/src/offerWatcher.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export function makeWatchOfferOutcomes(vowTools: VowTools): (watchers: OutcomeWatchers, seat: UserSeat) => Promise<any[]>;
|
|
2
2
|
export function prepareOfferWatcher(baggage: Baggage, vowTools: VowTools): (walletHelper: any, deposit: {
|
|
3
3
|
receive: (payment: Payment) => Promise<Amount>;
|
|
4
|
-
}, offerSpec: OfferSpec, address: string, invitationAmount: import("@agoric/ertp").SetAmount<import("@endo/patterns").Key>, seatRef: UserSeat
|
|
4
|
+
}, offerSpec: OfferSpec, address: string, invitationAmount: import("@agoric/ertp").SetAmount<import("@endo/patterns").Key>, seatRef: UserSeat) => import("@endo/exo").GuardedKit<{
|
|
5
5
|
helper: {
|
|
6
6
|
/**
|
|
7
7
|
* @param {Record<string, unknown>} offerStatusUpdates
|
|
@@ -44,9 +44,11 @@ export type OutcomeWatchers = {
|
|
|
44
44
|
export type MakeOfferWatcher = ReturnType<typeof prepareOfferWatcher>;
|
|
45
45
|
export type OfferWatcher = ReturnType<MakeOfferWatcher>;
|
|
46
46
|
import type { VowTools } from '@agoric/vow';
|
|
47
|
+
import type { UserSeat } from '@agoric/zoe';
|
|
47
48
|
import type { Baggage } from '@agoric/vat-data';
|
|
48
49
|
import type { OfferSpec } from './offers.js';
|
|
49
50
|
import type { Passable } from '@endo/pass-style';
|
|
50
51
|
import type { ContinuingOfferResult } from './types.js';
|
|
51
52
|
import type { PromiseWatcher } from '@agoric/swingset-liveslots';
|
|
53
|
+
import type { PaymentPKeywordRecord } from '@agoric/zoe';
|
|
52
54
|
//# sourceMappingURL=offerWatcher.d.ts.map
|
|
@@ -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":"AAyEO,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,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;IAuC3C,iDAAiD;qBAAtC,eAAe,CAAC,iBAAiB,CAAC;GA2BlD;;;;gCAzTkB,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;+BAmTU,UAAU,CAAC,OAAO,mBAAmB,CAAC;2BACtC,UAAU,CAAC,gBAAgB,CAAC;8BAlUV,aAAa;8BAC2B,aAAa;6BAF3D,kBAAkB;+BAJhB,aAAa;8BAEd,kBAAkB;2CADL,YAAY;oCAEnB,4BAA4B;2CAGW,aAAa"}
|
package/src/offerWatcher.js
CHANGED
|
@@ -19,6 +19,7 @@ import { UNPUBLISHED_RESULT } from './offers.js';
|
|
|
19
19
|
* @import {PromiseWatcher} from '@agoric/swingset-liveslots';
|
|
20
20
|
* @import {Baggage} from '@agoric/vat-data';
|
|
21
21
|
* @import {Vow, VowTools} from '@agoric/vow';
|
|
22
|
+
* @import {PaymentPKeywordRecord, Proposal, UserSeat, ZoeService} from '@agoric/zoe';
|
|
22
23
|
*/
|
|
23
24
|
|
|
24
25
|
/**
|
|
@@ -273,7 +274,20 @@ export const prepareOfferWatcher = (baggage, vowTools) => {
|
|
|
273
274
|
resultWatcher: {
|
|
274
275
|
onFulfilled(result) {
|
|
275
276
|
const { facets } = this;
|
|
276
|
-
|
|
277
|
+
const { walletHelper } = this.state;
|
|
278
|
+
const { saveResult } = this.state.status;
|
|
279
|
+
if (saveResult) {
|
|
280
|
+
// Note: result is passable and storable since it was received from another vat
|
|
281
|
+
const name = walletHelper.saveEntry(saveResult, result);
|
|
282
|
+
facets.helper.updateStatus({
|
|
283
|
+
result: {
|
|
284
|
+
name,
|
|
285
|
+
passStyle: passStyleOf(result),
|
|
286
|
+
},
|
|
287
|
+
});
|
|
288
|
+
} else {
|
|
289
|
+
facets.helper.publishResult(result);
|
|
290
|
+
}
|
|
277
291
|
},
|
|
278
292
|
/**
|
|
279
293
|
* If promise disconnected, watch again. Or if there's an Error, handle
|
package/src/offers.d.ts
CHANGED
|
@@ -1,27 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {Proposal} from '@agoric/zoe';
|
|
3
|
+
* @import {Passable} from '@endo/pass-style';
|
|
4
|
+
*/
|
|
1
5
|
/**
|
|
2
6
|
* @typedef {number | string} OfferId
|
|
3
7
|
*/
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {object} ResultPlan
|
|
10
|
+
* @property {string} name by which to save the item
|
|
11
|
+
* @property {boolean} [overwrite=false] whether to overwrite an existing item.
|
|
12
|
+
* If false and there is a conflict, the contract will autogen a similar
|
|
13
|
+
* name.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {{
|
|
17
|
+
* targetName: string;
|
|
18
|
+
* method: string;
|
|
19
|
+
* args: Passable[];
|
|
20
|
+
* saveResult?: ResultPlan;
|
|
21
|
+
* id?: number | string;
|
|
22
|
+
* }} InvokeEntryMessage
|
|
23
|
+
*/
|
|
4
24
|
/**
|
|
5
25
|
* @typedef {{
|
|
6
26
|
* id: OfferId;
|
|
7
27
|
* invitationSpec: import('./invitations.js').InvitationSpec;
|
|
8
28
|
* proposal: Proposal;
|
|
9
29
|
* offerArgs?: any;
|
|
30
|
+
* saveResult?: ResultPlan;
|
|
10
31
|
* }} OfferSpec
|
|
32
|
+
* If `saveResult` is provided, the result of the invocation will be saved to
|
|
33
|
+
* the specified location. Otherwise it will be published directly to vstorage
|
|
34
|
+
* (or 'UNPUBLISHED' if it cannot be).
|
|
11
35
|
*/
|
|
12
36
|
/** Value for "result" field when the result can't be published */
|
|
13
37
|
export const UNPUBLISHED_RESULT: "UNPUBLISHED";
|
|
14
38
|
export type OfferId = number | string;
|
|
39
|
+
export type ResultPlan = {
|
|
40
|
+
/**
|
|
41
|
+
* by which to save the item
|
|
42
|
+
*/
|
|
43
|
+
name: string;
|
|
44
|
+
/**
|
|
45
|
+
* whether to overwrite an existing item.
|
|
46
|
+
* If false and there is a conflict, the contract will autogen a similar
|
|
47
|
+
* name.
|
|
48
|
+
*/
|
|
49
|
+
overwrite?: boolean | undefined;
|
|
50
|
+
};
|
|
51
|
+
export type InvokeEntryMessage = {
|
|
52
|
+
targetName: string;
|
|
53
|
+
method: string;
|
|
54
|
+
args: Passable[];
|
|
55
|
+
saveResult?: ResultPlan;
|
|
56
|
+
id?: number | string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* If `saveResult` is provided, the result of the invocation will be saved to
|
|
60
|
+
* the specified location. Otherwise it will be published directly to vstorage
|
|
61
|
+
* (or 'UNPUBLISHED' if it cannot be).
|
|
62
|
+
*/
|
|
15
63
|
export type OfferSpec = {
|
|
16
64
|
id: OfferId;
|
|
17
65
|
invitationSpec: import("./invitations.js").InvitationSpec;
|
|
18
66
|
proposal: Proposal;
|
|
19
67
|
offerArgs?: any;
|
|
68
|
+
saveResult?: ResultPlan;
|
|
20
69
|
};
|
|
21
70
|
export type OfferStatus = OfferSpec & {
|
|
22
71
|
error?: string;
|
|
23
72
|
numWantsSatisfied?: number;
|
|
24
|
-
result?: unknown | typeof UNPUBLISHED_RESULT
|
|
73
|
+
result?: unknown | typeof UNPUBLISHED_RESULT | {
|
|
74
|
+
name: string;
|
|
75
|
+
passStyle: string;
|
|
76
|
+
};
|
|
25
77
|
payouts?: AmountKeywordRecord;
|
|
26
78
|
};
|
|
79
|
+
import type { Passable } from '@endo/pass-style';
|
|
80
|
+
import type { Proposal } from '@agoric/zoe';
|
|
27
81
|
//# 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;;GAEG;AAEH
|
|
1
|
+
{"version":3,"file":"offers.d.ts","sourceRoot":"","sources":["offers.js"],"names":[],"mappings":"AAAA;;;GAGG;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,OAAO,kBAAkB,EAAE,cAAc,CAAC;IAC1D,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;8BAlDuB,kBAAkB;8BADlB,aAAa"}
|
package/src/offers.js
CHANGED
|
@@ -1,14 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {Proposal} from '@agoric/zoe';
|
|
3
|
+
* @import {Passable} from '@endo/pass-style';
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* @typedef {number | string} OfferId
|
|
3
8
|
*/
|
|
4
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {object} ResultPlan
|
|
12
|
+
* @property {string} name by which to save the item
|
|
13
|
+
* @property {boolean} [overwrite=false] whether to overwrite an existing item.
|
|
14
|
+
* If false and there is a conflict, the contract will autogen a similar
|
|
15
|
+
* name.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {{
|
|
20
|
+
* targetName: string;
|
|
21
|
+
* method: string;
|
|
22
|
+
* args: Passable[];
|
|
23
|
+
* saveResult?: ResultPlan;
|
|
24
|
+
* id?: number | string;
|
|
25
|
+
* }} InvokeEntryMessage
|
|
26
|
+
*/
|
|
27
|
+
|
|
5
28
|
/**
|
|
6
29
|
* @typedef {{
|
|
7
30
|
* id: OfferId;
|
|
8
31
|
* invitationSpec: import('./invitations.js').InvitationSpec;
|
|
9
32
|
* proposal: Proposal;
|
|
10
33
|
* offerArgs?: any;
|
|
34
|
+
* saveResult?: ResultPlan;
|
|
11
35
|
* }} OfferSpec
|
|
36
|
+
* If `saveResult` is provided, the result of the invocation will be saved to
|
|
37
|
+
* the specified location. Otherwise it will be published directly to vstorage
|
|
38
|
+
* (or 'UNPUBLISHED' if it cannot be).
|
|
12
39
|
*/
|
|
13
40
|
|
|
14
41
|
/** Value for "result" field when the result can't be published */
|
|
@@ -18,7 +45,10 @@ export const UNPUBLISHED_RESULT = 'UNPUBLISHED';
|
|
|
18
45
|
* @typedef {OfferSpec & {
|
|
19
46
|
* error?: string;
|
|
20
47
|
* numWantsSatisfied?: number;
|
|
21
|
-
* result?:
|
|
48
|
+
* result?:
|
|
49
|
+
* | unknown
|
|
50
|
+
* | typeof UNPUBLISHED_RESULT
|
|
51
|
+
* | { name: string; passStyle: string };
|
|
22
52
|
* payouts?: AmountKeywordRecord;
|
|
23
53
|
* }} OfferStatus
|
|
24
54
|
*/
|
|
@@ -45,7 +45,7 @@ export const upgradeWalletFactory = async (
|
|
|
45
45
|
console.log(`Successfully upgraded WalletFactory`);
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
export const getManifestForUpgradeWallet = (
|
|
48
|
+
export const getManifestForUpgradeWallet = ({ restoreRef }, { walletRef }) => ({
|
|
49
49
|
manifest: {
|
|
50
50
|
[upgradeWalletFactory.name]: {
|
|
51
51
|
consume: {
|
|
@@ -56,5 +56,6 @@ export const getManifestForUpgradeWallet = (_powers, { walletRef }) => ({
|
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
},
|
|
59
|
+
installations: { walletFactory: restoreRef(walletRef) },
|
|
59
60
|
options: { walletRef },
|
|
60
61
|
});
|
package/src/smartWallet.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export function prepareSmartWallet(baggage: import("@agoric/vat-data").Baggage,
|
|
|
11
11
|
* @param {boolean} [canSpend]
|
|
12
12
|
* @returns {Promise<void>}
|
|
13
13
|
*/
|
|
14
|
-
handleBridgeAction(actionCapData: import("@endo/marshal").CapData<string | null>, canSpend?: boolean
|
|
14
|
+
handleBridgeAction(actionCapData: import("@endo/marshal").CapData<string | null>, canSpend?: boolean): Promise<void>;
|
|
15
15
|
getDepositFacet(): import("@endo/exo").Guarded<{
|
|
16
16
|
/**
|
|
17
17
|
* Put the assets from the payment into the appropriate purse.
|
|
@@ -25,6 +25,12 @@ export function prepareSmartWallet(baggage: import("@agoric/vat-data").Baggage,
|
|
|
25
25
|
*/
|
|
26
26
|
receive(payment: Payment): Promise<Amount>;
|
|
27
27
|
}>;
|
|
28
|
+
getInvokeFacet(): import("@endo/exo").Guarded<{
|
|
29
|
+
/**
|
|
30
|
+
* @param {InvokeEntryMessage} message
|
|
31
|
+
*/
|
|
32
|
+
invokeEntry(message: InvokeEntryMessage): Promise<void>;
|
|
33
|
+
}>;
|
|
28
34
|
getOffersFacet(): import("@endo/exo").Guarded<{
|
|
29
35
|
/**
|
|
30
36
|
* Take an offer description provided in capData, augment it with
|
|
@@ -63,13 +69,6 @@ export function prepareSmartWallet(baggage: import("@agoric/vat-data").Baggage,
|
|
|
63
69
|
};
|
|
64
70
|
};
|
|
65
71
|
}>>;
|
|
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
72
|
export type ExecutorPowers = {
|
|
74
73
|
logger: {
|
|
75
74
|
info: (...args: any[]) => void;
|
|
@@ -86,7 +85,17 @@ export type TryExitOfferAction = {
|
|
|
86
85
|
method: "tryExitOffer";
|
|
87
86
|
offerId: OfferId;
|
|
88
87
|
};
|
|
89
|
-
export type
|
|
88
|
+
export type InvokeStoreEntryAction = {
|
|
89
|
+
/**
|
|
90
|
+
* BridgeAction discriminator
|
|
91
|
+
*/
|
|
92
|
+
method: "invokeEntry";
|
|
93
|
+
/**
|
|
94
|
+
* object method call to make
|
|
95
|
+
*/
|
|
96
|
+
message: InvokeEntryMessage;
|
|
97
|
+
};
|
|
98
|
+
export type BridgeAction = ExecuteOfferAction | TryExitOfferAction | InvokeStoreEntryAction;
|
|
90
99
|
/**
|
|
91
100
|
* Purses is an array to support a future requirement of multiple purses per
|
|
92
101
|
* brand.
|
|
@@ -145,6 +154,14 @@ export type UpdateRecord = {
|
|
|
145
154
|
status: {
|
|
146
155
|
error: string;
|
|
147
156
|
};
|
|
157
|
+
} | {
|
|
158
|
+
updated: "invocation";
|
|
159
|
+
id: string | number;
|
|
160
|
+
error?: string;
|
|
161
|
+
result?: {
|
|
162
|
+
name?: string;
|
|
163
|
+
passStyle: string;
|
|
164
|
+
};
|
|
148
165
|
};
|
|
149
166
|
/**
|
|
150
167
|
* For use by clients to describe brands to users. Includes `displayInfo` to
|
|
@@ -194,12 +211,24 @@ export type ImmutableState = Readonly<UniqueParams & {
|
|
|
194
211
|
liveOffers: MapStore<OfferId, OfferStatus>;
|
|
195
212
|
liveOfferSeats: MapStore<OfferId, UserSeat<unknown>>;
|
|
196
213
|
liveOfferPayments: MapStore<OfferId, MapStore<Brand, Payment>>;
|
|
214
|
+
myStore: MapStore;
|
|
197
215
|
}>;
|
|
198
216
|
export type PurseRecord = BrandDescriptor & {
|
|
199
217
|
purse: Purse;
|
|
200
218
|
};
|
|
201
219
|
export type MutableState = {};
|
|
202
|
-
export type SmartWallet =
|
|
220
|
+
export type SmartWallet = EReturn<EReturn<typeof prepareSmartWallet>>;
|
|
221
|
+
import type { Payment } from '@agoric/ertp';
|
|
222
|
+
import type { Amount } from '@agoric/ertp';
|
|
223
|
+
import type { InvokeEntryMessage } from './offers.js';
|
|
224
|
+
import type { OfferSpec } from './offers.js';
|
|
203
225
|
import type { OfferId } from './offers.js';
|
|
226
|
+
import type { Brand } from '@agoric/ertp';
|
|
204
227
|
import type { OfferStatus } from './offers.js';
|
|
228
|
+
import type { Issuer } from '@agoric/ertp';
|
|
229
|
+
import type { InvitationDetails } from '@agoric/zoe';
|
|
230
|
+
import type { Purse } from '@agoric/ertp';
|
|
231
|
+
import type { MapStore } from '@agoric/store';
|
|
232
|
+
import type { UserSeat } from '@agoric/zoe';
|
|
233
|
+
import type { EReturn } from '@endo/far';
|
|
205
234
|
//# 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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fail, q } from '@endo/errors';
|
|
2
|
-
import { E } from '@endo/far';
|
|
2
|
+
import { E, passStyleOf } from '@endo/far';
|
|
3
3
|
import {
|
|
4
4
|
AmountShape,
|
|
5
5
|
BrandShape,
|
|
@@ -45,7 +45,14 @@ import { shape } from './typeGuards.js';
|
|
|
45
45
|
import { objectMapStoragePath } from './utils.js';
|
|
46
46
|
import { prepareOfferWatcher, makeWatchOfferOutcomes } from './offerWatcher.js';
|
|
47
47
|
|
|
48
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* @import {Amount, Brand, Issuer, Payment, Purse} from '@agoric/ertp';
|
|
50
|
+
* @import {WeakMapStore, MapStore} from '@agoric/store'
|
|
51
|
+
* @import {InvitationDetails, PaymentPKeywordRecord, Proposal, UserSeat} from '@agoric/zoe';
|
|
52
|
+
* @import {CopyRecord} from '@endo/pass-style';
|
|
53
|
+
* @import {EReturn} from '@endo/far';
|
|
54
|
+
* @import {OfferId, OfferStatus, OfferSpec, InvokeEntryMessage, ResultPlan} from './offers.js';
|
|
55
|
+
*/
|
|
49
56
|
|
|
50
57
|
const trace = makeTracer('SmrtWlt');
|
|
51
58
|
|
|
@@ -54,17 +61,6 @@ const trace = makeTracer('SmrtWlt');
|
|
|
54
61
|
* @see {@link ../README.md} }
|
|
55
62
|
*/
|
|
56
63
|
|
|
57
|
-
/** @typedef {number | string} OfferId */
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* @typedef {{
|
|
61
|
-
* id: OfferId;
|
|
62
|
-
* invitationSpec: import('./invitations').InvitationSpec;
|
|
63
|
-
* proposal: Proposal;
|
|
64
|
-
* offerArgs?: any;
|
|
65
|
-
* }} OfferSpec
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
64
|
/**
|
|
69
65
|
* @typedef {{
|
|
70
66
|
* logger: {
|
|
@@ -90,10 +86,16 @@ const trace = makeTracer('SmrtWlt');
|
|
|
90
86
|
* }} TryExitOfferAction
|
|
91
87
|
*/
|
|
92
88
|
|
|
89
|
+
/**
|
|
90
|
+
* @typedef {object} InvokeStoreEntryAction
|
|
91
|
+
* @property {'invokeEntry'} method BridgeAction discriminator
|
|
92
|
+
* @property {InvokeEntryMessage} message object method call to make
|
|
93
|
+
*/
|
|
94
|
+
|
|
93
95
|
// Discriminated union. Possible future messages types:
|
|
94
96
|
// maybe suggestIssuer for https://github.com/Agoric/agoric-sdk/issues/6132
|
|
95
97
|
// setting petnames and adding brands for https://github.com/Agoric/agoric-sdk/issues/6126
|
|
96
|
-
/** @typedef {ExecuteOfferAction | TryExitOfferAction} BridgeAction */
|
|
98
|
+
/** @typedef {ExecuteOfferAction | TryExitOfferAction | InvokeStoreEntryAction} BridgeAction */
|
|
97
99
|
|
|
98
100
|
/**
|
|
99
101
|
* Purses is an array to support a future requirement of multiple purses per
|
|
@@ -132,7 +134,13 @@ const trace = makeTracer('SmrtWlt');
|
|
|
132
134
|
/**
|
|
133
135
|
* @typedef {{ updated: 'offerStatus'; status: OfferStatus }
|
|
134
136
|
* | { updated: 'balance'; currentAmount: Amount }
|
|
135
|
-
* | { updated: 'walletAction'; status: { error: string } }
|
|
137
|
+
* | { updated: 'walletAction'; status: { error: string } }
|
|
138
|
+
* | {
|
|
139
|
+
* updated: 'invocation';
|
|
140
|
+
* id: string | number;
|
|
141
|
+
* error?: string;
|
|
142
|
+
* result?: { name?: string; passStyle: string };
|
|
143
|
+
* }} UpdateRecord
|
|
136
144
|
* Record of an update to the state of this wallet.
|
|
137
145
|
*
|
|
138
146
|
* Client is responsible for coalescing updates into a current state. See
|
|
@@ -205,6 +213,7 @@ const trace = makeTracer('SmrtWlt');
|
|
|
205
213
|
* liveOffers: MapStore<OfferId, OfferStatus>;
|
|
206
214
|
* liveOfferSeats: MapStore<OfferId, UserSeat<unknown>>;
|
|
207
215
|
* liveOfferPayments: MapStore<OfferId, MapStore<Brand, Payment>>;
|
|
216
|
+
* myStore: MapStore;
|
|
208
217
|
* }
|
|
209
218
|
* >} ImmutableState
|
|
210
219
|
*
|
|
@@ -394,6 +403,9 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
394
403
|
durable: true,
|
|
395
404
|
},
|
|
396
405
|
),
|
|
406
|
+
// NB: Wallets before this state property was added do not support
|
|
407
|
+
// saving results or invoking the saved items.
|
|
408
|
+
myStore: zone.detached().mapStore('my items'),
|
|
397
409
|
};
|
|
398
410
|
|
|
399
411
|
/** @type {import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<UpdateRecord>} */
|
|
@@ -426,6 +438,11 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
426
438
|
};
|
|
427
439
|
};
|
|
428
440
|
|
|
441
|
+
const invocationResultShape = M.splitRecord(
|
|
442
|
+
{},
|
|
443
|
+
{ id: M.or(M.string(), M.number()), saveResult: shape.ResultPlan },
|
|
444
|
+
);
|
|
445
|
+
|
|
429
446
|
const behaviorGuards = {
|
|
430
447
|
helper: M.interface('helperFacetI', {
|
|
431
448
|
assertUniqueOfferId: M.call(M.string()).returns(),
|
|
@@ -447,6 +464,8 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
447
464
|
logWalletInfo: M.call().rest(M.arrayOf(M.any())).returns(),
|
|
448
465
|
logWalletError: M.call().rest(M.arrayOf(M.any())).returns(),
|
|
449
466
|
getLiveOfferPayments: M.call().returns(M.remotable('mapStore')),
|
|
467
|
+
saveEntry: M.call(shape.ResultPlan, M.any()).returns(M.string()),
|
|
468
|
+
findUnusedName: M.call(M.string()).returns(M.string()),
|
|
450
469
|
}),
|
|
451
470
|
|
|
452
471
|
deposit: M.interface('depositFacetI', {
|
|
@@ -465,11 +484,19 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
465
484
|
executeOffer: M.call(shape.OfferSpec).returns(M.promise()),
|
|
466
485
|
tryExitOffer: M.call(M.scalar()).returns(M.promise()),
|
|
467
486
|
}),
|
|
487
|
+
invoke: M.interface('invoke', {
|
|
488
|
+
invokeEntry: M.callWhen(shape.InvokeEntryMessage).returns(),
|
|
489
|
+
}),
|
|
490
|
+
resultStepWatcher: M.interface('resultStepWatcher', {
|
|
491
|
+
onFulfilled: M.call(M.any(), invocationResultShape).returns(),
|
|
492
|
+
onRejected: M.call(M.any(), invocationResultShape).returns(),
|
|
493
|
+
}),
|
|
468
494
|
self: M.interface('selfFacetI', {
|
|
469
495
|
handleBridgeAction: M.call(shape.StringCapData, M.boolean()).returns(
|
|
470
496
|
M.promise(),
|
|
471
497
|
),
|
|
472
498
|
getDepositFacet: M.call().returns(M.remotable()),
|
|
499
|
+
getInvokeFacet: M.call().returns(M.remotable()),
|
|
473
500
|
getOffersFacet: M.call().returns(M.remotable()),
|
|
474
501
|
getCurrentSubscriber: M.call().returns(SubscriberShape),
|
|
475
502
|
getUpdatesSubscriber: M.call().returns(SubscriberShape),
|
|
@@ -739,6 +766,35 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
739
766
|
}
|
|
740
767
|
return baggage.get(state.address);
|
|
741
768
|
},
|
|
769
|
+
/** @param {string} suggestion */
|
|
770
|
+
findUnusedName(suggestion) {
|
|
771
|
+
const { myStore } = this.state;
|
|
772
|
+
let nonce = 0;
|
|
773
|
+
let name = suggestion;
|
|
774
|
+
while (myStore.has(name)) {
|
|
775
|
+
nonce += myStore.getSize(); // avoid linear work
|
|
776
|
+
name = `${suggestion}.${nonce}`;
|
|
777
|
+
}
|
|
778
|
+
return name;
|
|
779
|
+
},
|
|
780
|
+
/**
|
|
781
|
+
* @param {ResultPlan} plan
|
|
782
|
+
* @param {unknown} value
|
|
783
|
+
*/
|
|
784
|
+
saveEntry(plan, value) {
|
|
785
|
+
const { myStore } = this.state;
|
|
786
|
+
const name = plan.overwrite
|
|
787
|
+
? plan.name
|
|
788
|
+
: this.facets.helper.findUnusedName(plan.name);
|
|
789
|
+
|
|
790
|
+
if (myStore.has(name)) {
|
|
791
|
+
myStore.set(name, value);
|
|
792
|
+
} else {
|
|
793
|
+
myStore.init(name, value);
|
|
794
|
+
}
|
|
795
|
+
trace('set', name, '=', value);
|
|
796
|
+
return name;
|
|
797
|
+
},
|
|
742
798
|
},
|
|
743
799
|
/**
|
|
744
800
|
* Similar to {DepositFacet} but async because it has to look up the
|
|
@@ -1013,6 +1069,78 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
1013
1069
|
await E(seatRef).tryExit();
|
|
1014
1070
|
},
|
|
1015
1071
|
},
|
|
1072
|
+
|
|
1073
|
+
invoke: {
|
|
1074
|
+
/**
|
|
1075
|
+
* @param {InvokeEntryMessage} message
|
|
1076
|
+
*/
|
|
1077
|
+
async invokeEntry(message) {
|
|
1078
|
+
trace('invokeEntry', message);
|
|
1079
|
+
const { myStore } = this.state;
|
|
1080
|
+
const { resultStepWatcher } = this.facets;
|
|
1081
|
+
|
|
1082
|
+
const { targetName: name, method, args, saveResult, id } = message;
|
|
1083
|
+
myStore.has(name) || Fail`cannot invoke ${q(name)}: no such item`;
|
|
1084
|
+
const value = myStore.get(name);
|
|
1085
|
+
trace('entry', name, value);
|
|
1086
|
+
trace('invoke', value, '.', method, '(', args, ')');
|
|
1087
|
+
if (id) {
|
|
1088
|
+
const { updateRecorderKit } = this.state;
|
|
1089
|
+
void updateRecorderKit.recorder.write({
|
|
1090
|
+
updated: 'invocation',
|
|
1091
|
+
id,
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
const callP = E(value)[method](...args);
|
|
1095
|
+
if (id || saveResult) {
|
|
1096
|
+
vowTools.watch(callP, resultStepWatcher, { id, saveResult });
|
|
1097
|
+
} else {
|
|
1098
|
+
void callP;
|
|
1099
|
+
}
|
|
1100
|
+
},
|
|
1101
|
+
},
|
|
1102
|
+
|
|
1103
|
+
resultStepWatcher: {
|
|
1104
|
+
/**
|
|
1105
|
+
* @param {unknown} result
|
|
1106
|
+
* @param {{ id?: string | number; saveResult?: ResultPlan }} opts
|
|
1107
|
+
*/
|
|
1108
|
+
onFulfilled(result, opts) {
|
|
1109
|
+
trace('resultStepWatcher opts', opts);
|
|
1110
|
+
const { id, saveResult } = opts;
|
|
1111
|
+
if (saveResult) {
|
|
1112
|
+
this.facets.helper.saveEntry(saveResult, result);
|
|
1113
|
+
}
|
|
1114
|
+
const passStyle = passStyleOf(result);
|
|
1115
|
+
const { updateRecorderKit } = this.state;
|
|
1116
|
+
if (id) {
|
|
1117
|
+
void updateRecorderKit.recorder.write({
|
|
1118
|
+
updated: 'invocation',
|
|
1119
|
+
id,
|
|
1120
|
+
result: {
|
|
1121
|
+
...(saveResult?.name ? { name: saveResult.name } : {}),
|
|
1122
|
+
passStyle,
|
|
1123
|
+
},
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
},
|
|
1127
|
+
/**
|
|
1128
|
+
* @param {unknown} reason
|
|
1129
|
+
* @param {{ id: string | number; saveResult?: ResultPlan }} opts
|
|
1130
|
+
*/
|
|
1131
|
+
onRejected(reason, opts) {
|
|
1132
|
+
trace('rejected', reason, opts);
|
|
1133
|
+
if (opts.id) {
|
|
1134
|
+
const { updateRecorderKit } = this.state;
|
|
1135
|
+
void updateRecorderKit.recorder.write({
|
|
1136
|
+
updated: 'invocation',
|
|
1137
|
+
id: opts.id,
|
|
1138
|
+
error: String(reason),
|
|
1139
|
+
});
|
|
1140
|
+
}
|
|
1141
|
+
},
|
|
1142
|
+
},
|
|
1143
|
+
|
|
1016
1144
|
self: {
|
|
1017
1145
|
/**
|
|
1018
1146
|
* Umarshals the actionCapData and delegates to the appropriate action
|
|
@@ -1024,8 +1152,8 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
1024
1152
|
* @returns {Promise<void>}
|
|
1025
1153
|
*/
|
|
1026
1154
|
handleBridgeAction(actionCapData, canSpend = false) {
|
|
1027
|
-
const { facets } = this;
|
|
1028
|
-
const { offers } = facets;
|
|
1155
|
+
const { facets, state } = this;
|
|
1156
|
+
const { offers, invoke } = facets;
|
|
1029
1157
|
const { publicMarshaller } = shared;
|
|
1030
1158
|
|
|
1031
1159
|
/** @param {Error} err */
|
|
@@ -1038,6 +1166,8 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
1038
1166
|
});
|
|
1039
1167
|
};
|
|
1040
1168
|
|
|
1169
|
+
const walletHasNameHub = 'myStore' in state && state.myStore != null;
|
|
1170
|
+
|
|
1041
1171
|
// use E.when to retain distributed stack trace
|
|
1042
1172
|
return E.when(
|
|
1043
1173
|
E(publicMarshaller).fromCapData(actionCapData),
|
|
@@ -1047,12 +1177,21 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
1047
1177
|
switch (action.method) {
|
|
1048
1178
|
case 'executeOffer': {
|
|
1049
1179
|
canSpend || Fail`executeOffer requires spend authority`;
|
|
1180
|
+
if (action.offer.saveResult != null && !walletHasNameHub) {
|
|
1181
|
+
Fail`executeOffer saveResult requires a new smart wallet with myStore`;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1050
1184
|
return offers.executeOffer(action.offer);
|
|
1051
1185
|
}
|
|
1052
1186
|
case 'tryExitOffer': {
|
|
1053
1187
|
assert(canSpend, 'tryExitOffer requires spend authority');
|
|
1054
1188
|
return offers.tryExitOffer(action.offerId);
|
|
1055
1189
|
}
|
|
1190
|
+
case 'invokeEntry': {
|
|
1191
|
+
walletHasNameHub ||
|
|
1192
|
+
Fail`invokeEntry requires a new smart wallet with myStore`;
|
|
1193
|
+
return invoke.invokeEntry(action.message);
|
|
1194
|
+
}
|
|
1056
1195
|
default: {
|
|
1057
1196
|
throw Fail`invalid handle bridge action ${q(action)}`;
|
|
1058
1197
|
}
|
|
@@ -1071,6 +1210,9 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
1071
1210
|
getDepositFacet() {
|
|
1072
1211
|
return this.facets.deposit;
|
|
1073
1212
|
},
|
|
1213
|
+
getInvokeFacet() {
|
|
1214
|
+
return this.facets.invoke;
|
|
1215
|
+
},
|
|
1074
1216
|
getOffersFacet() {
|
|
1075
1217
|
return this.facets.offers;
|
|
1076
1218
|
},
|
|
@@ -1138,5 +1280,4 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
1138
1280
|
return makeSmartWallet;
|
|
1139
1281
|
};
|
|
1140
1282
|
harden(prepareSmartWallet);
|
|
1141
|
-
|
|
1142
|
-
/** @typedef {Awaited<ReturnType<ReturnType<typeof prepareSmartWallet>>>} SmartWallet */
|
|
1283
|
+
/** @typedef {EReturn<EReturn<typeof prepareSmartWallet>>} SmartWallet */
|
package/src/typeGuards.js
CHANGED
|
@@ -4,6 +4,28 @@ import {
|
|
|
4
4
|
ProposalShape,
|
|
5
5
|
} from '@agoric/zoe/src/typeGuards.js';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @import {TypedPattern} from '@agoric/internal';
|
|
9
|
+
* @import {InvokeEntryMessage, ResultPlan} from './offers';
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** @type {TypedPattern<ResultPlan>} */
|
|
13
|
+
const ResultPlanShape = M.splitRecord(
|
|
14
|
+
{ name: M.string() },
|
|
15
|
+
{ overwrite: M.boolean() },
|
|
16
|
+
{},
|
|
17
|
+
);
|
|
18
|
+
/** @type {TypedPattern<InvokeEntryMessage>} */
|
|
19
|
+
const InvokeEntryMessageShape = M.splitRecord(
|
|
20
|
+
{
|
|
21
|
+
targetName: M.string(),
|
|
22
|
+
method: M.string(),
|
|
23
|
+
args: M.array(),
|
|
24
|
+
},
|
|
25
|
+
{ saveResult: ResultPlanShape, id: M.or(M.number(), M.string()) },
|
|
26
|
+
{},
|
|
27
|
+
);
|
|
28
|
+
|
|
7
29
|
export const shape = {
|
|
8
30
|
// smartWallet
|
|
9
31
|
StringCapData: {
|
|
@@ -51,8 +73,14 @@ export const shape = {
|
|
|
51
73
|
invitationSpec: M.any(),
|
|
52
74
|
proposal: ProposalShape,
|
|
53
75
|
},
|
|
54
|
-
{
|
|
76
|
+
{
|
|
77
|
+
offerArgs: M.any(),
|
|
78
|
+
saveResult: ResultPlanShape,
|
|
79
|
+
},
|
|
80
|
+
{},
|
|
55
81
|
),
|
|
82
|
+
ResultPlan: ResultPlanShape,
|
|
83
|
+
InvokeEntryMessage: InvokeEntryMessageShape,
|
|
56
84
|
|
|
57
85
|
// walletFactory
|
|
58
86
|
/**
|
package/src/types.d.ts
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* Similar to types.js but in TypeScript syntax because some types here need it.
|
|
5
5
|
* Downside is it can't reference any ambient types, which most of agoric-sdk type are presently.
|
|
6
6
|
*/
|
|
7
|
+
import type { Payment } from '@agoric/ertp';
|
|
7
8
|
import type { AgoricNamesRemotes } from '@agoric/vats/tools/board-utils.js';
|
|
9
|
+
import type { InvitationDetails } from '@agoric/zoe';
|
|
8
10
|
import type { PublicTopic } from '@agoric/zoe/src/contractSupport/topics.js';
|
|
9
|
-
import type { Payment } from '@agoric/ertp';
|
|
10
11
|
import type { OfferSpec } from './offers.js';
|
|
11
|
-
type Invitation = Payment<'set'>;
|
|
12
|
+
type Invitation = Payment<'set', InvitationDetails>;
|
|
12
13
|
/**
|
|
13
14
|
* A petname can either be a plain string or a path for which the first element
|
|
14
15
|
* is a petname for the origin, and the rest of the elements are a snapshot of
|
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C,KAAK,UAAU,GAAG,OAAO,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;AAExC,MAAM,MAAM,gBAAgB,GAAG,MAAM,CACnC,MAAM,EACN,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,UAAU,CAAC,CACxC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;AAErE,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,iBAAiB,EAAE,iBAAiB,CAAC;CACtC;AAED,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI;IACpB,GAAG,EAAE,MAAM,CAAC,CAAC;IACb,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,eAAe,CAAC;IACtB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,oBAAoB,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CACvB,WAAW,EAAE,kBAAkB,EAC/B,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,SAAS,CAAC"}
|
package/src/types.ts
CHANGED
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
* Downside is it can't reference any ambient types, which most of agoric-sdk type are presently.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- fails to notice the @see uses
|
|
8
9
|
import type { agoric } from '@agoric/cosmic-proto/agoric/bundle.js';
|
|
10
|
+
import type { Payment } from '@agoric/ertp';
|
|
9
11
|
import type { AgoricNamesRemotes } from '@agoric/vats/tools/board-utils.js';
|
|
12
|
+
import type { InvitationDetails } from '@agoric/zoe';
|
|
10
13
|
import type { PublicTopic } from '@agoric/zoe/src/contractSupport/topics.js';
|
|
11
|
-
import type { Payment } from '@agoric/ertp';
|
|
12
14
|
import type { OfferSpec } from './offers.js';
|
|
13
15
|
|
|
14
|
-
declare const CapDataShape: unique symbol;
|
|
15
|
-
|
|
16
16
|
// Match the type in Zoe, which can't be imported because it's ambient.
|
|
17
17
|
// This omits the parameters that aren't used in this module.
|
|
18
|
-
type Invitation = Payment<'set'>;
|
|
18
|
+
type Invitation = Payment<'set', InvitationDetails>;
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* A petname can either be a plain string or a path for which the first element
|
package/src/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @import {OfferId, OfferStatus} from './offers.js'; */
|
|
2
2
|
export const NO_SMART_WALLET_ERROR: "no smart wallet";
|
|
3
|
-
export function makeWalletStateCoalescer(invitationBrand?:
|
|
3
|
+
export function makeWalletStateCoalescer(invitationBrand?: Brand<"set">): {
|
|
4
4
|
state: {
|
|
5
5
|
invitationsReceived: Map<OfferId, {
|
|
6
6
|
acceptedIn: OfferId;
|
|
@@ -12,7 +12,7 @@ export function makeWalletStateCoalescer(invitationBrand?: globalThis.Brand<"set
|
|
|
12
12
|
};
|
|
13
13
|
update: (updateRecord: import("./smartWallet.js").UpdateRecord | {}) => void;
|
|
14
14
|
};
|
|
15
|
-
export function coalesceUpdates(updates: ERef<Subscriber<import("./smartWallet.js").UpdateRecord>>, invitationBrand?:
|
|
15
|
+
export function coalesceUpdates(updates: ERef<Subscriber<import("./smartWallet.js").UpdateRecord>>, invitationBrand?: Brand<"set">): {
|
|
16
16
|
invitationsReceived: Map<OfferId, {
|
|
17
17
|
acceptedIn: OfferId;
|
|
18
18
|
description: string;
|
|
@@ -22,7 +22,7 @@ export function coalesceUpdates(updates: ERef<Subscriber<import("./smartWallet.j
|
|
|
22
22
|
balances: Map<globalThis.Brand, globalThis.Amount>;
|
|
23
23
|
};
|
|
24
24
|
export function assertHasData(follower: import("@agoric/casting").Follower<any>): Promise<void>;
|
|
25
|
-
export function objectMapStoragePath(subscribers?: import("
|
|
25
|
+
export function objectMapStoragePath(subscribers?: import("./types.js").PublicSubscribers | import("@agoric/zoe/src/contractSupport/index.js").TopicsRecord): ERef<Record<string, string>> | null;
|
|
26
26
|
export type CoalescedWalletState = ReturnType<typeof makeWalletStateCoalescer>["state"];
|
|
27
27
|
import type { OfferId } from './offers.js';
|
|
28
28
|
import type { OfferStatus } from './offers.js';
|
package/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"AAIA,yDAAyD;AAEzD,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"AAIA,yDAAyD;AAEzD,oCAAqC,iBAAiB,CAAC;AAKhD,2DADK,KAAK,CAAC,KAAK,CAAC;;;wBAaH,OAAO;yBACN,MAAM;sBACT,QAAQ;;;;;2BAOd,OAAO,kBAAkB,EAAE,YAAY,GAAG,EAAE;EAgExD;AAaM,yCAHI,IAAI,CAAC,UAAU,CAAC,OAAO,kBAAkB,EAAE,YAAY,CAAC,CAAC,oBACzD,KAAK,CAAC,KAAK,CAAC;;oBApFF,OAAO;qBACN,MAAM;kBACT,QAAQ;;;;EA6F1B;AAMM,wCAHI,OAAO,iBAAiB,EAAE,QAAQ,CAAC,GAAG,CAAC,iBAYjD;AASM,mDAJI,OAAO,YAAY,EAAE,iBAAiB,GAC1C,OAAO,0CAA0C,EAAE,YAAY,GACzD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAY/C;mCAvDa,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,OAAO,CAAC;6BA7F1B,aAAa;iCAAb,aAAa"}
|
package/src/walletFactory.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export namespace customTermsShape {
|
|
2
|
-
let agoricNames:
|
|
3
|
-
let board:
|
|
4
|
-
let assetPublisher:
|
|
2
|
+
let agoricNames: Pattern;
|
|
3
|
+
let board: Pattern;
|
|
4
|
+
let assetPublisher: Pattern;
|
|
5
5
|
}
|
|
6
6
|
export const privateArgsShape: import("@endo/patterns").Matcher;
|
|
7
7
|
export function publishDepositFacet(address: string, wallet: import("./smartWallet.js").SmartWallet, namesByAddressAdmin: ERef<import("@agoric/vats").NameAdmin>): Promise<unknown>;
|
|
@@ -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":";;;;;AAgCA,gEAKE;AAYK,6CAJI,MAAM,UACN,OAAO,kBAAkB,EAAE,WAAW,uBACtC,IAAI,CAAC,OAAO,cAAc,EAAE,SAAS,CAAC,oBAehD;AAWM,kDAFI,cAAc;IAyCrB,2BAA2B;iBAAf,KAAK;IAEjB,2BAA2B;iBAAf,KAAK;eArCP,KAAK;qBACC,WAAW;gBAChB,MAAM;iBACL,OAAO,YAAY,EAAE,OAAO;;;eAH9B,KAAK;qBACC,WAAW;gBAChB,MAAM;iBACL,OAAO,YAAY,EAAE,OAAO;;EAuC3C;AAyCM,6BAVI,GAAG,CAAC,wBAAwB,CAAC,eAC7B;IACN,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC/B,mBAAmB,CAAC,EAAE,IAAI,CAC9B,OAAa,cAAc,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CACrD,CAAC;IACF,aAAa,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;CACrC,WACO,OAAO,kBAAkB,EAAE,OAAO;;QAiHvC;;;;;;;;;WASG;oCARQ,MAAM,QACN,IAAI,CAAC,OAAO,8BAA8B,EAAE,IAAI,CAAC,uBACjD,IAAI,CAAC,OAAO,2BAA2B,EAAE,SAAS,CAAC,GACjD,OAAO,CACnB,CAAK,MAAM,EAAE,OAAO,kBAAkB,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,CACjE;;GAuDT;uCAlNY;IACR,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3B,KAAK,EAAE,IAAI,CAAC,OAAO,cAAc,EAAE,KAAK,CAAC,CAAC;IAC1C,cAAc,EAAE,cAAc,CAAC;CAChC;6BAGS;IACR,oBAAoB,EAAE,MAAM,IAAI,CAC9B,iBAAiB,CAAC,OAAO,8BAA8B,EAAE,eAAe,CAAC,CAC1E,CAAC;CACH;uBAGS,OAAO;4BAEP;IACR,YAAY,EAAE,CACZ,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC,OAAO,kBAAkB,EAAE,WAAW,CAAC,CAAC;IACrD,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,QAAQ,CAAC;CAC1C;oBAkMU,OAAO,OAAO;6BA5TF,cAAc"}
|
package/src/walletFactory.js
CHANGED
|
@@ -17,7 +17,10 @@ import { E } from '@endo/far';
|
|
|
17
17
|
import { prepareSmartWallet } from './smartWallet.js';
|
|
18
18
|
import { shape } from './typeGuards.js';
|
|
19
19
|
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* @import {MapStore} from '@agoric/swingset-liveslots';
|
|
22
|
+
* @import {NameHub} from '@agoric/vats';
|
|
23
|
+
*/
|
|
21
24
|
|
|
22
25
|
const trace = makeTracer('WltFct');
|
|
23
26
|
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export function upgradeWalletFactory({ consume: { walletFactoryStartResult, provisionPoolStartResult, chainStorage, walletBridgeManager: walletBridgeManagerP, }, }: BootstrapPowers & ChainBootstrapSpace, options: {
|
|
2
|
-
options: {
|
|
3
|
-
walletRef: VatSourceRef;
|
|
4
|
-
};
|
|
5
|
-
}): Promise<void>;
|
|
6
|
-
export function getManifestForUpgradeWallet(_powers: any, { walletRef }: {
|
|
7
|
-
walletRef: any;
|
|
8
|
-
}): {
|
|
9
|
-
manifest: {
|
|
10
|
-
[x: string]: {
|
|
11
|
-
consume: {
|
|
12
|
-
walletFactoryStartResult: string;
|
|
13
|
-
provisionPoolStartResult: string;
|
|
14
|
-
chainStorage: string;
|
|
15
|
-
walletBridgeManager: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
options: {
|
|
20
|
-
walletRef: any;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=upgrade-wallet-factory2-proposal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade-wallet-factory2-proposal.d.ts","sourceRoot":"","sources":["upgrade-wallet-factory2-proposal.js"],"names":[],"mappings":"AAWO,qKAJI,eAAe,GAAG,mBAAmB,WAE7C;IAA6C,OAAO,EAA5C;QAAE,SAAS,EAAE,YAAY,CAAA;KAAE;CACrC,iBAmCA;AAEM;;;;;;;;;;;;;;;;EAYL"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export function upgradeWalletFactory({ consume: { contractKits, governedContractKits, chainStorage, walletBridgeManager: walletBridgeManagerP, }, instance: { consume: { walletFactory: wfInstanceP, provisionPool: ppInstanceP }, }, }: BootstrapPowers, config: {
|
|
2
|
-
options: {
|
|
3
|
-
walletFactoryRef: VatSourceRef & {
|
|
4
|
-
bundleID: string;
|
|
5
|
-
};
|
|
6
|
-
};
|
|
7
|
-
}): Promise<void>;
|
|
8
|
-
export function publishAgoricBrandsDisplayInfo({ consume: { agoricNames, board, chainStorage }, }: BootstrapPowers): Promise<void>;
|
|
9
|
-
export function getManifestForUpgrade(_powers: any, { walletFactoryRef }: {
|
|
10
|
-
walletFactoryRef: any;
|
|
11
|
-
}): {
|
|
12
|
-
manifest: import("@agoric/vats/src/core/lib-boot").BootstrapManifest;
|
|
13
|
-
options: {
|
|
14
|
-
walletFactoryRef: any;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=upgrade-walletFactory-proposal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade-walletFactory-proposal.d.ts","sourceRoot":"","sources":["upgrade-walletFactory-proposal.js"],"names":[],"mappings":"AAmBO,yOAJI,eAAe,UAEvB;IAA0E,OAAO,EAAzE;QAAE,gBAAgB,EAAE,YAAY,GAAG;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE;CACnE,iBAiDA;AAMM,mGAFI,eAAe,iBAwBzB;AAyBM;;;;;;;EAKN"}
|