@agoric/smart-wallet 0.5.4-other-dev-1f26562.0 → 0.5.4-other-dev-3eb1a1d.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 +35 -26
- package/src/index.d.ts +2 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +2 -0
- package/src/invitations.d.ts +14 -10
- package/src/invitations.d.ts.map +1 -1
- package/src/invitations.js +35 -32
- package/src/marshal-contexts.d.ts +44 -41
- package/src/marshal-contexts.d.ts.map +1 -1
- package/src/marshal-contexts.js +68 -61
- package/src/offerWatcher.d.ts +52 -0
- package/src/offerWatcher.d.ts.map +1 -0
- package/src/offerWatcher.js +329 -0
- package/src/offers.d.ts +7 -31
- package/src/offers.d.ts.map +1 -1
- package/src/offers.js +9 -183
- package/src/proposals/upgrade-wallet-factory2-proposal.d.ts +23 -0
- package/src/proposals/upgrade-wallet-factory2-proposal.d.ts.map +1 -0
- package/src/proposals/upgrade-wallet-factory2-proposal.js +60 -0
- package/src/proposals/upgrade-walletFactory-proposal.d.ts +1 -1
- package/src/proposals/upgrade-walletFactory-proposal.d.ts.map +1 -1
- package/src/proposals/upgrade-walletFactory-proposal.js +46 -23
- package/src/smartWallet.d.ts +101 -66
- package/src/smartWallet.d.ts.map +1 -1
- package/src/smartWallet.js +576 -216
- package/src/typeGuards.d.ts +1 -1
- package/src/types-index.d.ts +2 -0
- package/src/types-index.js +2 -0
- package/src/types.d.ts +35 -41
- package/src/types.d.ts.map +1 -0
- package/src/types.ts +90 -0
- package/src/utils.d.ts +17 -14
- package/src/utils.d.ts.map +1 -1
- package/src/utils.js +19 -6
- package/src/walletFactory.d.ts +24 -78
- package/src/walletFactory.d.ts.map +1 -1
- package/src/walletFactory.js +61 -37
- package/CHANGELOG.md +0 -180
- package/src/payments.d.ts +0 -20
- package/src/payments.d.ts.map +0 -1
- package/src/payments.js +0 -89
package/src/typeGuards.d.ts
CHANGED
package/src/types.d.ts
CHANGED
|
@@ -4,13 +4,11 @@
|
|
|
4
4
|
* Similar to types.js but in TypeScript syntax because some types here need it.
|
|
5
5
|
* Downside is it can't reference any ambient types, which most of agoric-sdk type are presently.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
11
|
-
|
|
12
|
-
declare const CapDataShape: unique symbol;
|
|
13
|
-
|
|
7
|
+
import type { AgoricNamesRemotes } from '@agoric/vats/tools/board-utils.js';
|
|
8
|
+
import type { PublicTopic } from '@agoric/zoe/src/contractSupport/topics.js';
|
|
9
|
+
import type { Payment } from '@agoric/ertp';
|
|
10
|
+
import type { OfferSpec } from './offers.js';
|
|
11
|
+
type Invitation = Payment<'set'>;
|
|
14
12
|
/**
|
|
15
13
|
* A petname can either be a plain string or a path for which the first element
|
|
16
14
|
* is a petname for the origin, and the rest of the elements are a snapshot of
|
|
@@ -18,54 +16,44 @@ declare const CapDataShape: unique symbol;
|
|
|
18
16
|
* using plain strings, for consistency.
|
|
19
17
|
*/
|
|
20
18
|
export type Petname = string | string[];
|
|
21
|
-
|
|
22
|
-
export type
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export type PublicSubscribers = Record<string, ERef<StoredFacet>>;
|
|
29
|
-
|
|
19
|
+
export type InvitationMakers = Record<string, (...args: any[]) => Promise<Invitation>>;
|
|
20
|
+
export type PublicSubscribers = Record<string, PublicTopic<unknown>>;
|
|
21
|
+
export interface ContinuingOfferResult {
|
|
22
|
+
invitationMakers: InvitationMakers;
|
|
23
|
+
publicSubscribers: PublicSubscribers;
|
|
24
|
+
}
|
|
30
25
|
export type Cell<T> = {
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
get: () => T;
|
|
27
|
+
set(val: T): void;
|
|
33
28
|
};
|
|
34
|
-
|
|
35
|
-
export type BridgeActionCapData = WalletCapData<
|
|
36
|
-
import('./smartWallet.js').BridgeAction
|
|
37
|
-
>;
|
|
38
|
-
|
|
39
29
|
/**
|
|
40
30
|
* Defined by walletAction struct in msg_server.go
|
|
41
31
|
*
|
|
42
|
-
* @see {
|
|
32
|
+
* @see {agoric.swingset.MsgWalletAction} and walletSpendAction in msg_server.go
|
|
43
33
|
*/
|
|
44
34
|
export type WalletActionMsg = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
35
|
+
type: 'WALLET_ACTION';
|
|
36
|
+
/** base64 of Uint8Array of bech32 data */
|
|
37
|
+
owner: string;
|
|
38
|
+
/** JSON of marshalled BridgeAction */
|
|
39
|
+
action: string;
|
|
40
|
+
blockHeight: unknown;
|
|
41
|
+
blockTime: unknown;
|
|
52
42
|
};
|
|
53
|
-
|
|
54
43
|
/**
|
|
55
44
|
* Defined by walletSpendAction struct in msg_server.go
|
|
56
45
|
*
|
|
57
|
-
* @see {MsgWalletSpendAction} and walletSpendAction in msg_server.go
|
|
46
|
+
* @see {agoric.swingset.MsgWalletSpendAction} and walletSpendAction in msg_server.go
|
|
58
47
|
*/
|
|
59
48
|
export type WalletSpendActionMsg = {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
49
|
+
type: 'WALLET_SPEND_ACTION';
|
|
50
|
+
/** base64 of Uint8Array of bech32 data */
|
|
51
|
+
owner: string;
|
|
52
|
+
/** JSON of BridgeActionCapData */
|
|
53
|
+
spendAction: string;
|
|
54
|
+
blockHeight: unknown;
|
|
55
|
+
blockTime: unknown;
|
|
67
56
|
};
|
|
68
|
-
|
|
69
57
|
/**
|
|
70
58
|
* Messages transmitted over Cosmos chain, cryptographically verifying that the
|
|
71
59
|
* message came from the 'owner'.
|
|
@@ -74,3 +62,9 @@ export type WalletSpendActionMsg = {
|
|
|
74
62
|
* the sending of the message (as is the case for WALLET_SPEND_ACTION).
|
|
75
63
|
*/
|
|
76
64
|
export type WalletBridgeMsg = WalletActionMsg | WalletSpendActionMsg;
|
|
65
|
+
/**
|
|
66
|
+
* Used for clientSupport helpers
|
|
67
|
+
*/
|
|
68
|
+
export type OfferMaker = (agoricNames: AgoricNamesRemotes, ...rest: any[]) => OfferSpec;
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAM7C,KAAK,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAEjC;;;;;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"}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
|
|
8
|
+
import type { agoric } from '@agoric/cosmic-proto/agoric/bundle.js';
|
|
9
|
+
import type { AgoricNamesRemotes } from '@agoric/vats/tools/board-utils.js';
|
|
10
|
+
import type { PublicTopic } from '@agoric/zoe/src/contractSupport/topics.js';
|
|
11
|
+
import type { Payment } from '@agoric/ertp';
|
|
12
|
+
import type { OfferSpec } from './offers.js';
|
|
13
|
+
|
|
14
|
+
declare const CapDataShape: unique symbol;
|
|
15
|
+
|
|
16
|
+
// Match the type in Zoe, which can't be imported because it's ambient.
|
|
17
|
+
// This omits the parameters that aren't used in this module.
|
|
18
|
+
type Invitation = Payment<'set'>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A petname can either be a plain string or a path for which the first element
|
|
22
|
+
* is a petname for the origin, and the rest of the elements are a snapshot of
|
|
23
|
+
* the names that were first given by that origin. We are migrating away from
|
|
24
|
+
* using plain strings, for consistency.
|
|
25
|
+
*/
|
|
26
|
+
export type Petname = string | string[];
|
|
27
|
+
|
|
28
|
+
export type InvitationMakers = Record<
|
|
29
|
+
string,
|
|
30
|
+
(...args: any[]) => Promise<Invitation>
|
|
31
|
+
>;
|
|
32
|
+
|
|
33
|
+
export type PublicSubscribers = Record<string, PublicTopic<unknown>>;
|
|
34
|
+
|
|
35
|
+
export interface ContinuingOfferResult {
|
|
36
|
+
invitationMakers: InvitationMakers;
|
|
37
|
+
publicSubscribers: PublicSubscribers;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type Cell<T> = {
|
|
41
|
+
get: () => T;
|
|
42
|
+
set(val: T): void;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Defined by walletAction struct in msg_server.go
|
|
47
|
+
*
|
|
48
|
+
* @see {agoric.swingset.MsgWalletAction} and walletSpendAction in msg_server.go
|
|
49
|
+
*/
|
|
50
|
+
export type WalletActionMsg = {
|
|
51
|
+
type: 'WALLET_ACTION';
|
|
52
|
+
/** base64 of Uint8Array of bech32 data */
|
|
53
|
+
owner: string;
|
|
54
|
+
/** JSON of marshalled BridgeAction */
|
|
55
|
+
action: string;
|
|
56
|
+
blockHeight: unknown; // int64
|
|
57
|
+
blockTime: unknown; // int64
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Defined by walletSpendAction struct in msg_server.go
|
|
62
|
+
*
|
|
63
|
+
* @see {agoric.swingset.MsgWalletSpendAction} and walletSpendAction in msg_server.go
|
|
64
|
+
*/
|
|
65
|
+
export type WalletSpendActionMsg = {
|
|
66
|
+
type: 'WALLET_SPEND_ACTION';
|
|
67
|
+
/** base64 of Uint8Array of bech32 data */
|
|
68
|
+
owner: string;
|
|
69
|
+
/** JSON of BridgeActionCapData */
|
|
70
|
+
spendAction: string;
|
|
71
|
+
blockHeight: unknown; // int64
|
|
72
|
+
blockTime: unknown; // int64
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Messages transmitted over Cosmos chain, cryptographically verifying that the
|
|
77
|
+
* message came from the 'owner'.
|
|
78
|
+
*
|
|
79
|
+
* The two wallet actions are distinguished by whether the user had to confirm
|
|
80
|
+
* the sending of the message (as is the case for WALLET_SPEND_ACTION).
|
|
81
|
+
*/
|
|
82
|
+
export type WalletBridgeMsg = WalletActionMsg | WalletSpendActionMsg;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Used for clientSupport helpers
|
|
86
|
+
*/
|
|
87
|
+
export type OfferMaker = (
|
|
88
|
+
agoricNames: AgoricNamesRemotes,
|
|
89
|
+
...rest: any[]
|
|
90
|
+
) => OfferSpec;
|
package/src/utils.d.ts
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
+
/** @import {OfferId, OfferStatus} from './offers.js'; */
|
|
1
2
|
export const NO_SMART_WALLET_ERROR: "no smart wallet";
|
|
2
|
-
export function makeWalletStateCoalescer(invitationBrand?: Brand<"set"> | undefined): {
|
|
3
|
+
export function makeWalletStateCoalescer(invitationBrand?: globalThis.Brand<"set"> | undefined): {
|
|
3
4
|
state: {
|
|
4
|
-
invitationsReceived: Map<
|
|
5
|
-
acceptedIn:
|
|
5
|
+
invitationsReceived: Map<OfferId, {
|
|
6
|
+
acceptedIn: OfferId;
|
|
6
7
|
description: string;
|
|
7
8
|
instance: Instance;
|
|
8
9
|
}>;
|
|
9
|
-
offerStatuses: Map<
|
|
10
|
-
balances: Map<Brand
|
|
10
|
+
offerStatuses: Map<OfferId, OfferStatus>;
|
|
11
|
+
balances: Map<globalThis.Brand, globalThis.Amount>;
|
|
11
12
|
};
|
|
12
|
-
update: (updateRecord: import(
|
|
13
|
+
update: (updateRecord: import("./smartWallet.js").UpdateRecord | {}) => void;
|
|
13
14
|
};
|
|
14
|
-
export function coalesceUpdates(updates: ERef<Subscriber<import(
|
|
15
|
-
invitationsReceived: Map<
|
|
16
|
-
acceptedIn:
|
|
15
|
+
export function coalesceUpdates(updates: ERef<Subscriber<import("./smartWallet.js").UpdateRecord>>, invitationBrand?: globalThis.Brand<"set"> | undefined): {
|
|
16
|
+
invitationsReceived: Map<OfferId, {
|
|
17
|
+
acceptedIn: OfferId;
|
|
17
18
|
description: string;
|
|
18
19
|
instance: Instance;
|
|
19
20
|
}>;
|
|
20
|
-
offerStatuses: Map<
|
|
21
|
-
balances: Map<Brand
|
|
21
|
+
offerStatuses: Map<OfferId, OfferStatus>;
|
|
22
|
+
balances: Map<globalThis.Brand, globalThis.Amount>;
|
|
22
23
|
};
|
|
23
|
-
export function assertHasData(follower: import(
|
|
24
|
-
export function objectMapStoragePath(subscribers?: import("@agoric/zoe/src/contractSupport").TopicsRecord | import("./types.js").PublicSubscribers | undefined): ERef<Record<string, string>> | null;
|
|
25
|
-
export type CoalescedWalletState = ReturnType<typeof makeWalletStateCoalescer>[
|
|
24
|
+
export function assertHasData(follower: import("@agoric/casting").Follower<any>): Promise<void>;
|
|
25
|
+
export function objectMapStoragePath(subscribers?: import("@agoric/zoe/src/contractSupport/topics.js").TopicsRecord | import("./types.js").PublicSubscribers | undefined): ERef<Record<string, string>> | null;
|
|
26
|
+
export type CoalescedWalletState = ReturnType<typeof makeWalletStateCoalescer>["state"];
|
|
27
|
+
import type { OfferId } from './offers.js';
|
|
28
|
+
import type { OfferStatus } from './offers.js';
|
|
26
29
|
//# sourceMappingURL=utils.d.ts.map
|
package/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"AAIA,yDAAyD;AAEzD,sDAAuD;AAKhD;;;wBAYc,OAAO;yBACN,MAAM;sBACT,QAAQ;;;;;2BAOd,OAAO,kBAAkB,EAAE,YAAY,GAAG,EAAE;EAgExD;AAaM,yCAHI,IAAI,CAAC,UAAU,CAAC,OAAO,kBAAkB,EAAE,YAAY,CAAC,CAAC;;oBAnF/C,OAAO;qBACN,MAAM;kBACT,QAAQ;;;;EA6F1B;AAMM,wCAHI,OAAO,iBAAiB,EAAE,QAAQ,CAAC,GAAG,CAAC,iBAYjD;AASM,2KAFM,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAY/C;mCAvDa,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,OAAO,CAAC;6BA7F1B,aAAa;iCAAb,aAAa"}
|
package/src/utils.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
/* eslint-disable no-undef-init */
|
|
2
1
|
import { deeplyFulfilledObject, objectMap, makeTracer } from '@agoric/internal';
|
|
3
2
|
import { observeIteration, subscribeEach } from '@agoric/notifier';
|
|
4
3
|
import { E } from '@endo/far';
|
|
5
4
|
|
|
5
|
+
/** @import {OfferId, OfferStatus} from './offers.js'; */
|
|
6
|
+
|
|
6
7
|
export const NO_SMART_WALLET_ERROR = 'no smart wallet';
|
|
7
8
|
|
|
8
9
|
const trace = makeTracer('WUTIL', false);
|
|
9
10
|
|
|
10
11
|
/** @param {Brand<'set'>} [invitationBrand] */
|
|
11
12
|
export const makeWalletStateCoalescer = (invitationBrand = undefined) => {
|
|
12
|
-
/** @type {Map<
|
|
13
|
+
/** @type {Map<OfferId, OfferStatus>} */
|
|
13
14
|
const offerStatuses = new Map();
|
|
14
15
|
/** @type {Map<Brand, Amount>} */
|
|
15
16
|
const balances = new Map();
|
|
@@ -17,11 +18,21 @@ export const makeWalletStateCoalescer = (invitationBrand = undefined) => {
|
|
|
17
18
|
/**
|
|
18
19
|
* keyed by description; xxx assumes unique
|
|
19
20
|
*
|
|
20
|
-
* @type {Map<
|
|
21
|
+
* @type {Map<
|
|
22
|
+
* OfferId,
|
|
23
|
+
* {
|
|
24
|
+
* acceptedIn: OfferId;
|
|
25
|
+
* description: string;
|
|
26
|
+
* instance: Instance;
|
|
27
|
+
* }
|
|
28
|
+
* >}
|
|
21
29
|
*/
|
|
22
30
|
const invitationsReceived = new Map();
|
|
23
31
|
|
|
24
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* @param {import('./smartWallet.js').UpdateRecord | {}} updateRecord newer
|
|
34
|
+
* than previous
|
|
35
|
+
*/
|
|
25
36
|
const update = updateRecord => {
|
|
26
37
|
if (!('updated' in updateRecord)) {
|
|
27
38
|
return;
|
|
@@ -93,7 +104,7 @@ export const makeWalletStateCoalescer = (invitationBrand = undefined) => {
|
|
|
93
104
|
* If this proves to be a problem we can add an option to this or a related
|
|
94
105
|
* utility to reset state from RPC.
|
|
95
106
|
*
|
|
96
|
-
* @param {ERef<Subscriber<import('./smartWallet').UpdateRecord>>} updates
|
|
107
|
+
* @param {ERef<Subscriber<import('./smartWallet.js').UpdateRecord>>} updates
|
|
97
108
|
* @param {Brand<'set'>} [invitationBrand]
|
|
98
109
|
*/
|
|
99
110
|
export const coalesceUpdates = (updates, invitationBrand) => {
|
|
@@ -125,7 +136,8 @@ export const assertHasData = async follower => {
|
|
|
125
136
|
/**
|
|
126
137
|
* Handles the case of falsy argument so the caller can consistently await.
|
|
127
138
|
*
|
|
128
|
-
* @param {import('./types.js').PublicSubscribers
|
|
139
|
+
* @param {import('./types.js').PublicSubscribers
|
|
140
|
+
* | import('@agoric/zoe/src/contractSupport/index.js').TopicsRecord} [subscribers]
|
|
129
141
|
* @returns {ERef<Record<string, string>> | null}
|
|
130
142
|
*/
|
|
131
143
|
export const objectMapStoragePath = subscribers => {
|
|
@@ -134,6 +146,7 @@ export const objectMapStoragePath = subscribers => {
|
|
|
134
146
|
}
|
|
135
147
|
return deeplyFulfilledObject(
|
|
136
148
|
objectMap(subscribers, sub =>
|
|
149
|
+
// @ts-expect-error backwards compat
|
|
137
150
|
'subscriber' in sub ? sub.storagePath : E(sub).getPath(),
|
|
138
151
|
),
|
|
139
152
|
);
|
package/src/walletFactory.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export namespace customTermsShape {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
let agoricNames: globalThis.Pattern;
|
|
3
|
+
let board: globalThis.Pattern;
|
|
4
|
+
let assetPublisher: globalThis.Pattern;
|
|
5
5
|
}
|
|
6
6
|
export const privateArgsShape: import("@endo/patterns").Matcher;
|
|
7
|
-
export function publishDepositFacet(address: string, wallet: import(
|
|
7
|
+
export function publishDepositFacet(address: string, wallet: import("./smartWallet.js").SmartWallet, namesByAddressAdmin: ERef<import("@agoric/vats").NameAdmin>): Promise<unknown>;
|
|
8
8
|
export function makeAssetRegistry(assetPublisher: AssetPublisher): {
|
|
9
9
|
/** @param {Brand} brand */
|
|
10
10
|
has: (brand: Brand) => boolean;
|
|
@@ -13,101 +13,47 @@ export function makeAssetRegistry(assetPublisher: AssetPublisher): {
|
|
|
13
13
|
brand: Brand;
|
|
14
14
|
displayInfo: DisplayInfo;
|
|
15
15
|
issuer: Issuer;
|
|
16
|
-
petname: import(
|
|
16
|
+
petname: import("./types.js").Petname;
|
|
17
17
|
};
|
|
18
18
|
values: () => Iterable<{
|
|
19
19
|
brand: Brand;
|
|
20
20
|
displayInfo: DisplayInfo;
|
|
21
21
|
issuer: Issuer;
|
|
22
|
-
petname: import(
|
|
22
|
+
petname: import("./types.js").Petname;
|
|
23
23
|
}>;
|
|
24
24
|
};
|
|
25
25
|
export function prepare(zcf: ZCF<SmartWalletContractTerms>, privateArgs: {
|
|
26
26
|
storageNode: ERef<StorageNode>;
|
|
27
|
-
walletBridgeManager?: ERef<import("@agoric/vats").ScopedBridgeManager
|
|
28
|
-
walletReviver?: ERef<WalletReviver
|
|
29
|
-
}, baggage:
|
|
30
|
-
creatorFacet: {
|
|
27
|
+
walletBridgeManager?: ERef<import("@agoric/vats").ScopedBridgeManager<"wallet">>;
|
|
28
|
+
walletReviver?: ERef<WalletReviver>;
|
|
29
|
+
}, baggage: import("@agoric/vat-data").Baggage): Promise<{
|
|
30
|
+
creatorFacet: import("@endo/exo").Guarded<{
|
|
31
31
|
/**
|
|
32
32
|
* @param {string} address
|
|
33
|
-
* @param {ERef<import('@agoric/vats/src/vat-bank').Bank>} bank
|
|
34
|
-
* @param {ERef<import('@agoric/vats/').NameAdmin>} namesByAddressAdmin
|
|
35
|
-
* @returns {Promise<
|
|
36
|
-
*
|
|
37
|
-
*
|
|
33
|
+
* @param {ERef<import('@agoric/vats/src/vat-bank.js').Bank>} bank
|
|
34
|
+
* @param {ERef<import('@agoric/vats/src/types.js').NameAdmin>} namesByAddressAdmin
|
|
35
|
+
* @returns {Promise<
|
|
36
|
+
* [wallet: import('./smartWallet.js').SmartWallet, isNew: boolean]
|
|
37
|
+
* >}
|
|
38
|
+
* wallet along with a flag to distinguish between looking up an existing
|
|
39
|
+
* wallet and creating a new one.
|
|
38
40
|
*/
|
|
39
|
-
provideSmartWallet(address: string, bank: ERef<import(
|
|
40
|
-
handleBridgeAction(actionCapData: import("@endo/marshal").CapData<string>, canSpend?: boolean | undefined): Promise<void>;
|
|
41
|
-
getDepositFacet(): {
|
|
42
|
-
receive(payment: Payment<AssetKind>): Promise<Amount<AssetKind>>;
|
|
43
|
-
};
|
|
44
|
-
getOffersFacet(): {
|
|
45
|
-
executeOffer(offerSpec: import("./offers.js").OfferSpec): Promise<void>;
|
|
46
|
-
tryExitOffer(offerId: import("./offers.js").OfferId): Promise<void>;
|
|
47
|
-
};
|
|
48
|
-
getCurrentSubscriber(): Subscriber<import("./smartWallet.js").CurrentWalletRecord>;
|
|
49
|
-
getUpdatesSubscriber(): Subscriber<import("./smartWallet.js").UpdateRecord>;
|
|
50
|
-
getPublicTopics(): {
|
|
51
|
-
current: {
|
|
52
|
-
description: string;
|
|
53
|
-
subscriber: Subscriber<import("./smartWallet.js").CurrentWalletRecord>;
|
|
54
|
-
storagePath: Promise<string>;
|
|
55
|
-
};
|
|
56
|
-
updates: {
|
|
57
|
-
description: string;
|
|
58
|
-
subscriber: Subscriber<import("./smartWallet.js").UpdateRecord>;
|
|
59
|
-
storagePath: Promise<string>;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
}, isNew: boolean]>;
|
|
63
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
64
|
-
/**
|
|
65
|
-
* @param {string} address
|
|
66
|
-
* @param {ERef<import('@agoric/vats/src/vat-bank').Bank>} bank
|
|
67
|
-
* @param {ERef<import('@agoric/vats/').NameAdmin>} namesByAddressAdmin
|
|
68
|
-
* @returns {Promise<[wallet: import('./smartWallet').SmartWallet, isNew: boolean]>} wallet
|
|
69
|
-
* along with a flag to distinguish between looking up an existing wallet
|
|
70
|
-
* and creating a new one.
|
|
71
|
-
*/
|
|
72
|
-
provideSmartWallet(address: string, bank: ERef<import('@agoric/vats/src/vat-bank').Bank>, namesByAddressAdmin: ERef<import('@agoric/vats/').NameAdmin>): Promise<[wallet: {
|
|
73
|
-
handleBridgeAction(actionCapData: import("@endo/marshal").CapData<string>, canSpend?: boolean | undefined): Promise<void>;
|
|
74
|
-
getDepositFacet(): {
|
|
75
|
-
receive(payment: Payment<AssetKind>): Promise<Amount<AssetKind>>;
|
|
76
|
-
};
|
|
77
|
-
getOffersFacet(): {
|
|
78
|
-
executeOffer(offerSpec: import("./offers.js").OfferSpec): Promise<void>;
|
|
79
|
-
tryExitOffer(offerId: import("./offers.js").OfferId): Promise<void>;
|
|
80
|
-
};
|
|
81
|
-
getCurrentSubscriber(): Subscriber<import("./smartWallet.js").CurrentWalletRecord>;
|
|
82
|
-
getUpdatesSubscriber(): Subscriber<import("./smartWallet.js").UpdateRecord>;
|
|
83
|
-
getPublicTopics(): {
|
|
84
|
-
current: {
|
|
85
|
-
description: string;
|
|
86
|
-
subscriber: Subscriber<import("./smartWallet.js").CurrentWalletRecord>;
|
|
87
|
-
storagePath: Promise<string>;
|
|
88
|
-
};
|
|
89
|
-
updates: {
|
|
90
|
-
description: string;
|
|
91
|
-
subscriber: Subscriber<import("./smartWallet.js").UpdateRecord>;
|
|
92
|
-
storagePath: Promise<string>;
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
}, isNew: boolean]>;
|
|
41
|
+
provideSmartWallet(address: string, bank: ERef<import("@agoric/vats/src/vat-bank.js").Bank>, namesByAddressAdmin: ERef<import("@agoric/vats/src/types.js").NameAdmin>): Promise<[wallet: import("./smartWallet.js").SmartWallet, isNew: boolean]>;
|
|
96
42
|
}>;
|
|
97
43
|
}>;
|
|
98
44
|
export type SmartWalletContractTerms = {
|
|
99
45
|
agoricNames: ERef<NameHub>;
|
|
100
|
-
board: ERef<import(
|
|
46
|
+
board: ERef<import("@agoric/vats").Board>;
|
|
101
47
|
assetPublisher: AssetPublisher;
|
|
102
48
|
};
|
|
103
|
-
export type NameHub = import('@agoric/vats').NameHub;
|
|
104
49
|
export type AssetPublisher = {
|
|
105
|
-
getAssetSubscription: () => ERef<IterableEachTopic<import(
|
|
50
|
+
getAssetSubscription: () => ERef<IterableEachTopic<import("@agoric/vats/src/vat-bank.js").AssetDescriptor>>;
|
|
106
51
|
};
|
|
107
|
-
export type
|
|
52
|
+
export type IsRevive = boolean;
|
|
108
53
|
export type WalletReviver = {
|
|
109
|
-
reviveWallet: (address: string) => Promise<import(
|
|
110
|
-
ackWallet: (address: string) =>
|
|
54
|
+
reviveWallet: (address: string) => Promise<import("./smartWallet.js").SmartWallet>;
|
|
55
|
+
ackWallet: (address: string) => IsRevive;
|
|
111
56
|
};
|
|
112
57
|
export type start = typeof prepare;
|
|
58
|
+
import type { NameHub } from '@agoric/vats';
|
|
113
59
|
//# sourceMappingURL=walletFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walletFactory.d.ts","sourceRoot":"","sources":["walletFactory.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"walletFactory.d.ts","sourceRoot":"","sources":["walletFactory.js"],"names":[],"mappings":";;;;;AA6BA,gEAKE;AAYK,6CAJI,MAAM,UACN,OAAO,kBAAkB,EAAE,WAAW,uBACtC,IAAI,CAAC,OAAO,cAAc,EAAE,SAAS,CAAC,oBAehD;AAWM,kDAFI,cAAc;IAyCrB,2BAA2B;iBAAf,KAAK;IAEjB,2BAA2B;iBAAf,KAAK;eArCP,KAAK;qBACC,WAAW;gBAChB,MAAM;iBACL,OAAO,YAAY,EAAE,OAAO;;;eAH9B,KAAK;qBACC,WAAW;gBAChB,MAAM;iBACL,OAAO,YAAY,EAAE,OAAO;;EAuC3C;AAyCM,6BAVI,GAAG,CAAC,wBAAwB,CAAC,eAC7B;IACN,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC/B,mBAAmB,CAAC,EAAE,IAAI,CAC9B,OAAa,cAAc,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CACrD,CAAC;IACF,aAAa,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;CACrC,WACO,OAAO,kBAAkB,EAAE,OAAO;;QAiHvC;;;;;;;;;WASG;oCARQ,MAAM,QACN,IAAI,CAAC,OAAO,8BAA8B,EAAE,IAAI,CAAC,uBACjD,IAAI,CAAC,OAAO,2BAA2B,EAAE,SAAS,CAAC,GACjD,OAAO,CACnB,CAAK,MAAM,EAAE,OAAO,kBAAkB,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,CACjE;;GAuDT;uCAlNY;IACR,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3B,KAAK,EAAE,IAAI,CAAC,OAAO,cAAc,EAAE,KAAK,CAAC,CAAC;IAC1C,cAAc,EAAE,cAAc,CAAC;CAChC;6BAGS;IACR,oBAAoB,EAAE,MAAM,IAAI,CAC9B,iBAAiB,CAAC,OAAO,8BAA8B,EAAE,eAAe,CAAC,CAC1E,CAAC;CACH;uBAGS,OAAO;4BAEP;IACR,YAAY,EAAE,CACZ,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC,OAAO,kBAAkB,EAAE,WAAW,CAAC,CAAC;IACrD,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,QAAQ,CAAC;CAC1C;oBAkMU,OAAO,OAAO;6BA3TD,cAAc"}
|