@agoric/smart-wallet 0.5.4-dev-4264b77.0 → 0.5.4-dev-68f7b6b.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 +13 -13
- 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 +2 -2
- 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 +2 -3
- package/src/smartWallet.d.ts.map +1 -1
- package/src/smartWallet.js +7 -12
- package/src/types.d.ts +4 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/smart-wallet",
|
|
3
|
-
"version": "0.5.4-dev-
|
|
3
|
+
"version": "0.5.4-dev-68f7b6b.0+68f7b6b",
|
|
4
4
|
"description": "Wallet contract",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -16,23 +16,23 @@
|
|
|
16
16
|
"lint:eslint": "eslint ."
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@agoric/cosmic-proto": "0.3.1-dev-
|
|
19
|
+
"@agoric/cosmic-proto": "0.3.1-dev-68f7b6b.0+68f7b6b",
|
|
20
20
|
"@endo/captp": "^3.1.2",
|
|
21
21
|
"@endo/init": "^0.5.57",
|
|
22
22
|
"ava": "^5.3.0",
|
|
23
23
|
"import-meta-resolve": "^2.2.1"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@agoric/assert": "0.6.1-dev-
|
|
27
|
-
"@agoric/casting": "0.4.3-dev-
|
|
28
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
29
|
-
"@agoric/internal": "0.3.3-dev-
|
|
30
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
31
|
-
"@agoric/store": "0.9.3-dev-
|
|
32
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
33
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
34
|
-
"@agoric/vats": "0.15.2-dev-
|
|
35
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
26
|
+
"@agoric/assert": "0.6.1-dev-68f7b6b.0+68f7b6b",
|
|
27
|
+
"@agoric/casting": "0.4.3-dev-68f7b6b.0+68f7b6b",
|
|
28
|
+
"@agoric/ertp": "0.16.3-dev-68f7b6b.0+68f7b6b",
|
|
29
|
+
"@agoric/internal": "0.3.3-dev-68f7b6b.0+68f7b6b",
|
|
30
|
+
"@agoric/notifier": "0.6.3-dev-68f7b6b.0+68f7b6b",
|
|
31
|
+
"@agoric/store": "0.9.3-dev-68f7b6b.0+68f7b6b",
|
|
32
|
+
"@agoric/swingset-vat": "0.32.3-dev-68f7b6b.0+68f7b6b",
|
|
33
|
+
"@agoric/vat-data": "0.5.3-dev-68f7b6b.0+68f7b6b",
|
|
34
|
+
"@agoric/vats": "0.15.2-dev-68f7b6b.0+68f7b6b",
|
|
35
|
+
"@agoric/zoe": "0.26.3-dev-68f7b6b.0+68f7b6b",
|
|
36
36
|
"@endo/eventual-send": "^0.17.3",
|
|
37
37
|
"@endo/far": "^0.2.19",
|
|
38
38
|
"@endo/marshal": "^0.8.6",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "68f7b6bcbadd4380bc0c00ac7d9365e61c3b5ac3"
|
|
66
66
|
}
|
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').InvitationMakers): (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,gBAAgB,UAsFlD,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').InvitationMakers} 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<Purse>;
|
|
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').InvitationMakers, 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":"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,
|
|
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,KAAK,CAAC;;6BACvB,WAAW,KAAK,IAAI;oCACnB,MAAM,oBAAoB,OAAO,KAAK,CAAC,oBAAoB,OAAO,SAAS,EAAE,gBAAgB,qBAAqB,OAAO,SAAS,EAAE,iBAAiB,GAAG,OAAO,iCAAiC,EAAE,YAAY,KAAM,QAAQ,IAAI,CAAC;;IAalP;;;;;;;OAOG;4BAJQ,SAAS,2BACC,QAAQ,KAAK,IAAI,GACzB,QAAQ,IAAI,CAAC;EAyI7B;sBA9LY,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
|
@@ -35,9 +35,9 @@ export const UNPUBLISHED_RESULT = 'UNPUBLISHED';
|
|
|
35
35
|
* @param {object} opts.powers
|
|
36
36
|
* @param {Pick<Console, 'info'| 'error'>} opts.powers.logger
|
|
37
37
|
* @param {(spec: import('./invitations').InvitationSpec) => ERef<Invitation>} opts.powers.invitationFromSpec
|
|
38
|
-
* @param {(brand: Brand) => Promise<
|
|
38
|
+
* @param {(brand: Brand) => Promise<Purse>} opts.powers.purseForBrand
|
|
39
39
|
* @param {(status: OfferStatus) => void} opts.onStatusChange
|
|
40
|
-
* @param {(offerId: string, invitationAmount: Amount<'set'>, invitationMakers: import('./types').
|
|
40
|
+
* @param {(offerId: string, invitationAmount: Amount<'set'>, invitationMakers: import('./types').InvitationMakers, publicSubscribers: import('./types').PublicSubscribers | import('@agoric/zoe/src/contractSupport').TopicsRecord ) => Promise<void>} opts.onNewContinuingOffer
|
|
41
41
|
*/
|
|
42
42
|
export const makeOfferExecutor = ({
|
|
43
43
|
zoe,
|
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<Purse>, depositFacet: {
|
|
2
2
|
receive: (payment: any) => Promise<Amount>;
|
|
3
3
|
}): {
|
|
4
4
|
/**
|
|
@@ -10,7 +10,7 @@ export function makePaymentsHelper(purseForBrand: (brand: Brand) => Promise<impo
|
|
|
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<AssetKind> | 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,KAAK,CAAC;+BACL,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<Purse>} 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, Purse>}
|
|
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<Purse>} */
|
|
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
|
@@ -124,7 +124,6 @@ export type BrandDescriptor = {
|
|
|
124
124
|
issuer: Issuer;
|
|
125
125
|
petname: import('./types').Petname;
|
|
126
126
|
};
|
|
127
|
-
export type RemotePurse = import('./types').RemotePurse;
|
|
128
127
|
export type UniqueParams = {
|
|
129
128
|
address: string;
|
|
130
129
|
bank: ERef<import('@agoric/vats/src/vat-bank').Bank>;
|
|
@@ -151,10 +150,10 @@ export type SharedParams = {
|
|
|
151
150
|
export type State = ImmutableState & MutableState;
|
|
152
151
|
export type ImmutableState = Readonly<UniqueParams & {
|
|
153
152
|
paymentQueues: MapStore<Brand, Array<import('@endo/far').FarRef<Payment>>>;
|
|
154
|
-
offerToInvitationMakers: MapStore<string, import('./types').
|
|
153
|
+
offerToInvitationMakers: MapStore<string, import('./types').InvitationMakers>;
|
|
155
154
|
offerToPublicSubscriberPaths: MapStore<string, Record<string, string>>;
|
|
156
155
|
offerToUsedInvitation: MapStore<string, Amount>;
|
|
157
|
-
purseBalances: MapStore<
|
|
156
|
+
purseBalances: MapStore<Purse, Amount>;
|
|
158
157
|
updateRecorderKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<UpdateRecord>;
|
|
159
158
|
currentRecorderKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<CurrentWalletRecord>;
|
|
160
159
|
liveOffers: MapStore<import('./offers.js').OfferId, import('./offers.js').OfferStatus>;
|
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
|
@@ -102,9 +102,6 @@ const { Fail, quote: q } = assert;
|
|
|
102
102
|
* For use by clients to describe brands to users. Includes `displayInfo` to save a remote call.
|
|
103
103
|
*/
|
|
104
104
|
|
|
105
|
-
// imports
|
|
106
|
-
/** @typedef {import('./types').RemotePurse} RemotePurse */
|
|
107
|
-
|
|
108
105
|
/**
|
|
109
106
|
* @typedef {{
|
|
110
107
|
* address: string,
|
|
@@ -133,10 +130,10 @@ const { Fail, quote: q } = assert;
|
|
|
133
130
|
*
|
|
134
131
|
* @typedef {Readonly<UniqueParams & {
|
|
135
132
|
* paymentQueues: MapStore<Brand, Array<import('@endo/far').FarRef<Payment>>>,
|
|
136
|
-
* offerToInvitationMakers: MapStore<string, import('./types').
|
|
133
|
+
* offerToInvitationMakers: MapStore<string, import('./types').InvitationMakers>,
|
|
137
134
|
* offerToPublicSubscriberPaths: MapStore<string, Record<string, string>>,
|
|
138
135
|
* offerToUsedInvitation: MapStore<string, Amount>,
|
|
139
|
-
* purseBalances: MapStore<
|
|
136
|
+
* purseBalances: MapStore<Purse, Amount>,
|
|
140
137
|
* updateRecorderKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<UpdateRecord>,
|
|
141
138
|
* currentRecorderKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<CurrentWalletRecord>,
|
|
142
139
|
* liveOffers: MapStore<import('./offers.js').OfferId, import('./offers.js').OfferStatus>,
|
|
@@ -303,7 +300,7 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
303
300
|
!used || Fail`cannot re-use offer id ${id}`;
|
|
304
301
|
},
|
|
305
302
|
/**
|
|
306
|
-
* @param {
|
|
303
|
+
* @param {Purse} purse
|
|
307
304
|
* @param {Amount<any>} balance
|
|
308
305
|
*/
|
|
309
306
|
updateBalance(purse, balance) {
|
|
@@ -342,7 +339,7 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
342
339
|
});
|
|
343
340
|
},
|
|
344
341
|
|
|
345
|
-
/** @type {(purse: ERef<
|
|
342
|
+
/** @type {(purse: ERef<Purse>) => Promise<void>} */
|
|
346
343
|
async watchPurse(purseRef) {
|
|
347
344
|
const { address } = this.state;
|
|
348
345
|
|
|
@@ -445,14 +442,13 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
445
442
|
),
|
|
446
443
|
/**
|
|
447
444
|
* @param {Brand} brand
|
|
448
|
-
* @returns {Promise<
|
|
445
|
+
* @returns {Promise<Purse>}
|
|
449
446
|
*/
|
|
450
447
|
purseForBrand: async brand => {
|
|
451
448
|
if (registry.has(brand)) {
|
|
452
|
-
// @ts-expect-error
|
|
449
|
+
// @ts-expect-error virtual purse
|
|
453
450
|
return E(bank).getPurse(brand);
|
|
454
451
|
} else if (invitationBrand === brand) {
|
|
455
|
-
// @ts-expect-error RemotePurse cast
|
|
456
452
|
return invitationPurse;
|
|
457
453
|
}
|
|
458
454
|
throw Fail`cannot find/make purse for ${brand}`;
|
|
@@ -479,7 +475,7 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
479
475
|
}
|
|
480
476
|
}
|
|
481
477
|
},
|
|
482
|
-
/** @type {(offerId: string, invitationAmount: Amount<'set'>, invitationMakers: import('./types').
|
|
478
|
+
/** @type {(offerId: string, invitationAmount: Amount<'set'>, invitationMakers: import('./types').InvitationMakers, publicSubscribers?: import('./types').PublicSubscribers | import('@agoric/zoe/src/contractSupport').TopicsRecord) => Promise<void>} */
|
|
483
479
|
onNewContinuingOffer: async (
|
|
484
480
|
offerId,
|
|
485
481
|
invitationAmount,
|
|
@@ -604,7 +600,6 @@ export const prepareSmartWallet = (baggage, shared) => {
|
|
|
604
600
|
const { invitationPurse } = state;
|
|
605
601
|
const { helper } = facets;
|
|
606
602
|
|
|
607
|
-
// @ts-expect-error RemotePurse cast
|
|
608
603
|
void helper.watchPurse(invitationPurse);
|
|
609
604
|
},
|
|
610
605
|
},
|
package/src/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
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 type { ERef
|
|
8
|
+
import type { ERef } from '@endo/far';
|
|
9
9
|
import type { CapData } from '@endo/marshal';
|
|
10
10
|
import type { MsgWalletSpendAction } from '@agoric/cosmic-proto/swingset/msgs';
|
|
11
11
|
import type { AgoricNamesRemotes } from '@agoric/vats/tools/board-utils.js';
|
|
@@ -21,10 +21,9 @@ declare const CapDataShape: unique symbol;
|
|
|
21
21
|
*/
|
|
22
22
|
export type Petname = string | string[];
|
|
23
23
|
|
|
24
|
-
export type
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Record<string, (...args: any[]) => Promise<Invitation>>
|
|
24
|
+
export type InvitationMakers = Record<
|
|
25
|
+
string,
|
|
26
|
+
(...args: any[]) => Promise<Invitation>
|
|
28
27
|
>;
|
|
29
28
|
|
|
30
29
|
export type PublicSubscribers = Record<string, ERef<StoredFacet>>;
|