@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.
- package/package.json +35 -26
- package/src/index.d.ts +2 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +2 -0
- package/src/invitations.d.ts +14 -10
- package/src/invitations.d.ts.map +1 -1
- package/src/invitations.js +35 -32
- package/src/marshal-contexts.d.ts +44 -41
- package/src/marshal-contexts.d.ts.map +1 -1
- package/src/marshal-contexts.js +68 -61
- package/src/offerWatcher.d.ts +52 -0
- package/src/offerWatcher.d.ts.map +1 -0
- package/src/offerWatcher.js +329 -0
- package/src/offers.d.ts +7 -31
- package/src/offers.d.ts.map +1 -1
- package/src/offers.js +9 -183
- 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 +60 -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 +46 -23
- package/src/smartWallet.d.ts +101 -66
- package/src/smartWallet.d.ts.map +1 -1
- package/src/smartWallet.js +576 -216
- package/src/typeGuards.d.ts +1 -1
- package/src/types-index.d.ts +2 -0
- package/src/types-index.js +2 -0
- package/src/types.d.ts +35 -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 +61 -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/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,8 @@ import { E } from '@endo/far';
|
|
|
14
17
|
import { prepareSmartWallet } from './smartWallet.js';
|
|
15
18
|
import { shape } from './typeGuards.js';
|
|
16
19
|
|
|
20
|
+
/** @import {NameHub} from '@agoric/vats'; */
|
|
21
|
+
|
|
17
22
|
const trace = makeTracer('WltFct');
|
|
18
23
|
|
|
19
24
|
export const customTermsShape = harden({
|
|
@@ -29,6 +34,8 @@ export const privateArgsShape = harden(
|
|
|
29
34
|
),
|
|
30
35
|
);
|
|
31
36
|
|
|
37
|
+
const WALLETS_BY_ADDRESS = 'walletsByAddress';
|
|
38
|
+
|
|
32
39
|
/**
|
|
33
40
|
* Provide a NameHub for this address and insert depositFacet only if not
|
|
34
41
|
* already done.
|
|
@@ -56,8 +63,8 @@ export const publishDepositFacet = async (
|
|
|
56
63
|
* Make a registry for use by the wallet instances.
|
|
57
64
|
*
|
|
58
65
|
* 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.
|
|
66
|
+
* "pinned" topic and call to getAssetSubscription gets a fresh stream of all
|
|
67
|
+
* the assets that it knows of.
|
|
61
68
|
*
|
|
62
69
|
* @param {AssetPublisher} assetPublisher
|
|
63
70
|
*/
|
|
@@ -65,12 +72,13 @@ export const makeAssetRegistry = assetPublisher => {
|
|
|
65
72
|
trace('makeAssetRegistry', assetPublisher);
|
|
66
73
|
/**
|
|
67
74
|
* @typedef {{
|
|
68
|
-
* brand: Brand
|
|
69
|
-
* displayInfo: DisplayInfo
|
|
70
|
-
* issuer: Issuer
|
|
71
|
-
* petname: import('./types').Petname
|
|
75
|
+
* brand: Brand;
|
|
76
|
+
* displayInfo: DisplayInfo;
|
|
77
|
+
* issuer: Issuer;
|
|
78
|
+
* petname: import('./types.js').Petname;
|
|
72
79
|
* }} BrandDescriptor
|
|
73
|
-
*
|
|
80
|
+
* For use by clients to describe brands to users. Includes `displayInfo` to
|
|
81
|
+
* save a remote call.
|
|
74
82
|
*/
|
|
75
83
|
/** @type {MapStore<Brand, BrandDescriptor>} */
|
|
76
84
|
const brandDescriptors = makeScalarMapStore();
|
|
@@ -110,45 +118,52 @@ export const makeAssetRegistry = assetPublisher => {
|
|
|
110
118
|
|
|
111
119
|
/**
|
|
112
120
|
* @typedef {{
|
|
113
|
-
* agoricNames: ERef<NameHub
|
|
114
|
-
* board: ERef<import('@agoric/vats').Board
|
|
115
|
-
* assetPublisher: AssetPublisher
|
|
121
|
+
* agoricNames: ERef<NameHub>;
|
|
122
|
+
* board: ERef<import('@agoric/vats').Board>;
|
|
123
|
+
* assetPublisher: AssetPublisher;
|
|
116
124
|
* }} SmartWalletContractTerms
|
|
117
125
|
*
|
|
118
|
-
* @typedef {import('@agoric/vats').NameHub} NameHub
|
|
119
126
|
*
|
|
120
127
|
* @typedef {{
|
|
121
128
|
* getAssetSubscription: () => ERef<
|
|
122
|
-
* IterableEachTopic<import('@agoric/vats/src/vat-bank').AssetDescriptor
|
|
129
|
+
* IterableEachTopic<import('@agoric/vats/src/vat-bank.js').AssetDescriptor>
|
|
130
|
+
* >;
|
|
123
131
|
* }} AssetPublisher
|
|
124
132
|
*
|
|
125
|
-
*
|
|
133
|
+
*
|
|
134
|
+
* @typedef {boolean} IsRevive
|
|
135
|
+
*
|
|
126
136
|
* @typedef {{
|
|
127
|
-
* reviveWallet: (
|
|
128
|
-
*
|
|
137
|
+
* reviveWallet: (
|
|
138
|
+
* address: string,
|
|
139
|
+
* ) => Promise<import('./smartWallet.js').SmartWallet>;
|
|
140
|
+
* ackWallet: (address: string) => IsRevive;
|
|
129
141
|
* }} WalletReviver
|
|
130
142
|
*/
|
|
131
143
|
|
|
132
|
-
// NB: even though all the wallets share this contract,
|
|
144
|
+
// NB: even though all the wallets share this contract,
|
|
133
145
|
// 1. they should not rely on that; they may be partitioned later
|
|
134
146
|
// 2. they should never be able to detect behaviors from another wallet
|
|
135
147
|
/**
|
|
136
148
|
* @param {ZCF<SmartWalletContractTerms>} zcf
|
|
137
149
|
* @param {{
|
|
138
|
-
* storageNode: ERef<StorageNode
|
|
139
|
-
* walletBridgeManager?: ERef<
|
|
140
|
-
*
|
|
150
|
+
* storageNode: ERef<StorageNode>;
|
|
151
|
+
* walletBridgeManager?: ERef<
|
|
152
|
+
* import('@agoric/vats').ScopedBridgeManager<'wallet'>
|
|
153
|
+
* >;
|
|
154
|
+
* walletReviver?: ERef<WalletReviver>;
|
|
141
155
|
* }} privateArgs
|
|
142
156
|
* @param {import('@agoric/vat-data').Baggage} baggage
|
|
143
157
|
*/
|
|
144
158
|
export const prepare = async (zcf, privateArgs, baggage) => {
|
|
159
|
+
const upgrading = baggage.has(WALLETS_BY_ADDRESS);
|
|
145
160
|
const { agoricNames, board, assetPublisher } = zcf.getTerms();
|
|
146
161
|
|
|
147
162
|
const zoe = zcf.getZoeService();
|
|
148
163
|
const { storageNode, walletBridgeManager, walletReviver } = privateArgs;
|
|
149
164
|
|
|
150
165
|
/** @type {MapStore<string, import('./smartWallet.js').SmartWallet>} */
|
|
151
|
-
const walletsByAddress = provideDurableMapStore(baggage,
|
|
166
|
+
const walletsByAddress = provideDurableMapStore(baggage, WALLETS_BY_ADDRESS);
|
|
152
167
|
const provider = makeAtomicProvider(walletsByAddress);
|
|
153
168
|
|
|
154
169
|
const handleWalletAction = makeExo(
|
|
@@ -160,17 +175,20 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
160
175
|
/**
|
|
161
176
|
* Designed to be called by the bridgeManager vat.
|
|
162
177
|
*
|
|
163
|
-
* If this errors before calling handleBridgeAction(), the failure will
|
|
164
|
-
* promise does reject, but as of now bridge
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
178
|
+
* If this errors before calling handleBridgeAction(), the failure will
|
|
179
|
+
* not be observable. The promise does reject, but as of now bridge
|
|
180
|
+
* manager drops instead of handling it. Eventually we'll make the bridge
|
|
181
|
+
* able to give feedback about the requesting transaction. Meanwhile we
|
|
182
|
+
* could write the error to chainStorage but we don't have a guarantee of
|
|
183
|
+
* the wallet owner to associate it with. (We could have a shared
|
|
184
|
+
* `lastError` node but it would be so noisy as to not provide much info
|
|
185
|
+
* to the end user.)
|
|
169
186
|
*
|
|
170
|
-
* Once the owner is known, this calls handleBridgeAction which ensures
|
|
171
|
-
* are published in the owner wallet's vstorage path.
|
|
187
|
+
* Once the owner is known, this calls handleBridgeAction which ensures
|
|
188
|
+
* that all errors are published in the owner wallet's vstorage path.
|
|
172
189
|
*
|
|
173
|
-
* @param {import('./types.js').WalletBridgeMsg} obj validated by
|
|
190
|
+
* @param {import('./types.js').WalletBridgeMsg} obj validated by
|
|
191
|
+
* shape.WalletBridgeMsg
|
|
174
192
|
* @returns {Promise<void>}
|
|
175
193
|
*/
|
|
176
194
|
fromBridge: async obj => {
|
|
@@ -231,6 +249,7 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
231
249
|
|
|
232
250
|
/**
|
|
233
251
|
* Holders of this object:
|
|
252
|
+
*
|
|
234
253
|
* - vat (transitively from holding the wallet factory)
|
|
235
254
|
* - wallet-ui (which has key material; dapps use wallet-ui to propose actions)
|
|
236
255
|
*/
|
|
@@ -249,16 +268,22 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
249
268
|
{
|
|
250
269
|
/**
|
|
251
270
|
* @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
|
-
*
|
|
271
|
+
* @param {ERef<import('@agoric/vats/src/vat-bank.js').Bank>} bank
|
|
272
|
+
* @param {ERef<import('@agoric/vats/src/types.js').NameAdmin>} namesByAddressAdmin
|
|
273
|
+
* @returns {Promise<
|
|
274
|
+
* [wallet: import('./smartWallet.js').SmartWallet, isNew: boolean]
|
|
275
|
+
* >}
|
|
276
|
+
* wallet along with a flag to distinguish between looking up an existing
|
|
277
|
+
* wallet and creating a new one.
|
|
257
278
|
*/
|
|
258
279
|
provideSmartWallet(address, bank, namesByAddressAdmin) {
|
|
259
280
|
let isNew = false;
|
|
260
281
|
|
|
261
|
-
/**
|
|
282
|
+
/**
|
|
283
|
+
* @type {(
|
|
284
|
+
* address: string,
|
|
285
|
+
* ) => Promise<import('./smartWallet.js').SmartWallet>}
|
|
286
|
+
*/
|
|
262
287
|
const maker = async _address => {
|
|
263
288
|
const invitationPurse = await E(invitationIssuer).makeEmptyPurse();
|
|
264
289
|
const walletStorageNode = E(storageNode).makeChildNode(address);
|
|
@@ -292,7 +317,6 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
292
317
|
if (walletBridgeManager) {
|
|
293
318
|
// NB: may not be in service when creatorFacet is used, or ever
|
|
294
319
|
// It can't be awaited because that fails vat restart
|
|
295
|
-
const upgrading = baggage.has('walletsByAddress');
|
|
296
320
|
if (upgrading) {
|
|
297
321
|
void E(walletBridgeManager).setHandler(handleWalletAction);
|
|
298
322
|
} 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);
|