@agoric/vats 0.15.1 → 0.15.2-calypso-dev-84eb287.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/README.md +3 -0
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -0
- package/index.js +9 -0
- package/package.json +43 -48
- package/scripts/build-bundles.js +19 -0
- package/src/bridge-target.d.ts +193 -0
- package/src/bridge-target.d.ts.map +1 -0
- package/src/bridge-target.js +316 -0
- package/src/bridge.d.ts +14 -4
- package/src/bridge.d.ts.map +1 -1
- package/src/bridge.js +45 -16
- package/src/centralSupply.d.ts +3 -3
- package/src/centralSupply.d.ts.map +1 -1
- package/src/centralSupply.js +3 -5
- package/src/core/README.md +1 -1
- package/src/core/basic-behaviors.d.ts +24 -39
- package/src/core/basic-behaviors.d.ts.map +1 -1
- package/src/core/basic-behaviors.js +63 -63
- package/src/core/boot-chain.d.ts +178 -44
- package/src/core/boot-chain.d.ts.map +1 -1
- package/src/core/boot-chain.js +5 -5
- package/src/core/boot-sim.d.ts +5 -43
- package/src/core/boot-sim.d.ts.map +1 -1
- package/src/core/boot-sim.js +3 -4
- package/src/core/boot-solo.d.ts +5 -43
- package/src/core/boot-solo.d.ts.map +1 -1
- package/src/core/boot-solo.js +4 -5
- package/src/core/chain-behaviors.d.ts +10 -26
- package/src/core/chain-behaviors.d.ts.map +1 -1
- package/src/core/chain-behaviors.js +38 -42
- package/src/core/client-behaviors.d.ts +2 -1
- package/src/core/client-behaviors.d.ts.map +1 -1
- package/src/core/client-behaviors.js +6 -5
- package/src/core/core-eval-env.d.ts +40 -0
- package/src/core/demoIssuers.d.ts +24 -26
- package/src/core/demoIssuers.d.ts.map +1 -1
- package/src/core/demoIssuers.js +37 -37
- package/src/core/lib-boot.d.ts +17 -53
- package/src/core/lib-boot.d.ts.map +1 -1
- package/src/core/lib-boot.js +52 -60
- package/src/core/promise-space.d.ts +4 -7
- package/src/core/promise-space.d.ts.map +1 -1
- package/src/core/promise-space.js +15 -16
- package/src/core/sim-behaviors.d.ts +3 -3
- package/src/core/sim-behaviors.d.ts.map +1 -1
- package/src/core/sim-behaviors.js +1 -1
- package/src/core/startWalletFactory.d.ts +23 -27
- package/src/core/startWalletFactory.d.ts.map +1 -1
- package/src/core/startWalletFactory.js +32 -18
- package/src/core/types-ambient.d.ts +538 -0
- package/src/core/types-ambient.js +1 -0
- package/src/core/utils.d.ts +47 -92
- package/src/core/utils.d.ts.map +1 -1
- package/src/core/utils.js +58 -50
- package/src/crc.d.ts +2 -6
- package/src/crc.d.ts.map +1 -1
- package/src/crc.js +5 -16
- package/src/ibc.d.ts +30 -35
- package/src/ibc.d.ts.map +1 -1
- package/src/ibc.js +740 -491
- package/src/lib-board.d.ts +49 -121
- package/src/lib-board.d.ts.map +1 -1
- package/src/lib-board.js +49 -50
- package/src/localchain.d.ts +195 -0
- package/src/localchain.d.ts.map +1 -0
- package/src/localchain.js +324 -0
- package/src/mintHolder.d.ts +6 -4
- package/src/mintHolder.d.ts.map +1 -1
- package/src/mintHolder.js +19 -21
- package/src/nameHub.d.ts +27 -5
- package/src/nameHub.d.ts.map +1 -1
- package/src/nameHub.js +33 -26
- package/src/priceAuthorityRegistry.d.ts +21 -0
- package/src/priceAuthorityRegistry.d.ts.map +1 -0
- package/src/priceAuthorityRegistry.js +220 -0
- package/src/proposals/kread-proposal.d.ts +15 -0
- package/src/proposals/kread-proposal.d.ts.map +1 -0
- package/src/proposals/kread-proposal.js +24 -0
- package/src/proposals/localchain-proposal.d.ts +62 -0
- package/src/proposals/localchain-proposal.d.ts.map +1 -0
- package/src/proposals/localchain-proposal.js +128 -0
- package/src/proposals/localchain-test.d.ts +25 -0
- package/src/proposals/localchain-test.d.ts.map +1 -0
- package/src/proposals/localchain-test.js +89 -0
- package/src/proposals/namesByAddress-fix-proposal.d.ts +22 -0
- package/src/proposals/namesByAddress-fix-proposal.d.ts.map +1 -0
- package/src/proposals/namesByAddress-fix-proposal.js +55 -0
- package/src/proposals/network-proposal.d.ts +23 -8
- package/src/proposals/network-proposal.d.ts.map +1 -1
- package/src/proposals/network-proposal.js +90 -65
- package/src/proposals/probeZcfBundle.d.ts +26 -0
- package/src/proposals/probeZcfBundle.d.ts.map +1 -0
- package/src/proposals/probeZcfBundle.js +72 -0
- package/src/proposals/restart-vats-proposal.d.ts +4 -2
- package/src/proposals/restart-vats-proposal.d.ts.map +1 -1
- package/src/proposals/restart-vats-proposal.js +20 -8
- package/src/proposals/transfer-proposal.d.ts +37 -0
- package/src/proposals/transfer-proposal.d.ts.map +1 -0
- package/src/proposals/transfer-proposal.js +115 -0
- package/src/proposals/upgrade-bank-proposal.d.ts +27 -0
- package/src/proposals/upgrade-bank-proposal.d.ts.map +1 -0
- package/src/proposals/upgrade-bank-proposal.js +42 -0
- package/src/proposals/upgrade-provisionPool-proposal.d.ts +27 -0
- package/src/proposals/upgrade-provisionPool-proposal.d.ts.map +1 -0
- package/src/proposals/upgrade-provisionPool-proposal.js +67 -0
- package/src/proposals/upgrade-zoe-proposal.d.ts +27 -0
- package/src/proposals/upgrade-zoe-proposal.d.ts.map +1 -0
- package/src/proposals/upgrade-zoe-proposal.js +42 -0
- package/src/proposals/vtransfer-echoer.d.ts +24 -0
- package/src/proposals/vtransfer-echoer.d.ts.map +1 -0
- package/src/proposals/vtransfer-echoer.js +42 -0
- package/src/proposals/zcf-only-proposal.d.ts +33 -0
- package/src/proposals/zcf-only-proposal.d.ts.map +1 -0
- package/src/proposals/zcf-only-proposal.js +36 -0
- package/src/proposals/zcf-proposal.d.ts +30 -0
- package/src/proposals/zcf-proposal.d.ts.map +1 -0
- package/src/proposals/zcf-proposal.js +50 -0
- package/src/repl.d.ts +3 -3
- package/src/repl.d.ts.map +1 -1
- package/src/repl.js +11 -5
- package/src/transfer.d.ts +111 -0
- package/src/transfer.d.ts.map +1 -0
- package/src/transfer.js +260 -0
- package/src/types.d.ts +237 -105
- package/src/types.js +1 -97
- package/src/vat-agoricNames.d.ts +4 -4
- package/src/vat-agoricNames.d.ts.map +1 -1
- package/src/vat-agoricNames.js +2 -4
- package/src/vat-bank.d.ts +217 -149
- package/src/vat-bank.d.ts.map +1 -1
- package/src/vat-bank.js +96 -68
- package/src/vat-board.d.ts +24 -24
- package/src/vat-board.d.ts.map +1 -1
- package/src/vat-board.js +0 -1
- package/src/vat-bridge.d.ts +9 -23
- package/src/vat-bridge.d.ts.map +1 -1
- package/src/vat-bridge.js +1 -2
- package/src/vat-ibc.d.ts +16 -4
- package/src/vat-ibc.d.ts.map +1 -1
- package/src/vat-ibc.js +20 -9
- package/src/vat-localchain.d.ts +37 -0
- package/src/vat-localchain.d.ts.map +1 -0
- package/src/vat-localchain.js +29 -0
- package/src/vat-mints.d.ts +31 -31
- package/src/vat-mints.d.ts.map +1 -1
- package/src/vat-mints.js +6 -7
- package/src/vat-network.d.ts +69 -1
- package/src/vat-network.d.ts.map +1 -1
- package/src/vat-network.js +45 -3
- package/src/vat-priceAuthority.d.ts +4 -4
- package/src/vat-priceAuthority.d.ts.map +1 -1
- package/src/vat-priceAuthority.js +1 -1
- package/src/vat-provisioning.d.ts +6 -6
- package/src/vat-provisioning.d.ts.map +1 -1
- package/src/vat-provisioning.js +15 -12
- package/src/vat-transfer.d.ts +81 -0
- package/src/vat-transfer.d.ts.map +1 -0
- package/src/vat-transfer.js +63 -0
- package/src/vat-zoe.d.ts +4 -1
- package/src/vat-zoe.d.ts.map +1 -1
- package/src/vat-zoe.js +10 -2
- package/src/virtual-purse.d.ts +46 -21
- package/src/virtual-purse.d.ts.map +1 -1
- package/src/virtual-purse.js +57 -46
- package/src/walletFlags.d.ts +2 -2
- package/src/walletFlags.js +1 -2
- package/tools/bank-utils.d.ts +20 -0
- package/tools/bank-utils.d.ts.map +1 -0
- package/tools/bank-utils.js +92 -0
- package/tools/board-utils.d.ts +39 -0
- package/tools/board-utils.d.ts.map +1 -0
- package/tools/board-utils.js +92 -0
- package/tools/boot-test-utils.d.ts +88 -0
- package/tools/boot-test-utils.d.ts.map +1 -0
- package/tools/boot-test-utils.js +157 -0
- package/tools/fake-bridge.d.ts +18 -0
- package/tools/fake-bridge.d.ts.map +1 -0
- package/tools/fake-bridge.js +289 -0
- package/tools/ibc-utils.d.ts +29 -0
- package/tools/ibc-utils.d.ts.map +1 -0
- package/tools/ibc-utils.js +115 -0
- package/decentral-core-config.json +0 -66
- package/decentral-demo-config.json +0 -155
- package/decentral-devnet-config.json +0 -216
- package/decentral-itest-vaults-config.json +0 -210
- package/decentral-main-vaults-config.json +0 -229
- package/decentral-test-vaults-config.json +0 -195
- package/demo-proposals.json +0 -5
- package/exported.js +0 -1
- package/jsconfig.build.json +0 -12
- package/jsconfig.json +0 -13
- package/src/core/types.d.ts +0 -764
- package/src/core/types.d.ts.map +0 -1
- package/src/core/types.js +0 -347
- package/src/provisionPool.d.ts +0 -164
- package/src/provisionPool.d.ts.map +0 -1
- package/src/provisionPool.js +0 -113
- package/src/provisionPoolKit.d.ts +0 -392
- package/src/provisionPoolKit.d.ts.map +0 -1
- package/src/provisionPoolKit.js +0 -464
- package/src/tokens.d.ts +0 -36
- package/src/tokens.d.ts.map +0 -1
- package/src/tokens.js +0 -37
- package/src/types.d.ts.map +0 -1
- package/src/vat-sharing.d.ts +0 -54
- package/src/vat-sharing.d.ts.map +0 -1
- package/src/vat-sharing.js +0 -14
package/src/lib-board.d.ts
CHANGED
|
@@ -1,141 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {RemotableObject} from '@endo/pass-style';
|
|
3
|
+
* @import {Key} from '@endo/patterns');
|
|
4
|
+
*/
|
|
1
5
|
export const DEFAULT_CRC_DIGITS: 2;
|
|
2
6
|
export const DEFAULT_PREFIX: "board0";
|
|
3
|
-
export function prepareBoardKit(baggage:
|
|
7
|
+
export function prepareBoardKit(baggage: import("@agoric/vat-data").Baggage): (initSequence?: number | bigint | undefined, args_1?: {
|
|
4
8
|
prefix?: string | undefined;
|
|
5
9
|
crcDigits?: number | undefined;
|
|
6
|
-
} | undefined) => {
|
|
7
|
-
board: {
|
|
8
|
-
/**
|
|
9
|
-
* Provide an ID for a value, generating one if not already present.
|
|
10
|
-
*
|
|
11
|
-
* Each board ID includes a CRC so that the last part is well-distributed,
|
|
12
|
-
* which mitigates typo risks.
|
|
13
|
-
*
|
|
14
|
-
* Scaling Consideration: since we cannot know when consumers
|
|
15
|
-
* are no longer interested in an ID, a board holds a strong reference
|
|
16
|
-
* to `value` for its entire lifetime. For a well-known board, this
|
|
17
|
-
* is essentially forever.
|
|
18
|
-
*
|
|
19
|
-
* @param {Key} value
|
|
20
|
-
* @throws if `value` is not a Key in the @agoric/store sense
|
|
21
|
-
*/
|
|
22
|
-
getId(value: Key): string;
|
|
23
|
-
/**
|
|
24
|
-
* @param {BoardId} id
|
|
25
|
-
* @throws if id is not in the mapping
|
|
26
|
-
*/
|
|
27
|
-
getValue(id: BoardId): any;
|
|
28
|
-
/**
|
|
29
|
-
* Convenience method for recursively traversing boards and
|
|
30
|
-
* board-like remotables to get data associated with a sequence of ids
|
|
31
|
-
* corresponding to each successive board.
|
|
32
|
-
* For example, `lookup("foo", "bar")` gets the value associated with
|
|
33
|
-
* id "foo" and returns the result of invoking `lookup("bar")` upon it
|
|
34
|
-
* to get the value it associates with id "bar".
|
|
35
|
-
*
|
|
36
|
-
* @param {...string} path
|
|
37
|
-
*/
|
|
38
|
-
lookup(...path: string[]): Promise<any>;
|
|
39
|
-
/** @param {Key} val */
|
|
40
|
-
has(val: Key): boolean;
|
|
41
|
-
ids(): string[];
|
|
42
|
-
/**
|
|
43
|
-
* Get a marshaller that implements the convertValToSlot hook using getId(),
|
|
44
|
-
* "publishing" previously un-mapped objects.
|
|
45
|
-
*/
|
|
46
|
-
getPublishingMarshaller(): {
|
|
47
|
-
toCapData(val: any): import("@endo/marshal").CapData<string>;
|
|
48
|
-
fromCapData(data: any): any;
|
|
49
|
-
serialize(data: any): import("@endo/marshal").CapData<string>;
|
|
50
|
-
unserialize(data: any): any;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Get a marshaller that implements the convertValToSlot hook using getId(),
|
|
54
|
-
* only for objects that the board has().
|
|
55
|
-
*
|
|
56
|
-
* For other objects, we don't throw, but we emit a null slot.
|
|
57
|
-
* Un-serializing a null slot always produces a fresh object
|
|
58
|
-
* rather than preserving object identity.
|
|
59
|
-
*/
|
|
60
|
-
getReadonlyMarshaller(): {
|
|
61
|
-
toCapData(val: any): import("@endo/marshal").CapData<string | null>;
|
|
62
|
-
fromCapData(data: any): any;
|
|
63
|
-
serialize(data: any): import("@endo/marshal").CapData<string | null>;
|
|
64
|
-
unserialize(data: any): any;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
readonlyMarshaller: {
|
|
68
|
-
toCapData(val: any): import("@endo/marshal").CapData<string | null>;
|
|
69
|
-
fromCapData(data: any): any;
|
|
70
|
-
serialize(data: any): import("@endo/marshal").CapData<string | null>;
|
|
71
|
-
unserialize(data: any): any;
|
|
72
|
-
};
|
|
73
|
-
publishingMarshaller: {
|
|
74
|
-
toCapData(val: any): import("@endo/marshal").CapData<string>;
|
|
75
|
-
fromCapData(data: any): any;
|
|
76
|
-
serialize(data: any): import("@endo/marshal").CapData<string>;
|
|
77
|
-
unserialize(data: any): any;
|
|
78
|
-
};
|
|
79
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
10
|
+
} | undefined) => import("@endo/exo").GuardedKit<{
|
|
80
11
|
board: {
|
|
81
12
|
/**
|
|
82
13
|
* Provide an ID for a value, generating one if not already present.
|
|
83
14
|
*
|
|
84
|
-
* Each board ID includes a CRC so that the last part is
|
|
85
|
-
* which mitigates typo risks.
|
|
15
|
+
* Each board ID includes a CRC so that the last part is
|
|
16
|
+
* well-distributed, which mitigates typo risks.
|
|
86
17
|
*
|
|
87
|
-
* Scaling Consideration: since we cannot know when consumers
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
18
|
+
* Scaling Consideration: since we cannot know when consumers are no
|
|
19
|
+
* longer interested in an ID, a board holds a strong reference to
|
|
20
|
+
* `value` for its entire lifetime. For a well-known board, this is
|
|
21
|
+
* essentially forever.
|
|
91
22
|
*
|
|
92
|
-
* @param {
|
|
93
|
-
* @throws if `value` is not a Key in the @agoric/store sense
|
|
23
|
+
* @param {RemotableObject} value
|
|
94
24
|
*/
|
|
95
|
-
getId(value:
|
|
25
|
+
getId(value: RemotableObject): string;
|
|
96
26
|
/**
|
|
97
27
|
* @param {BoardId} id
|
|
98
28
|
* @throws if id is not in the mapping
|
|
99
29
|
*/
|
|
100
|
-
getValue(id: BoardId):
|
|
30
|
+
getValue(id: BoardId): RemotableObject;
|
|
101
31
|
/**
|
|
102
|
-
* Convenience method for recursively traversing boards and
|
|
103
|
-
*
|
|
104
|
-
* corresponding to each successive board.
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
32
|
+
* Convenience method for recursively traversing boards and board-like
|
|
33
|
+
* remotables to get data associated with a sequence of ids
|
|
34
|
+
* corresponding to each successive board. For example, `lookup("foo",
|
|
35
|
+
* "bar")` gets the value associated with id "foo" and returns the
|
|
36
|
+
* result of invoking `lookup("bar")` upon it to get the value it
|
|
37
|
+
* associates with id "bar".
|
|
108
38
|
*
|
|
109
|
-
* @param
|
|
39
|
+
* @param {...string} path
|
|
110
40
|
*/
|
|
111
41
|
lookup(...path: string[]): Promise<any>;
|
|
112
|
-
/** @param {
|
|
113
|
-
has(val:
|
|
42
|
+
/** @param {RemotableObject} val */
|
|
43
|
+
has(val: RemotableObject): boolean;
|
|
114
44
|
ids(): string[];
|
|
115
45
|
/**
|
|
116
|
-
* Get a marshaller that implements the convertValToSlot hook using
|
|
117
|
-
* "publishing" previously un-mapped objects.
|
|
46
|
+
* Get a marshaller that implements the convertValToSlot hook using
|
|
47
|
+
* getId(), "publishing" previously un-mapped objects.
|
|
118
48
|
*/
|
|
119
|
-
getPublishingMarshaller(): {
|
|
49
|
+
getPublishingMarshaller(): import("@endo/exo").Guarded<{
|
|
120
50
|
toCapData(val: any): import("@endo/marshal").CapData<string>;
|
|
121
51
|
fromCapData(data: any): any;
|
|
122
52
|
serialize(data: any): import("@endo/marshal").CapData<string>;
|
|
123
53
|
unserialize(data: any): any;
|
|
124
|
-
}
|
|
54
|
+
}>;
|
|
125
55
|
/**
|
|
126
|
-
* Get a marshaller that implements the convertValToSlot hook using
|
|
127
|
-
* only for objects that the board has().
|
|
56
|
+
* Get a marshaller that implements the convertValToSlot hook using
|
|
57
|
+
* getId(), only for objects that the board has().
|
|
128
58
|
*
|
|
129
59
|
* For other objects, we don't throw, but we emit a null slot.
|
|
130
|
-
* Un-serializing a null slot always produces a fresh object
|
|
131
|
-
*
|
|
60
|
+
* Un-serializing a null slot always produces a fresh object rather than
|
|
61
|
+
* preserving object identity.
|
|
132
62
|
*/
|
|
133
|
-
getReadonlyMarshaller(): {
|
|
63
|
+
getReadonlyMarshaller(): import("@endo/exo").Guarded<{
|
|
134
64
|
toCapData(val: any): import("@endo/marshal").CapData<string | null>;
|
|
135
65
|
fromCapData(data: any): any;
|
|
136
66
|
serialize(data: any): import("@endo/marshal").CapData<string | null>;
|
|
137
67
|
unserialize(data: any): any;
|
|
138
|
-
}
|
|
68
|
+
}>;
|
|
139
69
|
};
|
|
140
70
|
readonlyMarshaller: {
|
|
141
71
|
toCapData(val: any): import("@endo/marshal").CapData<string | null>;
|
|
@@ -150,32 +80,29 @@ export function prepareBoardKit(baggage: MapStore<string, unknown>): (args_0?: n
|
|
|
150
80
|
unserialize(data: any): any;
|
|
151
81
|
};
|
|
152
82
|
}>;
|
|
153
|
-
export function prepareRecorderFactory(zone: import(
|
|
83
|
+
export function prepareRecorderFactory(zone: import("@agoric/zone").Zone): (label: string, marshaller: Marshaller) => <T>(storageNode: StorageNode | Awaited<import("@endo/far").FarRef<StorageNode>>, valueShape?: import("@agoric/zoe/src/contractSupport/recorder.js").TypedMatcher<T> | undefined) => RecorderKit<T>;
|
|
154
84
|
/**
|
|
155
|
-
* For a value with a known id in the board, we can use
|
|
156
|
-
*
|
|
85
|
+
* For a value with a known id in the board, we can use that board id as a slot
|
|
86
|
+
* to preserve identity when marshaling.
|
|
157
87
|
*
|
|
158
88
|
* The contents of the string depend on the `prefix` and `crcDigits` options:
|
|
159
|
-
*
|
|
89
|
+
* `${prefix}${crc}${seq}`
|
|
160
90
|
*
|
|
161
91
|
* For example, 'board0371' for prefix: 'board0', seq: 1, 2 digits crc.
|
|
162
92
|
*/
|
|
163
93
|
export type BoardId = string;
|
|
164
94
|
/**
|
|
165
|
-
* // TODO: use
|
|
95
|
+
* // TODO: use
|
|
96
|
+
* Key from
|
|
166
97
|
*/
|
|
167
98
|
export type BoardState = ReturnType<typeof initDurableBoardState>;
|
|
168
|
-
|
|
99
|
+
import type { RemotableObject } from '@endo/pass-style';
|
|
169
100
|
/**
|
|
101
|
+
* @typedef {ReturnType<typeof initDurableBoardState>} BoardState // TODO: use
|
|
102
|
+
* Key from @agoric/store when available
|
|
103
|
+
* @import {Passable} from '@endo/marshal'
|
|
170
104
|
* @see {prepareExoClassKit}
|
|
171
|
-
* @see {@link ../../SwingSet/docs/virtual-objects.md|SwingSet Virtual Objects}
|
|
172
|
-
*
|
|
173
|
-
* Hoisting this function makes defining the state type concise.
|
|
174
|
-
* @typedef {ReturnType<typeof initDurableBoardState>} BoardState
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
* // TODO: use Key from @agoric/store when available
|
|
178
|
-
* @typedef {import('@endo/marshal').Passable} Key
|
|
105
|
+
* @see {@link ../../SwingSet/docs/virtual-objects.md|SwingSet Virtual Objects} Hoisting this function makes defining the state type concise.
|
|
179
106
|
*/
|
|
180
107
|
/**
|
|
181
108
|
* Make state for the board. Hoisted up to define the BoardState type.
|
|
@@ -183,15 +110,16 @@ export type Key = import('@endo/marshal').Passable;
|
|
|
183
110
|
* @param {bigint | number} [initSequence]
|
|
184
111
|
* @param {object} [options]
|
|
185
112
|
* @param {string} [options.prefix] prefix for all ids generated
|
|
186
|
-
* @param {number} [options.crcDigits] count of digits to use in CRC at end of
|
|
113
|
+
* @param {number} [options.crcDigits] count of digits to use in CRC at end of
|
|
114
|
+
* the id
|
|
187
115
|
*/
|
|
188
116
|
declare function initDurableBoardState(initSequence?: number | bigint | undefined, { prefix, crcDigits }?: {
|
|
189
117
|
prefix?: string | undefined;
|
|
190
118
|
crcDigits?: number | undefined;
|
|
191
119
|
} | undefined): {
|
|
192
120
|
lastSequence: bigint;
|
|
193
|
-
idToVal: MapStore<string,
|
|
194
|
-
valToId: MapStore<
|
|
121
|
+
idToVal: globalThis.MapStore<string, RemotableObject>;
|
|
122
|
+
valToId: globalThis.MapStore<RemotableObject, string>;
|
|
195
123
|
prefix: string;
|
|
196
124
|
crcDigits: number;
|
|
197
125
|
};
|
package/src/lib-board.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib-board.d.ts","sourceRoot":"","sources":["lib-board.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lib-board.d.ts","sourceRoot":"","sources":["lib-board.js"],"names":[],"mappings":"AAiBA;;;GAGG;AAEH,mCAAoC;AACpC,sCAAuC;AAsOhC,yCAHI,OAAO,kBAAkB,EAAE,OAAO;;;yBAdpB,WAAW;;QAyB5B;;;;;;;;;;;;WAYG;qBADQ,eAAe;QAK1B;;;WAGG;qBAFQ,OAAO;QAMlB;;;;;;;;;WASG;wBADW,MAAM,EAAA;QAiBpB,mCAAmC;iBAAvB,eAAe;;QAS3B;;;WAGG;;;;;;;QAIH;;;;;;;WAOG;;;;;;;;;;;;;;;;;;;;GAuCV;AAGM,6CADK,OAAO,cAAc,EAAE,IAAI,WAS1B,MAAM,cACN,UAAU,mDA7NuB,WAAW,0IAyOxD;;;;;;;;;;sBA9UY,MAAM;;;;;yBAmBN,UAAU,CAAC,OAAO,qBAAqB,CAAC;qCA9DnB,kBAAkB;AA6DpD;;;;;;GAMG;AAGH;;;;;;;;GAQG;AACH;;;;;;;;;EA0BC"}
|
package/src/lib-board.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
/**
|
|
3
2
|
* @file lib-board: share objects by way of plain-data ids
|
|
4
|
-
*
|
|
5
3
|
* @see prepareBoardKit()
|
|
6
4
|
*/
|
|
7
5
|
|
|
@@ -13,10 +11,15 @@ import {
|
|
|
13
11
|
prepareRecorder,
|
|
14
12
|
} from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
15
13
|
import { E, Far } from '@endo/far';
|
|
16
|
-
import { makeMarshal } from '@endo/marshal';
|
|
14
|
+
import { isRemotable, makeMarshal } from '@endo/marshal';
|
|
17
15
|
|
|
18
16
|
import { crc6 } from './crc.js';
|
|
19
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @import {RemotableObject} from '@endo/pass-style';
|
|
20
|
+
* @import {Key} from '@endo/patterns');
|
|
21
|
+
*/
|
|
22
|
+
|
|
20
23
|
export const DEFAULT_CRC_DIGITS = 2;
|
|
21
24
|
export const DEFAULT_PREFIX = 'board0';
|
|
22
25
|
|
|
@@ -48,11 +51,11 @@ const BoardKitIKit = {
|
|
|
48
51
|
//#endregion
|
|
49
52
|
|
|
50
53
|
/**
|
|
51
|
-
* For a value with a known id in the board, we can use
|
|
52
|
-
*
|
|
54
|
+
* For a value with a known id in the board, we can use that board id as a slot
|
|
55
|
+
* to preserve identity when marshaling.
|
|
53
56
|
*
|
|
54
57
|
* The contents of the string depend on the `prefix` and `crcDigits` options:
|
|
55
|
-
*
|
|
58
|
+
* `${prefix}${crc}${seq}`
|
|
56
59
|
*
|
|
57
60
|
* For example, 'board0371' for prefix: 'board0', seq: 1, 2 digits crc.
|
|
58
61
|
*
|
|
@@ -75,15 +78,11 @@ const calcCrc = (data, crcDigits) => {
|
|
|
75
78
|
};
|
|
76
79
|
|
|
77
80
|
/**
|
|
81
|
+
* @typedef {ReturnType<typeof initDurableBoardState>} BoardState // TODO: use
|
|
82
|
+
* Key from @agoric/store when available
|
|
83
|
+
* @import {Passable} from '@endo/marshal'
|
|
78
84
|
* @see {prepareExoClassKit}
|
|
79
|
-
* @see {@link ../../SwingSet/docs/virtual-objects.md|SwingSet Virtual Objects}
|
|
80
|
-
*
|
|
81
|
-
* Hoisting this function makes defining the state type concise.
|
|
82
|
-
* @typedef {ReturnType<typeof initDurableBoardState>} BoardState
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* // TODO: use Key from @agoric/store when available
|
|
86
|
-
* @typedef {import('@endo/marshal').Passable} Key
|
|
85
|
+
* @see {@link ../../SwingSet/docs/virtual-objects.md|SwingSet Virtual Objects} Hoisting this function makes defining the state type concise.
|
|
87
86
|
*/
|
|
88
87
|
|
|
89
88
|
// TODO consider tightening initSequence to bigint only
|
|
@@ -93,7 +92,8 @@ const calcCrc = (data, crcDigits) => {
|
|
|
93
92
|
* @param {bigint | number} [initSequence]
|
|
94
93
|
* @param {object} [options]
|
|
95
94
|
* @param {string} [options.prefix] prefix for all ids generated
|
|
96
|
-
* @param {number} [options.crcDigits] count of digits to use in CRC at end of
|
|
95
|
+
* @param {number} [options.crcDigits] count of digits to use in CRC at end of
|
|
96
|
+
* the id
|
|
97
97
|
*/
|
|
98
98
|
const initDurableBoardState = (
|
|
99
99
|
initSequence = 0,
|
|
@@ -102,13 +102,13 @@ const initDurableBoardState = (
|
|
|
102
102
|
const immutable = { prefix, crcDigits };
|
|
103
103
|
|
|
104
104
|
const lastSequence = BigInt(initSequence);
|
|
105
|
-
/** @type {MapStore<BoardId,
|
|
105
|
+
/** @type {MapStore<BoardId, RemotableObject>} */
|
|
106
106
|
const idToVal = makeScalarBigMapStore('idToVal', {
|
|
107
107
|
durable: true,
|
|
108
108
|
keyShape: IdShape,
|
|
109
109
|
valueShape: ValShape,
|
|
110
110
|
});
|
|
111
|
-
/** @type {MapStore<
|
|
111
|
+
/** @type {MapStore<RemotableObject, BoardId>} */
|
|
112
112
|
const valToId = makeScalarBigMapStore('valToId', {
|
|
113
113
|
durable: true,
|
|
114
114
|
keyShape: ValShape,
|
|
@@ -130,11 +130,14 @@ const initDurableBoardState = (
|
|
|
130
130
|
// transient marshallers that get GCed when the function completes.
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
|
-
* @param {
|
|
133
|
+
* @param {RemotableObject} value
|
|
134
134
|
* @param {BoardState} state
|
|
135
135
|
*/
|
|
136
136
|
const getId = (value, state) => {
|
|
137
137
|
const { idToVal, valToId, prefix, crcDigits } = state;
|
|
138
|
+
if (!isRemotable(value)) {
|
|
139
|
+
Fail`Board cannot create id for non-remotable`;
|
|
140
|
+
}
|
|
138
141
|
|
|
139
142
|
if (valToId.has(value)) {
|
|
140
143
|
return valToId.get(value);
|
|
@@ -180,9 +183,7 @@ const getValue = (id, { prefix, crcDigits, idToVal }) => {
|
|
|
180
183
|
throw Fail`board does not have id: ${id}`;
|
|
181
184
|
};
|
|
182
185
|
|
|
183
|
-
/**
|
|
184
|
-
* @param {BoardState} state
|
|
185
|
-
*/
|
|
186
|
+
/** @param {BoardState} state */
|
|
186
187
|
const makeSlotToVal = state => {
|
|
187
188
|
const ifaceAllegedPrefix = 'Alleged: ';
|
|
188
189
|
const ifaceInaccessiblePrefix = 'SEVERED: ';
|
|
@@ -190,7 +191,7 @@ const makeSlotToVal = state => {
|
|
|
190
191
|
/**
|
|
191
192
|
* @param {BoardId} slot
|
|
192
193
|
* @param {string} iface
|
|
193
|
-
* @returns {
|
|
194
|
+
* @returns {any}
|
|
194
195
|
*/
|
|
195
196
|
const slotToVal = (slot, iface) => {
|
|
196
197
|
if (slot !== null) {
|
|
@@ -243,9 +244,9 @@ const makePublishingMarshaller = state => {
|
|
|
243
244
|
//#endregion
|
|
244
245
|
|
|
245
246
|
/**
|
|
246
|
-
* A board is a two-way mapping between objects (such as issuers,
|
|
247
|
-
*
|
|
248
|
-
*
|
|
247
|
+
* A board is a two-way mapping between objects (such as issuers, brands,
|
|
248
|
+
* installation handles) and plain-data string IDs. A well-known board allows
|
|
249
|
+
* sharing objects by way of their ids.
|
|
249
250
|
*
|
|
250
251
|
* @param {import('@agoric/vat-data').Baggage} baggage for upgrade successors
|
|
251
252
|
* @see {@link packages/SwingSet/docs/vat-upgrade.md|Vat Upgrade}
|
|
@@ -261,16 +262,15 @@ export const prepareBoardKit = baggage => {
|
|
|
261
262
|
/**
|
|
262
263
|
* Provide an ID for a value, generating one if not already present.
|
|
263
264
|
*
|
|
264
|
-
* Each board ID includes a CRC so that the last part is
|
|
265
|
-
* which mitigates typo risks.
|
|
265
|
+
* Each board ID includes a CRC so that the last part is
|
|
266
|
+
* well-distributed, which mitigates typo risks.
|
|
266
267
|
*
|
|
267
|
-
* Scaling Consideration: since we cannot know when consumers
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
268
|
+
* Scaling Consideration: since we cannot know when consumers are no
|
|
269
|
+
* longer interested in an ID, a board holds a strong reference to
|
|
270
|
+
* `value` for its entire lifetime. For a well-known board, this is
|
|
271
|
+
* essentially forever.
|
|
271
272
|
*
|
|
272
|
-
* @param {
|
|
273
|
-
* @throws if `value` is not a Key in the @agoric/store sense
|
|
273
|
+
* @param {RemotableObject} value
|
|
274
274
|
*/
|
|
275
275
|
getId(value) {
|
|
276
276
|
return getId(value, this.state);
|
|
@@ -283,14 +283,14 @@ export const prepareBoardKit = baggage => {
|
|
|
283
283
|
return getValue(id, this.state);
|
|
284
284
|
},
|
|
285
285
|
/**
|
|
286
|
-
* Convenience method for recursively traversing boards and
|
|
287
|
-
*
|
|
288
|
-
* corresponding to each successive board.
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
286
|
+
* Convenience method for recursively traversing boards and board-like
|
|
287
|
+
* remotables to get data associated with a sequence of ids
|
|
288
|
+
* corresponding to each successive board. For example, `lookup("foo",
|
|
289
|
+
* "bar")` gets the value associated with id "foo" and returns the
|
|
290
|
+
* result of invoking `lookup("bar")` upon it to get the value it
|
|
291
|
+
* associates with id "bar".
|
|
292
292
|
*
|
|
293
|
-
* @param
|
|
293
|
+
* @param {...string} path
|
|
294
294
|
*/
|
|
295
295
|
async lookup(...path) {
|
|
296
296
|
const {
|
|
@@ -300,13 +300,14 @@ export const prepareBoardKit = baggage => {
|
|
|
300
300
|
return board;
|
|
301
301
|
}
|
|
302
302
|
const [first, ...rest] = path;
|
|
303
|
+
/** @type {any} */
|
|
303
304
|
const firstValue = board.getValue(/** @type {BoardId} */ (first));
|
|
304
305
|
if (rest.length === 0) {
|
|
305
306
|
return firstValue;
|
|
306
307
|
}
|
|
307
308
|
return E(firstValue).lookup(...rest);
|
|
308
309
|
},
|
|
309
|
-
/** @param {
|
|
310
|
+
/** @param {RemotableObject} val */
|
|
310
311
|
has(val) {
|
|
311
312
|
const { state } = this;
|
|
312
313
|
return state.valToId.has(val);
|
|
@@ -316,19 +317,19 @@ export const prepareBoardKit = baggage => {
|
|
|
316
317
|
return harden([...state.idToVal.keys()]);
|
|
317
318
|
},
|
|
318
319
|
/**
|
|
319
|
-
* Get a marshaller that implements the convertValToSlot hook using
|
|
320
|
-
* "publishing" previously un-mapped objects.
|
|
320
|
+
* Get a marshaller that implements the convertValToSlot hook using
|
|
321
|
+
* getId(), "publishing" previously un-mapped objects.
|
|
321
322
|
*/
|
|
322
323
|
getPublishingMarshaller() {
|
|
323
324
|
return this.facets.publishingMarshaller;
|
|
324
325
|
},
|
|
325
326
|
/**
|
|
326
|
-
* Get a marshaller that implements the convertValToSlot hook using
|
|
327
|
-
* only for objects that the board has().
|
|
327
|
+
* Get a marshaller that implements the convertValToSlot hook using
|
|
328
|
+
* getId(), only for objects that the board has().
|
|
328
329
|
*
|
|
329
330
|
* For other objects, we don't throw, but we emit a null slot.
|
|
330
|
-
* Un-serializing a null slot always produces a fresh object
|
|
331
|
-
*
|
|
331
|
+
* Un-serializing a null slot always produces a fresh object rather than
|
|
332
|
+
* preserving object identity.
|
|
332
333
|
*/
|
|
333
334
|
getReadonlyMarshaller() {
|
|
334
335
|
return this.facets.readonlyMarshaller;
|
|
@@ -370,9 +371,7 @@ export const prepareBoardKit = baggage => {
|
|
|
370
371
|
);
|
|
371
372
|
};
|
|
372
373
|
|
|
373
|
-
/**
|
|
374
|
-
* @param {import('@agoric/zone').Zone} zone
|
|
375
|
-
*/
|
|
374
|
+
/** @param {import('@agoric/zone').Zone} zone */
|
|
376
375
|
export const prepareRecorderFactory = zone => {
|
|
377
376
|
const baggage = zone.mapStore(`Recorder Baggage`);
|
|
378
377
|
const makeDurablePublishKit = prepareDurablePublishKit(
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {TypedJson, ResponseTo, JsonSafe} from '@agoric/cosmic-proto';
|
|
3
|
+
* @import {PromiseVow, VowTools} from '@agoric/vow';
|
|
4
|
+
* @import {TargetApp, TargetRegistration} from './bridge-target.js';
|
|
5
|
+
* @import {BankManager, Bank} from './vat-bank.js';
|
|
6
|
+
* @import {ScopedBridgeManager} from './types.js';
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @template {unknown[]} T
|
|
10
|
+
* @typedef {Promise<T>} PromiseVowOfTupleMappedToGenerics Temporary hack
|
|
11
|
+
*
|
|
12
|
+
* UNTIL(microsoft/TypeScript#57122): This type should be replaced with just
|
|
13
|
+
* PromiseVow<T>, but TypeScript doesn't understand that the result of a
|
|
14
|
+
* mapping a tuple type using generics is iterable:
|
|
15
|
+
*
|
|
16
|
+
* 'JsonSafe<MsgTransferResponse & { '@type':
|
|
17
|
+
* "/ibc.applications.transfer.v1.MsgTransferResponse"; }>[] |
|
|
18
|
+
* Vow<JsonSafe<MsgTransferResponse & { ...; }>[]>' must have a
|
|
19
|
+
* '[Symbol.iterator]()' method that returns an iterator.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {{
|
|
23
|
+
* system: ScopedBridgeManager<'vlocalchain'>;
|
|
24
|
+
* bank: Bank;
|
|
25
|
+
* transfer: import('./transfer.js').TransferMiddleware;
|
|
26
|
+
* }} AccountPowers
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* @typedef {{
|
|
30
|
+
* system: ScopedBridgeManager<'vlocalchain'>;
|
|
31
|
+
* bankManager: BankManager;
|
|
32
|
+
* transfer: import('./transfer.js').TransferMiddleware;
|
|
33
|
+
* }} LocalChainPowers
|
|
34
|
+
*/
|
|
35
|
+
export const LocalChainAccountI: import("@endo/patterns").InterfaceGuard<{
|
|
36
|
+
getAddress: import("@endo/patterns").MethodGuard;
|
|
37
|
+
getBalance: import("@endo/patterns").MethodGuard;
|
|
38
|
+
deposit: import("@endo/patterns").MethodGuard;
|
|
39
|
+
withdraw: import("@endo/patterns").MethodGuard;
|
|
40
|
+
executeTx: import("@endo/patterns").MethodGuard;
|
|
41
|
+
monitorTransfers: import("@endo/patterns").MethodGuard;
|
|
42
|
+
}>;
|
|
43
|
+
export function prepareLocalChainAccountKit(zone: import("@agoric/base-zone").Zone, { watch }: VowTools): (address: string, powers: AccountPowers) => import("@endo/exo").GuardedKit<{
|
|
44
|
+
depositPaymentWatcher: {
|
|
45
|
+
/**
|
|
46
|
+
* @param {Brand<'nat'>} brand
|
|
47
|
+
* @param {{
|
|
48
|
+
* payment: Payment<'nat'>;
|
|
49
|
+
* optAmountShape: Amount<'nat'>;
|
|
50
|
+
* }} ctx
|
|
51
|
+
*/
|
|
52
|
+
onFulfilled(brand: Brand<"nat">, { payment, optAmountShape }: {
|
|
53
|
+
payment: Payment<"nat">;
|
|
54
|
+
optAmountShape: Amount<"nat">;
|
|
55
|
+
}): Promise<import("@agoric/ertp/src/types.js").NatAmount>;
|
|
56
|
+
};
|
|
57
|
+
account: {
|
|
58
|
+
getAddress(): string;
|
|
59
|
+
/**
|
|
60
|
+
* @param {Brand<'nat'>} brand
|
|
61
|
+
* @returns {PromiseVow<Amount<'nat'>>}
|
|
62
|
+
*/
|
|
63
|
+
getBalance(brand: Brand<"nat">): PromiseVow<Amount<"nat">>;
|
|
64
|
+
/**
|
|
65
|
+
* Deposit a payment into the bank purse that matches the alleged brand.
|
|
66
|
+
* This is safe, since even if the payment lies about its brand, ERTP
|
|
67
|
+
* will reject spoofed payment objects when depositing into a purse.
|
|
68
|
+
*
|
|
69
|
+
* @param {Payment<'nat'>} payment
|
|
70
|
+
* @param {Pattern} [optAmountShape] throws if the Amount of the Payment
|
|
71
|
+
* does not match the provided Pattern
|
|
72
|
+
* @returns {PromiseVow<Amount<'nat'>>}
|
|
73
|
+
*/
|
|
74
|
+
deposit(payment: Payment<"nat">, optAmountShape?: Pattern): PromiseVow<Amount<"nat">>;
|
|
75
|
+
/**
|
|
76
|
+
* Withdraw a payment from the account's bank purse of the amount's
|
|
77
|
+
* brand.
|
|
78
|
+
*
|
|
79
|
+
* @param {Amount<'nat'>} amount
|
|
80
|
+
* @returns {PromiseVow<Payment<'nat'>>} payment
|
|
81
|
+
*/
|
|
82
|
+
withdraw(amount: Amount<"nat">): PromiseVow<Payment<"nat">>;
|
|
83
|
+
/**
|
|
84
|
+
* Execute a batch of messages in order as a single atomic transaction
|
|
85
|
+
* and return the responses. If any of the messages fails, the entire
|
|
86
|
+
* batch will be rolled back. Use `typedJson()` on the arguments to get
|
|
87
|
+
* typed return values.
|
|
88
|
+
*
|
|
89
|
+
* @template {TypedJson[]} MT messages tuple (use const with multiple
|
|
90
|
+
* elements or it will be a mixed array)
|
|
91
|
+
* @param {MT} messages
|
|
92
|
+
* @returns {PromiseVowOfTupleMappedToGenerics<{
|
|
93
|
+
* [K in keyof MT]: JsonSafe<ResponseTo<MT[K]>>;
|
|
94
|
+
* }>}
|
|
95
|
+
*/
|
|
96
|
+
executeTx<MT extends TypedJson[]>(messages: MT): PromiseVowOfTupleMappedToGenerics<{ [K in keyof MT]: JsonSafe<ResponseTo<MT[K]>>; }>;
|
|
97
|
+
/**
|
|
98
|
+
* @param {TargetApp} tap
|
|
99
|
+
* @returns {PromiseVow<TargetRegistration>}
|
|
100
|
+
*/
|
|
101
|
+
monitorTransfers(tap: TargetApp): PromiseVow<TargetRegistration>;
|
|
102
|
+
};
|
|
103
|
+
}>;
|
|
104
|
+
/**
|
|
105
|
+
* @typedef {Awaited<
|
|
106
|
+
* ReturnType<ReturnType<typeof prepareLocalChainAccountKit>>
|
|
107
|
+
* >} LocalChainAccountKit
|
|
108
|
+
*/
|
|
109
|
+
/** @typedef {LocalChainAccountKit['account']} LocalChainAccount */
|
|
110
|
+
export const LocalChainI: import("@endo/patterns").InterfaceGuard<{
|
|
111
|
+
makeAccount: import("@endo/patterns").MethodGuard;
|
|
112
|
+
query: import("@endo/patterns").MethodGuard;
|
|
113
|
+
queryMany: import("@endo/patterns").MethodGuard;
|
|
114
|
+
}>;
|
|
115
|
+
export function prepareLocalChainTools(zone: import("@agoric/base-zone").Zone, vowTools: VowTools): {
|
|
116
|
+
makeLocalChain: (powers: LocalChainPowers) => import("@endo/exo").Guarded<{
|
|
117
|
+
/**
|
|
118
|
+
* Allocate a fresh address that doesn't correspond with a public key,
|
|
119
|
+
* and follows the ICA guidelines to help reduce collisions. See
|
|
120
|
+
* x/vlocalchain/keeper/keeper.go AllocateAddress for the use of the app
|
|
121
|
+
* hash and block data hash.
|
|
122
|
+
*
|
|
123
|
+
* @returns {PromiseVow<LocalChainAccount>}
|
|
124
|
+
*/
|
|
125
|
+
makeAccount(): PromiseVow<LocalChainAccount>;
|
|
126
|
+
/**
|
|
127
|
+
* Make a single query to the local chain. Will reject with an error if
|
|
128
|
+
* the query fails. Otherwise, return the response as a JSON-compatible
|
|
129
|
+
* object.
|
|
130
|
+
*
|
|
131
|
+
* @template {TypedJson} [T=TypedJson]
|
|
132
|
+
* @param {T} request
|
|
133
|
+
* @returns {PromiseVow<JsonSafe<ResponseTo<T>>>}
|
|
134
|
+
*/
|
|
135
|
+
query<T extends TypedJson = {
|
|
136
|
+
'@type': string;
|
|
137
|
+
}>(request: T): PromiseVow<JsonSafe<ResponseTo<T>>>;
|
|
138
|
+
/**
|
|
139
|
+
* Send a batch of query requests to the local chain. Unless there is a
|
|
140
|
+
* system error, will return all results to indicate their success or
|
|
141
|
+
* failure.
|
|
142
|
+
*
|
|
143
|
+
* @template {import('@agoric/cosmic-proto').TypedJson[]} RT
|
|
144
|
+
* @param {RT} requests
|
|
145
|
+
* @returns {PromiseVowOfTupleMappedToGenerics<{
|
|
146
|
+
* [K in keyof RT]: JsonSafe<{
|
|
147
|
+
* error?: string;
|
|
148
|
+
* reply: ResponseTo<RT[K]>;
|
|
149
|
+
* }>;
|
|
150
|
+
* }>}
|
|
151
|
+
*/
|
|
152
|
+
queryMany<RT extends import("@agoric/cosmic-proto").TypedJson[]>(requests: RT): PromiseVowOfTupleMappedToGenerics<{ [K in keyof RT]: JsonSafe<{
|
|
153
|
+
error?: string;
|
|
154
|
+
reply: ResponseTo<RT[K]>;
|
|
155
|
+
}>; }>;
|
|
156
|
+
}>;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Temporary hack
|
|
160
|
+
*
|
|
161
|
+
* UNTIL(microsoft/TypeScript#57122): This type should be replaced with just
|
|
162
|
+
* PromiseVow<T>, but TypeScript doesn't understand that the result of a
|
|
163
|
+
* mapping a tuple type using generics is iterable:
|
|
164
|
+
*
|
|
165
|
+
* 'JsonSafe<MsgTransferResponse & { '@type':
|
|
166
|
+
* "/ibc.applications.transfer.v1.MsgTransferResponse"; }>[] |
|
|
167
|
+
* Vow<JsonSafe<MsgTransferResponse & { ...; }>[]>' must have a
|
|
168
|
+
* '[Symbol.iterator]()' method that returns an iterator.
|
|
169
|
+
*/
|
|
170
|
+
export type PromiseVowOfTupleMappedToGenerics<T extends unknown[]> = Promise<T>;
|
|
171
|
+
export type AccountPowers = {
|
|
172
|
+
system: ScopedBridgeManager<"vlocalchain">;
|
|
173
|
+
bank: Bank;
|
|
174
|
+
transfer: import("./transfer.js").TransferMiddleware;
|
|
175
|
+
};
|
|
176
|
+
export type LocalChainPowers = {
|
|
177
|
+
system: ScopedBridgeManager<"vlocalchain">;
|
|
178
|
+
bankManager: BankManager;
|
|
179
|
+
transfer: import("./transfer.js").TransferMiddleware;
|
|
180
|
+
};
|
|
181
|
+
export type LocalChainAccountKit = Awaited<ReturnType<ReturnType<typeof prepareLocalChainAccountKit>>>;
|
|
182
|
+
export type LocalChainAccount = LocalChainAccountKit["account"];
|
|
183
|
+
export type LocalChainTools = ReturnType<typeof prepareLocalChainTools>;
|
|
184
|
+
export type LocalChain = ReturnType<LocalChainTools["makeLocalChain"]>;
|
|
185
|
+
import type { VowTools } from '@agoric/vow';
|
|
186
|
+
import type { PromiseVow } from '@agoric/vow';
|
|
187
|
+
import type { TypedJson } from '@agoric/cosmic-proto';
|
|
188
|
+
import type { ResponseTo } from '@agoric/cosmic-proto';
|
|
189
|
+
import type { JsonSafe } from '@agoric/cosmic-proto';
|
|
190
|
+
import type { TargetApp } from './bridge-target.js';
|
|
191
|
+
import type { TargetRegistration } from './bridge-target.js';
|
|
192
|
+
import type { ScopedBridgeManager } from './types.js';
|
|
193
|
+
import type { Bank } from './vat-bank.js';
|
|
194
|
+
import type { BankManager } from './vat-bank.js';
|
|
195
|
+
//# sourceMappingURL=localchain.d.ts.map
|