@agoric/smart-wallet 0.5.4-other-dev-1f26562.0 → 0.5.4-other-dev-3eb1a1d.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/package.json +35 -26
  2. package/src/index.d.ts +2 -0
  3. package/src/index.d.ts.map +1 -0
  4. package/src/index.js +2 -0
  5. package/src/invitations.d.ts +14 -10
  6. package/src/invitations.d.ts.map +1 -1
  7. package/src/invitations.js +35 -32
  8. package/src/marshal-contexts.d.ts +44 -41
  9. package/src/marshal-contexts.d.ts.map +1 -1
  10. package/src/marshal-contexts.js +68 -61
  11. package/src/offerWatcher.d.ts +52 -0
  12. package/src/offerWatcher.d.ts.map +1 -0
  13. package/src/offerWatcher.js +329 -0
  14. package/src/offers.d.ts +7 -31
  15. package/src/offers.d.ts.map +1 -1
  16. package/src/offers.js +9 -183
  17. package/src/proposals/upgrade-wallet-factory2-proposal.d.ts +23 -0
  18. package/src/proposals/upgrade-wallet-factory2-proposal.d.ts.map +1 -0
  19. package/src/proposals/upgrade-wallet-factory2-proposal.js +60 -0
  20. package/src/proposals/upgrade-walletFactory-proposal.d.ts +1 -1
  21. package/src/proposals/upgrade-walletFactory-proposal.d.ts.map +1 -1
  22. package/src/proposals/upgrade-walletFactory-proposal.js +46 -23
  23. package/src/smartWallet.d.ts +101 -66
  24. package/src/smartWallet.d.ts.map +1 -1
  25. package/src/smartWallet.js +576 -216
  26. package/src/typeGuards.d.ts +1 -1
  27. package/src/types-index.d.ts +2 -0
  28. package/src/types-index.js +2 -0
  29. package/src/types.d.ts +35 -41
  30. package/src/types.d.ts.map +1 -0
  31. package/src/types.ts +90 -0
  32. package/src/utils.d.ts +17 -14
  33. package/src/utils.d.ts.map +1 -1
  34. package/src/utils.js +19 -6
  35. package/src/walletFactory.d.ts +24 -78
  36. package/src/walletFactory.d.ts.map +1 -1
  37. package/src/walletFactory.js +61 -37
  38. package/CHANGELOG.md +0 -180
  39. package/src/payments.d.ts +0 -20
  40. package/src/payments.d.ts.map +0 -1
  41. package/src/payments.js +0 -89
package/src/offers.d.ts CHANGED
@@ -3,46 +3,22 @@
3
3
  */
4
4
  /**
5
5
  * @typedef {{
6
- * id: OfferId,
7
- * invitationSpec: import('./invitations').InvitationSpec,
8
- * proposal: Proposal,
9
- * offerArgs?: unknown
6
+ * id: OfferId;
7
+ * invitationSpec: import('./invitations.js').InvitationSpec;
8
+ * proposal: Proposal;
9
+ * offerArgs?: any;
10
10
  * }} OfferSpec
11
11
  */
12
12
  /** Value for "result" field when the result can't be published */
13
13
  export const UNPUBLISHED_RESULT: "UNPUBLISHED";
14
- export function makeOfferExecutor({ zoe, depositFacet, invitationIssuer, powers, onStatusChange, onNewContinuingOffer, }: {
15
- zoe: ERef<ZoeService>;
16
- depositFacet: {
17
- receive: (payment: any) => Promise<Amount>;
18
- };
19
- invitationIssuer: ERef<Issuer<'set'>>;
20
- powers: {
21
- logger: Pick<Console, 'info' | 'error'>;
22
- invitationFromSpec: (spec: import('./invitations').InvitationSpec) => ERef<Invitation>;
23
- purseForBrand: (brand: Brand) => Promise<import('./types').RemotePurse>;
24
- };
25
- onStatusChange: (status: OfferStatus) => void;
26
- onNewContinuingOffer: (offerId: string, invitationAmount: Amount<'set'>, invitationMakers: import('./types').RemoteInvitationMakers, publicSubscribers: import('./types').PublicSubscribers | import('@agoric/zoe/src/contractSupport').TopicsRecord) => Promise<void>;
27
- }): {
28
- /**
29
- * Take an offer description provided in capData, augment it with payments and call zoe.offer()
30
- *
31
- * @param {OfferSpec} offerSpec
32
- * @param {(seatRef: UserSeat) => void} onSeatCreated
33
- * @returns {Promise<void>} when the offer has been sent to Zoe; payouts go into this wallet's purses
34
- * @throws if any parts of the offer are determined to be invalid before calling Zoe's `offer()`
35
- */
36
- executeOffer(offerSpec: OfferSpec, onSeatCreated: (seatRef: UserSeat) => void): Promise<void>;
37
- };
38
14
  export type OfferId = number | string;
