@agoric/inter-protocol 0.16.2-dev-61d2935.0.61d2935 → 0.16.2-dev-0c6ee36.0.0c6ee36

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/inter-protocol",
3
- "version": "0.16.2-dev-61d2935.0.61d2935",
3
+ "version": "0.16.2-dev-0c6ee36.0.0c6ee36",
4
4
  "description": "Core cryptoeconomy contracts",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -31,17 +31,17 @@
31
31
  },
32
32
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
33
33
  "dependencies": {
34
- "@agoric/base-zone": "0.1.1-dev-61d2935.0.61d2935",
35
- "@agoric/ertp": "0.16.3-dev-61d2935.0.61d2935",
36
- "@agoric/governance": "0.10.4-dev-61d2935.0.61d2935",
37
- "@agoric/internal": "0.3.3-dev-61d2935.0.61d2935",
38
- "@agoric/notifier": "0.6.3-dev-61d2935.0.61d2935",
39
- "@agoric/store": "0.9.3-dev-61d2935.0.61d2935",
40
- "@agoric/time": "0.3.3-dev-61d2935.0.61d2935",
41
- "@agoric/vat-data": "0.5.3-dev-61d2935.0.61d2935",
42
- "@agoric/vats": "0.15.2-dev-61d2935.0.61d2935",
43
- "@agoric/zoe": "0.26.3-dev-61d2935.0.61d2935",
44
- "@agoric/zone": "0.2.3-dev-61d2935.0.61d2935",
34
+ "@agoric/base-zone": "0.1.1-dev-0c6ee36.0.0c6ee36",
35
+ "@agoric/ertp": "0.16.3-dev-0c6ee36.0.0c6ee36",
36
+ "@agoric/governance": "0.10.4-dev-0c6ee36.0.0c6ee36",
37
+ "@agoric/internal": "0.3.3-dev-0c6ee36.0.0c6ee36",
38
+ "@agoric/notifier": "0.6.3-dev-0c6ee36.0.0c6ee36",
39
+ "@agoric/store": "0.9.3-dev-0c6ee36.0.0c6ee36",
40
+ "@agoric/time": "0.3.3-dev-0c6ee36.0.0c6ee36",
41
+ "@agoric/vat-data": "0.5.3-dev-0c6ee36.0.0c6ee36",
42
+ "@agoric/vats": "0.15.2-dev-0c6ee36.0.0c6ee36",
43
+ "@agoric/zoe": "0.26.3-dev-0c6ee36.0.0c6ee36",
44
+ "@agoric/zone": "0.2.3-dev-0c6ee36.0.0c6ee36",
45
45
  "@endo/captp": "^4.4.8",
46
46
  "@endo/errors": "^1.2.13",
47
47
  "@endo/eventual-send": "^1.3.4",
@@ -52,9 +52,9 @@
52
52
  "jessie.js": "^0.3.4"
53
53
  },
54
54
  "devDependencies": {
55
- "@agoric/smart-wallet": "0.5.4-dev-61d2935.0.61d2935",
56
- "@agoric/swingset-liveslots": "0.10.3-dev-61d2935.0.61d2935",
57
- "@agoric/swingset-vat": "0.32.3-dev-61d2935.0.61d2935",
55
+ "@agoric/smart-wallet": "0.5.4-dev-0c6ee36.0.0c6ee36",
56
+ "@agoric/swingset-liveslots": "0.10.3-dev-0c6ee36.0.0c6ee36",
57
+ "@agoric/swingset-vat": "0.32.3-dev-0c6ee36.0.0c6ee36",
58
58
  "@endo/bundle-source": "^4.1.2",
59
59
  "@endo/init": "^1.1.12",
60
60
  "@endo/promise-kit": "^1.1.13",
@@ -85,5 +85,5 @@
85
85
  "typeCoverage": {
86
86
  "atLeast": 95.65
87
87
  },
88
- "gitHead": "61d29359b5f8b4fe62d55fe0641ef4bdcfa48627"
88
+ "gitHead": "0c6ee3656ebd5fe23027f792516d4d6fa5e8ae06"
89
89
  }
@@ -0,0 +1,63 @@
1
+ import { E } from '@endo/far';
2
+ import { makeTracer } from '@agoric/internal/src/debug.js';
3
+ import { reserveThenDeposit } from './utils.js';
4
+
5
+ /**
6
+ * @param {BootstrapPowers & {
7
+ * consume: {
8
+ * reserveKit: Promise<
9
+ * ReturnType<import('../reserve/assetReserve.js')['start']>
10
+ * >;
11
+ * };
12
+ * }} powers
13
+ * @param {{ options: { address: string; count?: number } }} namedArgs
14
+ */
15
+ export const inviteReserveWithdrawer = async (
16
+ { consume: { namesByAddressAdmin, reserveKit } },
17
+ { options: { address, count = 1 } },
18
+ ) => {
19
+ const trace = makeTracer('InviteReserveWithdrawer');
20
+
21
+ const maybeGovernedCreatorFacetP = E.get(reserveKit).creatorFacet;
22
+ const creatorFacetP = E(maybeGovernedCreatorFacetP)
23
+ .getLimitedCreatorFacet()
24
+ .catch(err => {
25
+ trace('Failed to get limited creator facet:', err);
26
+ return maybeGovernedCreatorFacetP;
27
+ });
28
+
29
+ const makeInvitation = () =>
30
+ // @ts-expect-error tolerate translation from governed to limited creatorFacet
31
+ E(creatorFacetP).makeSingleWithdrawalInvitation();
32
+
33
+ const invitations = await Promise.all(
34
+ Array.from({ length: count }, makeInvitation),
35
+ );
36
+
37
+ // Deposit the invitations, but don't block in case the address does not yet
38
+ // have a smart wallet.
39
+ void reserveThenDeposit(
40
+ `reserve withdrawer ${address}`,
41
+ namesByAddressAdmin,
42
+ address,
43
+ invitations,
44
+ );
45
+ };
46
+ harden(inviteReserveWithdrawer);
47
+
48
+ export const getManifestForInviteWithdrawer = async (
49
+ { restoreRef: _ },
50
+ { address, count },
51
+ ) => {
52
+ return {
53
+ manifest: {
54
+ [inviteReserveWithdrawer.name]: /** @type {const} */ ({
55
+ consume: {
56
+ namesByAddressAdmin: true,
57
+ reserveKit: true,
58
+ },
59
+ }),
60
+ },
61
+ options: { address, count },
62
+ };
63
+ };