@agoric/wallet-backend 0.13.4-dev-4ebcca5.0 → 0.13.4-dev-e7f11fd.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/wallet-backend",
3
- "version": "0.13.4-dev-4ebcca5.0+4ebcca5",
3
+ "version": "0.13.4-dev-e7f11fd.0+e7f11fd",
4
4
  "description": "Wallet backend",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -14,23 +14,23 @@
14
14
  "lint:eslint": "eslint ."
15
15
  },
16
16
  "devDependencies": {
17
- "@agoric/vats": "0.13.1-dev-4ebcca5.0+4ebcca5",
17
+ "@agoric/vats": "0.13.1-dev-e7f11fd.0+e7f11fd",
18
18
  "@endo/bundle-source": "^2.5.1",
19
19
  "@endo/init": "^0.5.56",
20
20
  "ava": "^5.2.0"
21
21
  },
22
22
  "dependencies": {
23
- "@agoric/assert": "0.5.2-dev-4ebcca5.0+4ebcca5",
24
- "@agoric/cache": "0.2.4-dev-4ebcca5.0+4ebcca5",
25
- "@agoric/ertp": "0.15.4-dev-4ebcca5.0+4ebcca5",
26
- "@agoric/inter-protocol": "0.13.2-dev-4ebcca5.0+4ebcca5",
27
- "@agoric/internal": "0.2.2-dev-4ebcca5.0+4ebcca5",
28
- "@agoric/notifier": "0.5.2-dev-4ebcca5.0+4ebcca5",
29
- "@agoric/smart-wallet": "0.4.3-dev-4ebcca5.0+4ebcca5",
30
- "@agoric/store": "0.8.4-dev-4ebcca5.0+4ebcca5",
31
- "@agoric/time": "0.2.2-dev-4ebcca5.0+4ebcca5",
32
- "@agoric/vat-data": "0.4.4-dev-4ebcca5.0+4ebcca5",
33
- "@agoric/zoe": "0.25.4-dev-4ebcca5.0+4ebcca5",
23
+ "@agoric/assert": "0.5.2-dev-e7f11fd.0+e7f11fd",
24
+ "@agoric/cache": "0.2.4-dev-e7f11fd.0+e7f11fd",
25
+ "@agoric/ertp": "0.15.4-dev-e7f11fd.0+e7f11fd",
26
+ "@agoric/inter-protocol": "0.13.2-dev-e7f11fd.0+e7f11fd",
27
+ "@agoric/internal": "0.2.2-dev-e7f11fd.0+e7f11fd",
28
+ "@agoric/notifier": "0.5.2-dev-e7f11fd.0+e7f11fd",
29
+ "@agoric/smart-wallet": "0.4.3-dev-e7f11fd.0+e7f11fd",
30
+ "@agoric/store": "0.8.4-dev-e7f11fd.0+e7f11fd",
31
+ "@agoric/time": "0.2.2-dev-e7f11fd.0+e7f11fd",
32
+ "@agoric/vat-data": "0.4.4-dev-e7f11fd.0+e7f11fd",
33
+ "@agoric/zoe": "0.25.4-dev-e7f11fd.0+e7f11fd",
34
34
  "@endo/eventual-send": "^0.17.2",
35
35
  "@endo/marshal": "^0.8.5",
36
36
  "@endo/nat": "^4.1.27",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "4ebcca53b15cec31410705617841e25cf92ba3ea"
61
+ "gitHead": "e7f11fd06e3b8de5946c31bb920141a1d4c0cf9e"
62
62
  }
@@ -341,6 +341,7 @@ export const makeDehydrator = (initialUnnamedCount = 0) => {
341
341
  // TODO Temporary hack.
342
342
  // See https://github.com/Agoric/agoric-sdk/issues/2780
343
343
  errorIdNum: 30000,
344
+ serializeBodyFormat: 'smallcaps',
344
345
  },
345
346
  );