39
15
  export type OfferSpec = {
40
16
  id: OfferId;
41
- invitationSpec: import('./invitations').InvitationSpec;
17
+ invitationSpec: import("./invitations.js").InvitationSpec;
42
18
  proposal: Proposal;
43
- offerArgs?: unknown;
19
+ offerArgs?: any;
44
20
  };
45
- export type OfferStatus = import('./offers.js').OfferSpec & {
21
+ export type OfferStatus = OfferSpec & {
46
22
  error?: string;
47
23
  numWantsSatisfied?: number;
48
24
  result?: unknown | typeof UNPUBLISHED_RESULT;
@@ -1 +1 @@
1
- {"version":3,"file":"offers.d.ts","sourceRoot":"","sources":["offers.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;;;;GAOG;AAEH,kEAAkE;AAClE,+CAAgD;AAwBzC;SAVI,KAAK,UAAU,CAAC;;mCACW,QAAQ,MAAM,CAAC;;sBAC1C,KAAK,OAAO,KAAK,CAAC,CAAC;;gBAEnB,KAAK,OAAO,EAAE,MAAM,GAAE,OAAO,CAAC;mCACvB,OAAO,eAAe,EAAE,cAAc,KAAK,KAAK,UAAU,CAAC;+BAC1D,KAAK,KAAK,QAAQ,OAAO,SAAS,EAAE,WAAW,CAAC;;6BAC/C,WAAW,KAAK,IAAI;oCACnB,MAAM,oBAAoB,OAAO,KAAK,CAAC,oBAAoB,OAAO,SAAS,EAAE,sBAAsB,qBAAqB,OAAO,SAAS,EAAE,iBAAiB,GAAG,OAAO,iCAAiC,EAAE,YAAY,KAAM,QAAQ,IAAI,CAAC;;IAaxP;;;;;;;OAOG;4BAJQ,SAAS,2BACC,QAAQ,KAAK,IAAI,GACzB,QAAQ,IAAI,CAAC;EA0I7B;sBA/LY,MAAM,GAAG,MAAM;wBAIf;IACZ,EAAM,EAAE,OAAO,CAAC;IAChB,cAAkB,EAAE,OAAO,eAAe,EAAE,cAAc,CAAC;IAC3D,QAAY,EAAE,QAAQ,CAAC;IACvB,SAAa,CAAC,EAAE,OAAO,CAAA;CACpB;0BAOS,OAAO,aAAa,EAAE,SAAS,GAAG;IAC9C,KAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,MAAQ,CAAC,EAAE,OAAO,GAAG,yBAAyB,CAAC;IAC/C,OAAS,CAAC,EAAE,mBAAmB,CAAC;CAC7B"}
1
+ {"version":3,"file":"offers.d.ts","sourceRoot":"","sources":["offers.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;GAOG;AAEH,kEAAkE;AAClE,+CAAgD;sBAbnC,MAAM,GAAG,MAAM;wBAIf;IACR,EAAE,EAAE,OAAO,CAAC;IACZ,cAAc,EAAE,OAAO,kBAAkB,EAAE,cAAc,CAAC;IAC1D,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,CAAC,EAAE,GAAG,CAAC;CACjB;0BAOS,SAAS,GAAG;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,kBAAkB,CAAC;IAC7C,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B"}
package/src/offers.js CHANGED
@@ -1,17 +1,13 @@
1
- import { E, passStyleOf } from '@endo/far';
2
- import { deeplyFulfilledObject } from '@agoric/internal';
3
- import { makePaymentsHelper } from './payments.js';
4
-
5
1
  /**
6
2
  * @typedef {number | string} OfferId
7
3
  */
8
4
 
9
5
  /**
10
6
  * @typedef {{
11
- * id: OfferId,
12
- * invitationSpec: import('./invitations').InvitationSpec,
13
- * proposal: Proposal,
14
- * offerArgs?: unknown
7
+ * id: OfferId;
8
+ * invitationSpec: import('./invitations.js').InvitationSpec;
9
+ * proposal: Proposal;
10
+ * offerArgs?: any;
15
11
  * }} OfferSpec
16
12
  */
17
13
 
@@ -19,180 +15,10 @@ import { makePaymentsHelper } from './payments.js';
19
15
  export const UNPUBLISHED_RESULT = 'UNPUBLISHED';
20
16
 
21
17
  /**
22
- * @typedef {import('./offers.js').OfferSpec & {
23
- * error?: string,
24
- * numWantsSatisfied?: number
25
- * result?: unknown | typeof UNPUBLISHED_RESULT,
26
- * payouts?: AmountKeywordRecord,
18
+ * @typedef {OfferSpec & {
19
+ * error?: string;
20
+ * numWantsSatisfied?: number;
21
+ * result?: unknown | typeof UNPUBLISHED_RESULT;
22
+ * payouts?: AmountKeywordRecord;
27
23
  * }} OfferStatus
28
24
  */
29
-
30
- /* eslint-disable jsdoc/check-param-names -- bug(?) with nested objects */
31
- /**
32
- * @param {object} opts
33
- * @param {ERef<ZoeService>} opts.zoe
34
- * @param {{ receive: (payment: *) => Promise<Amount> }} opts.depositFacet
35
- * @param {ERef<Issuer<'set'>>} opts.invitationIssuer
36
- * @param {object} opts.powers
37
- * @param {Pick<Console, 'info'| 'error'>} opts.powers.logger
38
- * @param {(spec: import('./invitations').InvitationSpec) => ERef<Invitation>} opts.powers.invitationFromSpec
39
- * @param {(brand: Brand) => Promise<import('./types').RemotePurse>} opts.powers.purseForBrand
40
- * @param {(status: OfferStatus) => void} opts.onStatusChange
41
- * @param {(offerId: string, invitationAmount: Amount<'set'>, invitationMakers: import('./types').RemoteInvitationMakers, publicSubscribers: import('./types').PublicSubscribers | import('@agoric/zoe/src/contractSupport').TopicsRecord ) => Promise<void>} opts.onNewContinuingOffer
42
- */
43
- export const makeOfferExecutor = ({
44
- zoe,
45
- depositFacet,
46
- invitationIssuer,
47
- powers,
48
- onStatusChange,
49
- onNewContinuingOffer,
50
- }) => {
51
- const { invitationFromSpec, logger, purseForBrand } = powers;
52
-
53
- return {
54
- /**
55
- * Take an offer description provided in capData, augment it with payments and call zoe.offer()
56
- *
57
- * @param {OfferSpec} offerSpec
58
- * @param {(seatRef: UserSeat) => void} onSeatCreated
59
- * @returns {Promise<void>} when the offer has been sent to Zoe; payouts go into this wallet's purses
60
- * @throws if any parts of the offer are determined to be invalid before calling Zoe's `offer()`
61
- */
62
- async executeOffer(offerSpec, onSeatCreated) {
63
- logger.info('starting executeOffer', offerSpec.id);
64
-
65
- const paymentsManager = makePaymentsHelper(purseForBrand, depositFacet);
66
-
67
- /** @type {OfferStatus} */
68
- let status = {
69
- ...offerSpec,
70
- };
71
- /** @param {Partial<OfferStatus>} changes */
72
- const updateStatus = changes => {
73
- status = { ...status, ...changes };
74
- onStatusChange(status);
75
- };
76
-
77
- /** @type {UserSeat} */
78
- let seatRef;
79
-
80
- const tryBody = async () => {
81
- // 1. Prepare values and validate synchronously.
82
- const { id, invitationSpec, proposal, offerArgs } = offerSpec;
83
-
84
- /** @type {PaymentKeywordRecord | undefined} */
85
- const paymentKeywordRecord = await (proposal?.give &&
86
- deeplyFulfilledObject(paymentsManager.withdrawGive(proposal.give)));
87
-
88
- const invitation = invitationFromSpec(invitationSpec);
89
- const invitationAmount = await E(invitationIssuer).getAmountOf(
90
- invitation,
91
- );
92
-
93
- // 2. Begin executing offer
94
- // No explicit signal to user that we reached here but if anything above
95
- // failed they'd get an 'error' status update.
96
-
97
- // eslint-disable-next-line @jessie.js/no-nested-await -- unconditional
98
- seatRef = await E(zoe).offer(
99
- invitation,
100
- proposal,
101
- paymentKeywordRecord,
102
- offerArgs,
103
- );
104
- logger.info(id, 'seated');
105
- onSeatCreated(seatRef);
106
-
107
- const publishResult = E.when(E(seatRef).getOfferResult(), result => {
108
- const passStyle = passStyleOf(result);
109
- logger.info(id, 'offerResult', passStyle, result);
110
- // someday can we get TS to type narrow based on the passStyleOf result match?
111
- switch (passStyle) {
112
- case 'bigint':
113
- case 'boolean':
114
- case 'null':
115
- case 'number':
116
- case 'string':
117
- case 'symbol':
118
- case 'undefined':
119
- updateStatus({ result });
120
- break;
121
- case 'copyRecord':
122
- // @ts-expect-error result narrowed by passStyle
123
- if ('invitationMakers' in result) {
124
- // save for continuing invitation offer
125
- void onNewContinuingOffer(
126
- String(id),
127
- invitationAmount,
128
- // @ts-expect-error result narrowed by passStyle
129
- result.invitationMakers,
130
- // @ts-expect-error result narrowed by passStyle
131
- result.publicSubscribers,
132
- );
133
- }
134
- // copyRecord is valid to publish but not safe as it may have private info
135
- updateStatus({ result: UNPUBLISHED_RESULT });
136
- break;
137
- default:
138
- // drop the result
139
- updateStatus({ result: UNPUBLISHED_RESULT });
140
- }
141
- });
142
-
143
- const publishWantsSatisfied = E.when(
144
- E(seatRef).numWantsSatisfied(),
145
- numSatisfied => {
146
- logger.info(id, 'numSatisfied', numSatisfied);
147
- if (numSatisfied === 0) {
148
- updateStatus({ numWantsSatisfied: 0 });
149
- }
150
- updateStatus({
151
- numWantsSatisfied: numSatisfied,
152
- });
153
- },
154
- );
155
-
156
- // This will block until all payouts succeed, but user will be updated
157
- // as each payout will trigger its corresponding purse notifier.
158
- const publishPayouts = E.when(E(seatRef).getPayouts(), payouts =>
159
- paymentsManager.depositPayouts(payouts).then(amountsOrDeferred => {
160
- updateStatus({ payouts: amountsOrDeferred });
161
- }),
162
- );
163
-
164
- // The offer is complete when these promises are resolved.
165
- // If any reject then executeOffer rejects and that must be handled.
166
- return Promise.all([
167
- publishResult,
168
- publishWantsSatisfied,
169
- publishPayouts,
170
- ]);
171
- };
172
-
173
- await tryBody().catch(err => {
174
- logger.error('OFFER ERROR:', err);
175
- // Notify the user
176
- updateStatus({ error: err.toString() });
177
- // Attempt to recover payments
178
- void paymentsManager.tryReclaimingWithdrawnPayments().then(result => {
179
- if (result) {
180
- updateStatus({ result });
181
- }
182
- });
183
- if (seatRef) {
184
- void E(seatRef)
185
- .hasExited()
186
- .then(hasExited => {
187
- if (!hasExited) {
188
- void E(seatRef).tryExit();
189
- }
190
- });
191
- }
192
- // propagate to caller
193
- throw err;
194
- });
195
- },
196
- };
197
- };
198
- harden(makeOfferExecutor);
@@ -0,0 +1,23 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,60 @@
1
+ // @ts-check
2
+ /// <reference types="@agoric/vats/src/core/types-ambient" />
3
+
4
+ import { E } from '@endo/far';
5
+ import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
6
+
7
+ /**
8
+ * @param {BootstrapPowers & ChainBootstrapSpace} powers
9
+ * @param {object} options
10
+ * @param {{ walletRef: VatSourceRef }} options.options
11
+ */
12
+ export const upgradeWalletFactory = async (
13
+ {
14
+ consume: {
15
+ walletFactoryStartResult,
16
+ provisionPoolStartResult,
17
+ chainStorage,
18
+ walletBridgeManager: walletBridgeManagerP,
19
+ },
20
+ },
21
+ options,
22
+ ) => {
23
+ const WALLET_STORAGE_PATH_SEGMENT = 'wallet';
24
+
25
+ const { walletRef } = options.options;
26
+
27
+ const [walletBridgeManager, walletStorageNode, ppFacets] = await Promise.all([
28
+ walletBridgeManagerP,
29
+ makeStorageNodeChild(chainStorage, WALLET_STORAGE_PATH_SEGMENT),
30
+ provisionPoolStartResult,
31
+ ]);
32
+ const walletReviver = await E(ppFacets.creatorFacet).getWalletReviver();
33
+
34
+ const privateArgs = {
35
+ storageNode: walletStorageNode,
36
+ walletBridgeManager,
37
+ walletReviver,
38
+ };
39
+
40
+ const { adminFacet } = await walletFactoryStartResult;
41
+
42
+ assert(walletRef.bundleID);
43
+ await E(adminFacet).upgradeContract(walletRef.bundleID, privateArgs);
44
+
45
+ console.log(`Successfully upgraded WalletFactory`);
46
+ };
47
+
48
+ export const getManifestForUpgradeWallet = (_powers, { walletRef }) => ({
49
+ manifest: {
50
+ [upgradeWalletFactory.name]: {
51
+ consume: {
52
+ walletFactoryStartResult: 'walletFactoryStartResult',
53
+ provisionPoolStartResult: 'provisionPoolStartResult',
54
+ chainStorage: 'chainStorage',
55
+ walletBridgeManager: 'walletBridgeManager',
56
+ },
57
+ },
58
+ },
59
+ options: { walletRef },
60
+ });
@@ -1,4 +1,4 @@
1
- export function upgradeWalletFactory({ consume: { contractKits: kitsP, instancePrivateArgs: argsP }, instance: { consume: { walletFactory: wfInstanceP }, }, }: BootstrapPowers, config: {
1
+ export function upgradeWalletFactory({ consume: { contractKits, governedContractKits, chainStorage, walletBridgeManager: walletBridgeManagerP, }, instance: { consume: { walletFactory: wfInstanceP, provisionPool: ppInstanceP }, }, }: BootstrapPowers, config: {
2
2
  options: {
3
3
  walletFactoryRef: VatSourceRef & {
4
4
  bundleID: string;
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade-walletFactory-proposal.d.ts","sourceRoot":"","sources":["upgrade-walletFactory-proposal.js"],"names":[],"mappings":"AAoBO,gKALK,eAAe;;0BAGI,YAAY,GAAG;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE;;kBA6BjE;AAMM,mGAFK,eAAe,iBAwB1B;AAsBM;;;;;;;EAKN"}
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"}
@@ -1,28 +1,32 @@
1
1
  // @ts-check
2
+ import { Fail } from '@endo/errors';
2
3
  import { E } from '@endo/far';
3
4
  import { makeMarshal } from '@endo/marshal';
4
5
  import { allValues } from '@agoric/internal';
5
6
 
6
7
  console.warn('upgrade-walletFactory-proposal.js module evaluating');
7
8
 
8
- const { Fail } = assert;
9
-
10
9
  // vstorage paths under published.*
10
+ const WALLET_STORAGE_PATH_SEGMENT = 'wallet';
11
11
  const BOARD_AUX = 'boardAux';
12
12
 
13
13
  const marshalData = makeMarshal(_val => Fail`data only`);
14
14
 
15
15
  /**
16
- * @param { BootstrapPowers } powers
17
- *
16
+ * @param {BootstrapPowers} powers
18
17
  * @param {object} config
19
18
  * @param {{ walletFactoryRef: VatSourceRef & { bundleID: string } }} config.options
20
19
  */
21
20
  export const upgradeWalletFactory = async (
22
21
  {
23
- consume: { contractKits: kitsP, instancePrivateArgs: argsP },
22
+ consume: {
23
+ contractKits,
24
+ governedContractKits,
25
+ chainStorage,
26
+ walletBridgeManager: walletBridgeManagerP,
27
+ },
24
28
  instance: {
25
- consume: { walletFactory: wfInstanceP },
29
+ consume: { walletFactory: wfInstanceP, provisionPool: ppInstanceP },
26
30
  },
27
31
  },
28
32
  config,
@@ -30,26 +34,42 @@ export const upgradeWalletFactory = async (
30
34
  console.log('upgradeWalletFactory: config', config);
31
35
  const { walletFactoryRef } = config.options;
32
36
 
33
- console.log('upgradeWalletFactory: awaiting instance');
34
- const wfInstance = await wfInstanceP;
35
- console.log('upgradeWalletFactory: awaiting contract kits');
36
- const { contractKits, instancePrivateArgs } = await allValues({
37
- contractKits: kitsP,
38
- instancePrivateArgs: argsP,
37
+ // console.log('upgradeWalletFactory: awaiting instances etc.');
38
+ const { wfInstance, ppInstance, walletBridgeManager, storageNode } =
39
+ await allValues({
40
+ wfInstance: wfInstanceP,
41
+ ppInstance: ppInstanceP,
42
+ walletBridgeManager: walletBridgeManagerP,
43
+ // @ts-expect-error chainStorage is only falsy in testing
44
+ storageNode: E(chainStorage).makeChildNode(WALLET_STORAGE_PATH_SEGMENT),
45
+ });
46
+ // console.log('upgradeWalletFactory: awaiting contract kits');
47
+ const { wfKit, ppKit } = await allValues({
48
+ wfKit: E(contractKits).get(wfInstance),
49
+ ppKit: E(governedContractKits).get(ppInstance),
39
50
  });
40
- const { adminFacet } = contractKits.get(wfInstance);
41
- /** @type {Parameters<typeof import('../walletFactory').prepare>[1]} */
42
- // @ts-expect-error cast
43
- const unsettledArgs = instancePrivateArgs.get(wfInstance);
44
- const privateArgs = await allValues(unsettledArgs);
45
- console.log('upgradeWalletFactory: upgrading with privateArgs', privateArgs);
46
- await E(adminFacet).upgradeContract(walletFactoryRef.bundleID, privateArgs);
51
+ // console.log('upgradeWalletFactory: awaiting walletReviver');
52
+ const walletReviver = await E(ppKit.creatorFacet).getWalletReviver();
53
+ const newPrivateArgs = harden({
54
+ storageNode,
55
+ walletBridgeManager,
56
+ walletReviver,
57
+ });
58
+
59
+ console.log(
60
+ 'upgradeWalletFactory: upgrading with newPrivateArgs',
61
+ newPrivateArgs,
62
+ );
63
+ await E(wfKit.adminFacet).upgradeContract(
64
+ walletFactoryRef.bundleID,
65
+ newPrivateArgs,
66
+ );
47
67
  console.log('upgradeWalletFactory: done');
48
68
  };
49
69
  harden(upgradeWalletFactory);
50
70
 
51
71
  /**
52
- * @param { BootstrapPowers } powers
72
+ * @param {BootstrapPowers} powers
53
73
  */
54
74
  export const publishAgoricBrandsDisplayInfo = async ({
55
75
  consume: { agoricNames, board, chainStorage },
@@ -68,7 +88,7 @@ export const publishAgoricBrandsDisplayInfo = async ({
68
88
  await E(node).setValue(JSON.stringify(aux));
69
89
  };
70
90
 
71
- /** @type {ERef<NameHub>} */
91
+ /** @type {ERef<import('@agoric/vats').NameHub>} */
72
92
  const brandHub = E(agoricNames).lookup('brand');
73
93
  const brands = await E(brandHub).values();
74
94
  // tolerate failure; in particular, for the timer brand
@@ -76,13 +96,16 @@ export const publishAgoricBrandsDisplayInfo = async ({
76
96
  };
77
97
  harden(publishAgoricBrandsDisplayInfo);
78
98
 
79
- /** @type { import("@agoric/vats/src/core/lib-boot").BootstrapManifest } */
99
+ /** @type {import('@agoric/vats/src/core/lib-boot').BootstrapManifest} */
80
100
  const manifest = {
81
101
  [upgradeWalletFactory.name]: {
82
102
  // include rationale for closely-held, high authority capabilities
83
103
  consume: {
84
104
  contractKits: `to upgrade walletFactory using its adminFacet`,
85
- instancePrivateArgs: `to get privateArgs for walletFactory`,
105
+ governedContractKits:
106
+ 'to get walletReviver from provisionPool.creatorFacet',
107
+ chainStorage: 'to allow walletFactory to (continue) write to vstorage',
108
+ walletBridgeManager: 'to handle bridged cosmos SpendAction messages',
86
109
  },
87
110
  // widely-shared, low authority instance handles need no rationale
88
111
  instance: {