@agoric/wallet-backend 0.14.4-mainnet1B-dev-26244e8.0 → 0.14.4-orchestration-dev-096c4e8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -24
- package/bundles/bundle-wallet-js-meta.json +664 -265
- package/bundles/bundle-wallet.js +1 -1
- package/package.json +29 -21
- package/src/internal-types.js +2 -2
- package/src/lib-wallet.js +33 -27
- package/src/wallet.js +5 -4
- package/test/test-getPursesNotifier.js +2 -4
- package/test/test-lib-wallet.js +11 -18
- package/test/test-middleware.js +0 -1
- package/{jsconfig.json → tsconfig.json} +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/wallet-backend",
|
|
3
|
-
"version": "0.14.4-
|
|
3
|
+
"version": "0.14.4-orchestration-dev-096c4e8.0+096c4e8",
|
|
4
4
|
"description": "Wallet backend",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -10,30 +10,32 @@
|
|
|
10
10
|
"test:xs": "exit 0",
|
|
11
11
|
"lint": "run-s --continue-on-error lint:*",
|
|
12
12
|
"lint-fix": "yarn lint:eslint --fix",
|
|
13
|
-
"lint:types": "tsc
|
|
13
|
+
"lint:types": "tsc",
|
|
14
14
|
"lint:eslint": "eslint ."
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@agoric/vats": "0.15.2-
|
|
18
|
-
"@endo/bundle-source": "
|
|
19
|
-
"@endo/
|
|
20
|
-
"
|
|
17
|
+
"@agoric/vats": "0.15.2-orchestration-dev-096c4e8.0+096c4e8",
|
|
18
|
+
"@endo/bundle-source": "^3.1.0",
|
|
19
|
+
"@endo/far": "^1.0.4",
|
|
20
|
+
"@endo/init": "^1.0.4",
|
|
21
|
+
"ava": "^5.3.0"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
|
-
"@agoric/assert": "0.6.1-
|
|
24
|
-
"@agoric/cache": "0.3.3-
|
|
25
|
-
"@agoric/ertp": "0.16.3-
|
|
26
|
-
"@agoric/internal": "0.
|
|
27
|
-
"@agoric/notifier": "0.6.3-
|
|
28
|
-
"@agoric/smart-wallet": "0.5.4-
|
|
29
|
-
"@agoric/store": "0.9.3-
|
|
30
|
-
"@agoric/time": "0.3.3-
|
|
31
|
-
"@agoric/vat-data": "0.5.3-
|
|
32
|
-
"@agoric/zoe": "0.26.3-
|
|
33
|
-
"@
|
|
34
|
-
"@endo/
|
|
35
|
-
"@endo/
|
|
36
|
-
"@endo/
|
|
24
|
+
"@agoric/assert": "0.6.1-orchestration-dev-096c4e8.0+096c4e8",
|
|
25
|
+
"@agoric/cache": "0.3.3-orchestration-dev-096c4e8.0+096c4e8",
|
|
26
|
+
"@agoric/ertp": "0.16.3-orchestration-dev-096c4e8.0+096c4e8",
|
|
27
|
+
"@agoric/internal": "0.3.3-orchestration-dev-096c4e8.0+096c4e8",
|
|
28
|
+
"@agoric/notifier": "0.6.3-orchestration-dev-096c4e8.0+096c4e8",
|
|
29
|
+
"@agoric/smart-wallet": "0.5.4-orchestration-dev-096c4e8.0+096c4e8",
|
|
30
|
+
"@agoric/store": "0.9.3-orchestration-dev-096c4e8.0+096c4e8",
|
|
31
|
+
"@agoric/time": "0.3.3-orchestration-dev-096c4e8.0+096c4e8",
|
|
32
|
+
"@agoric/vat-data": "0.5.3-orchestration-dev-096c4e8.0+096c4e8",
|
|
33
|
+
"@agoric/zoe": "0.26.3-orchestration-dev-096c4e8.0+096c4e8",
|
|
34
|
+
"@agoric/zone": "0.2.3-orchestration-dev-096c4e8.0+096c4e8",
|
|
35
|
+
"@endo/eventual-send": "^1.1.2",
|
|
36
|
+
"@endo/marshal": "^1.3.0",
|
|
37
|
+
"@endo/nat": "^5.0.4",
|
|
38
|
+
"@endo/promise-kit": "^1.0.4",
|
|
37
39
|
"import-meta-resolve": "^2.2.1"
|
|
38
40
|
},
|
|
39
41
|
"keywords": [],
|
|
@@ -51,11 +53,17 @@
|
|
|
51
53
|
"files": [
|
|
52
54
|
"test/**/test-*.js"
|
|
53
55
|
],
|
|
56
|
+
"require": [
|
|
57
|
+
"@endo/init/debug.js"
|
|
58
|
+
],
|
|
54
59
|
"timeout": "2m",
|
|
55
60
|
"workerThreads": false
|
|
56
61
|
},
|
|
57
62
|
"publishConfig": {
|
|
58
63
|
"access": "public"
|
|
59
64
|
},
|
|
60
|
-
"
|
|
65
|
+
"typeCoverage": {
|
|
66
|
+
"atLeast": 0
|
|
67
|
+
},
|
|
68
|
+
"gitHead": "096c4e8fce80e9a509b0e1a30fda11736c4570e1"
|
|
61
69
|
}
|
package/src/internal-types.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @property {PurseActions} actions
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
/** @typedef {import('@agoric/deploy-script-support/src/externalTypes').Petname} Petname */
|
|
10
|
+
/** @typedef {import('@agoric/deploy-script-support/src/externalTypes.js').Petname} Petname */
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @typedef {PursesJSONState & PursesAddedState} PursesFullState
|
|
@@ -93,6 +93,6 @@
|
|
|
93
93
|
* would make them part of the WalletUser available as `home.wallet` in the
|
|
94
94
|
* REPL. Then, the Wallet UI could use that instead.
|
|
95
95
|
*
|
|
96
|
-
* @typedef {import('./lib-wallet').WalletRoot['admin']}
|
|
96
|
+
* @typedef {import('./lib-wallet.js').WalletRoot['admin']}
|
|
97
97
|
* WalletAdminFacet
|
|
98
98
|
*/
|
package/src/lib-wallet.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
+
/* eslint @typescript-eslint/no-floating-promises: "warn" */
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* This file defines the wallet internals without dependency on the ag-solo on
|
|
@@ -46,7 +47,7 @@ import '@agoric/store/exported.js';
|
|
|
46
47
|
import '@agoric/zoe/exported.js';
|
|
47
48
|
|
|
48
49
|
import './internal-types.js';
|
|
49
|
-
|
|
50
|
+
/// <reference path="./types.js" />
|
|
50
51
|
|
|
51
52
|
// does nothing
|
|
52
53
|
const noActionStateChangeHandler = _newState => {};
|
|
@@ -502,9 +503,8 @@ export function makeWalletRoot({
|
|
|
502
503
|
const alreadyDisplayed =
|
|
503
504
|
inboxState.has(id) && inboxState.get(id).proposalForDisplay;
|
|
504
505
|
|
|
505
|
-
const augmentedInvitationDetails =
|
|
506
|
-
invitationDetails
|
|
507
|
-
);
|
|
506
|
+
const augmentedInvitationDetails =
|
|
507
|
+
await expandInvitationBrands(invitationDetails);
|
|
508
508
|
|
|
509
509
|
const offerForDisplay = {
|
|
510
510
|
...offer,
|
|
@@ -726,7 +726,7 @@ export function makeWalletRoot({
|
|
|
726
726
|
// eslint-disable-next-line no-use-before-define
|
|
727
727
|
p = makeEmptyPurse(petnameForBrand, petnameForBrand, true);
|
|
728
728
|
} else {
|
|
729
|
-
p = Promise.resolve();
|
|
729
|
+
p = Promise.resolve(undefined);
|
|
730
730
|
}
|
|
731
731
|
return E.when(p, _ => petnameForBrand);
|
|
732
732
|
};
|
|
@@ -1209,6 +1209,7 @@ export function makeWalletRoot({
|
|
|
1209
1209
|
updateInboxState(id, rejectOffer);
|
|
1210
1210
|
};
|
|
1211
1211
|
|
|
1212
|
+
await null;
|
|
1212
1213
|
try {
|
|
1213
1214
|
const pendingOffer = addMeta({
|
|
1214
1215
|
...offer,
|
|
@@ -1372,6 +1373,7 @@ export function makeWalletRoot({
|
|
|
1372
1373
|
brandToAutoDepositPurse.init(brand, purse);
|
|
1373
1374
|
}
|
|
1374
1375
|
|
|
1376
|
+
await null;
|
|
1375
1377
|
if (updateState) {
|
|
1376
1378
|
await updateAllPurseState();
|
|
1377
1379
|
}
|
|
@@ -1893,28 +1895,32 @@ export function makeWalletRoot({
|
|
|
1893
1895
|
// don't really trust.
|
|
1894
1896
|
// The param is{import('@agoric/vats/src/vat-bank.js').Bank} but that here triggers https://github.com/Agoric/agoric-sdk/issues/4620
|
|
1895
1897
|
const importBankAssets = async bank => {
|
|
1896
|
-
observeIteration(
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1898
|
+
observeIteration(
|
|
1899
|
+
subscribeEach(E(bank).getAssetSubscription()),
|
|
1900
|
+
harden({
|
|
1901
|
+
async updateState({ proposedName, issuerName, issuer, brand }) {
|
|
1902
|
+
await null;
|
|
1903
|
+
try {
|
|
1904
|
+
issuerName = await addIssuer(issuerName, issuer);
|
|
1905
|
+
const purse = await E(bank).getPurse(brand);
|
|
1906
|
+
// We can import this purse, because we trust the bank.
|
|
1907
|
+
await internalUnsafeImportPurse(
|
|
1908
|
+
issuerName,
|
|
1909
|
+
proposedName,
|
|
1910
|
+
true,
|
|
1911
|
+
purse,
|
|
1912
|
+
);
|
|
1913
|
+
} catch (e) {
|
|
1914
|
+
console.error('/// could not add bank asset purse', e, {
|
|
1915
|
+
issuerName,
|
|
1916
|
+
proposedName,
|
|
1917
|
+
issuer,
|
|
1918
|
+
brand,
|
|
1919
|
+
});
|
|
1920
|
+
}
|
|
1921
|
+
},
|
|
1922
|
+
}),
|
|
1923
|
+
).finally(() => console.error('/// This is the end of the bank assets'));
|
|
1918
1924
|
};
|
|
1919
1925
|
return {
|
|
1920
1926
|
admin: wallet,
|
package/src/wallet.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
+
/* eslint @typescript-eslint/no-floating-promises: "warn" */
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* This file defines the vat launched by the spawner in the ../deploy.js script.
|
|
@@ -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,
|
|
@@ -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', {
|
|
@@ -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,10 +3,8 @@ 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,
|
|
@@ -15,7 +13,7 @@ import { makeWalletRoot } from '../src/lib-wallet.js';
|
|
|
15
13
|
|
|
16
14
|
import '../src/types.js';
|
|
17
15
|
|
|
18
|
-
const mixinMyAddress = prepareMixinMyAddress(
|
|
16
|
+
const mixinMyAddress = prepareMixinMyAddress(makeHeapZone());
|
|
19
17
|
|
|
20
18
|
function makeFakeMyAddressNameAdmin() {
|
|
21
19
|
const { nameAdmin } = makeNameHubKit();
|
package/test/test-lib-wallet.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
+
/* eslint @typescript-eslint/no-floating-promises: "warn" */
|
|
2
3
|
import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js';
|
|
3
4
|
|
|
4
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
5
5
|
import bundleSource from '@endo/bundle-source';
|
|
6
6
|
import { makeCache } from '@agoric/cache';
|
|
7
7
|
import { makeIssuerKit, AmountMath, AssetKind } from '@agoric/ertp';
|
|
@@ -12,23 +12,20 @@ import { makeZoeForTest } from '@agoric/zoe/tools/setup-zoe.js';
|
|
|
12
12
|
import { E } from '@endo/eventual-send';
|
|
13
13
|
|
|
14
14
|
import { assert } from '@agoric/assert';
|
|
15
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
16
15
|
import { makeFakeBoard } from '@agoric/vats/tools/board-utils.js';
|
|
17
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
18
16
|
import {
|
|
19
17
|
makeNameHubKit,
|
|
20
18
|
prepareMixinMyAddress,
|
|
21
19
|
} from '@agoric/vats/src/nameHub.js';
|
|
22
20
|
import { resolve as importMetaResolve } from 'import-meta-resolve';
|
|
23
|
-
|
|
24
|
-
import { heapZone } from '@agoric/zone';
|
|
21
|
+
import { makeHeapZone } from '@agoric/zone';
|
|
25
22
|
import { makeWalletRoot } from '../src/lib-wallet.js';
|
|
26
23
|
|
|
27
24
|
import '../src/types.js';
|
|
28
25
|
|
|
29
26
|
const ZOE_INVITE_PURSE_PETNAME = 'Default Zoe invite purse';
|
|
30
27
|
|
|
31
|
-
const mixinMyAddress = prepareMixinMyAddress(
|
|
28
|
+
const mixinMyAddress = prepareMixinMyAddress(makeHeapZone());
|
|
32
29
|
|
|
33
30
|
function makeFakeMyAddressNameAdmin() {
|
|
34
31
|
const { nameAdmin } = makeNameHubKit();
|
|
@@ -1639,17 +1636,14 @@ test('stamps from dateNow', async t => {
|
|
|
1639
1636
|
const paymentNotifier = E(wallet).getPaymentsNotifier();
|
|
1640
1637
|
|
|
1641
1638
|
const date0 = currentDateMS;
|
|
1642
|
-
const { value: val0, updateCount: count0 } =
|
|
1643
|
-
paymentNotifier
|
|
1644
|
-
).getUpdateSince();
|
|
1639
|
+
const { value: val0, updateCount: count0 } =
|
|
1640
|
+
await E(paymentNotifier).getUpdateSince();
|
|
1645
1641
|
await E(wallet).addPayment(pmt1);
|
|
1646
|
-
const { value: val1a, updateCount: count1a } =
|
|
1647
|
-
paymentNotifier
|
|
1648
|
-
).getUpdateSince(count0);
|
|
1642
|
+
const { value: val1a, updateCount: count1a } =
|
|
1643
|
+
await E(paymentNotifier).getUpdateSince(count0);
|
|
1649
1644
|
E(wallet).addPayment(pmt4);
|
|
1650
|
-
const { value: val1, updateCount: count1 } =
|
|
1651
|
-
paymentNotifier
|
|
1652
|
-
).getUpdateSince(count1a);
|
|
1645
|
+
const { value: val1, updateCount: count1 } =
|
|
1646
|
+
await E(paymentNotifier).getUpdateSince(count1a);
|
|
1653
1647
|
|
|
1654
1648
|
// Wait for tick to take effect.
|
|
1655
1649
|
currentDateMS += 1234;
|
|
@@ -1657,9 +1651,8 @@ test('stamps from dateNow', async t => {
|
|
|
1657
1651
|
t.is(dateNow(), startDateMS + 1234);
|
|
1658
1652
|
|
|
1659
1653
|
await E(wallet).addPayment(pmt2);
|
|
1660
|
-
const { value: val2, updateCount: count2 } =
|
|
1661
|
-
paymentNotifier
|
|
1662
|
-
).getUpdateSince(count1);
|
|
1654
|
+
const { value: val2, updateCount: count2 } =
|
|
1655
|
+
await E(paymentNotifier).getUpdateSince(count1);
|
|
1663
1656
|
await E(wallet).addPayment(pmt3);
|
|
1664
1657
|
const { value: payments } = await E(paymentNotifier).getUpdateSince(count2);
|
|
1665
1658
|
|
package/test/test-middleware.js
CHANGED