@agoric/smart-wallet 0.5.4-mainnet1B-dev-b0c1f78.0 → 0.5.4-orchestration-dev-096c4e8.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/package.json +30 -24
- package/src/invitations.d.ts +1 -1
- package/src/invitations.d.ts.map +1 -1
- package/src/invitations.js +2 -2
- package/src/offerWatcher.d.ts +42 -0
- package/src/offerWatcher.d.ts.map +1 -0
- package/src/offerWatcher.js +294 -0
- package/src/offers.d.ts +2 -26
- package/src/offers.d.ts.map +1 -1
- package/src/offers.js +1 -175
- 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 +58 -0
- package/src/proposals/upgrade-walletFactory-proposal.d.ts +1 -1
- package/src/proposals/upgrade-walletFactory-proposal.d.ts.map +1 -1
- package/src/proposals/upgrade-walletFactory-proposal.js +42 -17
- package/src/smartWallet.d.ts +46 -24
- package/src/smartWallet.d.ts.map +1 -1
- package/src/smartWallet.js +554 -145
- package/src/typeGuards.d.ts +1 -1
- package/src/types.d.ts +7 -8
- package/src/utils.d.ts +9 -9
- package/src/utils.d.ts.map +1 -1
- package/src/utils.js +5 -5
- package/src/walletFactory.d.ts +77 -37
- package/src/walletFactory.d.ts.map +1 -1
- package/src/walletFactory.js +42 -10
- package/CHANGELOG.md +0 -208
- package/src/payments.d.ts +0 -20
- package/src/payments.d.ts.map +0 -1
- package/src/payments.js +0 -89
package/src/offers.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
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
|
*/
|
|
@@ -9,7 +5,7 @@ import { makePaymentsHelper } from './payments.js';
|
|
|
9
5
|
/**
|
|
10
6
|
* @typedef {{
|
|
11
7
|
* id: OfferId,
|
|
12
|
-
* invitationSpec: import('./invitations').InvitationSpec,
|
|
8
|
+
* invitationSpec: import('./invitations.js').InvitationSpec,
|
|
13
9
|
* proposal: Proposal,
|
|
14
10
|
* offerArgs?: unknown
|
|
15
11
|
* }} OfferSpec
|
|
@@ -26,173 +22,3 @@ export const UNPUBLISHED_RESULT = 'UNPUBLISHED';
|
|
|
26
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":"AASO,qKAJI,eAAe,GAAG,mBAAmB;;mBAExB,YAAY;;kBAoCnC;AAEM;;;;;;;;;;;;;;;;EAYL"}
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
const walletReviver = await E(ppFacets.creatorFacet).getWalletReviver();
|
|
31
|
+
|
|
32
|
+
const privateArgs = {
|
|
33
|
+
storageNode: walletStorageNode,
|
|
34
|
+
walletBridgeManager,
|
|
35
|
+
walletReviver,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const { adminFacet } = await walletFactoryStartResult;
|
|
39
|
+
|
|
40
|
+
assert(walletRef.bundleID);
|
|
41
|
+
await E(adminFacet).upgradeContract(walletRef.bundleID, privateArgs);
|
|
42
|
+
|
|
43
|
+
console.log(`Successfully upgraded WalletFactory`);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const getManifestForUpgradeWallet = (_powers, { walletRef }) => ({
|
|
47
|
+
manifest: {
|
|
48
|
+
[upgradeWalletFactory.name]: {
|
|
49
|
+
consume: {
|
|
50
|
+
walletFactoryStartResult: 'walletFactoryStartResult',
|
|
51
|
+
provisionPoolStartResult: 'provisionPoolStartResult',
|
|
52
|
+
chainStorage: 'chainStorage',
|
|
53
|
+
walletBridgeManager: 'walletBridgeManager',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
options: { walletRef },
|
|
58
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function upgradeWalletFactory({ consume: { contractKits
|
|
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":"
|
|
1
|
+
{"version":3,"file":"upgrade-walletFactory-proposal.d.ts","sourceRoot":"","sources":["upgrade-walletFactory-proposal.js"],"names":[],"mappings":"AAqBO,yOALK,eAAe;;0BAGI,YAAY,GAAG;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE;;kBAkDjE;AAMM,mGAFK,eAAe,iBAwB1B;AAyBM;;;;;;;EAKN"}
|
|
@@ -8,6 +8,7 @@ console.warn('upgrade-walletFactory-proposal.js module evaluating');
|
|
|
8
8
|
const { Fail } = assert;
|
|
9
9
|
|
|
10
10
|
// vstorage paths under published.*
|
|
11
|
+
const WALLET_STORAGE_PATH_SEGMENT = 'wallet';
|
|
11
12
|
const BOARD_AUX = 'boardAux';
|
|
12
13
|
|
|
13
14
|
const marshalData = makeMarshal(_val => Fail`data only`);
|
|
@@ -20,9 +21,14 @@ const marshalData = makeMarshal(_val => Fail`data only`);
|
|
|
20
21
|
*/
|
|
21
22
|
export const upgradeWalletFactory = async (
|
|
22
23
|
{
|
|
23
|
-
consume: {
|
|
24
|
+
consume: {
|
|
25
|
+
contractKits,
|
|
26
|
+
governedContractKits,
|
|
27
|
+
chainStorage,
|
|
28
|
+
walletBridgeManager: walletBridgeManagerP,
|
|
29
|
+
},
|
|
24
30
|
instance: {
|
|
25
|
-
consume: { walletFactory: wfInstanceP },
|
|
31
|
+
consume: { walletFactory: wfInstanceP, provisionPool: ppInstanceP },
|
|
26
32
|
},
|
|
27
33
|
},
|
|
28
34
|
config,
|
|
@@ -30,20 +36,36 @@ export const upgradeWalletFactory = async (
|
|
|
30
36
|
console.log('upgradeWalletFactory: config', config);
|
|
31
37
|
const { walletFactoryRef } = config.options;
|
|
32
38
|
|
|
33
|
-
console.log('upgradeWalletFactory: awaiting
|
|
34
|
-
const wfInstance
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
// console.log('upgradeWalletFactory: awaiting instances etc.');
|
|
40
|
+
const { wfInstance, ppInstance, walletBridgeManager, storageNode } =
|
|
41
|
+
await allValues({
|
|
42
|
+
wfInstance: wfInstanceP,
|
|
43
|
+
ppInstance: ppInstanceP,
|
|
44
|
+
walletBridgeManager: walletBridgeManagerP,
|
|
45
|
+
// @ts-expect-error chainStorage is only falsy in testing
|
|
46
|
+
storageNode: E(chainStorage).makeChildNode(WALLET_STORAGE_PATH_SEGMENT),
|
|
47
|
+
});
|
|
48
|
+
// console.log('upgradeWalletFactory: awaiting contract kits');
|
|
49
|
+
const { wfKit, ppKit } = await allValues({
|
|
50
|
+
wfKit: E(contractKits).get(wfInstance),
|
|
51
|
+
ppKit: E(governedContractKits).get(ppInstance),
|
|
39
52
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
// console.log('upgradeWalletFactory: awaiting walletReviver');
|
|
54
|
+
const walletReviver = await E(ppKit.creatorFacet).getWalletReviver();
|
|
55
|
+
const newPrivateArgs = harden({
|
|
56
|
+
storageNode,
|
|
57
|
+
walletBridgeManager,
|
|
58
|
+
walletReviver,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
console.log(
|
|
62
|
+
'upgradeWalletFactory: upgrading with newPrivateArgs',
|
|
63
|
+
newPrivateArgs,
|
|
64
|
+
);
|
|
65
|
+
await E(wfKit.adminFacet).upgradeContract(
|
|
66
|
+
walletFactoryRef.bundleID,
|
|
67
|
+
newPrivateArgs,
|
|
68
|
+
);
|
|
47
69
|
console.log('upgradeWalletFactory: done');
|
|
48
70
|
};
|
|
49
71
|
harden(upgradeWalletFactory);
|
|
@@ -68,7 +90,7 @@ export const publishAgoricBrandsDisplayInfo = async ({
|
|
|
68
90
|
await E(node).setValue(JSON.stringify(aux));
|
|
69
91
|
};
|
|
70
92
|
|
|
71
|
-
/** @type {ERef<NameHub>} */
|
|
93
|
+
/** @type {ERef<import('@agoric/vats').NameHub>} */
|
|
72
94
|
const brandHub = E(agoricNames).lookup('brand');
|
|
73
95
|
const brands = await E(brandHub).values();
|
|
74
96
|
// tolerate failure; in particular, for the timer brand
|
|
@@ -82,7 +104,10 @@ const manifest = {
|
|
|
82
104
|
// include rationale for closely-held, high authority capabilities
|
|
83
105
|
consume: {
|
|
84
106
|
contractKits: `to upgrade walletFactory using its adminFacet`,
|
|
85
|
-
|
|
107
|
+
governedContractKits:
|
|
108
|
+
'to get walletReviver from provisionPool.creatorFacet',
|
|
109
|
+
chainStorage: 'to allow walletFactory to (continue) write to vstorage',
|
|
110
|
+
walletBridgeManager: 'to handle bridged cosmos SpendAction messages',
|
|
86
111
|
},
|
|
87
112
|
// widely-shared, low authority instance handles need no rationale
|
|
88
113
|
instance: {
|
package/src/smartWallet.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export const BRAND_TO_PURSES_KEY: "brandToPurses";
|
|
2
|
-
export function prepareSmartWallet(baggage:
|
|
2
|
+
export function prepareSmartWallet(baggage: import('@agoric/vat-data').Baggage, shared: SharedParams): (uniqueWithoutChildNodes: Omit<UniqueParams, "currentStorageNode" | "walletStorageNode"> & {
|
|
3
3
|
walletStorageNode: ERef<StorageNode>;
|
|
4
|
-
}) => Promise<{
|
|
4
|
+
}) => Promise<import("@endo/exo/src/exo-makers.js").Guarded<{
|
|
5
5
|
/**
|
|
6
6
|
* Umarshals the actionCapData and delegates to the appropriate action handler.
|
|
7
7
|
*
|
|
8
|
-
* @param {import('@endo/marshal').CapData<string>} actionCapData of type BridgeAction
|
|
8
|
+
* @param {import('@endo/marshal').CapData<string | null>} actionCapData of type BridgeAction
|
|
9
9
|
* @param {boolean} [canSpend]
|
|
10
10
|
* @returns {Promise<void>}
|
|
11
11
|
*/
|
|
12
|
-
handleBridgeAction(actionCapData: import('@endo/marshal').CapData<string>, canSpend?: boolean | undefined): Promise<void>;
|
|
13
|
-
getDepositFacet(): {
|
|
12
|
+
handleBridgeAction(actionCapData: import('@endo/marshal').CapData<string | null>, canSpend?: boolean | undefined): Promise<void>;
|
|
13
|
+
getDepositFacet(): import("@endo/exo/src/exo-makers.js").Guarded<{
|
|
14
14
|
/**
|
|
15
15
|
* Put the assets from the payment into the appropriate purse.
|
|
16
16
|
*
|
|
@@ -21,25 +21,25 @@ export function prepareSmartWallet(baggage: MapStore<string, unknown>, shared: S
|
|
|
21
21
|
* @throws if there's not yet a purse, though the payment is held to try again when there is
|
|
22
22
|
*/
|
|
23
23
|
receive(payment: Payment): Promise<Amount>;
|
|
24
|
-
}
|
|
25
|
-
getOffersFacet(): {
|
|
24
|
+
}>;
|
|
25
|
+
getOffersFacet(): import("@endo/exo/src/exo-makers.js").Guarded<{
|
|
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:
|
|
42
|
-
}
|
|
41
|
+
tryExitOffer(offerId: OfferId): Promise<void>;
|
|
42
|
+
}>;
|
|
43
43
|
/** @deprecated use getPublicTopics */
|
|
44
44
|
getCurrentSubscriber(): Subscriber<CurrentWalletRecord>;
|
|
45
45
|
/** @deprecated use getPublicTopics */
|
|
@@ -56,14 +56,35 @@ export function prepareSmartWallet(baggage: MapStore<string, unknown>, shared: S
|
|
|
56
56
|
storagePath: Promise<string>;
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
|
-
|
|
59
|
+
/**
|
|
60
|
+
* To be called once ever per wallet.
|
|
61
|
+
*
|
|
62
|
+
* @param {object} key
|
|
63
|
+
*/
|
|
64
|
+
repairWalletForIncarnation2(key: object): void;
|
|
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').InvitationMakers>;
|
|
177
|
+
offerToInvitationMakers: MapStore<string, import('./types.js').InvitationMakers>;
|
|
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":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"smartWallet.d.ts","sourceRoot":"","sources":["smartWallet.js"],"names":[],"mappings":"AAiOA,kDAAmD;AAiB5C,4CAHI,OAAO,kBAAkB,EAAE,OAAO,UAClC,YAAY;uBAk6B2E,KAAK,WAAW,CAAC;;IAvH3G;;;;;;OAMG;sCAHQ,OAAO,eAAe,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,mCAE5C,QAAQ,IAAI,CAAC;;QArP1B;;;;;;;;WAQG;yBAHQ,OAAO,GACL,QAAQ,MAAM,CAAC;;;QAkH5B;;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