@agoric/smart-wallet 0.7.0-u23.0 → 0.7.0-u23.1
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 +17 -17
- package/source-spec-registry.d.ts +13 -0
- package/source-spec-registry.d.ts.map +1 -0
- package/src/index.d.ts +2 -0
- package/src/index.d.ts.map +1 -0
- package/src/invitations.d.ts +59 -0
- package/src/invitations.d.ts.map +1 -0
- package/src/marshal-contexts.d.ts +94 -0
- package/src/marshal-contexts.d.ts.map +1 -0
- package/src/offerWatcher.d.ts +59 -0
- package/src/offerWatcher.d.ts.map +1 -0
- package/src/offers.d.ts +84 -0
- package/src/offers.d.ts.map +1 -0
- package/src/smartWallet.d.ts +254 -0
- package/src/smartWallet.d.ts.map +1 -0
- package/src/typeGuards.d.ts +4 -0
- package/src/typeGuards.d.ts.map +1 -0
- package/src/types.d.ts +79 -0
- package/src/types.d.ts.map +1 -0
- package/src/utils.d.ts +35 -0
- package/src/utils.d.ts.map +1 -0
- package/src/walletFactory.d.ts +73 -0
- package/src/walletFactory.d.ts.map +1 -0
- package/tools/fixtures/gameAssetContract.d.ts +12 -0
- package/tools/fixtures/gameAssetContract.d.ts.map +1 -0
- package/tools/fixtures/start-game1-proposal.d.ts +14 -0
- package/tools/fixtures/start-game1-proposal.d.ts.map +1 -0
- package/tools/wf-tools.d.ts +81 -0
- package/tools/wf-tools.d.ts.map +1 -0
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/smart-wallet",
|
|
3
|
-
"version": "0.7.0-u23.
|
|
3
|
+
"version": "0.7.0-u23.1",
|
|
4
4
|
"description": "Wallet contract",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/Agoric/agoric-sdk.git"
|
|
8
|
+
},
|
|
5
9
|
"type": "module",
|
|
6
10
|
"main": "src/index.js",
|
|
7
11
|
"scripts": {
|
|
@@ -16,9 +20,9 @@
|
|
|
16
20
|
"lint:eslint": "node ../../scripts/eslint-repo.mjs ."
|
|
17
21
|
},
|
|
18
22
|
"devDependencies": {
|
|
19
|
-
"@agoric/casting": "0.6.0-u23.
|
|
20
|
-
"@agoric/cosmic-proto": "0.6.0-u23.
|
|
21
|
-
"@agoric/swingset-vat": "0.34.0-u23.
|
|
23
|
+
"@agoric/casting": "0.6.0-u23.1",
|
|
24
|
+
"@agoric/cosmic-proto": "0.6.0-u23.1",
|
|
25
|
+
"@agoric/swingset-vat": "0.34.0-u23.1",
|
|
22
26
|
"@endo/bundle-source": "^4.1.2",
|
|
23
27
|
"@endo/captp": "^4.4.8",
|
|
24
28
|
"@endo/init": "^1.1.12",
|
|
@@ -26,15 +30,15 @@
|
|
|
26
30
|
"import-meta-resolve": "^4.1.0"
|
|
27
31
|
},
|
|
28
32
|
"dependencies": {
|
|
29
|
-
"@agoric/ertp": "0.18.0-u23.
|
|
30
|
-
"@agoric/internal": "0.5.0-u23.
|
|
31
|
-
"@agoric/notifier": "0.8.0-u23.
|
|
33
|
+
"@agoric/ertp": "0.18.0-u23.1",
|
|
34
|
+
"@agoric/internal": "0.5.0-u23.1",
|
|
35
|
+
"@agoric/notifier": "0.8.0-u23.1",
|
|
32
36
|
"@agoric/store": "0.11.0-u23.0",
|
|
33
|
-
"@agoric/vat-data": "0.7.0-u23.
|
|
34
|
-
"@agoric/vats": "0.17.0-u23.
|
|
35
|
-
"@agoric/vow": "0.3.0-u23.
|
|
36
|
-
"@agoric/zoe": "0.28.0-u23.
|
|
37
|
-
"@agoric/zone": "0.4.0-u23.
|
|
37
|
+
"@agoric/vat-data": "0.7.0-u23.1",
|
|
38
|
+
"@agoric/vats": "0.17.0-u23.1",
|
|
39
|
+
"@agoric/vow": "0.3.0-u23.1",
|
|
40
|
+
"@agoric/zoe": "0.28.0-u23.1",
|
|
41
|
+
"@agoric/zone": "0.4.0-u23.1",
|
|
38
42
|
"@endo/errors": "^1.2.13",
|
|
39
43
|
"@endo/eventual-send": "^1.3.4",
|
|
40
44
|
"@endo/far": "^1.1.14",
|
|
@@ -49,10 +53,6 @@
|
|
|
49
53
|
"source-spec-registry.*"
|
|
50
54
|
],
|
|
51
55
|
"keywords": [],
|
|
52
|
-
"repository": {
|
|
53
|
-
"type": "git",
|
|
54
|
-
"url": "git+https://github.com/Agoric/agoric"
|
|
55
|
-
},
|
|
56
56
|
"author": "Agoric",
|
|
57
57
|
"license": "Apache-2.0",
|
|
58
58
|
"bugs": {
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"engines": {
|
|
78
78
|
"node": "^20.9 || ^22.11"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "6a6343510742fef366aa7b4a31a862f9ef409656"
|
|
81
81
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export namespace smartWalletSourceSpecRegistry {
|
|
2
|
+
namespace walletFactory {
|
|
3
|
+
let bundleName: string;
|
|
4
|
+
let packagePath: string;
|
|
5
|
+
let sourceSpec: string;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export function getSmartWalletSourceSpec(name: keyof typeof smartWalletSourceSpecRegistry): {
|
|
9
|
+
bundleName: string;
|
|
10
|
+
packagePath: string;
|
|
11
|
+
sourceSpec: string;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=source-spec-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-spec-registry.d.ts","sourceRoot":"","sources":["source-spec-registry.js"],"names":[],"mappings":";;;;;;;AAeO,+CADK,MAAM,OAAO,6BAA6B;;;;EAEjB"}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export function makeInvitationsHelper(zoe: ERef<ZoeService>, agoricNames: ERef<NameHub>, invitationBrand: Brand<"set">, invitationsPurse: Purse<"set", InvitationDetails>, getInvitationContinuation: (fromOfferId: string) => InvitationMakers): (spec: InvitationSpec) => ERef<Invitation>;
|
|
2
|
+
/**
|
|
3
|
+
* Specify how to produce an invitation. See each type in the union for details.
|
|
4
|
+
*/
|
|
5
|
+
export type InvitationSpec = AgoricContractInvitationSpec | ContractInvitationSpec | PurseInvitationSpec | ContinuingInvitationSpec;
|
|
6
|
+
/**
|
|
7
|
+
* source of invitation is a chain of calls starting with an agoricName
|
|
8
|
+
*
|
|
9
|
+
* - the start of the pipe is a lookup of instancePath within agoricNames
|
|
10
|
+
* - each entry in the callPipe executes a call on the preceding result
|
|
11
|
+
* - the end of the pipe is expected to return an Invitation
|
|
12
|
+
*/
|
|
13
|
+
export type AgoricContractInvitationSpec = {
|
|
14
|
+
source: "agoricContract";
|
|
15
|
+
instancePath: string[];
|
|
16
|
+
callPipe: [methodName: string, methodArgs?: any[]][];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* source is a contract (in which case this takes an Instance to look up in zoe)
|
|
20
|
+
*/
|
|
21
|
+
export type ContractInvitationSpec = {
|
|
22
|
+
source: "contract";
|
|
23
|
+
instance: Instance<any>;
|
|
24
|
+
publicInvitationMaker: string;
|
|
25
|
+
invitationArgs?: any[];
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* the invitation is already in your Zoe "invitation" purse so we need to query
|
|
29
|
+
* it
|
|
30
|
+
*
|
|
31
|
+
* - use the find/query invitation by kvs thing
|
|
32
|
+
*/
|
|
33
|
+
export type PurseInvitationSpec = {
|
|
34
|
+
source: "purse";
|
|
35
|
+
instance: Instance<any>;
|
|
36
|
+
description: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* continuing invitation in which the offer result from a previous invitation
|
|
40
|
+
* had an `invitationMakers` property
|
|
41
|
+
*/
|
|
42
|
+
export type ContinuingInvitationSpec = {
|
|
43
|
+
source: "continuing";
|
|
44
|
+
previousOffer: OfferId;
|
|
45
|
+
invitationMakerName: string;
|
|
46
|
+
invitationArgs?: any[];
|
|
47
|
+
};
|
|
48
|
+
export type InvitationsPurseQuery = Pick<InvitationDetails, "description" | "instance">;
|
|
49
|
+
import type { ZoeService } from '@agoric/zoe';
|
|
50
|
+
import type { ERef } from '@agoric/vow';
|
|
51
|
+
import type { NameHub } from '@agoric/vats';
|
|
52
|
+
import type { Brand } from '@agoric/ertp';
|
|
53
|
+
import type { InvitationDetails } from '@agoric/zoe';
|
|
54
|
+
import type { Purse } from '@agoric/ertp';
|
|
55
|
+
import type { InvitationMakers } from './types.js';
|
|
56
|
+
import type { Invitation } from '@agoric/zoe';
|
|
57
|
+
import type { Instance } from '@agoric/zoe/src/zoeService/utils.js';
|
|
58
|
+
import type { OfferId } from './offers.js';
|
|
59
|
+
//# sourceMappingURL=invitations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["invitations.js"],"names":[],"mappings":"AAkFO,2CANI,KAAK,UAAU,CAAC,eAChB,KAAK,OAAO,CAAC,mBACb,MAAM,KAAK,CAAC,oBACZ,MAAM,KAAK,EAAE,iBAAiB,CAAC,6BAC/B,CAAC,WAAW,EAAE,MAAM,KAAK,gBAAgB,UAoFhC,cAAc,KAAK,KAAK,UAAU,CAAC,CAgBtD;;;;6BA9JY,4BAA4B,GAClC,sBAAsB,GACtB,mBAAmB,GACnB,wBAAwB;;;;;;;;2CAKlB;IACR,MAAM,EAAE,gBAAgB,CAAC;IACzB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;CACtD;;;;qCAQS;IACR,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,SAAS,GAAG,CAAC,CAAC;IACxB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC;CACxB;;;;;;;kCAGS;IACR,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,SAAS,GAAG,CAAC,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB;;;;;uCAOS;IACR,MAAM,EAAE,YAAY,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC;CACxB;oCAMS,IAAI,CAAC,iBAAiB,EAAE,aAAa,GAAG,UAAU,CAAC;gCA/DJ,aAAa;0BAIlD,aAAa;6BAHV,cAAc;2BAIhB,cAAc;uCALsB,aAAa;2BAMjD,cAAc;sCAJH,YAAY;gCAFa,aAAa;8BAG9C,qCAAqC;6BAJtC,aAAa"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export function makeExportContext(): {
|
|
2
|
+
toCapData: import("@endo/marshal").ToCapData<string>;
|
|
3
|
+
fromCapData: import("@endo/marshal").FromCapData<string>;
|
|
4
|
+
serialize: import("@endo/marshal").ToCapData<string>;
|
|
5
|
+
unserialize: import("@endo/marshal").FromCapData<string>;
|
|
6
|
+
savePurseActions: (val: Purse) => void;
|
|
7
|
+
savePaymentActions: (val: Payment) => void;
|
|
8
|
+
/**
|
|
9
|
+
* @param {number} id
|
|
10
|
+
* @param {Purse} purse
|
|
11
|
+
*/
|
|
12
|
+
initPurseId: (id: number, purse: Purse) => void;
|
|
13
|
+
purseEntries: (keyPatt?: import("@endo/patterns").Pattern, valuePatt?: import("@endo/patterns").Pattern) => Iterable<[number, Purse]>;
|
|
14
|
+
/**
|
|
15
|
+
* @param {BoardId} id
|
|
16
|
+
* @param {RemotableObject} val
|
|
17
|
+
*/
|
|
18
|
+
initBoardId: (id: BoardId, val: RemotableObject) => void;
|
|
19
|
+
/**
|
|
20
|
+
* @param {BoardId} id
|
|
21
|
+
* @param {RemotableObject} val
|
|
22
|
+
*/
|
|
23
|
+
ensureBoardId: (id: BoardId, val: RemotableObject) => void;
|
|
24
|
+
};
|
|
25
|
+
export function makeImportContext(makePresence?: (iface: string) => PassableCap): {
|
|
26
|
+
/**
|
|
27
|
+
* @param {BoardId} id
|
|
28
|
+
* @param {PassableCap} val
|
|
29
|
+
*/
|
|
30
|
+
initBoardId: (id: BoardId, val: PassableCap) => void;
|
|
31
|
+
/**
|
|
32
|
+
* @param {BoardId} id
|
|
33
|
+
* @param {PassableCap} val
|
|
34
|
+
*/
|
|
35
|
+
ensureBoardId: (id: BoardId, val: PassableCap) => void;
|
|
36
|
+
fromMyWallet: {
|
|
37
|
+
toCapData: import("@endo/marshal").ToCapData<string>;
|
|
38
|
+
fromCapData: import("@endo/marshal").FromCapData<string>;
|
|
39
|
+
serialize: import("@endo/marshal").ToCapData<string>;
|
|
40
|
+
unserialize: import("@endo/marshal").FromCapData<string>;
|
|
41
|
+
} & RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
42
|
+
toCapData: import("@endo/marshal").ToCapData<string>;
|
|
43
|
+
fromCapData: import("@endo/marshal").FromCapData<string>;
|
|
44
|
+
serialize: import("@endo/marshal").ToCapData<string>;
|
|
45
|
+
unserialize: import("@endo/marshal").FromCapData<string>;
|
|
46
|
+
}>;
|
|
47
|
+
fromBoard: {
|
|
48
|
+
toCapData: import("@endo/marshal").ToCapData<string>;
|
|
49
|
+
fromCapData: import("@endo/marshal").FromCapData<string>;
|
|
50
|
+
serialize: import("@endo/marshal").ToCapData<string>;
|
|
51
|
+
unserialize: import("@endo/marshal").FromCapData<string>;
|
|
52
|
+
} & RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
53
|
+
toCapData: import("@endo/marshal").ToCapData<string>;
|
|
54
|
+
fromCapData: import("@endo/marshal").FromCapData<string>;
|
|
55
|
+
serialize: import("@endo/marshal").ToCapData<string>;
|
|
56
|
+
unserialize: import("@endo/marshal").FromCapData<string>;
|
|
57
|
+
}>;
|
|
58
|
+
};
|
|
59
|
+
export function makeLoggingPresence(iface: string, log: (parts: unknown[]) => void): any;
|
|
60
|
+
/**
|
|
61
|
+
* When marshaling a purse, payment, etc. we partition the slots using prefixes.
|
|
62
|
+
*/
|
|
63
|
+
export type WalletSlot<T extends Record<string, IdTable<any, any>>> = `${string & keyof T}:${Digits}`;
|
|
64
|
+
/**
|
|
65
|
+
* <K>
|
|
66
|
+
*/
|
|
67
|
+
export type KindSlot<K extends string> = `${K}:${Digits}`;
|
|
68
|
+
/**
|
|
69
|
+
* Since KindSlots always include a colon and BoardIds never do, we an mix them
|
|
70
|
+
* without confusion.
|
|
71
|
+
*/
|
|
72
|
+
export type MixedSlot<T extends Record<string, IdTable<any, any>>> = WalletSlot<T> | BoardId;
|
|
73
|
+
/**
|
|
74
|
+
* - 1 or more digits. NOTE: the typescript
|
|
75
|
+
* definition here is more restrictive than actual usage.
|
|
76
|
+
*/
|
|
77
|
+
export type Digits = `1` | `12` | `123`;
|
|
78
|
+
/**
|
|
79
|
+
* <Value>
|
|
80
|
+
*/
|
|
81
|
+
export type IdTable<Slot extends Key, Val extends PassableCap> = {
|
|
82
|
+
bySlot: MapStore<Slot, Val>;
|
|
83
|
+
byVal: MapStore<Val, Slot>;
|
|
84
|
+
};
|
|
85
|
+
export type ExportContext = ReturnType<typeof makeExportContext>;
|
|
86
|
+
export type ImportContext = ReturnType<typeof makeImportContext>;
|
|
87
|
+
import type { Purse } from '@agoric/ertp';
|
|
88
|
+
import type { Payment } from '@agoric/ertp';
|
|
89
|
+
import type { BoardId } from '@agoric/vats/src/lib-board.js';
|
|
90
|
+
import type { RemotableObject } from '@endo/marshal';
|
|
91
|
+
import type { PassableCap } from '@endo/marshal';
|
|
92
|
+
import type { Key } from '@endo/patterns';
|
|
93
|
+
import type { MapStore } from '@agoric/swingset-liveslots';
|
|
94
|
+
//# sourceMappingURL=marshal-contexts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
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,59 @@
|
|
|
1
|
+
export function makeWatchOfferOutcomes(vowTools: VowTools): (watchers: OutcomeWatchers, seat: UserSeat) => Promise<(void | 0 | 1 | PaymentPKeywordRecord)[]>;
|
|
2
|
+
export function prepareOfferWatcher(baggage: Baggage, vowTools: VowTools, zone: Zone): (walletHelper: any, deposit: {
|
|
3
|
+
receive: (payment: Payment) => Promise<Amount>;
|
|
4
|
+
}, offerSpec: OfferSpec, address: string, invitationAmount: import("@agoric/ertp").SetAmount<import("@endo/patterns").Key>, seatRef: UserSeat) => import("@endo/exo").GuardedKit<{
|
|
5
|
+
helper: {
|
|
6
|
+
/**
|
|
7
|
+
* @param {Record<string, unknown>} offerStatusUpdates
|
|
8
|
+
*/
|
|
9
|
+
updateStatus(offerStatusUpdates: Record<string, unknown>): void;
|
|
10
|
+
/**
|
|
11
|
+
* @param {string} offerId
|
|
12
|
+
* @param {Amount<'set'>} invitationAmount
|
|
13
|
+
* @param {InvitationMakers} invitationMakers
|
|
14
|
+
* @param {PublicSubscribers} publicSubscribers
|
|
15
|
+
*/
|
|
16
|
+
onNewContinuingOffer(offerId: string, invitationAmount: Amount<"set">, invitationMakers: InvitationMakers, publicSubscribers: PublicSubscribers): void;
|
|
17
|
+
/** @param {Passable | ContinuingOfferResult} result */
|
|
18
|
+
publishResult(result: Passable | ContinuingOfferResult): void;
|
|
19
|
+
/**
|
|
20
|
+
* Called when the offer result promise rejects. The other two watchers
|
|
21
|
+
* are waiting for particular values out of Zoe but they settle at the
|
|
22
|
+
* same time and don't need their own error handling.
|
|
23
|
+
*
|
|
24
|
+
* @param {Error} err
|
|
25
|
+
*/
|
|
26
|
+
handleError(err: Error): void;
|
|
27
|
+
};
|
|
28
|
+
/** @type {OutcomeWatchers['paymentWatcher']} */
|
|
29
|
+
paymentWatcher: OutcomeWatchers["paymentWatcher"];
|
|
30
|
+
/** @type {OutcomeWatchers['resultWatcher']} */
|
|
31
|
+
resultWatcher: OutcomeWatchers["resultWatcher"];
|
|
32
|
+
/** @type {OutcomeWatchers['numWantsWatcher']} */
|
|
33
|
+
numWantsWatcher: OutcomeWatchers["numWantsWatcher"];
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* <T, [UserSeat]
|
|
37
|
+
*/
|
|
38
|
+
export type OfferPromiseWatcher<T extends unknown> = PromiseWatcher<T, [UserSeat]>;
|
|
39
|
+
export type OutcomeWatchers = {
|
|
40
|
+
resultWatcher: OfferPromiseWatcher<Passable>;
|
|
41
|
+
numWantsWatcher: OfferPromiseWatcher<number>;
|
|
42
|
+
paymentWatcher: OfferPromiseWatcher<PaymentPKeywordRecord>;
|
|
43
|
+
};
|
|
44
|
+
export type MakeOfferWatcher = ReturnType<typeof prepareOfferWatcher>;
|
|
45
|
+
export type OfferWatcher = ReturnType<MakeOfferWatcher>;
|
|
46
|
+
import type { VowTools } from '@agoric/vow';
|
|
47
|
+
import type { UserSeat } from '@agoric/zoe';
|
|
48
|
+
import type { PaymentPKeywordRecord } from '@agoric/zoe';
|
|
49
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
50
|
+
import type { Zone } from '@agoric/base-zone';
|
|
51
|
+
import type { Payment } from '@agoric/ertp';
|
|
52
|
+
import type { Amount } from '@agoric/ertp';
|
|
53
|
+
import type { OfferSpec } from './offers.js';
|
|
54
|
+
import type { InvitationMakers } from './types.js';
|
|
55
|
+
import type { PublicSubscribers } from './types.js';
|
|
56
|
+
import type { Passable } from '@endo/pass-style';
|
|
57
|
+
import type { ContinuingOfferResult } from './types.js';
|
|
58
|
+
import type { PromiseWatcher } from '@agoric/swingset-liveslots';
|
|
59
|
+
//# sourceMappingURL=offerWatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offerWatcher.d.ts","sourceRoot":"","sources":["offerWatcher.js"],"names":[],"mappings":"AAwGO,iDADK,QAAQ,cAKP,eAAe,QACf,QAAQ,uDAiBpB;AAoCM,6CAJI,OAAO,YACP,QAAQ,QACR,IAAI;aAkDW,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC;;;QAgBvD;;WAEG;yCADQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;QAQlC;;;;;WAKG;sCAJQ,MAAM,oBACN,OAAO,KAAK,CAAC,oBACb,gBAAgB,qBAChB,iBAAiB;QAkB5B,uDAAuD;8BAA3C,QAAQ,GAAG,qBAAqB;QAoC5C;;;;;;WAMG;yBADQ,KAAK;;IAclB,gDAAgD;oBAArC,eAAe,CAAC,gBAAgB,CAAC;IA8B5C,+CAA+C;mBAApC,eAAe,CAAC,eAAe,CAAC;IAsC3C,iDAAiD;qBAAtC,eAAe,CAAC,iBAAiB,CAAC;GA6BlD;;;;gCAvXkB,CAAC,oBACP,eAAe,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;8BAI7B;IACR,aAAa,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAC7C,eAAe,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC7C,cAAc,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;CAC5D;+BAiXU,UAAU,CAAC,OAAO,mBAAmB,CAAC;2BACtC,UAAU,CAAC,gBAAgB,CAAC;8BAtYV,aAAa;8BAE2B,aAAa;2CAAb,aAAa;6BAH3D,kBAAkB;0BAErB,mBAAmB;6BAKhB,cAAc;4BACf,cAAc;+BAZX,aAAa;sCAQN,YAAY;uCACX,YAAY;8BAPrB,kBAAkB;2CADL,YAAY;oCAEnB,4BAA4B"}
|
package/src/offers.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {AmountKeywordRecord, Proposal} from '@agoric/zoe';
|
|
3
|
+
* @import {Passable} from '@endo/pass-style';
|
|
4
|
+
* @import {InvitationSpec} from './invitations.js';
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {number | string} OfferId
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {object} ResultPlan
|
|
11
|
+
* @property {string} name by which to save the item
|
|
12
|
+
* @property {boolean} [overwrite=false] whether to overwrite an existing item.
|
|
13
|
+
* If false and there is a conflict, the contract will autogen a similar
|
|
14
|
+
* name.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {{
|
|
18
|
+
* targetName: string;
|
|
19
|
+
* method: string;
|
|
20
|
+
* args: Passable[];
|
|
21
|
+
* saveResult?: ResultPlan;
|
|
22
|
+
* id?: number | string;
|
|
23
|
+
* }} InvokeEntryMessage
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* @typedef {{
|
|
27
|
+
* id: OfferId;
|
|
28
|
+
* invitationSpec: InvitationSpec;
|
|
29
|
+
* proposal: Proposal;
|
|
30
|
+
* offerArgs?: any;
|
|
31
|
+
* saveResult?: ResultPlan;
|
|
32
|
+
* }} OfferSpec
|
|
33
|
+
* If `saveResult` is provided, the result of the invocation will be saved to
|
|
34
|
+
* the specified location. Otherwise it will be published directly to vstorage
|
|
35
|
+
* (or 'UNPUBLISHED' if it cannot be).
|
|
36
|
+
*/
|
|
37
|
+
/** Value for "result" field when the result can't be published */
|
|
38
|
+
export const UNPUBLISHED_RESULT: "UNPUBLISHED";
|
|
39
|
+
export type OfferId = number | string;
|
|
40
|
+
export type ResultPlan = {
|
|
41
|
+
/**
|
|
42
|
+
* by which to save the item
|
|
43
|
+
*/
|
|
44
|
+
name: string;
|
|
45
|
+
/**
|
|
46
|
+
* whether to overwrite an existing item.
|
|
47
|
+
* If false and there is a conflict, the contract will autogen a similar
|
|
48
|
+
* name.
|
|
49
|
+
*/
|
|
50
|
+
overwrite?: boolean | undefined;
|
|
51
|
+
};
|
|
52
|
+
export type InvokeEntryMessage = {
|
|
53
|
+
targetName: string;
|
|
54
|
+
method: string;
|
|
55
|
+
args: Passable[];
|
|
56
|
+
saveResult?: ResultPlan;
|
|
57
|
+
id?: number | string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* If `saveResult` is provided, the result of the invocation will be saved to
|
|
61
|
+
* the specified location. Otherwise it will be published directly to vstorage
|
|
62
|
+
* (or 'UNPUBLISHED' if it cannot be).
|
|
63
|
+
*/
|
|
64
|
+
export type OfferSpec = {
|
|
65
|
+
id: OfferId;
|
|
66
|
+
invitationSpec: InvitationSpec;
|
|
67
|
+
proposal: Proposal;
|
|
68
|
+
offerArgs?: any;
|
|
69
|
+
saveResult?: ResultPlan;
|
|
70
|
+
};
|
|
71
|
+
export type OfferStatus = OfferSpec & {
|
|
72
|
+
error?: string;
|
|
73
|
+
numWantsSatisfied?: number;
|
|
74
|
+
result?: unknown | typeof UNPUBLISHED_RESULT | {
|
|
75
|
+
name: string;
|
|
76
|
+
passStyle: string;
|
|
77
|
+
};
|
|
78
|
+
payouts?: AmountKeywordRecord;
|
|
79
|
+
};
|
|
80
|
+
import type { Passable } from '@endo/pass-style';
|
|
81
|
+
import type { InvitationSpec } from './invitations.js';
|
|
82
|
+
import type { Proposal } from '@agoric/zoe';
|
|
83
|
+
import type { AmountKeywordRecord } from '@agoric/zoe';
|
|
84
|
+
//# sourceMappingURL=offers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offers.d.ts","sourceRoot":"","sources":["offers.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AAEH;;;;;;GAMG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;GAWG;AAEH,kEAAkE;AAClE,iCAAkC,aAAa,CAAC;sBAnCnC,MAAM,GAAG,MAAM;;;;;UAKd,MAAM;;;;;;;;iCAOP;IACR,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACtB;;;;;;wBAIS;IACR,EAAE,EAAE,OAAO,CAAC;IACZ,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;0BAUS,SAAS,GAAG;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EACH,OAAO,GACP,OAAO,kBAAkB,GACzB;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;8BAnDuB,kBAAkB;oCACZ,kBAAkB;8BAFH,aAAa;yCAAb,aAAa"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
export const EXISTING_WALLET_MY_STORES_KEY: "existingWalletMyStores";
|
|
2
|
+
export const BRAND_TO_PURSES_KEY: "brandToPurses";
|
|
3
|
+
export function prepareSmartWallet(baggage: Baggage, shared: SharedParams, setTestJig?: SetTestJig): (uniqueWithoutChildNodes: Omit<UniqueParams, "currentStorageNode" | "walletStorageNode"> & {
|
|
4
|
+
walletStorageNode: ERemote<StorageNode>;
|
|
5
|
+
}) => Promise<import("@endo/exo").Guarded<{
|
|
6
|
+
/**
|
|
7
|
+
* Umarshals the actionCapData and delegates to the appropriate action
|
|
8
|
+
* handler.
|
|
9
|
+
*
|
|
10
|
+
* @param {CapData<string | null>} actionCapData of type BridgeAction
|
|
11
|
+
* @param {boolean} [canSpend]
|
|
12
|
+
* @returns {Promise<void>}
|
|
13
|
+
*/
|
|
14
|
+
handleBridgeAction(actionCapData: CapData<string | null>, canSpend?: boolean): Promise<void>;
|
|
15
|
+
getDepositFacet(): import("@endo/exo").Guarded<{
|
|
16
|
+
/**
|
|
17
|
+
* Put the assets from the payment into the appropriate purse.
|
|
18
|
+
*
|
|
19
|
+
* If the purse doesn't exist, we hold the payment in durable storage.
|
|
20
|
+
*
|
|
21
|
+
* @param {Payment} payment
|
|
22
|
+
* @returns {Promise<Amount>}
|
|
23
|
+
* @throws if there's not yet a purse, though the payment is held to try
|
|
24
|
+
* again when there is
|
|
25
|
+
*/
|
|
26
|
+
receive(payment: Payment): Promise<Amount>;
|
|
27
|
+
}>;
|
|
28
|
+
getInvokeFacet(): import("@endo/exo").Guarded<{
|
|
29
|
+
/**
|
|
30
|
+
* @param {InvokeEntryMessage} message
|
|
31
|
+
*/
|
|
32
|
+
invokeEntry(message: InvokeEntryMessage): Promise<void>;
|
|
33
|
+
}>;
|
|
34
|
+
getOffersFacet(): import("@endo/exo").Guarded<{
|
|
35
|
+
/**
|
|
36
|
+
* Take an offer description provided in capData, augment it with
|
|
37
|
+
* payments and call zoe.offer()
|
|
38
|
+
*
|
|
39
|
+
* @param {OfferSpec} offerSpec
|
|
40
|
+
* @returns {Promise<void>} after the offer has been both seated and
|
|
41
|
+
* exited by Zoe.
|
|
42
|
+
* @throws if any parts of the offer can be determined synchronously to
|
|
43
|
+
* be invalid
|
|
44
|
+
*/
|
|
45
|
+
executeOffer(offerSpec: OfferSpec): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Take an offer's id, look up its seat, try to exit.
|
|
48
|
+
*
|
|
49
|
+
* @param {OfferId} offerId
|
|
50
|
+
* @returns {Promise<void>}
|
|
51
|
+
* @throws if the seat can't be found or E(seatRef).tryExit() fails.
|
|
52
|
+
*/
|
|
53
|
+
tryExitOffer(offerId: OfferId): Promise<void>;
|
|
54
|
+
}>;
|
|
55
|
+
/** @deprecated use getPublicTopics */
|
|
56
|
+
getCurrentSubscriber(): import("@agoric/notifier").Subscriber<CurrentWalletRecord>;
|
|
57
|
+
/** @deprecated use getPublicTopics */
|
|
58
|
+
getUpdatesSubscriber(): import("@agoric/notifier").Subscriber<UpdateRecord>;
|
|
59
|
+
getPublicTopics(): {
|
|
60
|
+
current: {
|
|
61
|
+
description: string;
|
|
62
|
+
subscriber: import("@agoric/notifier").Subscriber<CurrentWalletRecord>;
|
|
63
|
+
storagePath: Promise<string>;
|
|
64
|
+
};
|
|
65
|
+
updates: {
|
|
66
|
+
description: string;
|
|
67
|
+
subscriber: import("@agoric/notifier").Subscriber<UpdateRecord>;
|
|
68
|
+
storagePath: Promise<string>;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
}>>;
|
|
72
|
+
export type ExecutorPowers = {
|
|
73
|
+
logger: {
|
|
74
|
+
info: (...args: any[]) => void;
|
|
75
|
+
error: (...args: any[]) => void;
|
|
76
|
+
};
|
|
77
|
+
makeOfferWatcher: MakeOfferWatcher;
|
|
78
|
+
invitationFromSpec: ERef<Invitation>;
|
|
79
|
+
};
|
|
80
|
+
export type ExecuteOfferAction = {
|
|
81
|
+
method: "executeOffer";
|
|
82
|
+
offer: OfferSpec;
|
|
83
|
+
};
|
|
84
|
+
export type TryExitOfferAction = {
|
|
85
|
+
method: "tryExitOffer";
|
|
86
|
+
offerId: OfferId;
|
|
87
|
+
};
|
|
88
|
+
export type InvokeStoreEntryAction = {
|
|
89
|
+
/**
|
|
90
|
+
* BridgeAction discriminator
|
|
91
|
+
*/
|
|
92
|
+
method: "invokeEntry";
|
|
93
|
+
/**
|
|
94
|
+
* object method call to make
|
|
95
|
+
*/
|
|
96
|
+
message: InvokeEntryMessage;
|
|
97
|
+
};
|
|
98
|
+
export type BridgeAction = ExecuteOfferAction | TryExitOfferAction | InvokeStoreEntryAction;
|
|
99
|
+
/**
|
|
100
|
+
* Purses is an array to support a future requirement of multiple purses per
|
|
101
|
+
* brand.
|
|
102
|
+
*
|
|
103
|
+
* Each map is encoded as an array of entries because a Map doesn't serialize
|
|
104
|
+
* directly. We also considered having a vstorage key for each offer but for now
|
|
105
|
+
* are sticking with this design.
|
|
106
|
+
*
|
|
107
|
+
* Cons
|
|
108
|
+
*
|
|
109
|
+
* - Reserializes previously written results when a new result is added
|
|
110
|
+
* - Optimizes reads though writes are on-chain (~100 machines) and reads are
|
|
111
|
+
* off-chain (to 1 machine)
|
|
112
|
+
*
|
|
113
|
+
* Pros
|
|
114
|
+
*
|
|
115
|
+
* - Reading all offer results happens much more (>100) often than storing a new
|
|
116
|
+
* offer result
|
|
117
|
+
* - Reserialization and writes are paid in execution gas, whereas reads are not
|
|
118
|
+
*
|
|
119
|
+
* This design should be revisited if ever batch querying across vstorage keys
|
|
120
|
+
* become cheaper or reads be paid.
|
|
121
|
+
*/
|
|
122
|
+
export type CurrentWalletRecord = {
|
|
123
|
+
purses: {
|
|
124
|
+
brand: Brand;
|
|
125
|
+
balance: Amount;
|
|
126
|
+
}[];
|
|
127
|
+
offerToUsedInvitation: [offerId: string, usedInvitation: Amount][];
|
|
128
|
+
offerToPublicSubscriberPaths: [offerId: string, publicTopics: {
|
|
129
|
+
[subscriberName: string]: string;
|
|
130
|
+
}][];
|
|
131
|
+
liveOffers: [OfferId, OfferStatus][];
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Record of an update to the state of this wallet.
|
|
135
|
+
*
|
|
136
|
+
* Client is responsible for coalescing updates into a current state. See
|
|
137
|
+
* `coalesceUpdates` utility.
|
|
138
|
+
*
|
|
139
|
+
* The reason for this burden on the client is that publishing the full history
|
|
140
|
+
* of offers with each change is untenable.
|
|
141
|
+
*
|
|
142
|
+
* `balance` update supports forward-compatibility for more than one purse per
|
|
143
|
+
* brand. An additional key will be needed to disambiguate. For now the brand
|
|
144
|
+
* in the amount suffices.
|
|
145
|
+
*/
|
|
146
|
+
export type UpdateRecord = {
|
|
147
|
+
updated: "offerStatus";
|
|
148
|
+
status: OfferStatus;
|
|
149
|
+
} | {
|
|
150
|
+
updated: "balance";
|
|
151
|
+
currentAmount: Amount;
|
|
152
|
+
} | {
|
|
153
|
+
updated: "walletAction";
|
|
154
|
+
status: {
|
|
155
|
+
error: string;
|
|
156
|
+
};
|
|
157
|
+
} | {
|
|
158
|
+
updated: "invocation";
|
|
159
|
+
id: string | number;
|
|
160
|
+
error?: string;
|
|
161
|
+
result?: {
|
|
162
|
+
name?: string;
|
|
163
|
+
passStyle: string;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* For use by clients to describe brands to users. Includes `displayInfo` to
|
|
168
|
+
* save a remote call.
|
|
169
|
+
*/
|
|
170
|
+
export type BrandDescriptor = {
|
|
171
|
+
brand: Brand;
|
|
172
|
+
displayInfo: DisplayInfo;
|
|
173
|
+
issuer: Issuer;
|
|
174
|
+
petname: Petname;
|
|
175
|
+
};
|
|
176
|
+
export type UniqueParams = {
|
|
177
|
+
address: string;
|
|
178
|
+
bank: ERef<Bank>;
|
|
179
|
+
currentStorageNode: Remote<StorageNode>;
|
|
180
|
+
invitationPurse: Purse<"set", InvitationDetails>;
|
|
181
|
+
walletStorageNode: Remote<StorageNode>;
|
|
182
|
+
};
|
|
183
|
+
export type BrandDescriptorRegistry = Pick<MapStore<Brand, BrandDescriptor>, "has" | "get" | "values">;
|
|
184
|
+
export type SharedParams = {
|
|
185
|
+
agoricNames: ERef<NameHub>;
|
|
186
|
+
registry: BrandDescriptorRegistry;
|
|
187
|
+
invitationIssuer: Issuer<"set">;
|
|
188
|
+
invitationBrand: Brand<"set">;
|
|
189
|
+
invitationDisplayInfo: DisplayInfo;
|
|
190
|
+
publicMarshaller: ERemote<EMarshaller>;
|
|
191
|
+
zoe: ERef<ZoeService>;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* - `brandPurses` is precious
|
|
195
|
+
* and closely held. defined as late as possible to reduce its scope.
|
|
196
|
+
*
|
|
197
|
+
* - `offerToInvitationMakers` is precious and closely held.
|
|
198
|
+
* - `offerToPublicSubscriberPaths` is precious and closely held.
|
|
199
|
+
* - `purseBalances` is a cache of what we've received from purses. Held so we can
|
|
200
|
+
* publish all balances on change.
|
|
201
|
+
*/
|
|
202
|
+
export type State = ImmutableState & MutableState;
|
|
203
|
+
export type ImmutableState = Readonly<UniqueParams & {
|
|
204
|
+
paymentQueues: MapStore<Brand, Payment[]>;
|
|
205
|
+
offerToInvitationMakers: MapStore<string, InvitationMakers>;
|
|
206
|
+
offerToPublicSubscriberPaths: MapStore<string, Record<string, string>>;
|
|
207
|
+
offerToUsedInvitation: MapStore<string, Amount<"set">>;
|
|
208
|
+
purseBalances: MapStore<Purse, Amount>;
|
|
209
|
+
updateRecorderKit: RecorderKit<UpdateRecord>;
|
|
210
|
+
currentRecorderKit: RecorderKit<CurrentWalletRecord>;
|
|
211
|
+
liveOffers: MapStore<OfferId, OfferStatus>;
|
|
212
|
+
liveOfferSeats: MapStore<OfferId, UserSeat<unknown>>;
|
|
213
|
+
liveOfferPayments: MapStore<OfferId, MapStore<Brand, Payment>>;
|
|
214
|
+
myStore?: MapStore<string, unknown> | undefined;
|
|
215
|
+
}>;
|
|
216
|
+
export type PurseRecord = BrandDescriptor & {
|
|
217
|
+
purse: Purse;
|
|
218
|
+
};
|
|
219
|
+
export type MutableState = {};
|
|
220
|
+
export type SmartWalletTestJig = {
|
|
221
|
+
setWithMyStore: (enabled: boolean) => void;
|
|
222
|
+
};
|
|
223
|
+
export type SmartWallet = EReturn<EReturn<typeof prepareSmartWallet>>;
|
|
224
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
225
|
+
import type { SetTestJig } from '@agoric/zoe';
|
|
226
|
+
import type { StorageNode } from '@agoric/internal/src/lib-chainStorage.js';
|
|
227
|
+
import type { ERemote } from '@agoric/internal';
|
|
228
|
+
import type { CapData } from '@endo/marshal';
|
|
229
|
+
import type { Payment } from '@agoric/ertp';
|
|
230
|
+
import type { Amount } from '@agoric/ertp';
|
|
231
|
+
import type { InvokeEntryMessage } from './offers.js';
|
|
232
|
+
import type { OfferSpec } from './offers.js';
|
|
233
|
+
import type { OfferId } from './offers.js';
|
|
234
|
+
import type { MakeOfferWatcher } from './offerWatcher.js';
|
|
235
|
+
import type { Invitation } from '@agoric/zoe';
|
|
236
|
+
import type { ERef } from '@agoric/vow';
|
|
237
|
+
import type { Brand } from '@agoric/ertp';
|
|
238
|
+
import type { OfferStatus } from './offers.js';
|
|
239
|
+
import type { DisplayInfo } from '@agoric/ertp';
|
|
240
|
+
import type { Issuer } from '@agoric/ertp';
|
|
241
|
+
import type { Petname } from './types.js';
|
|
242
|
+
import type { Bank } from '@agoric/vats/src/vat-bank.js';
|
|
243
|
+
import type { Remote } from '@agoric/internal';
|
|
244
|
+
import type { InvitationDetails } from '@agoric/zoe';
|
|
245
|
+
import type { Purse } from '@agoric/ertp';
|
|
246
|
+
import type { MapStore } from '@agoric/store';
|
|
247
|
+
import type { NameHub } from '@agoric/vats';
|
|
248
|
+
import type { EMarshaller } from '@agoric/internal/src/marshal/wrap-marshaller.js';
|
|
249
|
+
import type { ZoeService } from '@agoric/zoe';
|
|
250
|
+
import type { InvitationMakers } from './types.js';
|
|
251
|
+
import type { RecorderKit } from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
252
|
+
import type { UserSeat } from '@agoric/zoe';
|
|
253
|
+
import type { EReturn } from '@endo/far';
|
|
254
|
+
//# sourceMappingURL=smartWallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smartWallet.d.ts","sourceRoot":"","sources":["smartWallet.js"],"names":[],"mappings":"AAuRA,4CAA6C,wBAAwB,CAAC;AAEtE,kCAAmC,eAAe,CAAC;AAkB5C,4CAJI,OAAO,UACP,YAAY,eACZ,UAAU,6BAgiCR,IAAI,CACV,YAAY,EAChB,oBAAwB,GAAG,mBAAmB,CAC3C,GAAG;IACF,iBAAiB,EAAE,QAAQ,WAAW,CAAC,CAAC;CACzC;IAhHE;;;;;;;OAOG;sCAHQ,QAAQ,MAAM,GAAG,IAAI,CAAC,aACtB,OAAO,GACL,OAAO,CAAC,IAAI,CAAC;;QAhX1B;;;;;;;;;WASG;yBAJQ,OAAO,GACL,OAAO,CAAC,MAAM,CAAC;;;QAwQ5B;;WAEG;6BADQ,kBAAkB;;;QA3I7B;;;;;;;;;WASG;gCALQ,SAAS,GACP,OAAO,CAAC,IAA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@@
|
|
|
1
|
+
{"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":""}
|
package/src/types.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Some types for smart-wallet contract
|
|
3
|
+
*
|
|
4
|
+
* Similar to types.js but in TypeScript syntax because some types here need it.
|
|
5
|
+
* Downside is it can't reference any ambient types, which most of agoric-sdk type are presently.
|
|
6
|
+
*/
|
|
7
|
+
import type { Payment } from '@agoric/ertp';
|
|
8
|
+
import type { AgoricNamesRemotes } from '@agoric/vats/tools/board-utils.js';
|
|
9
|
+
import type { InvitationDetails } from '@agoric/zoe';
|
|
10
|
+
import type { PublicTopic } from '@agoric/zoe/src/contractSupport/topics.js';
|
|
11
|
+
import type { OfferSpec } from './offers.js';
|
|
12
|
+
import type { CurrentWalletRecord, UpdateRecord } from './smartWallet.js';
|
|
13
|
+
type Invitation = Payment<'set', InvitationDetails>;
|
|
14
|
+
/**
|
|
15
|
+
* A petname can either be a plain string or a path for which the first element
|
|
16
|
+
* is a petname for the origin, and the rest of the elements are a snapshot of
|
|
17
|
+
* the names that were first given by that origin. We are migrating away from
|
|
18
|
+
* using plain strings, for consistency.
|
|
19
|
+
*/
|
|
20
|
+
export type Petname = string | string[];
|
|
21
|
+
export type InvitationMakers = Record<string, (...args: any[]) => Promise<Invitation>>;
|
|
22
|
+
export type PublicSubscribers = Record<string, PublicTopic<unknown>>;
|
|
23
|
+
export interface ContinuingOfferResult {
|
|
24
|
+
invitationMakers: InvitationMakers;
|
|
25
|
+
publicSubscribers: PublicSubscribers;
|
|
26
|
+
}
|
|
27
|
+
export type Cell<T> = {
|
|
28
|
+
get: () => T;
|
|
29
|
+
set(val: T): void;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Defined by walletAction struct in msg_server.go
|
|
33
|
+
*
|
|
34
|
+
* @see {agoric.swingset.MsgWalletAction} and walletSpendAction in msg_server.go
|
|
35
|
+
*/
|
|
36
|
+
export type WalletActionMsg = {
|
|
37
|
+
type: 'WALLET_ACTION';
|
|
38
|
+
/** base64 of Uint8Array of bech32 data */
|
|
39
|
+
owner: string;
|
|
40
|
+
/** JSON of marshalled BridgeAction */
|
|
41
|
+
action: string;
|
|
42
|
+
blockHeight: unknown;
|
|
43
|
+
blockTime: unknown;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Defined by walletSpendAction struct in msg_server.go
|
|
47
|
+
*
|
|
48
|
+
* @see {agoric.swingset.MsgWalletSpendAction} and walletSpendAction in msg_server.go
|
|
49
|
+
*/
|
|
50
|
+
export type WalletSpendActionMsg = {
|
|
51
|
+
type: 'WALLET_SPEND_ACTION';
|
|
52
|
+
/** base64 of Uint8Array of bech32 data */
|
|
53
|
+
owner: string;
|
|
54
|
+
/** JSON of BridgeActionCapData */
|
|
55
|
+
spendAction: string;
|
|
56
|
+
blockHeight: unknown;
|
|
57
|
+
blockTime: unknown;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Messages transmitted over Cosmos chain, cryptographically verifying that the
|
|
61
|
+
* message came from the 'owner'.
|
|
62
|
+
*
|
|
63
|
+
* The two wallet actions are distinguished by whether the user had to confirm
|
|
64
|
+
* the sending of the message (as is the case for WALLET_SPEND_ACTION).
|
|
65
|
+
*/
|
|
66
|
+
export type WalletBridgeMsg = WalletActionMsg | WalletSpendActionMsg;
|
|
67
|
+
/**
|
|
68
|
+
* Used for clientSupport helpers
|
|
69
|
+
*/
|
|
70
|
+
export type OfferMaker = (agoricNames: AgoricNamesRemotes, ...rest: any[]) => OfferSpec;
|
|
71
|
+
/**
|
|
72
|
+
* Published vstorage values under the `wallet.` hierarchy.
|
|
73
|
+
*/
|
|
74
|
+
export type SmartWalletPublishedPathValue<P extends string> = P extends `wallet.${string}.current` ? CurrentWalletRecord : P extends `wallet.${string}` ? UpdateRecord : never;
|
|
75
|
+
export type SmartWalletPublishedPathTypes = {
|
|
76
|
+
[P in `wallet.${string}` | `wallet.${string}.current`]?: SmartWalletPublishedPathValue<P>;
|
|
77
|
+
};
|
|
78
|
+
export {};
|
|
79
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAI1E,KAAK,UAAU,GAAG,OAAO,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;AAExC,MAAM,MAAM,gBAAgB,GAAG,MAAM,CACnC,MAAM,EACN,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,UAAU,CAAC,CACxC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;AAErE,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,iBAAiB,EAAE,iBAAiB,CAAC;CACtC;AAED,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI;IACpB,GAAG,EAAE,MAAM,CAAC,CAAC;IACb,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,eAAe,CAAC;IACtB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,oBAAoB,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CACvB,WAAW,EAAE,kBAAkB,EAC/B,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,SAAS,CAAC;AAEf;;GAEG;AACH,MAAM,MAAM,6BAA6B,CAAC,CAAC,SAAS,MAAM,IACxD,CAAC,SAAS,UAAU,MAAM,UAAU,GAChC,mBAAmB,GACnB,CAAC,SAAS,UAAU,MAAM,EAAE,GAC1B,YAAY,GACZ,KAAK,CAAC;AAEd,MAAM,MAAM,6BAA6B,GAAG;KACzC,CAAC,IACE,UAAU,MAAM,EAAE,GAClB,UAAU,MAAM,UAAU,CAAC,CAAC,EAAE,6BAA6B,CAAC,CAAC,CAAC;CACnE,CAAC"}
|
package/src/utils.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export { makeCoalescer as makeWalletStateCoalescer };
|
|
2
|
+
export function coalesceUpdates(updates: ERef<Subscriber<UpdateRecord>>, invitationBrand?: Brand<"set">): {
|
|
3
|
+
invitationsReceived: Map<string, {
|
|
4
|
+
acceptedIn?: OfferId;
|
|
5
|
+
description: string;
|
|
6
|
+
instance: Instance;
|
|
7
|
+
}>;
|
|
8
|
+
offerStatuses: Map<OfferId, OfferStatus>;
|
|
9
|
+
balances: Map<Brand, Amount>;
|
|
10
|
+
};
|
|
11
|
+
export function objectMapStoragePath(subscribers?: PublicSubscribers | TopicsRecord): ERef<Record<string, string>> | null;
|
|
12
|
+
/** @param {Brand<'set'>} [invitationBrand] */
|
|
13
|
+
declare function makeCoalescer(invitationBrand?: Brand<"set">): {
|
|
14
|
+
state: {
|
|
15
|
+
invitationsReceived: Map<string, {
|
|
16
|
+
acceptedIn?: OfferId;
|
|
17
|
+
description: string;
|
|
18
|
+
instance: Instance;
|
|
19
|
+
}>;
|
|
20
|
+
offerStatuses: Map<OfferId, OfferStatus>;
|
|
21
|
+
balances: Map<Brand, Amount>;
|
|
22
|
+
};
|
|
23
|
+
update: (updateRecord: UpdateRecord | {}) => void;
|
|
24
|
+
};
|
|
25
|
+
import type { UpdateRecord } from './smartWallet.js';
|
|
26
|
+
import type { Subscriber } from '@agoric/notifier';
|
|
27
|
+
import type { ERef } from '@agoric/vow';
|
|
28
|
+
import type { Brand } from '@agoric/ertp';
|
|
29
|
+
import type { OfferId } from './offers.js';
|
|
30
|
+
import type { Instance } from '@agoric/zoe';
|
|
31
|
+
import type { OfferStatus } from './offers.js';
|
|
32
|
+
import type { Amount } from '@agoric/ertp';
|
|
33
|
+
import type { PublicSubscribers } from './types.js';
|
|
34
|
+
import type { TopicsRecord } from '@agoric/zoe/src/contractSupport/index.js';
|
|
35
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":";AAsHO,yCAHI,KAAK,WAAW,YAAY,CAAC,CAAC,oBAC9B,MAAM,KAAK,CAAC;;qBArFD,OAAO;qBACP,MAAM;kBACT,QAAQ;;;;EA8F1B;AAQM,mDAHI,iBAAiB,GAAG,YAAY,GAC9B,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAY/C;AA/HD,8CAA8C;AAC9C,iDADY,MAAM,KAAK,CAAC;;;yBAaF,OAAO;yBACP,MAAM;sBACT,QAAQ;;;;;2BAOd,YAAY,GAAG,EAAE;EA+D7B;kCAjG8B,kBAAkB;gCACpB,kBAAkB;0BAMxB,aAAa;2BAFZ,cAAc;6BANC,aAAa;8BAKzB,aAAa;iCALD,aAAa;4BAO3B,cAAc;uCAJH,YAAY;kCACjB,0CAA0C"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export namespace customTermsShape {
|
|
2
|
+
let agoricNames: import("@agoric/swingset-liveslots").Pattern;
|
|
3
|
+
let board: import("@agoric/swingset-liveslots").Pattern;
|
|
4
|
+
let assetPublisher: import("@agoric/swingset-liveslots").Pattern;
|
|
5
|
+
}
|
|
6
|
+
export const privateArgsShape: import("@endo/patterns").Matcher;
|
|
7
|
+
export function publishDepositFacet(address: string, wallet: SmartWallet, namesByAddressAdmin: ERef<NameAdmin>): Promise<unknown>;
|
|
8
|
+
export function makeAssetRegistry(assetPublisher: AssetPublisher): {
|
|
9
|
+
/** @param {Brand} brand */
|
|
10
|
+
has: (brand: Brand) => boolean;
|
|
11
|
+
/** @param {Brand} brand */
|
|
12
|
+
get: (brand: Brand) => {
|
|
13
|
+
brand: Brand;
|
|
14
|
+
displayInfo: DisplayInfo;
|
|
15
|
+
issuer: Issuer;
|
|
16
|
+
petname: Petname;
|
|
17
|
+
};
|
|
18
|
+
values: () => Iterable<{
|
|
19
|
+
brand: Brand;
|
|
20
|
+
displayInfo: DisplayInfo;
|
|
21
|
+
issuer: Issuer;
|
|
22
|
+
petname: Petname;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
export function prepare(zcf: ZCF<SmartWalletContractTerms>, privateArgs: {
|
|
26
|
+
storageNode: ERemote<StorageNode>;
|
|
27
|
+
walletBridgeManager?: ERef<ScopedBridgeManager<"wallet">>;
|
|
28
|
+
walletReviver?: ERef<WalletReviver>;
|
|
29
|
+
}, baggage: Baggage): Promise<{
|
|
30
|
+
creatorFacet: import("@endo/exo").Guarded<{
|
|
31
|
+
/**
|
|
32
|
+
* @param {string} address
|
|
33
|
+
* @param {ERef<Bank>} bank
|
|
34
|
+
* @param {ERef<NameAdmin>} namesByAddressAdmin
|
|
35
|
+
* @returns {Promise<[wallet: SmartWallet, isNew: boolean]>} wallet along
|
|
36
|
+
* with a flag to distinguish between looking up an existing wallet and
|
|
37
|
+
* creating a new one.
|
|
38
|
+
*/
|
|
39
|
+
provideSmartWallet(address: string, bank: ERef<Bank>, namesByAddressAdmin: ERef<NameAdmin>): Promise<[wallet: SmartWallet, isNew: boolean]>;
|
|
40
|
+
}>;
|
|
41
|
+
}>;
|
|
42
|
+
export type SmartWalletContractTerms = {
|
|
43
|
+
agoricNames: ERef<NameHub>;
|
|
44
|
+
board: ERef<Board>;
|
|
45
|
+
assetPublisher: AssetPublisher;
|
|
46
|
+
};
|
|
47
|
+
export type AssetPublisher = {
|
|
48
|
+
getAssetSubscription: () => ERef<IterableEachTopic<AssetDescriptor>>;
|
|
49
|
+
};
|
|
50
|
+
export type IsRevive = boolean;
|
|
51
|
+
export type WalletReviver = {
|
|
52
|
+
reviveWallet: (address: string) => Promise<SmartWallet>;
|
|
53
|
+
ackWallet: (address: string) => IsRevive;
|
|
54
|
+
};
|
|
55
|
+
export type start = typeof prepare;
|
|
56
|
+
import type { SmartWallet } from './smartWallet.js';
|
|
57
|
+
import type { NameAdmin } from '@agoric/vats';
|
|
58
|
+
import type { ERef } from '@agoric/vow';
|
|
59
|
+
import type { Brand } from '@agoric/ertp';
|
|
60
|
+
import type { DisplayInfo } from '@agoric/ertp';
|
|
61
|
+
import type { Issuer } from '@agoric/ertp';
|
|
62
|
+
import type { Petname } from './types.js';
|
|
63
|
+
import type { ZCF } from '@agoric/zoe';
|
|
64
|
+
import type { StorageNode } from '@agoric/internal/src/lib-chainStorage.js';
|
|
65
|
+
import type { ERemote } from '@agoric/internal';
|
|
66
|
+
import type { ScopedBridgeManager } from '@agoric/vats';
|
|
67
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
68
|
+
import type { Bank } from '@agoric/vats/src/vat-bank.js';
|
|
69
|
+
import type { NameHub } from '@agoric/vats';
|
|
70
|
+
import type { Board } from '@agoric/vats';
|
|
71
|
+
import type { AssetDescriptor } from '@agoric/vats/src/vat-bank.js';
|
|
72
|
+
import type { IterableEachTopic } from '@agoric/notifier';
|
|
73
|
+
//# sourceMappingURL=walletFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walletFactory.d.ts","sourceRoot":"","sources":["walletFactory.js"],"names":[],"mappings":";;;;;AAoDA,gEAKE;AAYK,6CAJI,MAAM,UACN,WAAW,uBACX,KAAK,SAAS,CAAC,oBAezB;AAWM,kDAFI,cAAc;IAyCrB,2BAA2B;iBAAf,KAAK;IAEjB,2BAA2B;iBAAf,KAAK;eArCP,KAAK;qBACC,WAAW;gBAChB,MAAM;iBACL,OAAO;;;eAHT,KAAK;qBACC,WAAW;gBAChB,MAAM;iBACL,OAAO;;EAuCtB;AAmCM,6BARI,IAAI,wBAAwB,CAAC,eAC7B;IACN,WAAW,EAAE,QAAQ,WAAW,CAAC,CAAC;IAClC,mBAAmB,CAAC,EAAE,KAAK,oBAAoB,QAAQ,CAAC,CAAC,CAAC;IAC1D,aAAa,CAAC,EAAE,KAAK,aAAa,CAAC,CAAC;CACrC,WACO,OAAO;;QAyHZ;;;;;;;WAOG;oCANQ,MAAM,QACN,KAAK,IAAI,CAAC,uBACV,KAAK,SAAS,CAAC,GACb,OAAO,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;;GAyDhE;uCApNY;IACR,WAAW,EAAE,KAAK,OAAO,CAAC,CAAC;IAC3B,KAAK,EAAE,KAAK,KAAK,CAAC,CAAC;IACnB,cAAc,EAAE,cAAc,CAAC;CAChC;6BAGS;IACR,oBAAoB,EAAE,MAAM,KAAK,kBAAkB,eAAe,CAAC,CAAC,CAAC;CACtE;uBAGS,OAAO;4BAEP;IACR,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IACxD,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,QAAQ,CAAC;CAC1C;oBAwMU,OAAO,OAAO;iCA5UsB,kBAAkB;+BACxC,cAAc;0BAUnB,aAAa;2BACZ,cAAc;iCACR,cAAc;4BACnB,cAAc;6BAZb,YAAY;yBAQhB,aAAa;iCAdL,0CAA0C;6BAD9C,kBAAkB;yCAUN,cAAc;6BAC1B,kBAAkB;0BAErB,8BAA8B;6BAV3B,cAAc;2BAKhB,cAAc;qCACJ,8BAA8B;uCAL5B,kBAAkB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function start(zcf: ZCF<{
|
|
2
|
+
joinPrice: Amount;
|
|
3
|
+
}>): Promise<{
|
|
4
|
+
publicFacet: {
|
|
5
|
+
makeJoinInvitation: () => Promise<import("@agoric/zoe").Invitation<string, undefined>>;
|
|
6
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
7
|
+
makeJoinInvitation: () => Promise<import("@agoric/zoe").Invitation<string, undefined>>;
|
|
8
|
+
}>;
|
|
9
|
+
}>;
|
|
10
|
+
import type { Amount } from '@agoric/ertp';
|
|
11
|
+
import type { ZCF } from '@agoric/zoe';
|
|
12
|
+
//# sourceMappingURL=gameAssetContract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gameAssetContract.d.ts","sourceRoot":"","sources":["gameAssetContract.js"],"names":[],"mappings":"AA8BO,2BAFI,IAAI;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;;;;;;GA6CpC;4BA3DwB,cAAc;yBAFjB,aAAa"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function startGameContract(permittedPowers: BootstrapPowers): Promise<void>;
|
|
2
|
+
export function getManifestForGame1({ restoreRef }: {
|
|
3
|
+
restoreRef: any;
|
|
4
|
+
}, { game1Ref }: {
|
|
5
|
+
game1Ref: any;
|
|
6
|
+
}): {
|
|
7
|
+
manifest: BootstrapManifest;
|
|
8
|
+
installations: {
|
|
9
|
+
game1: any;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
import type { BootstrapPowers } from '@agoric/vats/src/core/types.js';
|
|
13
|
+
import type { BootstrapManifest } from '@agoric/vats/src/core/lib-boot.js';
|
|
14
|
+
//# sourceMappingURL=start-game1-proposal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-game1-proposal.d.ts","sourceRoot":"","sources":["start-game1-proposal.js"],"names":[],"mappings":"AA+CO,mDAFI,eAAe,iBAiDzB;AAoBM;;;;;;;;;EAON;qCA/GiC,gCAAgC;uCAH9B,mCAAmC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export function makeBootstrap({ root }?: {
|
|
2
|
+
root?: string | undefined;
|
|
3
|
+
}): Promise<{
|
|
4
|
+
agoricNames: import("@agoric/vats").NameHub<any>;
|
|
5
|
+
agoricNamesAdmin: import("@agoric/vats").NameAdmin;
|
|
6
|
+
board: import("@endo/exo").Guarded<{
|
|
7
|
+
getId(value: import("@endo/pass-style").RemotableObject): string;
|
|
8
|
+
getValue(id: BoardId): import("@endo/pass-style").RemotableObject;
|
|
9
|
+
lookup(...path: string[]): Promise<any>;
|
|
10
|
+
has(val: import("@endo/pass-style").RemotableObject): boolean;
|
|
11
|
+
ids(): string[];
|
|
12
|
+
getPublishingMarshaller(): import("@endo/exo").Guarded<{
|
|
13
|
+
toCapData(val: any): import("@endo/marshal").CapData<string>;
|
|
14
|
+
fromCapData(data: any): any;
|
|
15
|
+
serialize(data: any): import("@endo/marshal").CapData<string>;
|
|
16
|
+
unserialize(data: any): any;
|
|
17
|
+
}>;
|
|
18
|
+
getReadonlyMarshaller(): import("@endo/exo").Guarded<{
|
|
19
|
+
toCapData(val: any): import("@endo/marshal").CapData<string | null>;
|
|
20
|
+
fromCapData(data: any): any;
|
|
21
|
+
serialize(data: any): import("@endo/marshal").CapData<string | null>;
|
|
22
|
+
unserialize(data: any): any;
|
|
23
|
+
}>;
|
|
24
|
+
}>;
|
|
25
|
+
bankManager: import("@endo/exo").Guarded<{
|
|
26
|
+
getAssetSubscription(): import("@agoric/notifier").IterableEachTopic<AssetDescriptor>;
|
|
27
|
+
getRewardDistributorDepositFacet(denom: string, feeKit: AssetIssuerKit): import("@endo/eventual-send").ERef<import("@endo/eventual-send").EOnly<import("@agoric/ertp").DepositFacet>>;
|
|
28
|
+
getModuleAccountAddress(moduleName: string): Promise<string | null>;
|
|
29
|
+
addAsset(denom: string, issuerName: string, proposedName: string, kit: AssetIssuerKit & {
|
|
30
|
+
payment?: import("@endo/eventual-send").ERef<import("@agoric/ertp").Payment<"nat">>;
|
|
31
|
+
}): Promise<void>;
|
|
32
|
+
getBankForAddress(address: string): Promise<Bank>;
|
|
33
|
+
}>;
|
|
34
|
+
namesByAddress: import("@agoric/vats").NameHub<any>;
|
|
35
|
+
namesByAddressAdmin: import("@agoric/vats").NameAdmin;
|
|
36
|
+
storage: {
|
|
37
|
+
rootNode: import("@endo/exo").Guarded<{
|
|
38
|
+
getPath(): string;
|
|
39
|
+
getStoreKey(): Promise<VStorageKey>;
|
|
40
|
+
makeChildNode(name: string, childNodeOptions?: {
|
|
41
|
+
sequence?: boolean;
|
|
42
|
+
}): StorageNode;
|
|
43
|
+
setValue(value: string): Promise<void>;
|
|
44
|
+
}>;
|
|
45
|
+
data: Map<string, string>;
|
|
46
|
+
updateNewCellBlockHeight: (blockHeight?: number) => void;
|
|
47
|
+
getValues: (path: string) => string[];
|
|
48
|
+
messages: import("@agoric/internal/src/lib-chainStorage.js").StorageMessage[];
|
|
49
|
+
toStorage: ((message: import("@agoric/internal/src/lib-chainStorage.js").StorageMessage) => string | number | true | any[] | {
|
|
50
|
+
storeName: string;
|
|
51
|
+
storeSubkey: string;
|
|
52
|
+
} | null) & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, (message: import("@agoric/internal/src/lib-chainStorage.js").StorageMessage) => string | number | true | any[] | {
|
|
53
|
+
storeName: string;
|
|
54
|
+
storeSubkey: string;
|
|
55
|
+
} | null>;
|
|
56
|
+
};
|
|
57
|
+
zoe: import("@endo/exo").Guarded<import("@agoric/zoe").ZoeService>;
|
|
58
|
+
utils: {
|
|
59
|
+
pourPayment: (amount: import("@agoric/ertp").Amount<"nat">) => Promise<import("@agoric/ertp").Payment<"nat">>;
|
|
60
|
+
bundleAndInstall: (pathOrExports: object, bundleId?: string) => Promise<Installation>;
|
|
61
|
+
readLegible: (path: string) => Promise<{
|
|
62
|
+
structure: any;
|
|
63
|
+
slots: any;
|
|
64
|
+
}>;
|
|
65
|
+
getTestJig: () => any;
|
|
66
|
+
};
|
|
67
|
+
}>;
|
|
68
|
+
export function deploy({ boot }?: {
|
|
69
|
+
boot?: typeof makeBootstrap;
|
|
70
|
+
}): Promise<{
|
|
71
|
+
walletFactoryFacets: StartedInstanceKit<wfExports.start>;
|
|
72
|
+
bootstrap: Awaited<ReturnType<typeof makeBootstrap>>;
|
|
73
|
+
provisionSmartWallet: (addr: string) => Promise<[SmartWallet, boolean]>;
|
|
74
|
+
testJig: SmartWalletTestJig;
|
|
75
|
+
}>;
|
|
76
|
+
import type { Installation } from '@agoric/zoe';
|
|
77
|
+
import * as wfExports from '../src/walletFactory.js';
|
|
78
|
+
import type { StartedInstanceKit } from '@agoric/zoe/src/zoeService/utils.js';
|
|
79
|
+
import type { SmartWallet } from '../src/smartWallet.js';
|
|
80
|
+
import type { SmartWalletTestJig } from '../src/smartWallet.js';
|
|
81
|
+
//# sourceMappingURL=wf-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wf-tools.d.ts","sourceRoot":"","sources":["wf-tools.js"],"names":[],"mappings":"AA2BO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAiG6riB,CAAC;;;;;;;;;;;wBAA1he,CAAC;;;;;;;;;;;;;;;;;;;;4BAnE9pE,MAAM;;;;;;GAiBnB;AAWM,kCARI;IAAE,IAAI,CAAC,EAAE,OAAO,aAAa,CAAA;CAAE,GAC7B,OAAO,CAAC;IAChB,mBAAmB,EAAE,mBAAmB,eAAO,CAAC,CAAC;IACjD,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC;IACrD,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IACxE,OAAO,EAAE,kBAAkB,CAAC;CAC7B,CAAC,CAwCJ;kCA3G8B,aAAa;2BANjB,yBAAyB;wCAKf,qCAAqC;iCADxB,uBAAuB;wCAAvB,uBAAuB"}
|