@agoric/smart-wallet 0.5.4-dev-eb7e9eb.0 → 0.5.4-u11.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 +180 -0
- package/package.json +23 -25
- package/src/invitations.d.ts +1 -1
- package/src/invitations.d.ts.map +1 -1
- package/src/invitations.js +1 -1
- package/src/offers.d.ts +2 -2
- package/src/offers.d.ts.map +1 -1
- package/src/offers.js +7 -7
- package/src/payments.d.ts +2 -2
- package/src/payments.d.ts.map +1 -1
- package/src/payments.js +3 -3
- package/src/smartWallet.d.ts +9 -13
- package/src/smartWallet.d.ts.map +1 -1
- package/src/smartWallet.js +25 -166
- package/src/typeGuards.d.ts +1 -1
- package/src/types.d.ts +5 -14
- package/src/walletFactory.d.ts +10 -6
- package/src/walletFactory.d.ts.map +1 -1
- package/src/walletFactory.js +10 -13
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
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/package.json
CHANGED
|
@@ -1,44 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/smart-wallet",
|
|
3
|
-
"version": "0.5.4-
|
|
3
|
+
"version": "0.5.4-u11.0",
|
|
4
4
|
"description": "Wallet contract",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "yarn build:bundles",
|
|
8
8
|
"build:bundles": "node ./scripts/build-bundles.js",
|
|
9
|
-
"prepack": "tsc --build
|
|
9
|
+
"prepack": "tsc --build jsconfig.build.json",
|
|
10
10
|
"postpack": "git clean -f '*.d.ts*'",
|
|
11
11
|
"test": "ava",
|
|
12
12
|
"test:xs": "exit 0",
|
|
13
13
|
"lint": "run-s --continue-on-error lint:*",
|
|
14
14
|
"lint-fix": "yarn lint:eslint --fix",
|
|
15
|
-
"lint:types": "tsc",
|
|
15
|
+
"lint:types": "tsc -p jsconfig.json",
|
|
16
16
|
"lint:eslint": "eslint ."
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@agoric/cosmic-proto": "0.3.
|
|
20
|
-
"@endo/
|
|
21
|
-
"@endo/
|
|
22
|
-
"
|
|
23
|
-
"ava": "^5.3.0",
|
|
24
|
-
"import-meta-resolve": "^2.2.1"
|
|
19
|
+
"@agoric/cosmic-proto": "^0.3.0",
|
|
20
|
+
"@endo/captp": "^3.1.1",
|
|
21
|
+
"@endo/init": "^0.5.56",
|
|
22
|
+
"ava": "^5.2.0"
|
|
25
23
|
},
|
|
26
24
|
"dependencies": {
|
|
27
|
-
"@agoric/assert": "0.6.
|
|
28
|
-
"@agoric/casting": "0.4.3-
|
|
29
|
-
"@agoric/ertp": "0.16.3-
|
|
30
|
-
"@agoric/internal": "0.3.3-
|
|
31
|
-
"@agoric/notifier": "0.6.3-
|
|
32
|
-
"@agoric/store": "0.9.3-
|
|
33
|
-
"@agoric/swingset-vat": "0.32.3-
|
|
34
|
-
"@agoric/vat-data": "0.5.3-
|
|
35
|
-
"@agoric/vats": "0.15.2-
|
|
36
|
-
"@agoric/zoe": "0.26.3-
|
|
37
|
-
"@endo/eventual-send": "^0.17.
|
|
38
|
-
"@endo/far": "^0.2.
|
|
39
|
-
"@endo/marshal": "^0.8.
|
|
40
|
-
"@endo/nat": "^4.1.
|
|
41
|
-
"@endo/promise-kit": "^0.2.
|
|
25
|
+
"@agoric/assert": "^0.6.0",
|
|
26
|
+
"@agoric/casting": "^0.4.3-u11.0",
|
|
27
|
+
"@agoric/ertp": "^0.16.3-u11.0",
|
|
28
|
+
"@agoric/internal": "^0.3.3-u11.0",
|
|
29
|
+
"@agoric/notifier": "^0.6.3-u11.0",
|
|
30
|
+
"@agoric/store": "^0.9.3-u11.0",
|
|
31
|
+
"@agoric/swingset-vat": "^0.32.3-u11.0",
|
|
32
|
+
"@agoric/vat-data": "^0.5.3-u11.0",
|
|
33
|
+
"@agoric/vats": "^0.15.2-u11.0",
|
|
34
|
+
"@agoric/zoe": "^0.26.3-u11.0",
|
|
35
|
+
"@endo/eventual-send": "^0.17.2",
|
|
36
|
+
"@endo/far": "^0.2.18",
|
|
37
|
+
"@endo/marshal": "^0.8.5",
|
|
38
|
+
"@endo/nat": "^4.1.27",
|
|
39
|
+
"@endo/promise-kit": "^0.2.56"
|
|
42
40
|
},
|
|
43
41
|
"files": [
|
|
44
42
|
"src/"
|
|
@@ -63,5 +61,5 @@
|
|
|
63
61
|
"publishConfig": {
|
|
64
62
|
"access": "public"
|
|
65
63
|
},
|
|
66
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "92b6cd72484079b0349d8ccfa4510aeb820e8d67"
|
|
67
65
|
}
|
package/src/invitations.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function makeInvitationsHelper(zoe: ERef<ZoeService>, agoricNames: ERef<NameHub>, invitationBrand: Brand<'set'>, invitationsPurse: Purse<'set'>, getInvitationContinuation: (fromOfferId: string) => import('./types').
|
|
1
|
+
export function makeInvitationsHelper(zoe: ERef<ZoeService>, agoricNames: ERef<NameHub>, invitationBrand: Brand<'set'>, invitationsPurse: Purse<'set'>, getInvitationContinuation: (fromOfferId: string) => import('./types').RemoteInvitationMakers): (spec: InvitationSpec) => ERef<Invitation>;
|
|
2
2
|
/**
|
|
3
3
|
* Specify how to produce an invitation. See each type in the union for details.
|
|
4
4
|
*/
|
package/src/invitations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["invitations.js"],"names":[],"mappings":"AAkEO,2CANI,KAAK,UAAU,CAAC,eAChB,KAAK,OAAO,CAAC,mBACb,MAAM,KAAK,CAAC,oBACZ,MAAM,KAAK,CAAC,2CACE,MAAM,KAAK,OAAO,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["invitations.js"],"names":[],"mappings":"AAkEO,2CANI,KAAK,UAAU,CAAC,eAChB,KAAK,OAAO,CAAC,mBACb,MAAM,KAAK,CAAC,oBACZ,MAAM,KAAK,CAAC,2CACE,MAAM,KAAK,OAAO,SAAS,EAAE,sBAAsB,UAsFxD,cAAc,KAAK,KAAK,UAAU,CAAC,CAgBtD;;;;6BAvJY,4BAA4B,GAAG,sBAAsB,GAAG,mBAAmB,GAAG,wBAAwB;;;;;;;2CAKtG;IACZ,MAAQ,EAAE,gBAAgB,CAAC;IAC3B,YAAc,EAAE,MAAM,EAAE,CAAC;IACzB,QAAU,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;CACzD;;;;qCAMS;IACZ,MAAQ,EAAE,UAAU,CAAC;IACrB,QAAU,EAAE,QAAQ,CAAC;IACrB,qBAAuB,EAAE,MAAM,CAAC;IAChC,cAAgB,CAAC,EAAE,GAAG,EAAE,CAAC;CACtB;;;;;kCAGS;IACZ,MAAQ,EAAE,OAAO,CAAC;IAClB,QAAU,EAAE,QAAQ,CAAC;IACrB,WAAa,EAAE,MAAM,CAAC;CACnB;;;;uCAIS;IACZ,MAAQ,EAAE,YAAY,CAAC;IACvB,aAAe,EAAE,OAAO,aAAa,EAAE,OAAO,CAAC;IAC/C,mBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAgB,CAAC,EAAE,GAAG,EAAE,CAAC;CACtB;oCAKS,KAAK,iBAAiB,EAAE,aAAa,GAAG,UAAU,CAAC"}
|
package/src/invitations.js
CHANGED
|
@@ -62,7 +62,7 @@ const MAX_PIPE_LENGTH = 2;
|
|
|
62
62
|
* @param {ERef<NameHub>} agoricNames
|
|
63
63
|
* @param {Brand<'set'>} invitationBrand
|
|
64
64
|
* @param {Purse<'set'>} invitationsPurse
|
|
65
|
-
* @param {(fromOfferId: string) => import('./types').
|
|
65
|
+
* @param {(fromOfferId: string) => import('./types').RemoteInvitationMakers} getInvitationContinuation
|
|
66
66
|
*/
|
|
67
67
|
export const makeInvitationsHelper = (
|
|
68
68
|
zoe,
|
package/src/offers.d.ts
CHANGED
|
@@ -20,10 +20,10 @@ export function makeOfferExecutor({ zoe, depositFacet, invitationIssuer, powers,
|
|
|
20
20
|
powers: {
|
|
21
21
|
logger: Pick<Console, 'info' | 'error'>;
|
|
22
22
|
invitationFromSpec: (spec: import('./invitations').InvitationSpec) => ERef<Invitation>;
|
|
23
|
-
purseForBrand: (brand: Brand) => Promise<
|
|
23
|
+
purseForBrand: (brand: Brand) => Promise<import('./types').RemotePurse>;
|
|
24
24
|
};
|
|
25
25
|
onStatusChange: (status: OfferStatus) => void;
|
|
26
|
-
onNewContinuingOffer: (offerId: string, invitationAmount: Amount<'set'>, invitationMakers: import('./types').
|
|
26
|
+
onNewContinuingOffer: (offerId: string, invitationAmount: Amount<'set'>, invitationMakers: import('./types').RemoteInvitationMakers, publicSubscribers: import('./types').PublicSubscribers | import('@agoric/zoe/src/contractSupport').TopicsRecord) => Promise<void>;
|
|
27
27
|
}): {
|
|
28
28
|
/**
|
|
29
29
|
* Take an offer description provided in capData, augment it with payments and call zoe.offer()
|
package/src/offers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offers.d.ts","sourceRoot":"","sources":["offers.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"offers.d.ts","sourceRoot":"","sources":["offers.js"],"names":[],"mappings":"AAGA;;GAEG;AAEH;;;;;;;GAOG;AAEH,kEAAkE;AAClE,+CAAgD;AAwBzC;SAVI,KAAK,UAAU,CAAC;;mCACW,QAAQ,MAAM,CAAC;;sBAC1C,KAAK,OAAO,KAAK,CAAC,CAAC;;gBAEnB,KAAK,OAAO,EAAE,MAAM,GAAE,OAAO,CAAC;mCACvB,OAAO,eAAe,EAAE,cAAc,KAAK,KAAK,UAAU,CAAC;+BAC1D,KAAK,KAAK,QAAQ,OAAO,SAAS,EAAE,WAAW,CAAC;;6BAC/C,WAAW,KAAK,IAAI;oCACnB,MAAM,oBAAoB,OAAO,KAAK,CAAC,oBAAoB,OAAO,SAAS,EAAE,sBAAsB,qBAAqB,OAAO,SAAS,EAAE,iBAAiB,GAAG,OAAO,iCAAiC,EAAE,YAAY,KAAM,QAAQ,IAAI,CAAC;;IAaxP;;;;;;;OAOG;4BAJQ,SAAS,2BACC,QAAQ,KAAK,IAAI,GACzB,QAAQ,IAAI,CAAC;EA0I7B;sBA/LY,MAAM,GAAG,MAAM;wBAIf;IACZ,EAAM,EAAE,OAAO,CAAC;IAChB,cAAkB,EAAE,OAAO,eAAe,EAAE,cAAc,CAAC;IAC3D,QAAY,EAAE,QAAQ,CAAC;IACvB,SAAa,CAAC,EAAE,OAAO,CAAA;CACpB;0BAOS,OAAO,aAAa,EAAE,SAAS,GAAG;IAC9C,KAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,MAAQ,CAAC,EAAE,OAAO,GAAG,yBAAyB,CAAC;IAC/C,OAAS,CAAC,EAAE,mBAAmB,CAAC;CAC7B"}
|
package/src/offers.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { E, passStyleOf } from '@endo/far';
|
|
2
|
-
import { deeplyFulfilledObject } from '@agoric/internal';
|
|
3
2
|
import { makePaymentsHelper } from './payments.js';
|
|
4
3
|
|
|
5
4
|
/**
|
|
@@ -36,9 +35,9 @@ export const UNPUBLISHED_RESULT = 'UNPUBLISHED';
|
|
|
36
35
|
* @param {object} opts.powers
|
|
37
36
|
* @param {Pick<Console, 'info'| 'error'>} opts.powers.logger
|
|
38
37
|
* @param {(spec: import('./invitations').InvitationSpec) => ERef<Invitation>} opts.powers.invitationFromSpec
|
|
39
|
-
* @param {(brand: Brand) => Promise<
|
|
38
|
+
* @param {(brand: Brand) => Promise<import('./types').RemotePurse>} opts.powers.purseForBrand
|
|
40
39
|
* @param {(status: OfferStatus) => void} opts.onStatusChange
|
|
41
|
-
* @param {(offerId: string, invitationAmount: Amount<'set'>, invitationMakers: import('./types').
|
|
40
|
+
* @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
41
|
*/
|
|
43
42
|
export const makeOfferExecutor = ({
|
|
44
43
|
zoe,
|
|
@@ -81,19 +80,20 @@ export const makeOfferExecutor = ({
|
|
|
81
80
|
// 1. Prepare values and validate synchronously.
|
|
82
81
|
const { id, invitationSpec, proposal, offerArgs } = offerSpec;
|
|
83
82
|
|
|
84
|
-
/** @type {PaymentKeywordRecord | undefined} */
|
|
85
|
-
const paymentKeywordRecord = await (proposal?.give &&
|
|
86
|
-
deeplyFulfilledObject(paymentsManager.withdrawGive(proposal.give)));
|
|
87
|
-
|
|
88
83
|
const invitation = invitationFromSpec(invitationSpec);
|
|
89
84
|
const invitationAmount = await E(invitationIssuer).getAmountOf(
|
|
90
85
|
invitation,
|
|
91
86
|
);
|
|
92
87
|
|
|
88
|
+
const paymentKeywordRecord = proposal?.give
|
|
89
|
+
? paymentsManager.withdrawGive(proposal.give)
|
|
90
|
+
: undefined;
|
|
91
|
+
|
|
93
92
|
// 2. Begin executing offer
|
|
94
93
|
// No explicit signal to user that we reached here but if anything above
|
|
95
94
|
// failed they'd get an 'error' status update.
|
|
96
95
|
|
|
96
|
+
// eslint-disable-next-line @jessie.js/no-nested-await -- unconditional
|
|
97
97
|
seatRef = await E(zoe).offer(
|
|
98
98
|
invitation,
|
|
99
99
|
proposal,
|
package/src/payments.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function makePaymentsHelper(purseForBrand: (brand: Brand) => Promise<
|
|
1
|
+
export function makePaymentsHelper(purseForBrand: (brand: Brand) => Promise<import('./types').RemotePurse>, depositFacet: {
|
|
2
2
|
receive: (payment: any) => Promise<Amount>;
|
|
3
3
|
}): {
|
|
4
4
|
/**
|
|
@@ -10,7 +10,7 @@ export function makePaymentsHelper(purseForBrand: (brand: Brand) => Promise<Purs
|
|
|
10
10
|
* Try reclaiming any of our payments that we successfully withdrew, but
|
|
11
11
|
* were left unclaimed.
|
|
12
12
|
*/
|
|
13
|
-
tryReclaimingWithdrawnPayments(): Promise<undefined> | Promise<PromiseSettledResult<Amount<
|
|
13
|
+
tryReclaimingWithdrawnPayments(): Promise<undefined> | Promise<PromiseSettledResult<Amount<unknown> | undefined>[]>;
|
|
14
14
|
/**
|
|
15
15
|
* @param {PaymentPKeywordRecord} payouts
|
|
16
16
|
* @returns {Promise<AmountKeywordRecord>} amounts for deferred deposits will be empty
|
package/src/payments.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["payments.js"],"names":[],"mappings":"AAUO,0DAHY,KAAK,KAAK,QAAQ,
|
|
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
CHANGED
|
@@ -5,7 +5,7 @@ import { E } from '@endo/far';
|
|
|
5
5
|
/**
|
|
6
6
|
* Used in an offer execution to manage payments state safely.
|
|
7
7
|
*
|
|
8
|
-
* @param {(brand: Brand) => Promise<
|
|
8
|
+
* @param {(brand: Brand) => Promise<import('./types').RemotePurse>} purseForBrand
|
|
9
9
|
* @param {{ receive: (payment: *) => Promise<Amount> }} depositFacet
|
|
10
10
|
*/
|
|
11
11
|
export const makePaymentsHelper = (purseForBrand, depositFacet) => {
|
|
@@ -15,7 +15,7 @@ export const makePaymentsHelper = (purseForBrand, depositFacet) => {
|
|
|
15
15
|
/**
|
|
16
16
|
* Tracks from whence our payment came.
|
|
17
17
|
*
|
|
18
|
-
* @type {Map<Payment,
|
|
18
|
+
* @type {Map<Payment, import('./types').RemotePurse>}
|
|
19
19
|
*/
|
|
20
20
|
const paymentToPurse = new Map();
|
|
21
21
|
|
|
@@ -28,7 +28,7 @@ export const makePaymentsHelper = (purseForBrand, depositFacet) => {
|
|
|
28
28
|
!keywordPaymentPromises ||
|
|
29
29
|
Fail`withdrawPayments can be called once per helper`;
|
|
30
30
|
keywordPaymentPromises = objectMap(give, amount => {
|
|
31
|
-
/** @type {Promise<
|
|
31
|
+
/** @type {Promise<import('./types').RemotePurse<any>>} */
|
|
32
32
|
const purseP = purseForBrand(amount.brand);
|
|
33
33
|
return Promise.all([purseP, E(purseP).withdraw(amount)]).then(
|
|
34
34
|
([purse, payment]) => {
|
package/src/smartWallet.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
export
|
|
2
|
-
export function prepareSmartWallet(baggage: MapStore<string, any>, shared: SharedParams): (uniqueWithoutChildNodes: Omit<UniqueParams, "currentStorageNode" | "walletStorageNode"> & {
|
|
1
|
+
export function prepareSmartWallet(baggage: MapStore<string, unknown>, shared: SharedParams): (uniqueWithoutChildNodes: Omit<UniqueParams, "currentStorageNode" | "walletStorageNode"> & {
|
|
3
2
|
walletStorageNode: ERef<StorageNode>;
|
|
4
3
|
}) => Promise<{
|
|
5
4
|
/**
|
|
6
5
|
* Umarshals the actionCapData and delegates to the appropriate action handler.
|
|
7
6
|
*
|
|
8
7
|
* @param {import('@endo/marshal').CapData<string>} actionCapData of type BridgeAction
|
|
9
|
-
* @param {boolean} [canSpend]
|
|
8
|
+
* @param {boolean} [canSpend=false]
|
|
10
9
|
* @returns {Promise<void>}
|
|
11
10
|
*/
|
|
12
11
|
handleBridgeAction(actionCapData: import('@endo/marshal').CapData<string>, canSpend?: boolean | undefined): Promise<void>;
|
|
@@ -16,11 +15,10 @@ export function prepareSmartWallet(baggage: MapStore<string, any>, shared: Share
|
|
|
16
15
|
*
|
|
17
16
|
* If the purse doesn't exist, we hold the payment in durable storage.
|
|
18
17
|
*
|
|
19
|
-
* @param {Payment} payment
|
|
20
|
-
* @returns {Promise<Amount>}
|
|
21
|
-
* @throws if there's not yet a purse, though the payment is held to try again when there is
|
|
18
|
+
* @param {import('@endo/far').FarRef<Payment>} payment
|
|
19
|
+
* @returns {Promise<Amount>} amounts for deferred deposits will be empty
|
|
22
20
|
*/
|
|
23
|
-
receive(payment: Payment): Promise<Amount>;
|
|
21
|
+
receive(payment: import('@endo/far').FarRef<Payment>): Promise<Amount>;
|
|
24
22
|
};
|
|
25
23
|
getOffersFacet(): {
|
|
26
24
|
/**
|
|
@@ -126,6 +124,7 @@ export type BrandDescriptor = {
|
|
|
126
124
|
issuer: Issuer;
|
|
127
125
|
petname: import('./types').Petname;
|
|
128
126
|
};
|
|
127
|
+
export type RemotePurse = import('./types').RemotePurse;
|
|
129
128
|
export type UniqueParams = {
|
|
130
129
|
address: string;
|
|
131
130
|
bank: ERef<import('@agoric/vats/src/vat-bank').Bank>;
|
|
@@ -151,19 +150,16 @@ export type SharedParams = {
|
|
|
151
150
|
*/
|
|
152
151
|
export type State = ImmutableState & MutableState;
|
|
153
152
|
export type ImmutableState = Readonly<UniqueParams & {
|
|
154
|
-
paymentQueues: MapStore<Brand, Array<Payment
|
|
155
|
-
offerToInvitationMakers: MapStore<string, import('./types').
|
|
153
|
+
paymentQueues: MapStore<Brand, Array<import('@endo/far').FarRef<Payment>>>;
|
|
154
|
+
offerToInvitationMakers: MapStore<string, import('./types').RemoteInvitationMakers>;
|
|
156
155
|
offerToPublicSubscriberPaths: MapStore<string, Record<string, string>>;
|
|
157
156
|
offerToUsedInvitation: MapStore<string, Amount>;
|
|
158
|
-
purseBalances: MapStore<
|
|
157
|
+
purseBalances: MapStore<RemotePurse, Amount>;
|
|
159
158
|
updateRecorderKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<UpdateRecord>;
|
|
160
159
|
currentRecorderKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<CurrentWalletRecord>;
|
|
161
160
|
liveOffers: MapStore<import('./offers.js').OfferId, import('./offers.js').OfferStatus>;
|
|
162
161
|
liveOfferSeats: WeakMapStore<import('./offers.js').OfferId, UserSeat<unknown>>;
|
|
163
162
|
}>;
|
|
164
|
-
export type PurseRecord = BrandDescriptor & {
|
|
165
|
-
purse: Purse;
|
|
166
|
-
};
|
|
167
163
|
export type MutableState = {};
|
|
168
164
|
export type SmartWallet = Awaited<ReturnType<ReturnType<typeof prepareSmartWallet>>>;
|
|
169
165
|
//# sourceMappingURL=smartWallet.d.ts.map
|
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":"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"}
|
package/src/smartWallet.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AmountMath,
|
|
2
3
|
AmountShape,
|
|
3
4
|
BrandShape,
|
|
4
5
|
DisplayInfoShape,
|
|
@@ -6,23 +7,15 @@ import {
|
|
|
6
7
|
PaymentShape,
|
|
7
8
|
PurseShape,
|
|
8
9
|
} from '@agoric/ertp';
|
|
9
|
-
import { StorageNodeShape
|
|
10
|
+
import { StorageNodeShape } from '@agoric/internal';
|
|
10
11
|
import { observeNotifier } from '@agoric/notifier';
|
|
11
12
|
import { M, mustMatch } from '@agoric/store';
|
|
13
|
+
import { appendToStoredArray } from '@agoric/store/src/stores/store-utils.js';
|
|
14
|
+
import { makeScalarBigMapStore, prepareExoClassKit } from '@agoric/vat-data';
|
|
12
15
|
import {
|
|
13
|
-
|
|
14
|
-
provideLazy,
|
|
15
|
-
} from '@agoric/store/src/stores/store-utils.js';
|
|
16
|
-
import {
|
|
17
|
-
makeScalarBigMapStore,
|
|
18
|
-
makeScalarBigWeakMapStore,
|
|
19
|
-
prepareExoClassKit,
|
|
20
|
-
provide,
|
|
21
|
-
} from '@agoric/vat-data';
|
|
22
|
-
import {
|
|
16
|
+
prepareRecorderKit,
|
|
23
17
|
SubscriberShape,
|
|
24
18
|
TopicsRecordShape,
|
|
25
|
-
prepareRecorderKit,
|
|
26
19
|
} from '@agoric/zoe/src/contractSupport/index.js';
|
|
27
20
|
import { E } from '@endo/far';
|
|
28
21
|
import { makeInvitationsHelper } from './invitations.js';
|
|
@@ -32,8 +25,6 @@ import { objectMapStoragePath } from './utils.js';
|
|
|
32
25
|
|
|
33
26
|
const { Fail, quote: q } = assert;
|
|
34
27
|
|
|
35
|
-
const trace = makeTracer('SmrtWlt');
|
|
36
|
-
|
|
37
28
|
/**
|
|
38
29
|
* @file Smart wallet module
|
|
39
30
|
*
|
|
@@ -111,6 +102,9 @@ const trace = makeTracer('SmrtWlt');
|
|
|
111
102
|
* For use by clients to describe brands to users. Includes `displayInfo` to save a remote call.
|
|
112
103
|
*/
|
|
113
104
|
|
|
105
|
+
// imports
|
|
106
|
+
/** @typedef {import('./types').RemotePurse} RemotePurse */
|
|
107
|
+
|
|
114
108
|
/**
|
|
115
109
|
* @typedef {{
|
|
116
110
|
* address: string,
|
|
@@ -138,77 +132,27 @@ const trace = makeTracer('SmrtWlt');
|
|
|
138
132
|
* - `purseBalances` is a cache of what we've received from purses. Held so we can publish all balances on change.
|
|
139
133
|
*
|
|
140
134
|
* @typedef {Readonly<UniqueParams & {
|
|
141
|
-
* paymentQueues: MapStore<Brand, Array<Payment
|
|
142
|
-
* offerToInvitationMakers: MapStore<string, import('./types').
|
|
135
|
+
* paymentQueues: MapStore<Brand, Array<import('@endo/far').FarRef<Payment>>>,
|
|
136
|
+
* offerToInvitationMakers: MapStore<string, import('./types').RemoteInvitationMakers>,
|
|
143
137
|
* offerToPublicSubscriberPaths: MapStore<string, Record<string, string>>,
|
|
144
138
|
* offerToUsedInvitation: MapStore<string, Amount>,
|
|
145
|
-
* purseBalances: MapStore<
|
|
139
|
+
* purseBalances: MapStore<RemotePurse, Amount>,
|
|
146
140
|
* updateRecorderKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<UpdateRecord>,
|
|
147
141
|
* currentRecorderKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<CurrentWalletRecord>,
|
|
148
142
|
* liveOffers: MapStore<import('./offers.js').OfferId, import('./offers.js').OfferStatus>,
|
|
149
143
|
* liveOfferSeats: WeakMapStore<import('./offers.js').OfferId, UserSeat<unknown>>,
|
|
150
144
|
* }>} ImmutableState
|
|
151
145
|
*
|
|
152
|
-
* @typedef {BrandDescriptor & { purse: Purse }} PurseRecord
|
|
153
146
|
* @typedef {{
|
|
154
147
|
* }} MutableState
|
|
155
148
|
*/
|
|
156
149
|
|
|
157
|
-
/**
|
|
158
|
-
* NameHub reverse-lookup, finding 0 or more names for a target value
|
|
159
|
-
*
|
|
160
|
-
* TODO: consider moving to nameHub.js?
|
|
161
|
-
*
|
|
162
|
-
* @param {unknown} target - passable Key
|
|
163
|
-
* @param {ERef<NameHub>} nameHub
|
|
164
|
-
*/
|
|
165
|
-
const namesOf = async (target, nameHub) => {
|
|
166
|
-
const entries = await E(nameHub).entries();
|
|
167
|
-
const matches = [];
|
|
168
|
-
for (const [name, candidate] of entries) {
|
|
169
|
-
if (candidate === target) {
|
|
170
|
-
matches.push(name);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return harden(matches);
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Check that an issuer and its brand belong to each other.
|
|
178
|
-
*
|
|
179
|
-
* TODO: move to ERTP?
|
|
180
|
-
*
|
|
181
|
-
* @param {Issuer} issuer
|
|
182
|
-
* @param {Brand} brand
|
|
183
|
-
* @returns {Promise<boolean>} true iff the the brand and issuer match
|
|
184
|
-
*/
|
|
185
|
-
const checkMutual = (issuer, brand) =>
|
|
186
|
-
Promise.all([
|
|
187
|
-
E(issuer)
|
|
188
|
-
.getBrand()
|
|
189
|
-
.then(b => b === brand),
|
|
190
|
-
E(brand).isMyIssuer(issuer),
|
|
191
|
-
]).then(checks => checks.every(Boolean));
|
|
192
|
-
|
|
193
|
-
export const BRAND_TO_PURSES_KEY = 'brandToPurses';
|
|
194
|
-
|
|
195
|
-
const getBrandToPurses = (walletPurses, key) => {
|
|
196
|
-
const brandToPurses = provideLazy(walletPurses, key, _k => {
|
|
197
|
-
/** @type {MapStore<Brand, PurseRecord[]>} */
|
|
198
|
-
const store = makeScalarBigMapStore('purses by brand', {
|
|
199
|
-
durable: true,
|
|
200
|
-
});
|
|
201
|
-
return store;
|
|
202
|
-
});
|
|
203
|
-
return brandToPurses;
|
|
204
|
-
};
|
|
205
|
-
|
|
206
150
|
/**
|
|
207
151
|
* @param {import('@agoric/vat-data').Baggage} baggage
|
|
208
152
|
* @param {SharedParams} shared
|
|
209
153
|
*/
|
|
210
154
|
export const prepareSmartWallet = (baggage, shared) => {
|
|
211
|
-
const { registry:
|
|
155
|
+
const { registry: _, ...passableShared } = shared;
|
|
212
156
|
mustMatch(
|
|
213
157
|
harden(passableShared),
|
|
214
158
|
harden({
|
|
@@ -223,15 +167,6 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
223
167
|
|
|
224
168
|
const makeRecorderKit = prepareRecorderKit(baggage, shared.publicMarshaller);
|
|
225
169
|
|
|
226
|
-
const walletPurses = provide(baggage, BRAND_TO_PURSES_KEY, () => {
|
|
227
|
-
trace('make purses by wallet and save in baggage at', BRAND_TO_PURSES_KEY);
|
|
228
|
-
/** @type {WeakMapStore<unknown, MapStore<Brand, PurseRecord[]>>} */
|
|
229
|
-
const store = makeScalarBigWeakMapStore('purses by wallet', {
|
|
230
|
-
durable: true,
|
|
231
|
-
});
|
|
232
|
-
return store;
|
|
233
|
-
});
|
|
234
|
-
|
|
235
170
|
/**
|
|
236
171
|
*
|
|
237
172
|
* @param {UniqueParams} unique
|
|
@@ -310,9 +245,6 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
310
245
|
helper: M.interface('helperFacetI', {
|
|
311
246
|
assertUniqueOfferId: M.call(M.string()).returns(),
|
|
312
247
|
updateBalance: M.call(PurseShape, AmountShape).optional('init').returns(),
|
|
313
|
-
getPurseIfKnownBrand: M.call(BrandShape)
|
|
314
|
-
.optional(M.eref(M.remotable()))
|
|
315
|
-
.returns(M.promise()),
|
|
316
248
|
publishCurrentState: M.call().returns(),
|
|
317
249
|
watchPurse: M.call(M.eref(PurseShape)).returns(M.promise()),
|
|
318
250
|
}),
|
|
@@ -371,7 +303,7 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
371
303
|
!used || Fail`cannot re-use offer id ${id}`;
|
|
372
304
|
},
|
|
373
305
|
/**
|
|
374
|
-
* @param {
|
|
306
|
+
* @param {RemotePurse} purse
|
|
375
307
|
* @param {Amount<any>} balance
|
|
376
308
|
*/
|
|
377
309
|
updateBalance(purse, balance) {
|
|
@@ -410,7 +342,7 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
410
342
|
});
|
|
411
343
|
},
|
|
412
344
|
|
|
413
|
-
/** @type {(purse: ERef<
|
|
345
|
+
/** @type {(purse: ERef<RemotePurse>) => Promise<void>} */
|
|
414
346
|
async watchPurse(purseRef) {
|
|
415
347
|
const { address } = this.state;
|
|
416
348
|
|
|
@@ -437,63 +369,6 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
437
369
|
},
|
|
438
370
|
});
|
|
439
371
|
},
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* Provide a purse given a NameHub of issuers and their
|
|
443
|
-
* brands.
|
|
444
|
-
*
|
|
445
|
-
* We current support only one NameHub, agoricNames, and
|
|
446
|
-
* hence one purse per brand. But we store an array of them
|
|
447
|
-
* to facilitate a transition to decentralized introductions.
|
|
448
|
-
*
|
|
449
|
-
* @param {Brand} brand
|
|
450
|
-
* @param {ERef<NameHub>} known - namehub with brand, issuer branches
|
|
451
|
-
* @returns {Promise<Purse | undefined>} undefined if brand is not known
|
|
452
|
-
*/
|
|
453
|
-
async getPurseIfKnownBrand(brand, known) {
|
|
454
|
-
const { helper, self } = this.facets;
|
|
455
|
-
const brandToPurses = getBrandToPurses(walletPurses, self);
|
|
456
|
-
|
|
457
|
-
if (brandToPurses.has(brand)) {
|
|
458
|
-
const purses = brandToPurses.get(brand);
|
|
459
|
-
if (purses.length > 0) {
|
|
460
|
-
// UNTIL https://github.com/Agoric/agoric-sdk/issues/6126
|
|
461
|
-
// multiple purses
|
|
462
|
-
return purses[0].purse;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
const found = await namesOf(brand, E(known).lookup('brand'));
|
|
467
|
-
if (found.length === 0) {
|
|
468
|
-
return undefined;
|
|
469
|
-
}
|
|
470
|
-
const [edgeName] = found;
|
|
471
|
-
const issuer = await E(known).lookup('issuer', edgeName);
|
|
472
|
-
|
|
473
|
-
// Even though we rely on this nameHub, double-check
|
|
474
|
-
// that the issuer and the brand belong to each other.
|
|
475
|
-
if (!(await checkMutual(issuer, brand))) {
|
|
476
|
-
// if they don't, it's not a "known" brand in a coherent way
|
|
477
|
-
return undefined;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
// Accept the issuer; rely on it in future offers.
|
|
481
|
-
const [displayInfo, purse] = await Promise.all([
|
|
482
|
-
E(issuer).getDisplayInfo(),
|
|
483
|
-
E(issuer).makeEmptyPurse(),
|
|
484
|
-
]);
|
|
485
|
-
|
|
486
|
-
// adopt edgeName as petname
|
|
487
|
-
// NOTE: for decentralized introductions, qualify edgename by nameHub petname
|
|
488
|
-
const petname = edgeName;
|
|
489
|
-
const assetInfo = { petname, brand, issuer, purse, displayInfo };
|
|
490
|
-
appendToStoredArray(brandToPurses, brand, assetInfo);
|
|
491
|
-
// NOTE: when we decentralize introduction of issuers,
|
|
492
|
-
// process queued payments for this brand.
|
|
493
|
-
|
|
494
|
-
void helper.watchPurse(purse);
|
|
495
|
-
return purse;
|
|
496
|
-
},
|
|
497
372
|
},
|
|
498
373
|
/**
|
|
499
374
|
* Similar to {DepositFacet} but async because it has to look up the purse.
|
|
@@ -504,12 +379,10 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
504
379
|
*
|
|
505
380
|
* If the purse doesn't exist, we hold the payment in durable storage.
|
|
506
381
|
*
|
|
507
|
-
* @param {Payment} payment
|
|
508
|
-
* @returns {Promise<Amount>}
|
|
509
|
-
* @throws if there's not yet a purse, though the payment is held to try again when there is
|
|
382
|
+
* @param {import('@endo/far').FarRef<Payment>} payment
|
|
383
|
+
* @returns {Promise<Amount>} amounts for deferred deposits will be empty
|
|
510
384
|
*/
|
|
511
385
|
async receive(payment) {
|
|
512
|
-
const { helper } = this.facets;
|
|
513
386
|
const { paymentQueues: queues, bank, invitationPurse } = this.state;
|
|
514
387
|
const { registry, invitationBrand } = shared;
|
|
515
388
|
const brand = await E(payment).getAllegedBrand();
|
|
@@ -517,24 +390,17 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
517
390
|
// When there is a purse deposit into it
|
|
518
391
|
if (registry.has(brand)) {
|
|
519
392
|
const purse = E(bank).getPurse(brand);
|
|
393
|
+
// @ts-expect-error deposit does take a FarRef<Payment>
|
|
520
394
|
return E(purse).deposit(payment);
|
|
521
395
|
} else if (invitationBrand === brand) {
|
|
522
|
-
// @ts-expect-error
|
|
396
|
+
// @ts-expect-error deposit does take a FarRef<Payment>
|
|
523
397
|
return E(invitationPurse).deposit(payment);
|
|
524
398
|
}
|
|
525
399
|
|
|
526
|
-
const purse = await helper.getPurseIfKnownBrand(
|
|
527
|
-
brand,
|
|
528
|
-
shared.agoricNames,
|
|
529
|
-
);
|
|
530
|
-
if (purse) {
|
|
531
|
-
return E(purse).deposit(payment);
|
|
532
|
-
}
|
|
533
|
-
|
|
534
400
|
// When there is no purse, save the payment into a queue.
|
|
535
401
|
// It's not yet ever read but a future version of the contract can
|
|
536
402
|
appendToStoredArray(queues, brand, payment);
|
|
537
|
-
|
|
403
|
+
return AmountMath.makeEmpty(brand);
|
|
538
404
|
},
|
|
539
405
|
},
|
|
540
406
|
offers: {
|
|
@@ -579,24 +445,16 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
579
445
|
),
|
|
580
446
|
/**
|
|
581
447
|
* @param {Brand} brand
|
|
582
|
-
* @returns {Promise<
|
|
448
|
+
* @returns {Promise<RemotePurse>}
|
|
583
449
|
*/
|
|
584
450
|
purseForBrand: async brand => {
|
|
585
|
-
const { helper } = facets;
|
|
586
451
|
if (registry.has(brand)) {
|
|
587
|
-
// @ts-expect-error
|
|
452
|
+
// @ts-expect-error RemotePurse cast
|
|
588
453
|
return E(bank).getPurse(brand);
|
|
589
454
|
} else if (invitationBrand === brand) {
|
|
455
|
+
// @ts-expect-error RemotePurse cast
|
|
590
456
|
return invitationPurse;
|
|
591
457
|
}
|
|
592
|
-
|
|
593
|
-
const purse = await helper.getPurseIfKnownBrand(
|
|
594
|
-
brand,
|
|
595
|
-
shared.agoricNames,
|
|
596
|
-
);
|
|
597
|
-
if (purse) {
|
|
598
|
-
return purse;
|
|
599
|
-
}
|
|
600
458
|
throw Fail`cannot find/make purse for ${brand}`;
|
|
601
459
|
},
|
|
602
460
|
logger,
|
|
@@ -621,7 +479,7 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
621
479
|
}
|
|
622
480
|
}
|
|
623
481
|
},
|
|
624
|
-
/** @type {(offerId: string, invitationAmount: Amount<'set'>, invitationMakers: import('./types').
|
|
482
|
+
/** @type {(offerId: string, invitationAmount: Amount<'set'>, invitationMakers: import('./types').RemoteInvitationMakers, publicSubscribers?: import('./types').PublicSubscribers | import('@agoric/zoe/src/contractSupport').TopicsRecord) => Promise<void>} */
|
|
625
483
|
onNewContinuingOffer: async (
|
|
626
484
|
offerId,
|
|
627
485
|
invitationAmount,
|
|
@@ -662,7 +520,7 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
662
520
|
* Umarshals the actionCapData and delegates to the appropriate action handler.
|
|
663
521
|
*
|
|
664
522
|
* @param {import('@endo/marshal').CapData<string>} actionCapData of type BridgeAction
|
|
665
|
-
* @param {boolean} [canSpend]
|
|
523
|
+
* @param {boolean} [canSpend=false]
|
|
666
524
|
* @returns {Promise<void>}
|
|
667
525
|
*/
|
|
668
526
|
handleBridgeAction(actionCapData, canSpend = false) {
|
|
@@ -746,6 +604,7 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
746
604
|
const { invitationPurse } = state;
|
|
747
605
|
const { helper } = facets;
|
|
748
606
|
|
|
607
|
+
// @ts-expect-error RemotePurse cast
|
|
749
608
|
void helper.watchPurse(invitationPurse);
|
|
750
609
|
},
|
|
751
610
|
},
|
package/src/typeGuards.d.ts
CHANGED
package/src/types.d.ts
CHANGED
|
@@ -5,11 +5,9 @@
|
|
|
5
5
|
* Downside is it can't reference any ambient types, which most of agoric-sdk type are presently.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import { ERef, FarRef } from '@endo/far';
|
|
9
9
|
import type { CapData } from '@endo/marshal';
|
|
10
10
|
import type { MsgWalletSpendAction } from '@agoric/cosmic-proto/swingset/msgs';
|
|
11
|
-
import type { AgoricNamesRemotes } from '@agoric/vats/tools/board-utils.js';
|
|
12
|
-
import type { OfferSpec } from './offers.js';
|
|
13
11
|
|
|
14
12
|
declare const CapDataShape: unique symbol;
|
|
15
13
|
|
|
@@ -21,9 +19,10 @@ declare const CapDataShape: unique symbol;
|
|
|
21
19
|
*/
|
|
22
20
|
export type Petname = string | string[];
|
|
23
21
|
|
|
24
|
-
export type
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
export type RemotePurse<T = unknown> = FarRef<Purse<T>>;
|
|
23
|
+
|
|
24
|
+
export type RemoteInvitationMakers = FarRef<
|
|
25
|
+
Record<string, (...args: any[]) => Promise<Invitation>>
|
|
27
26
|
>;
|
|
28
27
|
|
|
29
28
|
export type PublicSubscribers = Record<string, ERef<StoredFacet>>;
|
|
@@ -75,11 +74,3 @@ export type WalletSpendActionMsg = {
|
|
|
75
74
|
* the sending of the message (as is the case for WALLET_SPEND_ACTION).
|
|
76
75
|
*/
|
|
77
76
|
export type WalletBridgeMsg = WalletActionMsg | WalletSpendActionMsg;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Used for clientSupport helpers
|
|
81
|
-
*/
|
|
82
|
-
export type OfferMaker = (
|
|
83
|
-
agoricNames: AgoricNamesRemotes,
|
|
84
|
-
...rest: any[]
|
|
85
|
-
) => OfferSpec;
|
package/src/walletFactory.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
export const privateArgsShape: import("@endo/patterns").Matcher;
|
|
2
|
+
export namespace customTermsShape {
|
|
3
|
+
const agoricNames: any;
|
|
4
|
+
const board: any;
|
|
5
|
+
const assetPublisher: any;
|
|
6
|
+
}
|
|
3
7
|
export function publishDepositFacet(address: string, wallet: import('./smartWallet.js').SmartWallet, namesByAddressAdmin: ERef<import('@agoric/vats').NameAdmin>): Promise<unknown>;
|
|
4
8
|
export function makeAssetRegistry(assetPublisher: AssetPublisher): {
|
|
5
9
|
/** @param {Brand} brand */
|
|
@@ -18,11 +22,11 @@ export function makeAssetRegistry(assetPublisher: AssetPublisher): {
|
|
|
18
22
|
petname: import('./types').Petname;
|
|
19
23
|
}>;
|
|
20
24
|
};
|
|
21
|
-
export function
|
|
25
|
+
export function prepare(zcf: ZCF<SmartWalletContractTerms>, privateArgs: {
|
|
22
26
|
storageNode: ERef<StorageNode>;
|
|
23
27
|
walletBridgeManager?: ERef<import("@agoric/vats").ScopedBridgeManager> | undefined;
|
|
24
28
|
walletReviver?: ERef<WalletReviver> | undefined;
|
|
25
|
-
}, baggage: MapStore<string,
|
|
29
|
+
}, baggage: MapStore<string, unknown>): Promise<{
|
|
26
30
|
creatorFacet: {
|
|
27
31
|
/**
|
|
28
32
|
* @param {string} address
|
|
@@ -35,7 +39,7 @@ export function start(zcf: ZCF<SmartWalletContractTerms>, privateArgs: {
|
|
|
35
39
|
provideSmartWallet(address: string, bank: ERef<import('@agoric/vats/src/vat-bank').Bank>, namesByAddressAdmin: ERef<import('@agoric/vats/').NameAdmin>): Promise<[wallet: {
|
|
36
40
|
handleBridgeAction(actionCapData: import("@endo/marshal").CapData<string>, canSpend?: boolean | undefined): Promise<void>;
|
|
37
41
|
getDepositFacet(): {
|
|
38
|
-
receive(payment: Payment<AssetKind
|
|
42
|
+
receive(payment: import("@endo/far").FarRef<Payment<AssetKind>, import("@endo/eventual-send").DataOnly<Payment<AssetKind>>>): Promise<Amount<AssetKind>>;
|
|
39
43
|
};
|
|
40
44
|
getOffersFacet(): {
|
|
41
45
|
executeOffer(offerSpec: import("./offers.js").OfferSpec): Promise<void>;
|
|
@@ -68,7 +72,7 @@ export function start(zcf: ZCF<SmartWalletContractTerms>, privateArgs: {
|
|
|
68
72
|
provideSmartWallet(address: string, bank: ERef<import('@agoric/vats/src/vat-bank').Bank>, namesByAddressAdmin: ERef<import('@agoric/vats/').NameAdmin>): Promise<[wallet: {
|
|
69
73
|
handleBridgeAction(actionCapData: import("@endo/marshal").CapData<string>, canSpend?: boolean | undefined): Promise<void>;
|
|
70
74
|
getDepositFacet(): {
|
|
71
|
-
receive(payment: Payment<AssetKind
|
|
75
|
+
receive(payment: import("@endo/far").FarRef<Payment<AssetKind>, import("@endo/eventual-send").DataOnly<Payment<AssetKind>>>): Promise<Amount<AssetKind>>;
|
|
72
76
|
};
|
|
73
77
|
getOffersFacet(): {
|
|
74
78
|
executeOffer(offerSpec: import("./offers.js").OfferSpec): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walletFactory.d.ts","sourceRoot":"","sources":["walletFactory.js"],"names":[],"mappings":"AAkBA,
|
|
1
|
+
{"version":3,"file":"walletFactory.d.ts","sourceRoot":"","sources":["walletFactory.js"],"names":[],"mappings":"AAkBA,gEAKE;;;;;;AAgBK,6CAJI,MAAM,UACN,OAAO,kBAAkB,EAAE,WAAW,uBACtC,KAAK,OAAO,cAAc,EAAE,SAAS,CAAC,oBAehD;AAWM,kDAFI,cAAc;IAwCrB,2BAA2B;iBAAf,KAAK;IAEjB,2BAA2B;iBAAf,KAAK;eApCP,KAAK;qBACC,WAAW;gBAChB,MAAM;iBACL,OAAO,SAAS,EAAE,OAAO;;;eAH3B,KAAK;qBACC,WAAW;gBAChB,MAAM;iBACL,OAAO,SAAS,EAAE,OAAO;;EAsCxC;AAmCM,6BARI,IAAI,wBAAwB,CAAC;iBAEtB,KAAK,WAAW,CAAC;;;;;QAgH7B;;;;;;;WAOG;oCANQ,MAAM,QACN,KAAK,OAAO,2BAA2B,EAAE,IAAI,CAAC,uBAC9C,KAAK,OAAO,eAAe,EAAE,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;QAHlD;;;;;;;WAOG;oCANQ,MAAM,QACN,KAAK,OAAO,2BAA2B,EAAE,IAAI,CAAC,uBAC9C,KAAK,OAAO,eAAe,EAAE,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;GAgDvD;uCA7LY;IACZ,WAAe,EAAE,KAAK,OAAO,CAAC,CAAC;IAC/B,KAAS,EAAE,KAAK,OAAO,cAAc,EAAE,KAAK,CAAC,CAAC;IAC9C,cAAkB,EAAE,cAAc,CAAC;CAChC;sBAES,OAAO,cAAc,EAAE,OAAO;6BAE9B;IACZ,oBAAwB,EAAE,MAAM,KAChC,kBAAwB,OAAO,2BAA2B,EAAE,eAAe,CAAC,CAAC,CAAA;CAC1E;uBAES,OAAO;;4BAES,MAAM,KAAK,QAAQ,OAAO,eAAe,EAAE,WAAW,CAAC;yBAC1D,MAAM,KAAK,QAAQ"}
|
package/src/walletFactory.js
CHANGED
|
@@ -16,20 +16,18 @@ import { shape } from './typeGuards.js';
|
|
|
16
16
|
|
|
17
17
|
const trace = makeTracer('WltFct');
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
customTermsShape: {
|
|
22
|
-
agoricNames: M.eref(M.remotable('agoricNames')),
|
|
23
|
-
board: M.eref(M.remotable('board')),
|
|
24
|
-
assetPublisher: M.eref(M.remotable('Bank')),
|
|
25
|
-
},
|
|
26
|
-
privateArgsShape: M.splitRecord(
|
|
19
|
+
export const privateArgsShape = harden(
|
|
20
|
+
M.splitRecord(
|
|
27
21
|
{ storageNode: M.eref(M.remotable('StorageNode')) },
|
|
28
22
|
{ walletBridgeManager: M.eref(M.remotable('walletBridgeManager')) },
|
|
29
23
|
),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
harden(
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export const customTermsShape = harden({
|
|
27
|
+
agoricNames: M.eref(M.remotable('agoricNames')),
|
|
28
|
+
board: M.eref(M.remotable('board')),
|
|
29
|
+
assetPublisher: M.eref(M.remotable('Bank')),
|
|
30
|
+
});
|
|
33
31
|
|
|
34
32
|
/**
|
|
35
33
|
* Provide a NameHub for this address and insert depositFacet only if not
|
|
@@ -143,7 +141,7 @@ export const makeAssetRegistry = assetPublisher => {
|
|
|
143
141
|
* }} privateArgs
|
|
144
142
|
* @param {import('@agoric/vat-data').Baggage} baggage
|
|
145
143
|
*/
|
|
146
|
-
export const
|
|
144
|
+
export const prepare = async (zcf, privateArgs, baggage) => {
|
|
147
145
|
const { agoricNames, board, assetPublisher } = zcf.getTerms();
|
|
148
146
|
|
|
149
147
|
const zoe = zcf.getZoeService();
|
|
@@ -301,4 +299,3 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
301
299
|
creatorFacet,
|
|
302
300
|
};
|
|
303
301
|
};
|
|
304
|
-
harden(start);
|