@agoric/smart-wallet 0.5.4-other-dev-8f8782b.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 +43 -29
- package/src/index.d.ts +2 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +6 -0
- package/src/invitations.d.ts +14 -10
- package/src/invitations.d.ts.map +1 -1
- package/src/invitations.js +39 -33
- package/src/marshal-contexts.d.ts +45 -41
- package/src/marshal-contexts.d.ts.map +1 -1
- package/src/marshal-contexts.js +69 -61
- package/src/offerWatcher.d.ts +54 -0
- package/src/offerWatcher.d.ts.map +1 -0
- package/src/offerWatcher.js +343 -0
- package/src/offers.d.ts +60 -30
- package/src/offers.d.ts.map +1 -1
- package/src/offers.js +38 -182
- package/src/proposals/upgrade-wallet-factory2-proposal.js +61 -0
- package/src/proposals/upgrade-walletFactory-proposal.js +46 -23
- package/src/smartWallet.d.ts +132 -68
- package/src/smartWallet.d.ts.map +1 -1
- package/src/smartWallet.js +718 -217
- package/src/typeGuards.d.ts +1 -1
- package/src/typeGuards.js +29 -1
- package/src/types-index.d.ts +2 -0
- package/src/types-index.js +2 -0
- package/src/types.d.ts +36 -41
- package/src/types.d.ts.map +1 -0
- package/src/types.ts +90 -0
- package/src/utils.d.ts +17 -14
- package/src/utils.d.ts.map +1 -1
- package/src/utils.js +19 -6
- package/src/walletFactory.d.ts +24 -78
- package/src/walletFactory.d.ts.map +1 -1
- package/src/walletFactory.js +64 -37
- package/CHANGELOG.md +0 -180
- package/src/payments.d.ts +0 -20
- package/src/payments.d.ts.map +0 -1
- package/src/payments.js +0 -89
- package/src/proposals/upgrade-walletFactory-proposal.d.ts +0 -17
- package/src/proposals/upgrade-walletFactory-proposal.d.ts.map +0 -1
package/src/walletFactory.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Wallet Factory
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Contract to make smart wallets.
|
|
5
|
+
*
|
|
6
|
+
* Note: The upgrade test uses a slightly modified copy of this file. When the
|
|
7
|
+
* interface changes here, that will also need to change.
|
|
5
8
|
*/
|
|
6
9
|
|
|
7
10
|
import { makeTracer, WalletName } from '@agoric/internal';
|
|
@@ -14,6 +17,11 @@ import { E } from '@endo/far';
|
|
|
14
17
|
import { prepareSmartWallet } from './smartWallet.js';
|
|
15
18
|
import { shape } from './typeGuards.js';
|
|
16
19
|
|
|
20
|
+
/**
|
|
21
|
+
* @import {MapStore} from '@agoric/swingset-liveslots';
|
|
22
|
+
* @import {NameHub} from '@agoric/vats';
|
|
23
|
+
*/
|
|
24
|
+
|
|
17
25
|
const trace = makeTracer('WltFct');
|
|
18
26
|
|
|
19
27
|
export const customTermsShape = harden({
|
|
@@ -29,6 +37,8 @@ export const privateArgsShape = harden(
|
|
|
29
37
|
),
|
|
30
38
|
);
|
|
31
39
|
|
|
40
|
+
const WALLETS_BY_ADDRESS = 'walletsByAddress';
|
|
41
|
+
|
|
32
42
|
/**
|
|
33
43
|
* Provide a NameHub for this address and insert depositFacet only if not
|
|
34
44
|
* already done.
|
|
@@ -56,8 +66,8 @@ export const publishDepositFacet = async (
|
|
|
56
66
|
* Make a registry for use by the wallet instances.
|
|
57
67
|
*
|
|
58
68
|
* This doesn't need to persist durably because the `assetPublisher` has a
|
|
59
|
-
* "pinned" topic and call to getAssetSubscription gets a fresh stream of all
|
|
60
|
-
* assets that it knows of.
|
|
69
|
+
* "pinned" topic and call to getAssetSubscription gets a fresh stream of all
|
|
70
|
+
* the assets that it knows of.
|
|
61
71
|
*
|
|
62
72
|
* @param {AssetPublisher} assetPublisher
|
|
63
73
|
*/
|
|
@@ -65,12 +75,13 @@ export const makeAssetRegistry = assetPublisher => {
|
|
|
65
75
|
trace('makeAssetRegistry', assetPublisher);
|
|
66
76
|
/**
|
|
67
77
|
* @typedef {{
|
|
68
|
-
* brand: Brand
|
|
69
|
-
* displayInfo: DisplayInfo
|
|
70
|
-
* issuer: Issuer
|
|
71
|
-
* petname: import('./types').Petname
|
|
78
|
+
* brand: Brand;
|
|
79
|
+
* displayInfo: DisplayInfo;
|
|
80
|
+
* issuer: Issuer;
|
|
81
|
+
* petname: import('./types.js').Petname;
|
|
72
82
|
* }} BrandDescriptor
|
|
73
|
-
*
|
|
83
|
+
* For use by clients to describe brands to users. Includes `displayInfo` to
|
|
84
|
+
* save a remote call.
|
|
74
85
|
*/
|
|
75
86
|
/** @type {MapStore<Brand, BrandDescriptor>} */
|
|
76
87
|
const brandDescriptors = makeScalarMapStore();
|
|
@@ -110,45 +121,52 @@ export const makeAssetRegistry = assetPublisher => {
|
|
|
110
121
|
|
|
111
122
|
/**
|
|
112
123
|
* @typedef {{
|
|
113
|
-
* agoricNames: ERef<NameHub
|
|
114
|
-
* board: ERef<import('@agoric/vats').Board
|
|
115
|
-
* assetPublisher: AssetPublisher
|
|
124
|
+
* agoricNames: ERef<NameHub>;
|
|
125
|
+
* board: ERef<import('@agoric/vats').Board>;
|
|
126
|
+
* assetPublisher: AssetPublisher;
|
|
116
127
|
* }} SmartWalletContractTerms
|
|
117
128
|
*
|
|
118
|
-
* @typedef {import('@agoric/vats').NameHub} NameHub
|
|
119
129
|
*
|
|
120
130
|
* @typedef {{
|
|
121
131
|
* getAssetSubscription: () => ERef<
|
|
122
|
-
* IterableEachTopic<import('@agoric/vats/src/vat-bank').AssetDescriptor
|
|
132
|
+
* IterableEachTopic<import('@agoric/vats/src/vat-bank.js').AssetDescriptor>
|
|
133
|
+
* >;
|
|
123
134
|
* }} AssetPublisher
|
|
124
135
|
*
|
|
125
|
-
*
|
|
136
|
+
*
|
|
137
|
+
* @typedef {boolean} IsRevive
|
|
138
|
+
*
|
|
126
139
|
* @typedef {{
|
|
127
|
-
* reviveWallet: (
|
|
128
|
-
*
|
|
140
|
+
* reviveWallet: (
|
|
141
|
+
* address: string,
|
|
142
|
+
* ) => Promise<import('./smartWallet.js').SmartWallet>;
|
|
143
|
+
* ackWallet: (address: string) => IsRevive;
|
|
129
144
|
* }} WalletReviver
|
|
130
145
|
*/
|
|
131
146
|
|
|
132
|
-
// NB: even though all the wallets share this contract,
|
|
147
|
+
// NB: even though all the wallets share this contract,
|
|
133
148
|
// 1. they should not rely on that; they may be partitioned later
|
|
134
149
|
// 2. they should never be able to detect behaviors from another wallet
|
|
135
150
|
/**
|
|
136
151
|
* @param {ZCF<SmartWalletContractTerms>} zcf
|
|
137
152
|
* @param {{
|
|
138
|
-
* storageNode: ERef<StorageNode
|
|
139
|
-
* walletBridgeManager?: ERef<
|
|
140
|
-
*
|
|
153
|
+
* storageNode: ERef<StorageNode>;
|
|
154
|
+
* walletBridgeManager?: ERef<
|
|
155
|
+
* import('@agoric/vats').ScopedBridgeManager<'wallet'>
|
|
156
|
+
* >;
|
|
157
|
+
* walletReviver?: ERef<WalletReviver>;
|
|
141
158
|
* }} privateArgs
|
|
142
159
|
* @param {import('@agoric/vat-data').Baggage} baggage
|
|
143
160
|
*/
|
|
144
161
|
export const prepare = async (zcf, privateArgs, baggage) => {
|
|
162
|
+
const upgrading = baggage.has(WALLETS_BY_ADDRESS);
|
|
145
163
|
const { agoricNames, board, assetPublisher } = zcf.getTerms();
|
|
146
164
|
|
|
147
165
|
const zoe = zcf.getZoeService();
|
|
148
166
|
const { storageNode, walletBridgeManager, walletReviver } = privateArgs;
|
|
149
167
|
|
|
150
168
|
/** @type {MapStore<string, import('./smartWallet.js').SmartWallet>} */
|
|
151
|
-
const walletsByAddress = provideDurableMapStore(baggage,
|
|
169
|
+
const walletsByAddress = provideDurableMapStore(baggage, WALLETS_BY_ADDRESS);
|
|
152
170
|
const provider = makeAtomicProvider(walletsByAddress);
|
|
153
171
|
|
|
154
172
|
const handleWalletAction = makeExo(
|
|
@@ -160,17 +178,20 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
160
178
|
/**
|
|
161
179
|
* Designed to be called by the bridgeManager vat.
|
|
162
180
|
*
|
|
163
|
-
* If this errors before calling handleBridgeAction(), the failure will
|
|
164
|
-
* promise does reject, but as of now bridge
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
181
|
+
* If this errors before calling handleBridgeAction(), the failure will
|
|
182
|
+
* not be observable. The promise does reject, but as of now bridge
|
|
183
|
+
* manager drops instead of handling it. Eventually we'll make the bridge
|
|
184
|
+
* able to give feedback about the requesting transaction. Meanwhile we
|
|
185
|
+
* could write the error to chainStorage but we don't have a guarantee of
|
|
186
|
+
* the wallet owner to associate it with. (We could have a shared
|
|
187
|
+
* `lastError` node but it would be so noisy as to not provide much info
|
|
188
|
+
* to the end user.)
|
|
169
189
|
*
|
|
170
|
-
* Once the owner is known, this calls handleBridgeAction which ensures
|
|
171
|
-
* are published in the owner wallet's vstorage path.
|
|
190
|
+
* Once the owner is known, this calls handleBridgeAction which ensures
|
|
191
|
+
* that all errors are published in the owner wallet's vstorage path.
|
|
172
192
|
*
|
|
173
|
-
* @param {import('./types.js').WalletBridgeMsg} obj validated by
|
|
193
|
+
* @param {import('./types.js').WalletBridgeMsg} obj validated by
|
|
194
|
+
* shape.WalletBridgeMsg
|
|
174
195
|
* @returns {Promise<void>}
|
|
175
196
|
*/
|
|
176
197
|
fromBridge: async obj => {
|
|
@@ -231,6 +252,7 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
231
252
|
|
|
232
253
|
/**
|
|
233
254
|
* Holders of this object:
|
|
255
|
+
*
|
|
234
256
|
* - vat (transitively from holding the wallet factory)
|
|
235
257
|
* - wallet-ui (which has key material; dapps use wallet-ui to propose actions)
|
|
236
258
|
*/
|
|
@@ -249,16 +271,22 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
249
271
|
{
|
|
250
272
|
/**
|
|
251
273
|
* @param {string} address
|
|
252
|
-
* @param {ERef<import('@agoric/vats/src/vat-bank').Bank>} bank
|
|
253
|
-
* @param {ERef<import('@agoric/vats/').NameAdmin>} namesByAddressAdmin
|
|
254
|
-
* @returns {Promise<
|
|
255
|
-
*
|
|
256
|
-
*
|
|
274
|
+
* @param {ERef<import('@agoric/vats/src/vat-bank.js').Bank>} bank
|
|
275
|
+
* @param {ERef<import('@agoric/vats/src/types.js').NameAdmin>} namesByAddressAdmin
|
|
276
|
+
* @returns {Promise<
|
|
277
|
+
* [wallet: import('./smartWallet.js').SmartWallet, isNew: boolean]
|
|
278
|
+
* >}
|
|
279
|
+
* wallet along with a flag to distinguish between looking up an existing
|
|
280
|
+
* wallet and creating a new one.
|
|
257
281
|
*/
|
|
258
282
|
provideSmartWallet(address, bank, namesByAddressAdmin) {
|
|
259
283
|
let isNew = false;
|
|
260
284
|
|
|
261
|
-
/**
|
|
285
|
+
/**
|
|
286
|
+
* @type {(
|
|
287
|
+
* address: string,
|
|
288
|
+
* ) => Promise<import('./smartWallet.js').SmartWallet>}
|
|
289
|
+
*/
|
|
262
290
|
const maker = async _address => {
|
|
263
291
|
const invitationPurse = await E(invitationIssuer).makeEmptyPurse();
|
|
264
292
|
const walletStorageNode = E(storageNode).makeChildNode(address);
|
|
@@ -292,7 +320,6 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
292
320
|
if (walletBridgeManager) {
|
|
293
321
|
// NB: may not be in service when creatorFacet is used, or ever
|
|
294
322
|
// It can't be awaited because that fails vat restart
|
|
295
|
-
const upgrading = baggage.has('walletsByAddress');
|
|
296
323
|
if (upgrading) {
|
|
297
324
|
void E(walletBridgeManager).setHandler(handleWalletAction);
|
|
298
325
|
} else {
|
package/CHANGELOG.md
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
### [0.5.4-u11.0](https://github.com/Agoric/agoric/compare/@agoric/smart-wallet@0.5.3...@agoric/smart-wallet@0.5.4-u11.0) (2023-08-24)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @agoric/smart-wallet
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
### [0.5.3](https://github.com/Agoric/agoric/compare/@agoric/smart-wallet@0.5.2...@agoric/smart-wallet@0.5.3) (2023-06-09)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @agoric/smart-wallet
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
### [0.5.2](https://github.com/Agoric/agoric/compare/@agoric/smart-wallet@0.5.1...@agoric/smart-wallet@0.5.2) (2023-06-02)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @agoric/smart-wallet
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### [0.5.1](https://github.com/Agoric/agoric/compare/@agoric/smart-wallet@0.5.0...@agoric/smart-wallet@0.5.1) (2023-05-24)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @agoric/smart-wallet
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## [0.5.0](https://github.com/Agoric/agoric/compare/@agoric/smart-wallet@0.4.2...@agoric/smart-wallet@0.5.0) (2023-05-19)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
### ⚠ BREAKING CHANGES
|
|
42
|
-
|
|
43
|
-
* emit smallcaps-format data in all marshallers
|
|
44
|
-
* move PublicTopic to Zoe contractSupport
|
|
45
|
-
* **wallet:** reject executeOffer on failure
|
|
46
|
-
* storage paths by getPublicTopics
|
|
47
|
-
* rename 'fit' to 'mustMatch'
|
|
48
|
-
|
|
49
|
-
### Features
|
|
50
|
-
|
|
51
|
-
* emit smallcaps-format data in all marshallers ([1753df8](https://github.com/Agoric/agoric/commit/1753df83465785b5ee71b250770c9b012d750ffc)), closes [#6822](https://github.com/Agoric/agoric/issues/6822)
|
|
52
|
-
* **board-utils:** BoardRemote like Remotables ([3aa44de](https://github.com/Agoric/agoric/commit/3aa44debbdc955892611ba870478fb088395cf10))
|
|
53
|
-
* **smartWallet:** fail early on offerId re-use ([08307e0](https://github.com/Agoric/agoric/commit/08307e01a6c9a3d53144df55f52e03f8f9df2a78))
|
|
54
|
-
* Add incarnation number to the transcript store records ([5d64be7](https://github.com/Agoric/agoric/commit/5d64be7aa1fd222822b145240f541f5eabb01c43)), closes [#7482](https://github.com/Agoric/agoric/issues/7482)
|
|
55
|
-
* **contractSupport:** provideAll takes thunks ([f35034b](https://github.com/Agoric/agoric/commit/f35034b13b99dbfb8d472816644e09f9b4f2be3a))
|
|
56
|
-
* **contractSupport:** providePublicTopic ([5bdb71e](https://github.com/Agoric/agoric/commit/5bdb71e1af9ecde163322612de3e648fd75d7a47))
|
|
57
|
-
* **smart-wallet:** exit offer ([7323023](https://github.com/Agoric/agoric/commit/7323023308aa40c145e60093b7fc52580534cd2d))
|
|
58
|
-
* **smart-wallet:** preserve existing `myAddressNameAdmin` ([8f283af](https://github.com/Agoric/agoric/commit/8f283aff0fc7b6146e9b6393c158cd9ca15f31f9))
|
|
59
|
-
* **smart-wallet:** publish pending offers before completion ([c913b36](https://github.com/Agoric/agoric/commit/c913b36950be1d2ae1b16d16bfcfc8df32305e0c))
|
|
60
|
-
* **smart-wallet:** publish possibly exitable offers ([de0170a](https://github.com/Agoric/agoric/commit/de0170add5bd4c82cbef23431bffaa95f7007880))
|
|
61
|
-
* **topics:** makePublicTopic ([c8b464c](https://github.com/Agoric/agoric/commit/c8b464c26c53535097e4df573e126c81e00e5aa6))
|
|
62
|
-
* **vats:** Scoped bridge managers ([11f6429](https://github.com/Agoric/agoric/commit/11f64298d8529cca249d2933894236dc534dfe3e))
|
|
63
|
-
* **wallet:** executeOffer throw errors ([224dbca](https://github.com/Agoric/agoric/commit/224dbca918343608d53f691a448171c8a48d283e))
|
|
64
|
-
* **wallet:** record bridge errors to vstorage ([f8581e9](https://github.com/Agoric/agoric/commit/f8581e95311f7cb4105f6d81f0ac7b6a9121b68f))
|
|
65
|
-
* **wallet:** reject executeOffer on failure ([308caab](https://github.com/Agoric/agoric/commit/308caab24c1680c2c7910eff8128f9089dedf26d))
|
|
66
|
-
* **walletFactory:** more durability ([7e6c98d](https://github.com/Agoric/agoric/commit/7e6c98d4a448eb94de98c865bc8280534bd5069f))
|
|
67
|
-
* **walletFactory:** upgradable ([ca30e05](https://github.com/Agoric/agoric/commit/ca30e05988fae00f437b5708dbabe061742797f1))
|
|
68
|
-
* agoricContract invitation getter ([ca6166f](https://github.com/Agoric/agoric/commit/ca6166f94a934811f698631f9ce1dd2a32ad422c))
|
|
69
|
-
* allow string for offer id, leave uniqueness to client ([7856e56](https://github.com/Agoric/agoric/commit/7856e5635ba04671da17334080dad061a8f9fc15))
|
|
70
|
-
* boot-oracles ([ce8f8de](https://github.com/Agoric/agoric/commit/ce8f8de65ad4c14b4e8d699cd721683cfa1cc495))
|
|
71
|
-
* durable smart wallet ([6977f73](https://github.com/Agoric/agoric/commit/6977f73f820a9345ef49f4f18095a5c88af06729))
|
|
72
|
-
* fixed heap for getPublicTopics ([1886c3a](https://github.com/Agoric/agoric/commit/1886c3af2319b9540faa318cf6179d4d01eec084))
|
|
73
|
-
* storage paths by getPublicTopics ([40a8624](https://github.com/Agoric/agoric/commit/40a8624240f241a686c28bd7d7c7ef1ef780f984))
|
|
74
|
-
* support TopicsRecord ([8618461](https://github.com/Agoric/agoric/commit/8618461781fe11f28e6b891a4d31ebfd9dda5e0d))
|
|
75
|
-
* track publicSubscribers ([30cae51](https://github.com/Agoric/agoric/commit/30cae513a624a74f2df05b668f4eaa02d6d13656))
|
|
76
|
-
* vaults list command ([894c92f](https://github.com/Agoric/agoric/commit/894c92f9ee6331aba43aaeebd6c007dd03d53996))
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
### Bug Fixes
|
|
80
|
-
|
|
81
|
-
* handle {} wallet update records ([c7dbccb](https://github.com/Agoric/agoric/commit/c7dbccbad2d2007af398c31c94f68793fe4e8504))
|
|
82
|
-
* **cli:** dont blow up from old wallet updates ([ac5a28e](https://github.com/Agoric/agoric/commit/ac5a28e9e47916b0d3ba7978d90067a757470be3))
|
|
83
|
-
* **walletFactory:** handle restartContract ([f8b7200](https://github.com/Agoric/agoric/commit/f8b720014c2987301a67d073348b80fc1d30d756))
|
|
84
|
-
* Improve the smart wallet revival handshake ([69ec2e7](https://github.com/Agoric/agoric/commit/69ec2e76f06cf87454d087adfa2ef6c2adcea8a0))
|
|
85
|
-
* **vats:** Extract revivable wallet addresses from the correct chain storage path ([2454d3f](https://github.com/Agoric/agoric/commit/2454d3f48eefb2bdea5a0d03a250d8a5a74b0ba3))
|
|
86
|
-
* add missing facet interface ([d16bc2e](https://github.com/Agoric/agoric/commit/d16bc2e121810c8c432519028e4382146b066956))
|
|
87
|
-
* bootstrap handles BundleIDs, not full bundles ([de8b0f5](https://github.com/Agoric/agoric/commit/de8b0f5d35e0938fa00d795d11cfad3acadd9428)), closes [#6826](https://github.com/Agoric/agoric/issues/6826) [#4374](https://github.com/Agoric/agoric/issues/4374)
|
|
88
|
-
* number/string inconsistency with offer lookup ([59abbdb](https://github.com/Agoric/agoric/commit/59abbdb0a6498333ec48e971347076f7739c9b84))
|
|
89
|
-
* Preserve smart wallets through bulldozer upgrade ([160bf6c](https://github.com/Agoric/agoric/commit/160bf6cad0bbdfe6a245f6b7a8e260d244c44f21)), closes [#7537](https://github.com/Agoric/agoric/issues/7537)
|
|
90
|
-
* use `subscribeEach` to get reconnect benefits ([fb24132](https://github.com/Agoric/agoric/commit/fb24132f9b4e117e56bae2803994e57c188344f3))
|
|
91
|
-
* **wallet:** pipeTopicToStorage with Recorder kit ([31b79b7](https://github.com/Agoric/agoric/commit/31b79b71eda59b62d3bacd7ca648b53b9385afc0))
|
|
92
|
-
* **wallet:** recording handleBridgeAction errors ([8e64158](https://github.com/Agoric/agoric/commit/8e6415872dafc1cd5def9c038d673842464b316b))
|
|
93
|
-
* multiple deposits of unknown brand ([6ef6062](https://github.com/Agoric/agoric/commit/6ef6062a4b69b0d44b18dc576021bbbaf372b3b2))
|
|
94
|
-
* purse making (use vbank) ([9175882](https://github.com/Agoric/agoric/commit/91758824848ea24f5cd4cae5eaadf88169b80e39))
|
|
95
|
-
* race in watchPurse to update balance ([51869c1](https://github.com/Agoric/agoric/commit/51869c1ffce90350cbaed84b5f92fa05c3473f3e))
|
|
96
|
-
* rename from FarClass to ExoClass, etc ([#6323](https://github.com/Agoric/agoric/issues/6323)) ([da96c7c](https://github.com/Agoric/agoric/commit/da96c7c3c902a5e266baeedf23df02481f2e9c9d))
|
|
97
|
-
* **smart-wallet:** create purses for new assets lazily ([e241ba0](https://github.com/Agoric/agoric/commit/e241ba03a7d9f441436b3d987f9327060d7dd8ce))
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
### Miscellaneous Chores
|
|
101
|
-
|
|
102
|
-
* rename 'fit' to 'mustMatch' ([9fa3232](https://github.com/Agoric/agoric/commit/9fa32324f84bfb85de9e99e0c9ad277b8017b50e)), closes [#6844](https://github.com/Agoric/agoric/issues/6844)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
### Code Refactoring
|
|
106
|
-
|
|
107
|
-
* move PublicTopic to Zoe contractSupport ([c51ea3d](https://github.com/Agoric/agoric/commit/c51ea3de22f50e05fcc1aaabd2108e785d51eb2e))
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
### [0.4.4](https://github.com/Agoric/agoric/compare/@agoric/smart-wallet@0.4.3...@agoric/smart-wallet@0.4.4) (2023-02-17)
|
|
112
|
-
|
|
113
|
-
**Note:** Version bump only for package @agoric/smart-wallet
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
### [0.4.3](https://github.com/Agoric/agoric/compare/@agoric/smart-wallet@0.4.2...@agoric/smart-wallet@0.4.3) (2022-12-14)
|
|
120
|
-
|
|
121
|
-
**Note:** Version bump only for package @agoric/smart-wallet
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
### [0.4.2](https://github.com/Agoric/agoric/compare/@agoric/smart-wallet@0.4.1...@agoric/smart-wallet@0.4.2) (2022-10-18)
|
|
128
|
-
|
|
129
|
-
**Note:** Version bump only for package @agoric/smart-wallet
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
### [0.4.1](https://github.com/Agoric/agoric/compare/@agoric/smart-wallet@0.4.0...@agoric/smart-wallet@0.4.1) (2022-10-08)
|
|
136
|
-
|
|
137
|
-
**Note:** Version bump only for package @agoric/smart-wallet
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
## [0.4.0](https://github.com/Agoric/agoric/compare/@agoric/smart-wallet@0.3.0...@agoric/smart-wallet@0.4.0) (2022-10-05)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
### Features
|
|
147
|
-
|
|
148
|
-
* **cli:** use new wallet.current node ([71effe7](https://github.com/Agoric/agoric/commit/71effe758c28181b8709ae4ccf025fcec7bb8a38))
|
|
149
|
-
* track consumed invitation amounts ([e9e3c35](https://github.com/Agoric/agoric/commit/e9e3c35cebdc85e80fb2eaa117ff0be00d26c9bb))
|
|
150
|
-
* **cli:** show status of invitations ([8506e6d](https://github.com/Agoric/agoric/commit/8506e6d87ef331e781c9d2e2251fdcf48e784e04))
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
### Bug Fixes
|
|
154
|
-
|
|
155
|
-
* **vats:** handle duplicate provision requests ([#6307](https://github.com/Agoric/agoric/issues/6307)) ([05d405d](https://github.com/Agoric/agoric/commit/05d405d5409e1f80612bb002234f5a9c3910a7df))
|
|
156
|
-
* **wallet-ui:** detect unprovisioned wallet ([1747d57](https://github.com/Agoric/agoric/commit/1747d5781f4ee594eca1ded76af4944c405e7000))
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
## 0.3.0 (2022-09-20)
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
### Features
|
|
164
|
-
|
|
165
|
-
* **wallet:** more diagnostics for invitation match ([98630ee](https://github.com/Agoric/agoric/commit/98630ee96a202cf3907e37b5d4d549bb37b1263d))
|
|
166
|
-
* **wallet-ui:** start displaying balances ([0f36da9](https://github.com/Agoric/agoric/commit/0f36da99daef86f24670d606ae5fd1adb32b419b))
|
|
167
|
-
* ensure voting via PSMCharter works with a unit test ([#6167](https://github.com/Agoric/agoric/issues/6167)) ([ff9471b](https://github.com/Agoric/agoric/commit/ff9471bf3a90ffab050e8b659d64d4cbd7c2d764))
|
|
168
|
-
* **smart-wallet:** include lastOfferId in error ([932cb7d](https://github.com/Agoric/agoric/commit/932cb7d90b8e281f0922d0b38287230aabd6f535))
|
|
169
|
-
* **smartWallet:** defer deposits until purse available ([#6172](https://github.com/Agoric/agoric/issues/6172)) ([1a1cc41](https://github.com/Agoric/agoric/commit/1a1cc41d421760563892212e1ca3df237a7a6661))
|
|
170
|
-
* **smartWallet:** virtual objects ([659ad58](https://github.com/Agoric/agoric/commit/659ad58349f972881a540d78ec5d856872dacc7d))
|
|
171
|
-
* distribute PSM Charter Invitatitons ([#6166](https://github.com/Agoric/agoric/issues/6166)) ([50cd3e2](https://github.com/Agoric/agoric/commit/50cd3e240fb33079948fa03b32bda86276879b4a))
|
|
172
|
-
* new Smart Wallet ([708972f](https://github.com/Agoric/agoric/commit/708972f1f531c9ea5e346f833c6d253efe80f837))
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
### Bug Fixes
|
|
176
|
-
|
|
177
|
-
* **smart-wallet:** invitation brand is remote ([6613136](https://github.com/Agoric/agoric/commit/66131366f563ebfefbeabeecffda43211a093d1e))
|
|
178
|
-
* **smart-wallet:** not yet durable-able ([db66c2c](https://github.com/Agoric/agoric/commit/db66c2c13de92f2a0783bcaf174223691ab0a339))
|
|
179
|
-
* Fix test failures in packages other than "vats" ([364815b](https://github.com/Agoric/agoric/commit/364815b88429e3443734681b5b0771b7d824ebe8))
|
|
180
|
-
* two corrections we found by demoing on 6084 ([#6155](https://github.com/Agoric/agoric/issues/6155)) ([88b1067](https://github.com/Agoric/agoric/commit/88b10676b9617e662fed38df61ab3210df07c602))
|
package/src/payments.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export function makePaymentsHelper(purseForBrand: (brand: Brand) => Promise<import('./types').RemotePurse>, depositFacet: {
|
|
2
|
-
receive: (payment: any) => Promise<Amount>;
|
|
3
|
-
}): {
|
|
4
|
-
/**
|
|
5
|
-
* @param {AmountKeywordRecord} give
|
|
6
|
-
* @returns {PaymentPKeywordRecord}
|
|
7
|
-
*/
|
|
8
|
-
withdrawGive(give: AmountKeywordRecord): PaymentPKeywordRecord;
|
|
9
|
-
/**
|
|
10
|
-
* Try reclaiming any of our payments that we successfully withdrew, but
|
|
11
|
-
* were left unclaimed.
|
|
12
|
-
*/
|
|
13
|
-
tryReclaimingWithdrawnPayments(): Promise<undefined> | Promise<PromiseSettledResult<Amount<unknown> | undefined>[]>;
|
|
14
|
-
/**
|
|
15
|
-
* @param {PaymentPKeywordRecord} payouts
|
|
16
|
-
* @returns {Promise<AmountKeywordRecord>} amounts for deferred deposits will be empty
|
|
17
|
-
*/
|
|
18
|
-
depositPayouts(payouts: PaymentPKeywordRecord): Promise<AmountKeywordRecord>;
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=payments.d.ts.map
|
package/src/payments.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["payments.js"],"names":[],"mappings":"AAUO,0DAHY,KAAK,KAAK,QAAQ,OAAO,SAAS,EAAE,WAAW,CAAC;+BAC7B,QAAQ,MAAM,CAAC;;IAcjD;;;OAGG;uBAFQ,mBAAmB,GACjB,qBAAqB;IAkBlC;;;OAGG;;IA8BH;;;OAGG;4BAFQ,qBAAqB,GACnB,QAAQ,mBAAmB,CAAC;EAU5C"}
|
package/src/payments.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Fail } from '@agoric/assert';
|
|
2
|
-
import { deeplyFulfilledObject, objectMap } from '@agoric/internal';
|
|
3
|
-
import { E } from '@endo/far';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Used in an offer execution to manage payments state safely.
|
|
7
|
-
*
|
|
8
|
-
* @param {(brand: Brand) => Promise<import('./types').RemotePurse>} purseForBrand
|
|
9
|
-
* @param {{ receive: (payment: *) => Promise<Amount> }} depositFacet
|
|
10
|
-
*/
|
|
11
|
-
export const makePaymentsHelper = (purseForBrand, depositFacet) => {
|
|
12
|
-
/** @type {PaymentPKeywordRecord | null} */
|
|
13
|
-
let keywordPaymentPromises = null;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Tracks from whence our payment came.
|
|
17
|
-
*
|
|
18
|
-
* @type {Map<Payment, import('./types').RemotePurse>}
|
|
19
|
-
*/
|
|
20
|
-
const paymentToPurse = new Map();
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
/**
|
|
24
|
-
* @param {AmountKeywordRecord} give
|
|
25
|
-
* @returns {PaymentPKeywordRecord}
|
|
26
|
-
*/
|
|
27
|
-
withdrawGive(give) {
|
|
28
|
-
!keywordPaymentPromises ||
|
|
29
|
-
Fail`withdrawPayments can be called once per helper`;
|
|
30
|
-
keywordPaymentPromises = objectMap(give, amount => {
|
|
31
|
-
/** @type {Promise<import('./types').RemotePurse<any>>} */
|
|
32
|
-
const purseP = purseForBrand(amount.brand);
|
|
33
|
-
return Promise.all([purseP, E(purseP).withdraw(amount)]).then(
|
|
34
|
-
([purse, payment]) => {
|
|
35
|
-
paymentToPurse.set(payment, purse);
|
|
36
|
-
return payment;
|
|
37
|
-
},
|
|
38
|
-
);
|
|
39
|
-
});
|
|
40
|
-
return keywordPaymentPromises;
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Try reclaiming any of our payments that we successfully withdrew, but
|
|
45
|
-
* were left unclaimed.
|
|
46
|
-
*/
|
|
47
|
-
tryReclaimingWithdrawnPayments() {
|
|
48
|
-
if (!keywordPaymentPromises) return Promise.resolve(undefined);
|
|
49
|
-
const paymentPromises = Object.values(keywordPaymentPromises);
|
|
50
|
-
// Use allSettled to ensure we attempt all the deposits, regardless of
|
|
51
|
-
// individual rejections.
|
|
52
|
-
return Promise.allSettled(
|
|
53
|
-
paymentPromises.map(async paymentP => {
|
|
54
|
-
// Wait for the withdrawal to complete. This protects against a race
|
|
55
|
-
// when updating paymentToPurse.
|
|
56
|
-
const payment = await paymentP;
|
|
57
|
-
|
|
58
|
-
// Find out where it came from.
|
|
59
|
-
const purse = paymentToPurse.get(payment);
|
|
60
|
-
if (purse === undefined) {
|
|
61
|
-
// We already tried to reclaim this payment, so stop here.
|
|
62
|
-
return undefined;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Now send it back to the purse.
|
|
66
|
-
try {
|
|
67
|
-
return E(purse).deposit(payment);
|
|
68
|
-
} finally {
|
|
69
|
-
// Once we've called addPayment, mark this one as done.
|
|
70
|
-
paymentToPurse.delete(payment);
|
|
71
|
-
}
|
|
72
|
-
}),
|
|
73
|
-
);
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* @param {PaymentPKeywordRecord} payouts
|
|
78
|
-
* @returns {Promise<AmountKeywordRecord>} amounts for deferred deposits will be empty
|
|
79
|
-
*/
|
|
80
|
-
async depositPayouts(payouts) {
|
|
81
|
-
/** Record<string, Promise<Amount>> */
|
|
82
|
-
const amountPKeywordRecord = objectMap(payouts, paymentRef =>
|
|
83
|
-
E.when(paymentRef, payment => depositFacet.receive(payment)),
|
|
84
|
-
);
|
|
85
|
-
return deeplyFulfilledObject(amountPKeywordRecord);
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
harden(makePaymentsHelper);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export function upgradeWalletFactory({ consume: { contractKits: kitsP, instancePrivateArgs: argsP }, instance: { consume: { walletFactory: wfInstanceP }, }, }: 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":"AAoBO,gKALK,eAAe;;0BAGI,YAAY,GAAG;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE;;kBA6BjE;AAMM,mGAFK,eAAe,iBAwB1B;AAsBM;;;;;;;EAKN"}
|