@agoric/wallet 0.18.4-other-dev-1f26562.0 → 0.18.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/CHANGELOG.md +0 -8
- package/README.md +2 -2
- package/api/CHANGELOG.md +0 -8
- package/api/bundles/bundle-wallet-js-meta.json +497 -269
- package/api/bundles/bundle-wallet.js +1 -1
- package/api/deploy.js +8 -3
- package/api/package.json +30 -22
- package/api/src/findOrMakeInvitation.js +4 -2
- package/api/src/internal-types.js +8 -5
- package/api/src/issuerTable.js +1 -2
- package/api/src/lib-dehydrate.js +9 -16
- package/api/src/lib-wallet.js +53 -56
- package/api/src/pubsub.js +2 -2
- package/api/src/wallet.js +13 -12
- package/api/test/continuingInvitationExample.js +0 -2
- package/api/test/{test-getPursesNotifier.js → getPursesNotifier.test.js} +2 -6
- package/api/test/{test-lib-wallet.js → lib-wallet.test.js} +16 -27
- package/api/test/{test-middleware.js → middleware.test.js} +0 -1
- package/api/{jsconfig.json → tsconfig.json} +1 -0
- package/package.json +4 -4
- package/api/exported.js +0 -1
- /package/api/src/{types.js → types-ambient.js} +0 -0
- /package/api/test/{test-lib-dehydrate.js → lib-dehydrate.test.js} +0 -0
package/api/src/wallet.js
CHANGED
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
* types.js file.
|
|
10
10
|
*/
|
|
11
11
|
import { E } from '@endo/eventual-send';
|
|
12
|
-
import { makeNotifierKit, observeIteration } from '@agoric/notifier';
|
|
13
12
|
import { Far } from '@endo/marshal';
|
|
13
|
+
import { deepCopyJsonable } from '@agoric/internal/src/js-utils.js';
|
|
14
|
+
import { makeNotifierKit, observeIteration } from '@agoric/notifier';
|
|
14
15
|
|
|
15
16
|
import { makeWalletRoot } from './lib-wallet.js';
|
|
16
17
|
import pubsub from './pubsub.js';
|
|
@@ -25,7 +26,7 @@ import './internal-types.js';
|
|
|
25
26
|
* board: ERef<import('@agoric/vats').Board>,
|
|
26
27
|
* cacheStorageNode: ERef<StorageNode>,
|
|
27
28
|
* localTimerPollInterval?: bigint,
|
|
28
|
-
* localTimerService?: import('@agoric/time
|
|
29
|
+
* localTimerService?: import('@agoric/time').TimerService,
|
|
29
30
|
* myAddressNameAdmin: ERef<import('@agoric/vats').MyAddressNameAdmin>,
|
|
30
31
|
* namesByAddress: ERef<NameHub>,
|
|
31
32
|
* timerDevice?: unknown,
|
|
@@ -33,7 +34,7 @@ import './internal-types.js';
|
|
|
33
34
|
* zoe: ERef<ZoeService>,
|
|
34
35
|
* }} StartupTerms
|
|
35
36
|
*
|
|
36
|
-
* @
|
|
37
|
+
* @import {NameHub} from '@agoric/vats'
|
|
37
38
|
*/
|
|
38
39
|
|
|
39
40
|
export function buildRootObject(vatPowers) {
|
|
@@ -54,11 +55,11 @@ export function buildRootObject(vatPowers) {
|
|
|
54
55
|
const offerSubscriptions = new Map();
|
|
55
56
|
|
|
56
57
|
const httpSend = (obj, channelHandles) =>
|
|
57
|
-
E(http).send(
|
|
58
|
+
E(http).send(deepCopyJsonable(obj), channelHandles);
|
|
58
59
|
|
|
59
60
|
const pushOfferSubscriptions = (channelHandle, offers) => {
|
|
60
61
|
const subs = offerSubscriptions.get(channelHandle);
|
|
61
|
-
(
|
|
62
|
+
for (const { origin, status } of subs || []) {
|
|
62
63
|
// Filter by optional status and origin.
|
|
63
64
|
const result = harden(
|
|
64
65
|
offers.filter(
|
|
@@ -75,7 +76,7 @@ export function buildRootObject(vatPowers) {
|
|
|
75
76
|
},
|
|
76
77
|
[channelHandle],
|
|
77
78
|
);
|
|
78
|
-
}
|
|
79
|
+
}
|
|
79
80
|
};
|
|
80
81
|
|
|
81
82
|
const subscribeToOffers = (channelHandle, { origin, status = null }) => {
|
|
@@ -164,6 +165,7 @@ export function buildRootObject(vatPowers) {
|
|
|
164
165
|
yield state;
|
|
165
166
|
}
|
|
166
167
|
}
|
|
168
|
+
harden(makeApprovedNotifier);
|
|
167
169
|
|
|
168
170
|
/** @type {WalletBridge} */
|
|
169
171
|
const bridge = Far('bridge', {
|
|
@@ -171,7 +173,7 @@ export function buildRootObject(vatPowers) {
|
|
|
171
173
|
await approve();
|
|
172
174
|
const pursesNotifier = walletAdmin.getAttenuatedPursesNotifier();
|
|
173
175
|
const { notifier, updater } = makeNotifierKit();
|
|
174
|
-
observeIteration(makeApprovedNotifier(pursesNotifier), updater);
|
|
176
|
+
void observeIteration(makeApprovedNotifier(pursesNotifier), updater);
|
|
175
177
|
return notifier;
|
|
176
178
|
},
|
|
177
179
|
async getCacheCoordinator() {
|
|
@@ -200,7 +202,7 @@ export function buildRootObject(vatPowers) {
|
|
|
200
202
|
}));
|
|
201
203
|
};
|
|
202
204
|
|
|
203
|
-
observeIteration(makeApprovedNotifier(offerNotifier), {
|
|
205
|
+
void observeIteration(makeApprovedNotifier(offerNotifier), {
|
|
204
206
|
updateState(offers) {
|
|
205
207
|
updater.updateState(filteredOffers(offers));
|
|
206
208
|
},
|
|
@@ -439,7 +441,7 @@ export function buildRootObject(vatPowers) {
|
|
|
439
441
|
},
|
|
440
442
|
);
|
|
441
443
|
if (notYetEnabled) {
|
|
442
|
-
E(otherSide).dappApproved(dappOrigin);
|
|
444
|
+
await E(otherSide).dappApproved(dappOrigin);
|
|
443
445
|
}
|
|
444
446
|
};
|
|
445
447
|
|
|
@@ -587,9 +589,8 @@ export function buildRootObject(vatPowers) {
|
|
|
587
589
|
|
|
588
590
|
case 'walletGetDepositFacetId': {
|
|
589
591
|
const { brandBoardId } = obj;
|
|
590
|
-
const result =
|
|
591
|
-
brandBoardId
|
|
592
|
-
);
|
|
592
|
+
const result =
|
|
593
|
+
await walletAdmin.getDepositFacetId(brandBoardId);
|
|
593
594
|
return {
|
|
594
595
|
type: 'walletDepositFacetIdResponse',
|
|
595
596
|
data: result,
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
import { makeNotifierFromSubscriber, makePublishKit } from '@agoric/notifier';
|
|
4
4
|
import { Far } from '@endo/marshal';
|
|
5
5
|
|
|
6
|
-
import '@agoric/zoe/exported.js';
|
|
7
|
-
|
|
8
6
|
export const start = zcf => {
|
|
9
7
|
const { subscriber, publisher } = makePublishKit();
|
|
10
8
|
const notifier = makeNotifierFromSubscriber(subscriber);
|
|
@@ -3,19 +3,15 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js';
|
|
|
3
3
|
|
|
4
4
|
import { makeIssuerKit } from '@agoric/ertp';
|
|
5
5
|
import { makeZoeForTest } from '@agoric/zoe/tools/setup-zoe.js';
|
|
6
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
7
6
|
import { makeFakeBoard } from '@agoric/vats/tools/board-utils.js';
|
|
8
|
-
|
|
9
|
-
import { heapZone } from '@agoric/zone';
|
|
7
|
+
import { makeHeapZone } from '@agoric/zone';
|
|
10
8
|
import {
|
|
11
9
|
makeNameHubKit,
|
|
12
10
|
prepareMixinMyAddress,
|
|
13
11
|
} from '@agoric/vats/src/nameHub.js';
|
|
14
12
|
import { makeWalletRoot } from '../src/lib-wallet.js';
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const mixinMyAddress = prepareMixinMyAddress(heapZone);
|
|
14
|
+
const mixinMyAddress = prepareMixinMyAddress(makeHeapZone());
|
|
19
15
|
|
|
20
16
|
function makeFakeMyAddressNameAdmin() {
|
|
21
17
|
const { nameAdmin } = makeNameHubKit();
|
|
@@ -1,34 +1,27 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
import { assert } from '@endo/errors';
|
|
5
|
+
import { E } from '@endo/eventual-send';
|
|
5
6
|
import bundleSource from '@endo/bundle-source';
|
|
6
|
-
import { makeCache } from '@agoric/cache';
|
|
7
|
-
import { makeIssuerKit, AmountMath, AssetKind } from '@agoric/ertp';
|
|
8
7
|
|
|
9
8
|
import { M } from '@agoric/store';
|
|
10
|
-
|
|
9
|
+
import { makeCache } from '@agoric/cache';
|
|
10
|
+
import { makeIssuerKit, AmountMath, AssetKind } from '@agoric/ertp';
|
|
11
11
|
import { makeZoeForTest } from '@agoric/zoe/tools/setup-zoe.js';
|
|
12
|
-
import { E } from '@endo/eventual-send';
|
|
13
12
|
|
|
14
|
-
import { assert } from '@agoric/assert';
|
|
15
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
16
13
|
import { makeFakeBoard } from '@agoric/vats/tools/board-utils.js';
|
|
17
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
18
14
|
import {
|
|
19
15
|
makeNameHubKit,
|
|
20
16
|
prepareMixinMyAddress,
|
|
21
17
|
} from '@agoric/vats/src/nameHub.js';
|
|
22
18
|
import { resolve as importMetaResolve } from 'import-meta-resolve';
|
|
23
|
-
|
|
24
|
-
import { heapZone } from '@agoric/zone';
|
|
19
|
+
import { makeHeapZone } from '@agoric/zone';
|
|
25
20
|
import { makeWalletRoot } from '../src/lib-wallet.js';
|
|
26
21
|
|
|
27
|
-
import '../src/types.js';
|
|
28
|
-
|
|
29
22
|
const ZOE_INVITE_PURSE_PETNAME = 'Default Zoe invite purse';
|
|
30
23
|
|
|
31
|
-
const mixinMyAddress = prepareMixinMyAddress(
|
|
24
|
+
const mixinMyAddress = prepareMixinMyAddress(makeHeapZone());
|
|
32
25
|
|
|
33
26
|
function makeFakeMyAddressNameAdmin() {
|
|
34
27
|
const { nameAdmin } = makeNameHubKit();
|
|
@@ -303,12 +296,12 @@ test('lib-wallet dapp suggests issuer, instance, installation petnames', async t
|
|
|
303
296
|
const {
|
|
304
297
|
board,
|
|
305
298
|
automaticRefundInvitation,
|
|
306
|
-
autoswapInstallationHandle,
|
|
307
299
|
automaticRefundInstance,
|
|
308
300
|
wallet,
|
|
309
301
|
pursesStateChangeLog,
|
|
310
302
|
inboxStateChangeLog,
|
|
311
303
|
} = await setupTest(t, { autoswap: true, automaticRefund: true });
|
|
304
|
+
const { autoswapInstallation: autoswapInstallationHandle } = t.context;
|
|
312
305
|
|
|
313
306
|
const { issuer: bucksIssuer } = makeIssuerKit('bucks');
|
|
314
307
|
const bucksIssuerBoardId = await E(board).getId(bucksIssuer);
|
|
@@ -1639,17 +1632,14 @@ test('stamps from dateNow', async t => {
|
|
|
1639
1632
|
const paymentNotifier = E(wallet).getPaymentsNotifier();
|
|
1640
1633
|
|
|
1641
1634
|
const date0 = currentDateMS;
|
|
1642
|
-
const { value: val0, updateCount: count0 } =
|
|
1643
|
-
paymentNotifier
|
|
1644
|
-
).getUpdateSince();
|
|
1635
|
+
const { value: val0, updateCount: count0 } =
|
|
1636
|
+
await E(paymentNotifier).getUpdateSince();
|
|
1645
1637
|
await E(wallet).addPayment(pmt1);
|
|
1646
|
-
const { value: val1a, updateCount: count1a } =
|
|
1647
|
-
paymentNotifier
|
|
1648
|
-
).
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
paymentNotifier,
|
|
1652
|
-
).getUpdateSince(count1a);
|
|
1638
|
+
const { value: val1a, updateCount: count1a } =
|
|
1639
|
+
await E(paymentNotifier).getUpdateSince(count0);
|
|
1640
|
+
void E(wallet).addPayment(pmt4);
|
|
1641
|
+
const { value: val1, updateCount: count1 } =
|
|
1642
|
+
await E(paymentNotifier).getUpdateSince(count1a);
|
|
1653
1643
|
|
|
1654
1644
|
// Wait for tick to take effect.
|
|
1655
1645
|
currentDateMS += 1234;
|
|
@@ -1657,9 +1647,8 @@ test('stamps from dateNow', async t => {
|
|
|
1657
1647
|
t.is(dateNow(), startDateMS + 1234);
|
|
1658
1648
|
|
|
1659
1649
|
await E(wallet).addPayment(pmt2);
|
|
1660
|
-
const { value: val2, updateCount: count2 } =
|
|
1661
|
-
paymentNotifier
|
|
1662
|
-
).getUpdateSince(count1);
|
|
1650
|
+
const { value: val2, updateCount: count2 } =
|
|
1651
|
+
await E(paymentNotifier).getUpdateSince(count1);
|
|
1663
1652
|
await E(wallet).addPayment(pmt3);
|
|
1664
1653
|
const { value: payments } = await E(paymentNotifier).getUpdateSince(count2);
|
|
1665
1654
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/wallet",
|
|
3
|
-
"version": "0.18.4-other-dev-
|
|
3
|
+
"version": "0.18.4-other-dev-3eb1a1d.0+3eb1a1d",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": "Agoric",
|
|
8
8
|
"agoric-wallet": {
|
|
9
|
-
"htmlBasedir": "
|
|
9
|
+
"htmlBasedir": "@agoric/wallet-ui/build",
|
|
10
10
|
"deploy": [
|
|
11
11
|
"./api/deploy.js"
|
|
12
12
|
]
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"build": "exit 0"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"@agoric/internal": "0.3.3-other-dev-3eb1a1d.0+3eb1a1d",
|
|
22
23
|
"@agoric/wallet-ui": "0.1.3-solo.0",
|
|
23
|
-
"agoric": "0.21.2-other-dev-1f26562.0+1f26562",
|
|
24
24
|
"babel-eslint": "^10.0.3",
|
|
25
25
|
"eslint-plugin-eslint-comments": "^3.1.2",
|
|
26
26
|
"import-meta-resolve": "^2.2.1"
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "3eb1a1d2d75b2b4a94807cd3bf759bc9fc531f05"
|
|
32
32
|
}
|
package/api/exported.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './src/types.js';
|
|
File without changes
|
|
File without changes
|