346
347
  return harden({
package/src/lib-wallet.js CHANGED
@@ -14,6 +14,7 @@
14
14
  import { assert, q, Fail } from '@agoric/assert';
15
15
  import { makeScalarStoreCoordinator } from '@agoric/cache';
16
16
  import { objectMap, WalletName } from '@agoric/internal';
17
+ import { slotStringUnserialize } from '@agoric/internal/src/storage-test-utils.js';
17
18
  import {
18
19
  makeLegacyMap,
19
20
  makeScalarMapStore,
@@ -23,7 +24,7 @@ import { makeScalarBigMapStore } from '@agoric/vat-data';
23
24
  import { AmountMath } from '@agoric/ertp';
24
25
  import { E } from '@endo/eventual-send';
25
26
 
26
- import { makeMarshal, passStyleOf, Far, mapIterable } from '@endo/marshal';
27
+ import { passStyleOf, Far, mapIterable } from '@endo/marshal';
27
28
  import { Nat } from '@endo/nat';
28
29
  import {
29
30
  makeNotifierFromSubscriber,
@@ -228,18 +229,10 @@ export function makeWalletRoot({
228
229
  return getSortedValues(inboxState);
229
230
  }
230
231
 
231
- const noOp = () => {};
232
- const identitySlotToValFn = (slot, _) => slot;
233
-
234
232
  // Instead of { body, slots }, fill the slots. This is useful for
235
233
  // display but not for data processing, since the special identifier
236
234
  // @qclass is lost.
237
- const { unserialize: fillInSlots } = makeMarshal(noOp, identitySlotToValFn, {
238
- marshalName: 'wallet',
239
- // TODO Temporary hack.
240
- // See https://github.com/Agoric/agoric-sdk/issues/2780
241
- errorIdNum: 40000,
242
- });
235
+ const fillInSlots = slotStringUnserialize;
243
236
 
244
237
  /** @type {NotifierRecord<OfferState[]>} */
245
238
  const { notifier: offersNotifier, updater: offersUpdater } = makeNotifierKit(
@@ -1802,7 +1795,7 @@ export function makeWalletRoot({
1802
1795
 
1803
1796
  const firstPathToLookup = createRootLookups();
1804
1797
 
1805
- /** @type {ReturnType<typeof makeMarshal>} */
1798
+ /** @type {ReturnType<typeof import('@endo/marshal').makeMarshal>} */
1806
1799
  const marshaller = harden({
1807
1800
  fromCapData: context.fromCapData,
1808
1801
  toCapData: context.toCapData,
@@ -66,7 +66,7 @@ test('getPursesNotifier', async t => {
66
66
  value: 0n,
67
67
  });
68
68
  t.deepEqual(moolaPurseInfo.currentAmountSlots, {
69
- body: '{"brand":{"@qclass":"slot","iface":"Alleged: moola brand","index":0},"value":{"@qclass":"bigint","digits":"0"}}',
69
+ body: '#{"brand":"$0.Alleged: moola brand","value":"+0"}',
70
70
  slots: [
71
71
  {
72
72
  kind: 'brand',
@@ -100,7 +100,7 @@ test('getAttenuatedPursesNotifier', async t => {
100
100
  value: 0n,
101
101
  });
102
102
  t.deepEqual(moolaPurseInfo.currentAmountSlots, {
103
- body: '{"brand":{"@qclass":"slot","iface":"Alleged: moola brand","index":0},"value":{"@qclass":"bigint","digits":"0"}}',
103
+ body: '#{"brand":"$0.Alleged: moola brand","value":"+0"}',
104
104
  slots: [
105
105
  {
106
106
  kind: 'brand',
@@ -111,7 +111,7 @@ test('makeDehydrator', async t => {
111
111
  t.deepEqual(
112
112
  dehydrate(harden({ handle: handle1 })),
113
113
  {
114
- body: '{"handle":{"@qclass":"slot","iface":"Alleged: handle1","index":0}}',
114
+ body: '#{"handle":"$0.Alleged: handle1"}',
115
115
  slots: [{ kind: 'instanceHandle', petname: 'simpleExchange' }],
116
116
  },
117
117
  `serialize val with petname`,
@@ -119,7 +119,7 @@ test('makeDehydrator', async t => {
119
119
  t.deepEqual(
120
120
  hydrate(
121
121
  harden({
122
- body: '{"handle":{"@qclass":"slot","index":0}}',
122
+ body: '#{"handle":"$0"}',
123
123
  slots: [
124
124
  {
125
125
  kind: 'instanceHandle',
@@ -134,7 +134,7 @@ test('makeDehydrator', async t => {
134
134
  t.deepEqual(
135
135
  dehydrate(harden({ brand: brand1, value: 40 })),
136
136
  harden({
137
- body: '{"brand":{"@qclass":"slot","iface":"Alleged: mock brand","index":0},"value":40}',
137
+ body: '#{"brand":"$0.Alleged: mock brand","value":40}',
138
138
  slots: [{ kind: 'brand', petname: 'moola' }],
139
139
  }),
140
140
  `serialize brand with petname`,
@@ -142,7 +142,7 @@ test('makeDehydrator', async t => {
142
142
  t.deepEqual(
143
143
  hydrate(
144
144
  harden({
145
- body: '{"brand":{"@qclass":"slot","index":0},"value":40}',
145
+ body: '#{"brand":"$0","value":40}',
146
146
  slots: [{ kind: 'brand', petname: 'moola' }],
147
147
  }),
148
148
  ),
@@ -167,7 +167,7 @@ test('makeDehydrator', async t => {
167
167
  t.deepEqual(
168
168
  dehydrate(proposal),
169
169
  {
170
- body: '{"exit":{"afterDeadline":{"deadline":55,"timer":{"@qclass":"slot","iface":"Alleged: timer","index":0}}},"give":{"Price":{"brand":{"@qclass":"slot","iface":"Alleged: mock brand","index":1},"value":3}},"want":{"Asset1":{"brand":{"@qclass":"slot","iface":"Alleged: mock brand","index":2},"value":60},"Asset2":{"brand":{"@qclass":"slot","iface":"Alleged: mock brand","index":3},"value":{"instanceHandle":{"@qclass":"slot","iface":"Alleged: handle3","index":4}}}}}',
170
+ body: '#{"exit":{"afterDeadline":{"deadline":55,"timer":"$0.Alleged: timer"}},"give":{"Price":{"brand":"$1.Alleged: mock brand","value":3}},"want":{"Asset1":{"brand":"$2.Alleged: mock brand","value":60},"Asset2":{"brand":"$3.Alleged: mock brand","value":{"instanceHandle":"$4.Alleged: handle3"}}}}',
171
171
  slots: [
172
172
  { kind: 'unnamed', petname: 'unnamed-1' },
173
173
  { kind: 'brand', petname: 'simolean' },
@@ -181,7 +181,7 @@ test('makeDehydrator', async t => {
181
181
  t.deepEqual(
182
182
  hydrate(
183
183
  harden({
184
- body: '{"want":{"Asset1":{"brand":{"@qclass":"slot","index":0},"value":60},"Asset2":{"brand":{"@qclass":"slot","index":1},"value":{"instanceHandle":{"@qclass":"slot","index":2}}}},"give":{"Price":{"brand":{"@qclass":"slot","index":3},"value":3}},"exit":{"afterDeadline":{"timer":{"@qclass":"slot","index":4},"deadline":55}}}',
184
+ body: '#{"want":{"Asset1":{"brand":"$0","value":60},"Asset2":{"brand":"$1","value":{"instanceHandle":"$2"}}},"give":{"Price":{"brand":"$3","value":3}},"exit":{"afterDeadline":{"timer":"$4","deadline":55}}}',
185
185
  slots: [
186
186
  { kind: 'brand', petname: 'moola' },
187
187
  { kind: 'brand', petname: 'zoeInvite' },
@@ -198,7 +198,7 @@ test('makeDehydrator', async t => {
198
198
  t.deepEqual(
199
199
  dehydrate(harden({ handle: handle4 })),
200
200
  {
201
- body: '{"handle":{"@qclass":"slot","iface":"Alleged: handle4","index":0}}',
201
+ body: '#{"handle":"$0.Alleged: handle4"}',
202
202
  slots: [{ kind: 'unnamed', petname: 'unnamed-2' }],
203
203
  },
204
204
  `serialize val with no petname`,
@@ -206,7 +206,7 @@ test('makeDehydrator', async t => {
206
206
  t.deepEqual(
207
207
  hydrate(
208
208
  harden({
209
- body: '{"handle":{"@qclass":"slot","index":0}}',
209
+ body: '#{"handle":"$0"}',
210
210
  slots: [{ kind: 'unnamed', petname: 'unnamed-2' }],
211
211
  }),
212
212
  ),
@@ -218,7 +218,7 @@ test('makeDehydrator', async t => {
218
218
  t.deepEqual(
219
219
  dehydrate(harden({ handle: handle4 })),
220
220
  {
221
- body: '{"handle":{"@qclass":"slot","iface":"Alleged: handle4","index":0}}',
221
+ body: '#{"handle":"$0.Alleged: handle4"}',
222
222
  slots: [{ kind: 'instanceHandle', petname: 'autoswap' }],
223
223
  },
224
224
  `serialize val with new petname`,
@@ -226,7 +226,7 @@ test('makeDehydrator', async t => {
226
226
  t.deepEqual(
227
227
  hydrate(
228
228
  harden({
229
- body: '{"handle":{"@qclass":"slot","index":0}}',
229
+ body: '#{"handle":"$0"}',
230
230
  slots: [{ kind: 'instanceHandle', petname: 'autoswap' }],
231
231
  }),
232
232
  ),
@@ -320,7 +320,7 @@ test('lib-wallet issuer and purse methods', async t => {
320
320
  pursePetname: 'Default Zoe invite purse',
321
321
  value: [],
322
322
  currentAmountSlots: {
323
- body: '{"brand":{"@qclass":"slot","iface":"Alleged: Zoe Invitation brand","index":0},"value":[]}',
323
+ body: '#{"brand":"$0.Alleged: Zoe Invitation brand","value":[]}',
324
324
  slots: [{ kind: 'brand', petname: 'zoe invite' }],
325
325
  },
326
326
  currentAmount: {
@@ -342,7 +342,7 @@ test('lib-wallet issuer and purse methods', async t => {
342
342
  pursePetname: 'fun money',
343
343
  value: 100,
344
344
  currentAmountSlots: {
345
- body: '{"brand":{"@qclass":"slot","iface":"Alleged: moola brand","index":0},"value":{"@qclass":"bigint","digits":"100"}}',
345
+ body: '#{"brand":"$0.Alleged: moola brand","value":"+100"}',
346
346
  slots: [{ kind: 'brand', petname: 'moola' }],
347
347
  },
348
348
  currentAmount: {
@@ -472,7 +472,7 @@ test('lib-wallet dapp suggests issuer, instance, installation petnames', async t
472
472
  },
473
473
  ],
474
474
  currentAmountSlots: {
475
- body: '{"brand":{"@qclass":"slot","iface":"Alleged: Zoe Invitation brand","index":0},"value":[{"description":"getRefund","handle":{"@qclass":"slot","iface":"Alleged: InvitationHandle","index":1},"installation":{"@qclass":"slot","iface":"Alleged: BundleInstallation","index":2},"instance":{"@qclass":"slot","iface":"Alleged: InstanceHandle","index":3}}]}',
475
+ body: '#{"brand":"$0.Alleged: Zoe Invitation brand","value":[{"description":"getRefund","handle":"$1.Alleged: InvitationHandle","installation":"$2.Alleged: BundleInstallation","instance":"$3.Alleged: InstanceHandle"}]}',
476
476
  slots: [
477
477
  { kind: 'brand', petname: 'zoe invite' },
478
478
  { kind: 'unnamed', petname: 'unnamed-4' },
@@ -559,7 +559,7 @@ test('lib-wallet dapp suggests issuer, instance, installation petnames', async t
559
559
  },
560
560
  ],
561
561
  currentAmountSlots: {
562
- body: '{"brand":{"@qclass":"slot","iface":"Alleged: Zoe Invitation brand","index":0},"value":[{"description":"getRefund","handle":{"@qclass":"slot","iface":"Alleged: InvitationHandle","index":1},"installation":{"@qclass":"slot","iface":"Alleged: BundleInstallation","index":2},"instance":{"@qclass":"slot","iface":"Alleged: InstanceHandle","index":3}}]}',
562
+ body: '#{"brand":"$0.Alleged: Zoe Invitation brand","value":[{"description":"getRefund","handle":"$1.Alleged: InvitationHandle","installation":"$2.Alleged: BundleInstallation","instance":"$3.Alleged: InstanceHandle"}]}',
563
563
  slots: [
564
564
  { kind: 'brand', petname: 'zoe invite' },
565
565
  { kind: 'unnamed', petname: 'unnamed-4' },
@@ -698,7 +698,7 @@ test('lib-wallet dapp suggests issuer, instance, installation petnames', async t
698
698
  },
699
699
  ],
700
700
  currentAmountSlots: {
701
- body: '{"brand":{"@qclass":"slot","iface":"Alleged: Zoe Invitation brand","index":0},"value":[{"description":"getRefund","handle":{"@qclass":"slot","iface":"Alleged: InvitationHandle","index":1},"installation":{"@qclass":"slot","iface":"Alleged: BundleInstallation","index":2},"instance":{"@qclass":"slot","iface":"Alleged: InstanceHandle","index":3}}]}',
701
+ body: '#{"brand":"$0.Alleged: Zoe Invitation brand","value":[{"description":"getRefund","handle":"$1.Alleged: InvitationHandle","installation":"$2.Alleged: BundleInstallation","instance":"$3.Alleged: InstanceHandle"}]}',
702
702
  slots: [
703
703
  { kind: 'brand', petname: 'zoe invite' },
704
704
  { kind: 'unnamed', petname: 'unnamed-4' },
@@ -905,7 +905,7 @@ test('lib-wallet offer methods', async t => {
905
905
  pursePetname: 'Default Zoe invite purse',
906
906
  value: [],
907
907
  currentAmountSlots: {
908
- body: '{"brand":{"@qclass":"slot","iface":"Alleged: Zoe Invitation brand","index":0},"value":[]}',
908
+ body: '#{"brand":"$0.Alleged: Zoe Invitation brand","value":[]}',
909
909
  slots: [{ kind: 'brand', petname: 'zoe invite' }],
910
910
  },
911
911
  currentAmount: {
@@ -928,7 +928,7 @@ test('lib-wallet offer methods', async t => {
928
928
  depositBoardId: 'board0371',
929
929
  value: 100,
930
930
  currentAmountSlots: {
931
- body: '{"brand":{"@qclass":"slot","iface":"Alleged: moola brand","index":0},"value":{"@qclass":"bigint","digits":"100"}}',
931
+ body: '#{"brand":"$0.Alleged: moola brand","value":"+100"}',
932
932
  slots: [{ kind: 'brand', petname: 'moola' }],
933
933
  },
934
934
  meta: {
@@ -9,15 +9,7 @@ import {
9
9
  } from '@agoric/smart-wallet/src/marshal-contexts.js';
10
10
 
11
11
  const capData1 = {
12
- body: JSON.stringify([
13
- [
14
- 'applyMethod',
15
- { '@qclass': 'slot', iface: 'Alleged: purse.actions', index: 0 },
16
- 'deposit',
17
- [{ '@qclass': 'slot', iface: 'Alleged: payment', index: 1 }],
18
- ],
19
- ['applyFunction', { '@qclass': 'slot', index: 0 }, [1, 'thing']],
20
- ]),
12
+ body: '#[["applyMethod","$0.Alleged: purse.actions","deposit",["$1.Alleged: payment"]],["applyFunction","$0",[1,"thing"]]]',
21
13
  slots: ['purse:1', 'payment:1'],
22
14
  };
23
15
 
@@ -64,7 +56,7 @@ test('makeImportContext in wallet UI can unserialize messages', async t => {
64
56
  const capData = ctx.fromMyWallet.serialize(harden([...msgs]));
65
57
 
66
58
  t.deepEqual(capData, {
67
- body: '[["applyMethod",{"@qclass":"slot","iface":"Alleged: purse.actions","index":0},"transfer",[1]]]',
59
+ body: '#[["applyMethod","$0.Alleged: purse.actions","transfer",[1]]]',
68
60
  slots: ['purse:1'],
69
61
  });
70
62
  });