@agoric/smart-wallet 0.5.4-u13.0 → 0.5.4-u14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/package.json +14 -12
- package/src/offerWatcher.d.ts +66 -0
- package/src/offerWatcher.d.ts.map +1 -0
- package/src/offerWatcher.js +294 -0
- package/src/offers.d.ts +0 -24
- package/src/offers.d.ts.map +1 -1
- package/src/offers.js +0 -174
- package/src/proposals/upgrade-wallet-factory2-proposal.d.ts +23 -0
- package/src/proposals/upgrade-wallet-factory2-proposal.d.ts.map +1 -0
- package/src/proposals/upgrade-wallet-factory2-proposal.js +59 -0
- package/src/smartWallet.d.ts +37 -15
- package/src/smartWallet.d.ts.map +1 -1
- package/src/smartWallet.js +556 -144
- package/src/walletFactory.d.ts +6 -4
- package/src/walletFactory.d.ts.map +1 -1
- package/src/walletFactory.js +35 -3
- package/src/payments.d.ts +0 -20
- package/src/payments.d.ts.map +0 -1
- package/src/payments.js +0 -89
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade-wallet-factory2-proposal.d.ts","sourceRoot":"","sources":["upgrade-wallet-factory2-proposal.js"],"names":[],"mappings":"AASO,qKAJI,eAAe,GAAG,mBAAmB;;mBAExB,YAAY;;kBAqCnC;AAEM;;;;;;;;;;;;;;;;EAYL"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { E } from '@endo/far';
|
|
3
|
+
import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {BootstrapPowers & ChainBootstrapSpace} powers
|
|
7
|
+
* @param {object} options
|
|
8
|
+
* @param {{ walletRef: VatSourceRef }} options.options
|
|
9
|
+
*/
|
|
10
|
+
export const upgradeWalletFactory = async (
|
|
11
|
+
{
|
|
12
|
+
consume: {
|
|
13
|
+
walletFactoryStartResult,
|
|
14
|
+
provisionPoolStartResult,
|
|
15
|
+
chainStorage,
|
|
16
|
+
walletBridgeManager: walletBridgeManagerP,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
options,
|
|
20
|
+
) => {
|
|
21
|
+
const WALLET_STORAGE_PATH_SEGMENT = 'wallet';
|
|
22
|
+
|
|
23
|
+
const { walletRef } = options.options;
|
|
24
|
+
|
|
25
|
+
const [walletBridgeManager, walletStorageNode, ppFacets] = await Promise.all([
|
|
26
|
+
walletBridgeManagerP,
|
|
27
|
+
makeStorageNodeChild(chainStorage, WALLET_STORAGE_PATH_SEGMENT),
|
|
28
|
+
provisionPoolStartResult,
|
|
29
|
+
]);
|
|
30
|
+
// @ts-expect-error missing type declaration?
|
|
31
|
+
const walletReviver = await E(ppFacets.creatorFacet).getWalletReviver();
|
|
32
|
+
|
|
33
|
+
const privateArgs = {
|
|
34
|
+
storageNode: walletStorageNode,
|
|
35
|
+
walletBridgeManager,
|
|
36
|
+
walletReviver,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const { adminFacet } = await walletFactoryStartResult;
|
|
40
|
+
|
|
41
|
+
assert(walletRef.bundleID);
|
|
42
|
+
await E(adminFacet).upgradeContract(walletRef.bundleID, privateArgs);
|
|
43
|
+
|
|
44
|
+
console.log(`Successfully upgraded WalletFactory`);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const getManifestForUpgradeWallet = (_powers, { walletRef }) => ({
|
|
48
|
+
manifest: {
|
|
49
|
+
[upgradeWalletFactory.name]: {
|
|
50
|
+
consume: {
|
|
51
|
+
walletFactoryStartResult: 'walletFactoryStartResult',
|
|
52
|
+
provisionPoolStartResult: 'provisionPoolStartResult',
|
|
53
|
+
chainStorage: 'chainStorage',
|
|
54
|
+
walletBridgeManager: 'walletBridgeManager',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
options: { walletRef },
|
|
59
|
+
});
|
package/src/smartWallet.d.ts
CHANGED
|
@@ -26,19 +26,19 @@ export function prepareSmartWallet(baggage: MapStore<string, unknown>, shared: S
|
|
|
26
26
|
/**
|
|
27
27
|
* Take an offer description provided in capData, augment it with payments and call zoe.offer()
|
|
28
28
|
*
|
|
29
|
-
* @param {
|
|
29
|
+
* @param {OfferSpec} offerSpec
|
|
30
30
|
* @returns {Promise<void>} after the offer has been both seated and exited by Zoe.
|
|
31
31
|
* @throws if any parts of the offer can be determined synchronously to be invalid
|
|
32
32
|
*/
|
|
33
|
-
executeOffer(offerSpec:
|
|
33
|
+
executeOffer(offerSpec: OfferSpec): Promise<void>;
|
|
34
34
|
/**
|
|
35
35
|
* Take an offer's id, look up its seat, try to exit.
|
|
36
36
|
*
|
|
37
|
-
* @param {
|
|
37
|
+
* @param {OfferId} offerId
|
|
38
38
|
* @returns {Promise<void>}
|
|
39
39
|
* @throws if the seat can't be found or E(seatRef).tryExit() fails.
|
|
40
40
|
*/
|
|
41
|
-
tryExitOffer(offerId:
|
|
41
|
+
tryExitOffer(offerId: OfferId): Promise<void>;
|
|
42
42
|
};
|
|
43
43
|
/** @deprecated use getPublicTopics */
|
|
44
44
|
getCurrentSubscriber(): Subscriber<CurrentWalletRecord>;
|
|
@@ -56,14 +56,35 @@ export function prepareSmartWallet(baggage: MapStore<string, unknown>, shared: S
|
|
|
56
56
|
storagePath: Promise<string>;
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* To be called once ever per wallet.
|
|
61
|
+
*
|
|
62
|
+
* @param {object} key
|
|
63
|
+
*/
|
|
64
|
+
repairWalletForIncarnation2(key: object): void;
|
|
59
65
|
}>;
|
|
66
|
+
export type OfferId = number | string;
|
|
67
|
+
export type OfferSpec = {
|
|
68
|
+
id: OfferId;
|
|
69
|
+
invitationSpec: import('./invitations').InvitationSpec;
|
|
70
|
+
proposal: Proposal;
|
|
71
|
+
offerArgs?: unknown;
|
|
72
|
+
};
|
|
73
|
+
export type ExecutorPowers = {
|
|
74
|
+
logger: {
|
|
75
|
+
info: (...args: any[]) => void;
|
|
76
|
+
error: (...args: any[]) => void;
|
|
77
|
+
};
|
|
78
|
+
makeOfferWatcher: import('./offerWatcher.js').MakeOfferWatcher;
|
|
79
|
+
invitationFromSpec: ERef<Invitation>;
|
|
80
|
+
};
|
|
60
81
|
export type ExecuteOfferAction = {
|
|
61
82
|
method: 'executeOffer';
|
|
62
|
-
offer:
|
|
83
|
+
offer: OfferSpec;
|
|
63
84
|
};
|
|
64
85
|
export type TryExitOfferAction = {
|
|
65
86
|
method: 'tryExitOffer';
|
|
66
|
-
offerId:
|
|
87
|
+
offerId: OfferId;
|
|
67
88
|
};
|
|
68
89
|
export type BridgeAction = ExecuteOfferAction | TryExitOfferAction;
|
|
69
90
|
/**
|
|
@@ -91,7 +112,7 @@ export type CurrentWalletRecord = {
|
|
|
91
112
|
offerToPublicSubscriberPaths: [offerId: string, publicTopics: {
|
|
92
113
|
[subscriberName: string]: string;
|
|
93
114
|
}][];
|
|
94
|
-
liveOffers: Array<[
|
|
115
|
+
liveOffers: Array<[OfferId, import('./offers.js').OfferStatus]>;
|
|
95
116
|
};
|
|
96
117
|
/**
|
|
97
118
|
* Record of an update to the state of this wallet.
|
|
@@ -124,12 +145,11 @@ export type BrandDescriptor = {
|
|
|
124
145
|
brand: Brand;
|
|
125
146
|
displayInfo: DisplayInfo;
|
|
126
147
|
issuer: Issuer;
|
|
127
|
-
petname: import('./types').Petname;
|
|
148
|
+
petname: import('./types.js').Petname;
|
|
128
149
|
};
|
|
129
|
-
export type RemotePurse = import('./types').RemotePurse;
|
|
130
150
|
export type UniqueParams = {
|
|
131
151
|
address: string;
|
|
132
|
-
bank: ERef<import('@agoric/vats/src/vat-bank').Bank>;
|
|
152
|
+
bank: ERef<import('@agoric/vats/src/vat-bank.js').Bank>;
|
|
133
153
|
currentStorageNode: StorageNode;
|
|
134
154
|
invitationPurse: Purse<'set'>;
|
|
135
155
|
walletStorageNode: StorageNode;
|
|
@@ -143,6 +163,7 @@ export type SharedParams = {
|
|
|
143
163
|
invitationDisplayInfo: DisplayInfo;
|
|
144
164
|
publicMarshaller: Marshaller;
|
|
145
165
|
zoe: ERef<ZoeService>;
|
|
166
|
+
secretWalletFactoryKey: any;
|
|
146
167
|
};
|
|
147
168
|
/**
|
|
148
169
|
* - `brandPurses` is precious and closely held. defined as late as possible to reduce its scope.
|
|
@@ -153,14 +174,15 @@ export type SharedParams = {
|
|
|
153
174
|
export type State = ImmutableState & MutableState;
|
|
154
175
|
export type ImmutableState = Readonly<UniqueParams & {
|
|
155
176
|
paymentQueues: MapStore<Brand, Array<Payment>>;
|
|
156
|
-
offerToInvitationMakers: MapStore<string, import('./types').
|
|
177
|
+
offerToInvitationMakers: MapStore<string, import('./types').RemoteInvitationMakers>;
|
|
157
178
|
offerToPublicSubscriberPaths: MapStore<string, Record<string, string>>;
|
|
158
|
-
offerToUsedInvitation: MapStore<string, Amount
|
|
159
|
-
purseBalances: MapStore<
|
|
179
|
+
offerToUsedInvitation: MapStore<string, Amount<'set'>>;
|
|
180
|
+
purseBalances: MapStore<Purse, Amount>;
|
|
160
181
|
updateRecorderKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<UpdateRecord>;
|
|
161
182
|
currentRecorderKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<CurrentWalletRecord>;
|
|
162
|
-
liveOffers: MapStore<
|
|
163
|
-
liveOfferSeats:
|
|
183
|
+
liveOffers: MapStore<OfferId, import('./offers.js').OfferStatus>;
|
|
184
|
+
liveOfferSeats: MapStore<OfferId, UserSeat<unknown>>;
|
|
185
|
+
liveOfferPayments: MapStore<OfferId, MapStore<Brand, Payment>>;
|
|
164
186
|
}>;
|
|
165
187
|
export type PurseRecord = BrandDescriptor & {
|
|
166
188
|
purse: Purse;
|
package/src/smartWallet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smartWallet.d.ts","sourceRoot":"","sources":["smartWallet.js"],"names":[],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