@agoric/smart-wallet 0.5.4-other-dev-3eb1a1d.0 → 0.5.4-other-dev-d15096d.0.d15096d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +35 -30
- package/src/index.js +4 -0
- package/src/invitations.d.ts +6 -2
- package/src/invitations.d.ts.map +1 -1
- package/src/invitations.js +10 -3
- package/src/marshal-contexts.d.ts +2 -1
- package/src/marshal-contexts.d.ts.map +1 -1
- package/src/marshal-contexts.js +1 -0
- package/src/offerWatcher.d.ts +8 -4
- package/src/offerWatcher.d.ts.map +1 -1
- package/src/offerWatcher.js +23 -9
- package/src/offers.d.ts +59 -3
- package/src/offers.d.ts.map +1 -1
- package/src/offers.js +33 -2
- package/src/proposals/upgrade-wallet-factory2-proposal.js +3 -2
- package/src/proposals/upgrade-walletFactory-proposal.js +7 -2
- package/src/smartWallet.d.ts +63 -24
- package/src/smartWallet.d.ts.map +1 -1
- package/src/smartWallet.js +229 -51
- package/src/typeGuards.js +29 -1
- package/src/types.d.ts +3 -2
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +4 -4
- package/src/utils.d.ts +18 -8
- package/src/utils.d.ts.map +1 -1
- package/src/utils.js +12 -8
- package/src/walletFactory.d.ts +28 -20
- package/src/walletFactory.d.ts.map +1 -1
- package/src/walletFactory.js +37 -31
- package/src/proposals/upgrade-wallet-factory2-proposal.d.ts +0 -23
- package/src/proposals/upgrade-wallet-factory2-proposal.d.ts.map +0 -1
- package/src/proposals/upgrade-walletFactory-proposal.d.ts +0 -17
- package/src/proposals/upgrade-walletFactory-proposal.d.ts.map +0 -1
package/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-d15096d.0.d15096d",
|
|
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-d15096d.0.d15096d",
|
|
22
|
+
"@agoric/cosmic-proto": "0.4.1-other-dev-d15096d.0.d15096d",
|
|
23
|
+
"@agoric/swingset-vat": "0.32.3-other-dev-d15096d.0.d15096d",
|
|
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-d15096d.0.d15096d",
|
|
32
|
+
"@agoric/internal": "0.3.3-other-dev-d15096d.0.d15096d",
|
|
33
|
+
"@agoric/notifier": "0.6.3-other-dev-d15096d.0.d15096d",
|
|
34
|
+
"@agoric/store": "0.9.3-other-dev-d15096d.0.d15096d",
|
|
35
|
+
"@agoric/vat-data": "0.5.3-other-dev-d15096d.0.d15096d",
|
|
36
|
+
"@agoric/vats": "0.15.2-other-dev-d15096d.0.d15096d",
|
|
37
|
+
"@agoric/vow": "0.1.1-other-dev-d15096d.0.d15096d",
|
|
38
|
+
"@agoric/zoe": "0.26.3-other-dev-d15096d.0.d15096d",
|
|
39
|
+
"@agoric/zone": "0.2.3-other-dev-d15096d.0.d15096d",
|
|
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":
|
|
75
|
+
"atLeast": 93.68
|
|
74
76
|
},
|
|
75
|
-
"
|
|
77
|
+
"engines": {
|
|
78
|
+
"node": "^20.9 || ^22.11"
|
|
79
|
+
},
|
|
80
|
+
"gitHead": "d15096dc4ff8b96e9b6cd11954c20d3a9efbb393"
|
|
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<
|
|
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
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
|
|
@@ -64,10 +71,10 @@ const MAX_PIPE_LENGTH = 2;
|
|
|
64
71
|
|
|
65
72
|
/**
|
|
66
73
|
* @param {ERef<ZoeService>} zoe
|
|
67
|
-
* @param {ERef<
|
|
74
|
+
* @param {ERef<NameHub>} agoricNames
|
|
68
75
|
* @param {Brand<'set'>} invitationBrand
|
|
69
76
|
* @param {Purse<'set', InvitationDetails>} invitationsPurse
|
|
70
|
-
* @param {(fromOfferId: string) =>
|
|
77
|
+
* @param {(fromOfferId: string) => InvitationMakers} getInvitationContinuation
|
|
71
78
|
*/
|
|
72
79
|
export const makeInvitationsHelper = (
|
|
73
80
|
zoe,
|
|
@@ -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
|
|
@@ -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
|
/**
|
|
@@ -44,9 +44,13 @@ 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';
|
|
50
|
+
import type { InvitationMakers } from './types.js';
|
|
51
|
+
import type { PublicSubscribers } from './types.js';
|
|
49
52
|
import type { Passable } from '@endo/pass-style';
|
|
50
53
|
import type { ContinuingOfferResult } from './types.js';
|
|
51
54
|
import type { PromiseWatcher } from '@agoric/swingset-liveslots';
|
|
55
|
+
import type { PaymentPKeywordRecord } from '@agoric/zoe';
|
|
52
56
|
//# 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":"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
|
@@ -19,6 +19,10 @@ 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';
|
|
23
|
+
* @import {InvitationMakers} from './types.js';
|
|
24
|
+
* @import {PublicSubscribers} from './types.js';
|
|
25
|
+
* @import {UpgradeDisconnection} from '@agoric/internal/src/upgrade-api.js';
|
|
22
26
|
*/
|
|
23
27
|
|
|
24
28
|
/**
|
|
@@ -164,8 +168,8 @@ export const prepareOfferWatcher = (baggage, vowTools) => {
|
|
|
164
168
|
/**
|
|
165
169
|
* @param {string} offerId
|
|
166
170
|
* @param {Amount<'set'>} invitationAmount
|
|
167
|
-
* @param {
|
|
168
|
-
* @param {
|
|
171
|
+
* @param {InvitationMakers} invitationMakers
|
|
172
|
+
* @param {PublicSubscribers} publicSubscribers
|
|
169
173
|
*/
|
|
170
174
|
onNewContinuingOffer(
|
|
171
175
|
offerId,
|
|
@@ -255,8 +259,7 @@ export const prepareOfferWatcher = (baggage, vowTools) => {
|
|
|
255
259
|
* If promise disconnected, watch again. Or if there's an Error, handle
|
|
256
260
|
* it.
|
|
257
261
|
*
|
|
258
|
-
* @param {Error
|
|
259
|
-
* | import('@agoric/internal/src/upgrade-api.js').UpgradeDisconnection} reason
|
|
262
|
+
* @param {Error | UpgradeDisconnection} reason
|
|
260
263
|
* @param {UserSeat} seat
|
|
261
264
|
*/
|
|
262
265
|
onRejected(reason, seat) {
|
|
@@ -273,14 +276,26 @@ export const prepareOfferWatcher = (baggage, vowTools) => {
|
|
|
273
276
|
resultWatcher: {
|
|
274
277
|
onFulfilled(result) {
|
|
275
278
|
const { facets } = this;
|
|
276
|
-
|
|
279
|
+
const { walletHelper } = this.state;
|
|
280
|
+
const { saveResult } = this.state.status;
|
|
281
|
+
if (saveResult) {
|
|
282
|
+
// Note: result is passable and storable since it was received from another vat
|
|
283
|
+
const name = walletHelper.saveEntry(saveResult, result);
|
|
284
|
+
facets.helper.updateStatus({
|
|
285
|
+
result: {
|
|
286
|
+
name,
|
|
287
|
+
passStyle: passStyleOf(result),
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
} else {
|
|
291
|
+
facets.helper.publishResult(result);
|
|
292
|
+
}
|
|
277
293
|
},
|
|
278
294
|
/**
|
|
279
295
|
* If promise disconnected, watch again. Or if there's an Error, handle
|
|
280
296
|
* it.
|
|
281
297
|
*
|
|
282
|
-
* @param {Error
|
|
283
|
-
* | import('@agoric/internal/src/upgrade-api.js').UpgradeDisconnection} reason
|
|
298
|
+
* @param {Error | UpgradeDisconnection} reason
|
|
284
299
|
* @param {UserSeat} seat
|
|
285
300
|
*/
|
|
286
301
|
onRejected(reason, seat) {
|
|
@@ -309,8 +324,7 @@ export const prepareOfferWatcher = (baggage, vowTools) => {
|
|
|
309
324
|
* and getPayouts() settle the same (they await the same promise and
|
|
310
325
|
* then synchronously return a local value).
|
|
311
326
|
*
|
|
312
|
-
* @param {Error
|
|
313
|
-
* | import('@agoric/internal/src/upgrade-api.js').UpgradeDisconnection} reason
|
|
327
|
+
* @param {Error | UpgradeDisconnection} reason
|
|
314
328
|
* @param {UserSeat} seat
|
|
315
329
|
*/
|
|
316
330
|
onRejected(reason, seat) {
|
package/src/offers.d.ts
CHANGED
|
@@ -1,27 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {Proposal} from '@agoric/zoe';
|
|
3
|
+
* @import {Passable} from '@endo/pass-style';
|
|
4
|
+
* @import {InvitationSpec} from './invitations.js';
|
|
5
|
+
*/
|
|
1
6
|
/**
|
|
2
7
|
* @typedef {number | string} OfferId
|
|
3
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {object} ResultPlan
|
|
11
|
+
* @property {string} name by which to save the item
|
|
12
|
+
* @property {boolean} [overwrite=false] whether to overwrite an existing item.
|
|
13
|
+
* If false and there is a conflict, the contract will autogen a similar
|
|
14
|
+
* name.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {{
|
|
18
|
+
* targetName: string;
|
|
19
|
+
* method: string;
|
|
20
|
+
* args: Passable[];
|
|
21
|
+
* saveResult?: ResultPlan;
|
|
22
|
+
* id?: number | string;
|
|
23
|
+
* }} InvokeEntryMessage
|
|
24
|
+
*/
|
|
4
25
|
/**
|
|
5
26
|
* @typedef {{
|
|
6
27
|
* id: OfferId;
|
|
7
|
-
* invitationSpec:
|
|
28
|
+
* invitationSpec: InvitationSpec;
|
|
8
29
|
* proposal: Proposal;
|
|
9
30
|
* offerArgs?: any;
|
|
31
|
+
* saveResult?: ResultPlan;
|
|
10
32
|
* }} OfferSpec
|
|
33
|
+
* If `saveResult` is provided, the result of the invocation will be saved to
|
|
34
|
+
* the specified location. Otherwise it will be published directly to vstorage
|
|
35
|
+
* (or 'UNPUBLISHED' if it cannot be).
|
|
11
36
|
*/
|
|
12
37
|
/** Value for "result" field when the result can't be published */
|
|
13
38
|
export const UNPUBLISHED_RESULT: "UNPUBLISHED";
|
|
14
39
|
export type OfferId = number | string;
|
|
40
|
+
export type ResultPlan = {
|
|
41
|
+
/**
|
|
42
|
+
* by which to save the item
|
|
43
|
+
*/
|
|
44
|
+
name: string;
|
|
45
|
+
/**
|
|
46
|
+
* whether to overwrite an existing item.
|
|
47
|
+
* If false and there is a conflict, the contract will autogen a similar
|
|
48
|
+
* name.
|
|
49
|
+
*/
|
|
50
|
+
overwrite?: boolean | undefined;
|
|
51
|
+
};
|
|
52
|
+
export type InvokeEntryMessage = {
|
|
53
|
+
targetName: string;
|
|
54
|
+
method: string;
|
|
55
|
+
args: Passable[];
|
|
56
|
+
saveResult?: ResultPlan;
|
|
57
|
+
id?: number | string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* If `saveResult` is provided, the result of the invocation will be saved to
|
|
61
|
+
* the specified location. Otherwise it will be published directly to vstorage
|
|
62
|
+
* (or 'UNPUBLISHED' if it cannot be).
|
|
63
|
+
*/
|
|
15
64
|
export type OfferSpec = {
|
|
16
65
|
id: OfferId;
|
|
17
|
-
invitationSpec:
|
|
66
|
+
invitationSpec: InvitationSpec;
|
|
18
67
|
proposal: Proposal;
|
|
19
68
|
offerArgs?: any;
|
|
69
|
+
saveResult?: ResultPlan;
|
|
20
70
|
};
|
|
21
71
|
export type OfferStatus = OfferSpec & {
|
|
22
72
|
error?: string;
|
|
23
73
|
numWantsSatisfied?: number;
|
|
24
|
-
result?: unknown | typeof UNPUBLISHED_RESULT
|
|
74
|
+
result?: unknown | typeof UNPUBLISHED_RESULT | {
|
|
75
|
+
name: string;
|
|
76
|
+
passStyle: string;
|
|
77
|
+
};
|
|
25
78
|
payouts?: AmountKeywordRecord;
|
|
26
79
|
};
|
|
80
|
+
import type { Passable } from '@endo/pass-style';
|
|
81
|
+
import type { InvitationSpec } from './invitations.js';
|
|
82
|
+
import type { Proposal } from '@agoric/zoe';
|
|
27
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;;GAEG;AAEH
|
|
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,14 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {Proposal} from '@agoric/zoe';
|
|
3
|
+
* @import {Passable} from '@endo/pass-style';
|
|
4
|
+
* @import {InvitationSpec} from './invitations.js';
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
/**
|
|
2
8
|
* @typedef {number | string} OfferId
|
|
3
9
|
*/
|
|
4
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {object} ResultPlan
|
|
13
|
+
* @property {string} name by which to save the item
|
|
14
|
+
* @property {boolean} [overwrite=false] whether to overwrite an existing item.
|
|
15
|
+
* If false and there is a conflict, the contract will autogen a similar
|
|
16
|
+
* name.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @typedef {{
|
|
21
|
+
* targetName: string;
|
|
22
|
+
* method: string;
|
|
23
|
+
* args: Passable[];
|
|
24
|
+
* saveResult?: ResultPlan;
|
|
25
|
+
* id?: number | string;
|
|
26
|
+
* }} InvokeEntryMessage
|
|
27
|
+
*/
|
|
28
|
+
|
|
5
29
|
/**
|
|
6
30
|
* @typedef {{
|
|
7
31
|
* id: OfferId;
|
|
8
|
-
* invitationSpec:
|
|
32
|
+
* invitationSpec: InvitationSpec;
|
|
9
33
|
* proposal: Proposal;
|
|
10
34
|
* offerArgs?: any;
|
|
35
|
+
* saveResult?: ResultPlan;
|
|
11
36
|
* }} OfferSpec
|
|
37
|
+
* If `saveResult` is provided, the result of the invocation will be saved to
|
|
38
|
+
* the specified location. Otherwise it will be published directly to vstorage
|
|
39
|
+
* (or 'UNPUBLISHED' if it cannot be).
|
|
12
40
|
*/
|
|
13
41
|
|
|
14
42
|
/** Value for "result" field when the result can't be published */
|
|
@@ -18,7 +46,10 @@ export const UNPUBLISHED_RESULT = 'UNPUBLISHED';
|
|
|
18
46
|
* @typedef {OfferSpec & {
|
|
19
47
|
* error?: string;
|
|
20
48
|
* numWantsSatisfied?: number;
|
|
21
|
-
* result?:
|
|
49
|
+
* result?:
|
|
50
|
+
* | unknown
|
|
51
|
+
* | typeof UNPUBLISHED_RESULT
|
|
52
|
+
* | { name: string; passStyle: string };
|
|
22
53
|
* payouts?: AmountKeywordRecord;
|
|
23
54
|
* }} OfferStatus
|
|
24
55
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
/// <reference types="@agoric/vats/src/core/types-ambient" />
|
|
2
|
+
/// <reference types="@agoric/vats/src/core/types-ambient.js" />
|
|
3
3
|
|
|
4
4
|
import { E } from '@endo/far';
|
|
5
5
|
import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
|
|
@@ -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
|
});
|
|
@@ -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
|