@agoric/vats 0.16.0-upgrade-16-dev-0df76a7.0 → 0.16.0-upgrade-17-dev-a61cdab.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/CHANGELOG.md +21 -23
- package/package.json +27 -26
- package/src/bridge-target.d.ts +4 -0
- package/src/bridge-target.d.ts.map +1 -1
- package/src/bridge-target.js +5 -8
- package/src/bridge.d.ts +1 -0
- package/src/bridge.d.ts.map +1 -1
- package/src/bridge.js +21 -1
- package/src/core/basic-behaviors.d.ts +10 -22
- package/src/core/basic-behaviors.d.ts.map +1 -1
- package/src/core/basic-behaviors.js +17 -26
- package/src/core/boot-chain.d.ts +22 -50
- package/src/core/boot-chain.d.ts.map +1 -1
- package/src/core/boot-sim.d.ts +4 -4
- package/src/core/boot-solo.d.ts +4 -4
- package/src/core/chain-behaviors.d.ts +4 -20
- package/src/core/chain-behaviors.d.ts.map +1 -1
- package/src/core/chain-behaviors.js +22 -30
- package/src/core/client-behaviors.d.ts.map +1 -1
- package/src/core/client-behaviors.js +7 -3
- package/src/core/demoIssuers.d.ts +1 -5
- package/src/core/demoIssuers.d.ts.map +1 -1
- package/src/core/demoIssuers.js +6 -6
- package/src/core/lib-boot.d.ts +8 -4
- package/src/core/lib-boot.d.ts.map +1 -1
- package/src/core/lib-boot.js +3 -2
- package/src/core/types-ambient.d.ts +39 -5
- package/src/core/utils.d.ts +4 -4
- package/src/core/utils.d.ts.map +1 -1
- package/src/core/utils.js +1 -2
- package/src/ibc.d.ts.map +1 -1
- package/src/ibc.js +31 -17
- package/src/lib-board.d.ts +2 -5
- package/src/lib-board.d.ts.map +1 -1
- package/src/lib-board.js +2 -5
- package/src/localchain.d.ts +46 -22
- package/src/localchain.d.ts.map +1 -1
- package/src/localchain.js +39 -22
- package/src/nameHub.d.ts.map +1 -1
- package/src/nameHub.js +2 -4
- package/src/priceAuthorityRegistry.d.ts.map +1 -1
- package/src/priceAuthorityRegistry.js +4 -4
- package/src/proposals/localchain-proposal.d.ts +0 -1
- package/src/proposals/localchain-proposal.d.ts.map +1 -1
- package/src/proposals/localchain-proposal.js +5 -4
- package/src/proposals/localchain-test.js +3 -3
- package/src/proposals/network-proposal.d.ts +0 -20
- package/src/proposals/network-proposal.d.ts.map +1 -1
- package/src/proposals/network-proposal.js +2 -8
- package/src/proposals/restart-vats-proposal.js +1 -1
- package/src/proposals/transfer-proposal.d.ts +0 -4
- package/src/proposals/transfer-proposal.d.ts.map +1 -1
- package/src/proposals/transfer-proposal.js +2 -7
- 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-orch-core-proposal.d.ts +29 -0
- package/src/proposals/upgrade-orch-core-proposal.d.ts.map +1 -0
- package/src/proposals/upgrade-orch-core-proposal.js +43 -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 +69 -0
- package/src/proposals/upgrade-zoe-proposal.d.ts +0 -1
- package/src/proposals/upgrade-zoe-proposal.d.ts.map +1 -1
- package/src/proposals/upgrade-zoe-proposal.js +1 -1
- package/src/transfer.d.ts +7 -3
- package/src/transfer.d.ts.map +1 -1
- package/src/transfer.js +4 -3
- package/src/types.d.ts +49 -10
- package/src/vat-bank.d.ts.map +1 -1
- package/src/vat-bank.js +7 -7
- package/src/vat-board.d.ts +4 -4
- package/src/vat-board.d.ts.map +1 -1
- package/src/vat-bridge.d.ts.map +1 -1
- package/src/vat-bridge.js +1 -1
- package/src/vat-localchain.d.ts +16 -4
- package/src/vat-localchain.d.ts.map +1 -1
- package/src/vat-network.d.ts +4 -4
- package/src/vat-network.d.ts.map +1 -1
- package/src/vat-network.js +3 -1
- package/src/vat-transfer.d.ts +2 -2
- package/src/vat-transfer.d.ts.map +1 -1
- package/src/vat-zoe.d.ts +3 -2
- package/src/vat-zoe.d.ts.map +1 -1
- package/src/vat-zoe.js +2 -0
- package/src/virtual-purse.d.ts.map +1 -1
- package/src/virtual-purse.js +28 -9
- package/tools/bank-utils.d.ts.map +1 -1
- package/tools/boot-test-utils.d.ts.map +1 -1
- package/tools/boot-test-utils.js +6 -4
- package/tools/fake-bridge.d.ts +10 -0
- package/tools/fake-bridge.d.ts.map +1 -1
- package/tools/fake-bridge.js +145 -31
package/src/vat-board.d.ts
CHANGED
|
@@ -23,8 +23,8 @@ export function buildRootObject(_vatPowers: unknown, _vatParameters: unknown, ba
|
|
|
23
23
|
unserialize(data: any): any;
|
|
24
24
|
}>;
|
|
25
25
|
}>;
|
|
26
|
-
makePublishingRecorderKit: <T>(storageNode: StorageNode | Awaited<import("jessie.js").FarRef<StorageNode>>, valueShape?: import("@agoric/
|
|
27
|
-
makeReadOnlyRecorderKit: <T>(storageNode: StorageNode | Awaited<import("jessie.js").FarRef<StorageNode>>, valueShape?: import("@agoric/
|
|
26
|
+
makePublishingRecorderKit: <T>(storageNode: StorageNode | Awaited<import("jessie.js").FarRef<StorageNode>>, valueShape?: import("@agoric/internal").TypedPattern<T> | undefined) => RecorderKit<T>;
|
|
27
|
+
makeReadOnlyRecorderKit: <T>(storageNode: StorageNode | Awaited<import("jessie.js").FarRef<StorageNode>>, valueShape?: import("@agoric/internal").TypedPattern<T> | undefined) => RecorderKit<T>;
|
|
28
28
|
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
29
29
|
getBoard: () => import("@endo/exo").Guarded<{
|
|
30
30
|
getId(value: import("@endo/marshal").RemotableObject): string;
|
|
@@ -45,7 +45,7 @@ export function buildRootObject(_vatPowers: unknown, _vatParameters: unknown, ba
|
|
|
45
45
|
unserialize(data: any): any;
|
|
46
46
|
}>;
|
|
47
47
|
}>;
|
|
48
|
-
makePublishingRecorderKit: <T>(storageNode: StorageNode | Awaited<import("jessie.js").FarRef<StorageNode>>, valueShape?: import("@agoric/
|
|
49
|
-
makeReadOnlyRecorderKit: <T>(storageNode: StorageNode | Awaited<import("jessie.js").FarRef<StorageNode>>, valueShape?: import("@agoric/
|
|
48
|
+
makePublishingRecorderKit: <T>(storageNode: StorageNode | Awaited<import("jessie.js").FarRef<StorageNode>>, valueShape?: import("@agoric/internal").TypedPattern<T> | undefined) => RecorderKit<T>;
|
|
49
|
+
makeReadOnlyRecorderKit: <T>(storageNode: StorageNode | Awaited<import("jessie.js").FarRef<StorageNode>>, valueShape?: import("@agoric/internal").TypedPattern<T> | undefined) => RecorderKit<T>;
|
|
50
50
|
}>;
|
|
51
51
|
//# sourceMappingURL=vat-board.d.ts.map
|
package/src/vat-board.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vat-board.d.ts","sourceRoot":"","sources":["vat-board.js"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,4CAJW,OAAO,kBACP,OAAO,WACP,OAAO,kBAAkB,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"vat-board.d.ts","sourceRoot":"","sources":["vat-board.js"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,4CAJW,OAAO,kBACP,OAAO,WACP,OAAO,kBAAkB,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;6EA4BspH,WAAW;;;;;;;;;;;;;;;;;;;;;;;;GAD7sH"}
|
package/src/vat-bridge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vat-bridge.d.ts","sourceRoot":"","sources":["vat-bridge.js"],"names":[],"mappings":"AAOA;yDAea,IAAI,CAAC,OAAO,YAAY,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC,YACzD,MAAM,YACN,MAAM;;;;
|
|
1
|
+
{"version":3,"file":"vat-bridge.d.ts","sourceRoot":"","sources":["vat-bridge.js"],"names":[],"mappings":"AAOA;yDAea,IAAI,CAAC,OAAO,YAAY,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC,YACzD,MAAM,YACN,MAAM;;;;oBA0BqxJ,CAAC;;;;oEAAmH,YAAY;;yDA5B35J,IAAI,CAAC,OAAO,YAAY,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC,YACzD,MAAM,YACN,MAAM;;;;oBA0BqxJ,CAAC;;;;;GADxyJ"}
|
package/src/vat-bridge.js
CHANGED
package/src/vat-localchain.d.ts
CHANGED
|
@@ -10,9 +10,15 @@ export function buildRootObject(_vatPowers: any, _args: any, baggage: any): {
|
|
|
10
10
|
query<T extends import("@agoric/cosmic-proto").TypedJson = {
|
|
11
11
|
'@type': string;
|
|
12
12
|
}>(request: T): import("@agoric/vow").PromiseVow<import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto").ResponseTo<T>>>;
|
|
13
|
-
queryMany
|
|
13
|
+
queryMany(requests: {
|
|
14
|
+
'@type': string;
|
|
15
|
+
}[]): import("./localchain.js").PromiseVowOfTupleMappedToGenerics<{ [K in keyof {
|
|
16
|
+
'@type': string;
|
|
17
|
+
}[]]: import("@agoric/cosmic-proto").JsonSafe<{
|
|
14
18
|
error?: string;
|
|
15
|
-
reply: import("@agoric/cosmic-proto").ResponseTo<
|
|
19
|
+
reply: import("@agoric/cosmic-proto").ResponseTo<{
|
|
20
|
+
'@type': string;
|
|
21
|
+
}[][K]>;
|
|
16
22
|
}>; }>;
|
|
17
23
|
}>;
|
|
18
24
|
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
@@ -27,9 +33,15 @@ export function buildRootObject(_vatPowers: any, _args: any, baggage: any): {
|
|
|
27
33
|
query<T extends import("@agoric/cosmic-proto").TypedJson = {
|
|
28
34
|
'@type': string;
|
|
29
35
|
}>(request: T): import("@agoric/vow").PromiseVow<import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto").ResponseTo<T>>>;
|
|
30
|
-
queryMany
|
|
36
|
+
queryMany(requests: {
|
|
37
|
+
'@type': string;
|
|
38
|
+
}[]): import("./localchain.js").PromiseVowOfTupleMappedToGenerics<{ [K in keyof {
|
|
39
|
+
'@type': string;
|
|
40
|
+
}[]]: import("@agoric/cosmic-proto").JsonSafe<{
|
|
31
41
|
error?: string;
|
|
32
|
-
reply: import("@agoric/cosmic-proto").ResponseTo<
|
|
42
|
+
reply: import("@agoric/cosmic-proto").ResponseTo<{
|
|
43
|
+
'@type': string;
|
|
44
|
+
}[][K]>;
|
|
33
45
|
}>; }>;
|
|
34
46
|
}>;
|
|
35
47
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vat-localchain.d.ts","sourceRoot":"","sources":["vat-localchain.js"],"names":[],"mappings":"AAOO;IASH;;;;;OAKG;2BADQ,OAAO,iBAAiB,EAAE,gBAAgB
|
|
1
|
+
{"version":3,"file":"vat-localchain.d.ts","sourceRoot":"","sources":["vat-localchain.js"],"names":[],"mappings":"AAOO;IASH;;;;;OAKG;2BADQ,OAAO,iBAAiB,EAAE,gBAAgB;;;;;;;;;;iBASuiB,CAAC;;;;;;;IAb7lB;;;;;OAKG;2BADQ,OAAO,iBAAiB,EAAE,gBAAgB;;;;;;;;;;iBASuiB,CAAC;;;;;;GAHhmB;4BAEa,UAAU,CAAC,OAAO,eAAe,CAAC"}
|
package/src/vat-network.d.ts
CHANGED
|
@@ -12,12 +12,12 @@ export function buildRootObject(_vatPowers: any, _args: any, baggage: any): {
|
|
|
12
12
|
makeEchoConnectionKit: () => import("@endo/exo").GuardedKit<{
|
|
13
13
|
handler: {
|
|
14
14
|
onReceive(_connection: import("@agoric/network").Connection, bytes: import("@agoric/network").Bytes, _connectionHandler: import("@agoric/network").ConnectionHandler): Promise<string>;
|
|
15
|
-
onClose(_connection: import("@agoric/network").Connection,
|
|
15
|
+
onClose(_connection: import("@agoric/network").Connection, reason?: import("@agoric/network").CloseReason, _connectionHandler?: import("@agoric/network").ConnectionHandler | undefined): Promise<void>;
|
|
16
16
|
};
|
|
17
17
|
listener: {
|
|
18
18
|
onAccept(_port: any, _localAddr: any, _remoteAddr: any, _listenHandler: any): Promise<import("@endo/exo").Guarded<{
|
|
19
19
|
onReceive(_connection: import("@agoric/network").Connection, bytes: import("@agoric/network").Bytes, _connectionHandler: import("@agoric/network").ConnectionHandler): Promise<string>;
|
|
20
|
-
onClose(_connection: import("@agoric/network").Connection,
|
|
20
|
+
onClose(_connection: import("@agoric/network").Connection, reason?: import("@agoric/network").CloseReason, _connectionHandler?: import("@agoric/network").ConnectionHandler | undefined): Promise<void>;
|
|
21
21
|
}>>;
|
|
22
22
|
onListen(port: any, _listenHandler: any): Promise<void>;
|
|
23
23
|
};
|
|
@@ -46,12 +46,12 @@ export function buildRootObject(_vatPowers: any, _args: any, baggage: any): {
|
|
|
46
46
|
makeEchoConnectionKit: () => import("@endo/exo").GuardedKit<{
|
|
47
47
|
handler: {
|
|
48
48
|
onReceive(_connection: import("@agoric/network").Connection, bytes: import("@agoric/network").Bytes, _connectionHandler: import("@agoric/network").ConnectionHandler): Promise<string>;
|
|
49
|
-
onClose(_connection: import("@agoric/network").Connection,
|
|
49
|
+
onClose(_connection: import("@agoric/network").Connection, reason?: import("@agoric/network").CloseReason, _connectionHandler?: import("@agoric/network").ConnectionHandler | undefined): Promise<void>;
|
|
50
50
|
};
|
|
51
51
|
listener: {
|
|
52
52
|
onAccept(_port: any, _localAddr: any, _remoteAddr: any, _listenHandler: any): Promise<import("@endo/exo").Guarded<{
|
|
53
53
|
onReceive(_connection: import("@agoric/network").Connection, bytes: import("@agoric/network").Bytes, _connectionHandler: import("@agoric/network").ConnectionHandler): Promise<string>;
|
|
54
|
-
onClose(_connection: import("@agoric/network").Connection,
|
|
54
|
+
onClose(_connection: import("@agoric/network").Connection, reason?: import("@agoric/network").CloseReason, _connectionHandler?: import("@agoric/network").ConnectionHandler | undefined): Promise<void>;
|
|
55
55
|
}>>;
|
|
56
56
|
onListen(port: any, _listenHandler: any): Promise<void>;
|
|
57
57
|
};
|
package/src/vat-network.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vat-network.d.ts","sourceRoot":"","sources":["vat-network.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vat-network.d.ts","sourceRoot":"","sources":["vat-network.js"],"names":[],"mappings":"AAYA;;;;;qIAsC2hnC,aAAa;;;;;;;;;;;;;;;;;;;IAXpinC,wEAAwE;;IAGxE,0EAA0E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAH1E,wEAAwE;;IAGxE,0EAA0E;;;;;;;;GAO7E"}
|
package/src/vat-network.js
CHANGED
|
@@ -3,6 +3,7 @@ import { makeDurableZone } from '@agoric/zone/durable.js';
|
|
|
3
3
|
import {
|
|
4
4
|
prepareEchoConnectionKit,
|
|
5
5
|
prepareLoopbackProtocolHandler,
|
|
6
|
+
prepareNetworkPowers,
|
|
6
7
|
preparePortAllocator,
|
|
7
8
|
prepareRouterProtocol,
|
|
8
9
|
} from '@agoric/network';
|
|
@@ -11,7 +12,8 @@ import { Far } from '@endo/far';
|
|
|
11
12
|
|
|
12
13
|
export function buildRootObject(_vatPowers, _args, baggage) {
|
|
13
14
|
const zone = makeDurableZone(baggage);
|
|
14
|
-
const
|
|
15
|
+
const vowTools = prepareVowTools(zone.subZone('vow'));
|
|
16
|
+
const powers = prepareNetworkPowers(zone, vowTools);
|
|
15
17
|
|
|
16
18
|
const makeRouterProtocol = prepareRouterProtocol(
|
|
17
19
|
zone.subZone('network'),
|
package/src/vat-transfer.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export function buildRootObject(_vatPowers: any, _args: any, baggage: any): {
|
|
|
28
28
|
};
|
|
29
29
|
interceptorFactory: {
|
|
30
30
|
wrapApp: (tap: globalThis.ERef<import("./bridge-target.js").TargetApp>, targetHost: globalThis.ERef<import("./bridge-target.js").TargetHost>, isActiveTap?: boolean | undefined) => import("@endo/exo").Guarded<{
|
|
31
|
-
receiveUpcall(obj:
|
|
31
|
+
receiveUpcall(obj: import("./types").VTransferIBCEvent): Promise<import("@agoric/vow").Vow<unknown> | undefined>;
|
|
32
32
|
}>;
|
|
33
33
|
};
|
|
34
34
|
transferMiddleware: {
|
|
@@ -67,7 +67,7 @@ export function buildRootObject(_vatPowers: any, _args: any, baggage: any): {
|
|
|
67
67
|
};
|
|
68
68
|
interceptorFactory: {
|
|
69
69
|
wrapApp: (tap: globalThis.ERef<import("./bridge-target.js").TargetApp>, targetHost: globalThis.ERef<import("./bridge-target.js").TargetHost>, isActiveTap?: boolean | undefined) => import("@endo/exo").Guarded<{
|
|
70
|
-
receiveUpcall(obj:
|
|
70
|
+
receiveUpcall(obj: import("./types").VTransferIBCEvent): Promise<import("@agoric/vow").Vow<unknown> | undefined>;
|
|
71
71
|
}>;
|
|
72
72
|
};
|
|
73
73
|
transferMiddleware: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vat-transfer.d.ts","sourceRoot":"","sources":["vat-transfer.js"],"names":[],"mappings":"AASO;IAyBH;;;;;OAKG;2BAJqD,CAAC,SAA5C,OAAQ,kBAAkB,EAAE,aAAc,WAC5C,OAAO,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC;;;;;;;;;;;;;IAkBnD;;;OAGG;;;
|
|
1
|
+
{"version":3,"file":"vat-transfer.d.ts","sourceRoot":"","sources":["vat-transfer.js"],"names":[],"mappings":"AASO;IAyBH;;;;;OAKG;2BAJqD,CAAC,SAA5C,OAAQ,kBAAkB,EAAE,aAAc,WAC5C,OAAO,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC;;;;;;;;;;;;;IAkBnD;;;OAGG;;;yCAM6iK,oBAAiB;;;;;;;;yDAAl6C,oBAAoB;+DAApB,oBAAoB;;;;;IA7BnrH;;;;;OAKG;2BAJqD,CAAC,SAA5C,OAAQ,kBAAkB,EAAE,aAAc,WAC5C,OAAO,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC;;;;;;;;;;;;;IAkBnD;;;OAGG;;;;;;;;;;;;;;;;GAGN;0BAEa,UAAU,CAAC,OAAO,eAAe,CAAC"}
|
package/src/vat-zoe.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
export function buildRootObject(vatPowers: any, _vatParams: any, zoeBaggage: any): {
|
|
2
2
|
buildZoe: (adminVat: any, feeIssuerConfig: any, zcfBundleName: any) => Promise<{
|
|
3
|
-
zoeService: ZoeService
|
|
3
|
+
zoeService: import("@endo/exo").Guarded<ZoeService>;
|
|
4
4
|
feeMintAccess: FeeMintAccess;
|
|
5
5
|
}>;
|
|
6
6
|
getZoeConfigFacet: () => any;
|
|
7
7
|
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
8
8
|
buildZoe: (adminVat: any, feeIssuerConfig: any, zcfBundleName: any) => Promise<{
|
|
9
|
-
zoeService: ZoeService
|
|
9
|
+
zoeService: import("@endo/exo").Guarded<ZoeService>;
|
|
10
10
|
feeMintAccess: FeeMintAccess;
|
|
11
11
|
}>;
|
|
12
12
|
getZoeConfigFacet: () => any;
|
|
13
13
|
}>;
|
|
14
|
+
export type ZoeVat = ReturnType<typeof buildRootObject>;
|
|
14
15
|
//# sourceMappingURL=vat-zoe.d.ts.map
|
package/src/vat-zoe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vat-zoe.d.ts","sourceRoot":"","sources":["vat-zoe.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;GAgDC"}
|
|
1
|
+
{"version":3,"file":"vat-zoe.d.ts","sourceRoot":"","sources":["vat-zoe.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;GAgDC;qBAEa,UAAU,CAAC,OAAO,eAAe,CAAC"}
|
package/src/vat-zoe.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-purse.d.ts","sourceRoot":"","sources":["virtual-purse.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"virtual-purse.d.ts","sourceRoot":"","sources":["virtual-purse.js"],"names":[],"mappings":"AAmBO,qDAHI,OAAO,gBACP,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+DjB;AAwNM,0CADK,OAAO,cAAc,EAAE,IAAI,SAK1B,IAAI,CAAC,sBAAsB,CAAC,qDAE5B;IACV,MAAU,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAChC,KAAS,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACxB,IAAQ,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7B,WAAe,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;CAClC,KAQS,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CA0BnD;qBAhQY,CACZ,GAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EACvB,cAAkB,CAAC,EAAE,OAAO,KACrB,OAAO,CAAC,MAAM,CAAC;qBAET,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;;;;;;;;;;;;gBAK/C,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;;;;;;;gBAIjC,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;;;;;iBAIjC,CAAC,KAAK,EAAE,KAAK,KAAK,WAAW,CAAC,MAAM,CAAC;;2BArB1B,WAAW"}
|
package/src/virtual-purse.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fail } from '@endo/errors';
|
|
2
2
|
import { E } from '@endo/far';
|
|
3
3
|
import { isPromise } from '@endo/promise-kit';
|
|
4
|
+
import { getInterfaceGuardPayload, matches } from '@endo/patterns';
|
|
4
5
|
|
|
6
|
+
import { M } from '@agoric/store';
|
|
5
7
|
import {
|
|
8
|
+
AmountPatternShape,
|
|
6
9
|
AmountShape,
|
|
7
10
|
BrandShape,
|
|
8
11
|
DepositFacetShape,
|
|
9
12
|
NotifierShape,
|
|
10
13
|
PaymentShape,
|
|
11
|
-
} from '@agoric/ertp
|
|
12
|
-
|
|
13
|
-
import { getInterfaceGuardPayload } from '@endo/patterns';
|
|
14
|
-
|
|
15
|
-
const { Fail } = assert;
|
|
14
|
+
} from '@agoric/ertp';
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* @param {Pattern} [brandShape]
|
|
@@ -37,7 +36,7 @@ export const makeVirtualPurseKitIKit = (
|
|
|
37
36
|
// to this raw method to validate that this remotable is actually
|
|
38
37
|
// a live payment of the correct brand with sufficient funds.
|
|
39
38
|
deposit: M.callWhen(PaymentShape)
|
|
40
|
-
.optional(
|
|
39
|
+
.optional(AmountPatternShape)
|
|
41
40
|
.returns(amountShape),
|
|
42
41
|
getDepositFacet: M.callWhen().returns(DepositFacetShape),
|
|
43
42
|
withdraw: M.callWhen(amountShape).returns(PaymentShape),
|
|
@@ -50,7 +49,9 @@ export const makeVirtualPurseKitIKit = (
|
|
|
50
49
|
});
|
|
51
50
|
|
|
52
51
|
const RetainRedeemI = M.interface('RetainRedeem', {
|
|
53
|
-
retain: M.callWhen(PaymentShape)
|
|
52
|
+
retain: M.callWhen(PaymentShape)
|
|
53
|
+
.optional(AmountPatternShape)
|
|
54
|
+
.returns(amountShape),
|
|
54
55
|
redeem: M.callWhen(amountShape).returns(PaymentShape),
|
|
55
56
|
});
|
|
56
57
|
|
|
@@ -58,7 +59,7 @@ export const makeVirtualPurseKitIKit = (
|
|
|
58
59
|
retain: getInterfaceGuardPayload(RetainRedeemI).methodGuards.retain,
|
|
59
60
|
redeem: getInterfaceGuardPayload(RetainRedeemI).methodGuards.redeem,
|
|
60
61
|
recoverableClaim: M.callWhen(M.await(PaymentShape))
|
|
61
|
-
.optional(
|
|
62
|
+
.optional(AmountPatternShape)
|
|
62
63
|
.returns(PaymentShape),
|
|
63
64
|
});
|
|
64
65
|
|
|
@@ -104,6 +105,22 @@ export const makeVirtualPurseKitIKit = (
|
|
|
104
105
|
* current balance iterable for a given brand.
|
|
105
106
|
*/
|
|
106
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Until https://github.com/Agoric/agoric-sdk/issues/9407 is fixed, this
|
|
110
|
+
* function restricts the `optAmountShape`, if provided, to be a concrete
|
|
111
|
+
* `Amount` rather than a `Pattern` as it is supposed to be.
|
|
112
|
+
*
|
|
113
|
+
* TODO: Once https://github.com/Agoric/agoric-sdk/issues/9407 is fixed, remove
|
|
114
|
+
* this function and all calls to it.
|
|
115
|
+
*
|
|
116
|
+
* @param {Pattern} [optAmountShape]
|
|
117
|
+
*/
|
|
118
|
+
const legacyRestrictAmountShapeArg = optAmountShape => {
|
|
119
|
+
if (optAmountShape && !matches(optAmountShape, AmountShape)) {
|
|
120
|
+
throw Fail`optAmountShape if provided, must still be a concrete Amount due to https://github.com/Agoric/agoric-sdk/issues/9407`;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
107
124
|
/** @param {import('@agoric/zone').Zone} zone */
|
|
108
125
|
const prepareVirtualPurseKit = zone =>
|
|
109
126
|
zone.exoClassKit(
|
|
@@ -141,6 +158,7 @@ const prepareVirtualPurseKit = zone =>
|
|
|
141
158
|
* @returns {Promise<Payment<'nat'>>}
|
|
142
159
|
*/
|
|
143
160
|
async recoverableClaim(payment, optAmountShape) {
|
|
161
|
+
legacyRestrictAmountShapeArg(optAmountShape);
|
|
144
162
|
const {
|
|
145
163
|
state: { recoveryPurse },
|
|
146
164
|
} = this;
|
|
@@ -168,6 +186,7 @@ const prepareVirtualPurseKit = zone =>
|
|
|
168
186
|
minter: {
|
|
169
187
|
/** @type {Retain} */
|
|
170
188
|
async retain(payment, optAmountShape) {
|
|
189
|
+
legacyRestrictAmountShapeArg(optAmountShape);
|
|
171
190
|
!!this.state.mint || Fail`minter cannot retain without a mint.`;
|
|
172
191
|
return E(this.state.issuer).burn(payment, optAmountShape);
|
|
173
192
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bank-utils.d.ts","sourceRoot":"","sources":["bank-utils.js"],"names":[],"mappings":"AAYO,4CAFI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC,EAAE;sBA4B1C,MAAM,cACN,MAAM,gBACN,MAAM,OACN,OAAO,oBAAoB,EAAE,cAAc;;;EAqBvD;AAMM;cAFI,OAAO,kBAAkB,EAAE,QAAQ;;;;
|
|
1
|
+
{"version":3,"file":"bank-utils.d.ts","sourceRoot":"","sources":["bank-utils.js"],"names":[],"mappings":"AAYO,4CAFI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC,EAAE;sBA4B1C,MAAM,cACN,MAAM,gBACN,MAAM,OACN,OAAO,oBAAoB,EAAE,cAAc;;;EAqBvD;AAMM;cAFI,OAAO,kBAAkB,EAAE,QAAQ;;;;6FA0Bg+gB,WAAW,eAA6B,2BAA2B;;;mBAAo8C,CAAC;;;;0BAXzgkB,MAAM,CAAC,KAAK,CAAC,KACX,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;GASrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boot-test-utils.d.ts","sourceRoot":"","sources":["boot-test-utils.js"],"names":[],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"boot-test-utils.d.ts","sourceRoot":"","sources":["boot-test-utils.js"],"names":[],"mappings":";;;;;;;;;;;AAkCO,6BAAqB;AAE5B,qBAAqB;AACrB,yBADW,MAAM,CACgB;AAE1B;;;;;;;iBAGmB,GAAG;iBACH,GAAG;eAGL,GAAG;gBACF,GAAG;;;eAIJ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BvB;AAEG;;;EAoEN;AAEM,iDAON;mDAlJkD,2BAA2B;4CAClC,oBAAoB;6CACnB,qBAAqB;2CACvB,mBAAmB;6CACjB,qBAAqB;+CACnB,uBAAuB;sDAChB,8BAA8B;oDAChC,4BAA4B;2CACrC,mBAAmB"}
|
package/tools/boot-test-utils.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { Fail } from '@endo/errors';
|
|
2
|
+
import { E } from '@endo/far';
|
|
3
|
+
import { Far } from '@endo/marshal';
|
|
4
|
+
|
|
1
5
|
import {
|
|
2
6
|
makeFakeVatAdmin,
|
|
3
7
|
zcfBundleCap,
|
|
4
8
|
} from '@agoric/zoe/tools/fakeVatAdmin.js';
|
|
5
9
|
import { buildZoeManualTimer } from '@agoric/zoe/tools/manualTimer.js';
|
|
6
|
-
import { Far } from '@endo/marshal';
|
|
7
10
|
import { makeScalarBigMapStore } from '@agoric/vat-data';
|
|
8
11
|
import { bundles, devices } from '../test/devices.js';
|
|
9
12
|
|
|
@@ -17,8 +20,6 @@ import { buildRootObject as priceAuthorityRoot } from '../src/vat-priceAuthority
|
|
|
17
20
|
import { buildRootObject as provisioningRoot } from '../src/vat-provisioning.js';
|
|
18
21
|
import { buildRootObject as zoeRoot } from '../src/vat-zoe.js';
|
|
19
22
|
|
|
20
|
-
const { Fail } = assert;
|
|
21
|
-
|
|
22
23
|
export const vatRoots = {
|
|
23
24
|
agoricNames: agoricNamesRoot,
|
|
24
25
|
bank: bankRoot,
|
|
@@ -126,7 +127,8 @@ export const makePopulatedFakeVatAdmin = () => {
|
|
|
126
127
|
const baggage = makeScalarBigMapStore('baggage');
|
|
127
128
|
const adminNode =
|
|
128
129
|
/** @type {import('@agoric/swingset-vat').VatAdminFacet} */ ({});
|
|
129
|
-
|
|
130
|
+
const rootP = buildRoot({}, vatParameters, baggage);
|
|
131
|
+
return E.when(rootP, root => harden({ root, adminNode }));
|
|
130
132
|
};
|
|
131
133
|
const createVatByName = async name => {
|
|
132
134
|
return createVat(fakeNameToCap.get(name) || Fail`unknown vat ${name}`);
|
package/tools/fake-bridge.d.ts
CHANGED
|
@@ -5,6 +5,16 @@ export function makeFakeBankBridge(zone: import("@agoric/zone").Zone, opts?: {
|
|
|
5
5
|
}): ScopedBridgeManager<"bank">;
|
|
6
6
|
export function makeFakeIbcBridge(zone: import("@agoric/zone").Zone, onToBridge: (obj: any) => void): ScopedBridgeManager<"dibc">;
|
|
7
7
|
export const LOCALCHAIN_DEFAULT_ADDRESS: "agoric1fakeLCAAddress";
|
|
8
|
+
export namespace SIMULATED_ERRORS {
|
|
9
|
+
let TIMEOUT: bigint;
|
|
10
|
+
let BAD_REQUEST: bigint;
|
|
11
|
+
}
|
|
12
|
+
export function fakeLocalChainBridgeTxMsgHandler(message: object, sequence: number): unknown;
|
|
13
|
+
export const LOCALCHAIN_QUERY_ALL_BALANCES_RESPONSE: {
|
|
14
|
+
value: bigint;
|
|
15
|
+
denom: string;
|
|
16
|
+
}[];
|
|
17
|
+
export function fakeLocalChainBridgeQueryHandler(message: object): unknown;
|
|
8
18
|
export function makeFakeLocalchainBridge(zone: import("@agoric/zone").Zone, onToBridge?: ((obj: any) => void) | undefined): ScopedBridgeManager<"vlocalchain">;
|
|
9
19
|
export function makeFakeTransferBridge(zone: import("@agoric/zone").Zone, onToBridge?: ((obj: any) => void) | undefined): ScopedBridgeManager<"vtransfer">;
|
|
10
20
|
export type Balances = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fake-bridge.d.ts","sourceRoot":"","sources":["fake-bridge.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fake-bridge.d.ts","sourceRoot":"","sources":["fake-bridge.js"],"names":[],"mappings":"AAkBA,6EAA6E;AAE7E,sCAAuC;AAchC,yCANI,OAAO,cAAc,EAAE,IAAI,SAEnC;IAAuB,QAAQ,EAAvB,QAAQ;CAChB,GAAU,oBAAoB,MAAM,CAAC,CA0FvC;AAOM,wCAJI,OAAO,cAAc,EAAE,IAAI,cAC3B,CAAC,GAAG,KAAA,KAAK,IAAI,GACX,oBAAoB,MAAM,CAAC,CAwCvC;AAED,iEAAkE;;;;;AAwB3D,0DALI,MAAM,YACN,MAAM,GACJ,OAAO,CAsCnB;AAED;;;IASE;AAWK,0DAHI,MAAM,GACJ,OAAO,CAsCnB;AAOM,+CAJI,OAAO,cAAc,EAAE,IAAI,8BAClB,IAAI,gBACX,oBAAoB,aAAa,CAAC,CAgD9C;AAOM,6CAJI,OAAO,cAAc,EAAE,IAAI,8BAClB,IAAI,gBACX,oBAAoB,WAAW,CAAC,CAuC5C;uBA5Wa;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CAAE;yCAPX,iBAAiB"}
|
package/tools/fake-bridge.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import { assert, Fail } from '@
|
|
2
|
+
import { assert, Fail } from '@endo/errors';
|
|
3
3
|
import { makeTracer, VBankAccount } from '@agoric/internal';
|
|
4
4
|
import { E } from '@endo/far';
|
|
5
5
|
import { makeWhen } from '@agoric/vow/src/when.js';
|
|
@@ -8,6 +8,7 @@ import { Nat } from '@endo/nat';
|
|
|
8
8
|
/**
|
|
9
9
|
* @import {JsonSafe} from '@agoric/cosmic-proto';
|
|
10
10
|
* @import {MsgDelegateResponse, MsgUndelegateResponse} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/tx.js';
|
|
11
|
+
* @import {MsgSendResponse} from '@agoric/cosmic-proto/cosmos/bank/v1beta1/tx.js';
|
|
11
12
|
* @import {BridgeHandler, ScopedBridgeManager} from '../src/types.js';
|
|
12
13
|
* @import {Remote} from '@agoric/vow';
|
|
13
14
|
*/
|
|
@@ -71,6 +72,8 @@ export const makeFakeBankBridge = (zone, opts = { balances: {} }) => {
|
|
|
71
72
|
case 'VBANK_GIVE': {
|
|
72
73
|
const { amount, denom } = obj;
|
|
73
74
|
const address = type === 'VBANK_GRAB' ? obj.sender : obj.recipient;
|
|
75
|
+
(address && typeof address === 'string') ||
|
|
76
|
+
Fail`invalid address ${address}`;
|
|
74
77
|
balances[address] ||= {};
|
|
75
78
|
balances[address][denom] ||= 0n;
|
|
76
79
|
|
|
@@ -135,6 +138,16 @@ export const makeFakeIbcBridge = (zone, onToBridge) => {
|
|
|
135
138
|
if (method === 'sendPacket') {
|
|
136
139
|
const { packet } = params;
|
|
137
140
|
return { ...packet, sequence: '39' };
|
|
141
|
+
} else if (method === 'startChannelCloseInit') {
|
|
142
|
+
const { packet } = params;
|
|
143
|
+
if (hndlr)
|
|
144
|
+
E(hndlr)
|
|
145
|
+
.fromBridge({
|
|
146
|
+
type: 'IBC_EVENT',
|
|
147
|
+
event: 'channelCloseConfirm',
|
|
148
|
+
packet,
|
|
149
|
+
})
|
|
150
|
+
.catch(e => console.error(e));
|
|
138
151
|
}
|
|
139
152
|
return undefined;
|
|
140
153
|
},
|
|
@@ -155,6 +168,123 @@ export const makeFakeIbcBridge = (zone, onToBridge) => {
|
|
|
155
168
|
|
|
156
169
|
export const LOCALCHAIN_DEFAULT_ADDRESS = 'agoric1fakeLCAAddress';
|
|
157
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Constants that can be used to force an error state in a bridge transaction.
|
|
173
|
+
* Typically used for the LocalChainBridge which currently accepts all messages
|
|
174
|
+
* unless specified otherwise. Less useful for the DibcBridge which rejects all
|
|
175
|
+
* messages unless specified otherwise.
|
|
176
|
+
*/
|
|
177
|
+
export const SIMULATED_ERRORS = {
|
|
178
|
+
TIMEOUT: 504n,
|
|
179
|
+
BAD_REQUEST: 400n,
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Used to mock responses from Cosmos Golang back to SwingSet for for
|
|
184
|
+
* E(lca).executeTx().
|
|
185
|
+
*
|
|
186
|
+
* Returns an empty object per message unless specified.
|
|
187
|
+
*
|
|
188
|
+
* @param {object} message
|
|
189
|
+
* @param {number} sequence
|
|
190
|
+
* @returns {unknown}
|
|
191
|
+
* @throws {Error} to simulate failures in certain cases
|
|
192
|
+
*/
|
|
193
|
+
export const fakeLocalChainBridgeTxMsgHandler = (message, sequence) => {
|
|
194
|
+
switch (message['@type']) {
|
|
195
|
+
// TODO #9402 reference bank to ensure caller has tokens they are transferring
|
|
196
|
+
case '/ibc.applications.transfer.v1.MsgTransfer': {
|
|
197
|
+
if (message.token.amount === String(SIMULATED_ERRORS.TIMEOUT)) {
|
|
198
|
+
throw Error('simulated unexpected MsgTransfer packet timeout');
|
|
199
|
+
}
|
|
200
|
+
// like `JsonSafe<MsgTransferResponse>`, but bigints are converted to numbers
|
|
201
|
+
// FIXME should vlocalchain return a string instead of number for bigint?
|
|
202
|
+
return {
|
|
203
|
+
sequence,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
case '/cosmos.bank.v1beta1.MsgSend': {
|
|
207
|
+
if (message.amount[0].amount === String(SIMULATED_ERRORS.BAD_REQUEST)) {
|
|
208
|
+
throw Error('simulated error');
|
|
209
|
+
}
|
|
210
|
+
return /** @type {JsonSafe<MsgSendResponse>} */ ({});
|
|
211
|
+
}
|
|
212
|
+
case '/cosmos.staking.v1beta1.MsgDelegate': {
|
|
213
|
+
if (message.amount.amount === String(SIMULATED_ERRORS.TIMEOUT)) {
|
|
214
|
+
throw Error('simulated packet timeout');
|
|
215
|
+
}
|
|
216
|
+
return /** @type {JsonSafe<MsgDelegateResponse>} */ ({});
|
|
217
|
+
}
|
|
218
|
+
case '/cosmos.staking.v1beta1.MsgUndelegate': {
|
|
219
|
+
return /** @type {JsonSafe<MsgUndelegateResponse>} */ ({
|
|
220
|
+
// 5 seconds from unix epoch
|
|
221
|
+
completionTime: { seconds: 5n, nanos: 0 },
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
// returns one empty object per message unless specified
|
|
225
|
+
default:
|
|
226
|
+
return {};
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
export const LOCALCHAIN_QUERY_ALL_BALANCES_RESPONSE = [
|
|
231
|
+
{
|
|
232
|
+
value: 10n,
|
|
233
|
+
denom: 'ubld',
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
value: 10n,
|
|
237
|
+
denom: 'uist',
|
|
238
|
+
},
|
|
239
|
+
];
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Used to mock responses from Cosmos Golang back to SwingSet for for
|
|
243
|
+
* E(lca).query() and E(lca).queryMany().
|
|
244
|
+
*
|
|
245
|
+
* Returns an empty object per query message unless specified.
|
|
246
|
+
*
|
|
247
|
+
* @param {object} message
|
|
248
|
+
* @returns {unknown}
|
|
249
|
+
*/
|
|
250
|
+
export const fakeLocalChainBridgeQueryHandler = message => {
|
|
251
|
+
switch (message['@type']) {
|
|
252
|
+
case '/cosmos.bank.v1beta1.QueryAllBalancesRequest': {
|
|
253
|
+
return {
|
|
254
|
+
error: '',
|
|
255
|
+
height: '1',
|
|
256
|
+
reply: {
|
|
257
|
+
'@type': '/cosmos.bank.v1beta1.QueryAllBalancesResponse',
|
|
258
|
+
balances: LOCALCHAIN_QUERY_ALL_BALANCES_RESPONSE.map(x => ({
|
|
259
|
+
denom: x.denom,
|
|
260
|
+
amount: String(x.value),
|
|
261
|
+
})),
|
|
262
|
+
pagination: { nextKey: null, total: '2' },
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
case '/cosmos.bank.v1beta1.QueryBalanceRequest': {
|
|
267
|
+
return {
|
|
268
|
+
error: '',
|
|
269
|
+
height: '1',
|
|
270
|
+
reply: {
|
|
271
|
+
'@type': '/cosmos.bank.v1beta1.QueryBalanceResponse',
|
|
272
|
+
balance: {
|
|
273
|
+
denom: message.denom,
|
|
274
|
+
// return 10 for all denoms, somewhat arbitrarily.
|
|
275
|
+
// if a denom is not known to cosmos bank, we'd expect to see
|
|
276
|
+
// `{denom, amount: '0'}` returned
|
|
277
|
+
amount: '10',
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
// returns one empty object per message unless specified
|
|
283
|
+
default:
|
|
284
|
+
return {};
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
|
|
158
288
|
/**
|
|
159
289
|
* @param {import('@agoric/zone').Zone} zone
|
|
160
290
|
* @param {(obj) => void} [onToBridge]
|
|
@@ -164,6 +294,7 @@ export const makeFakeLocalchainBridge = (zone, onToBridge = () => {}) => {
|
|
|
164
294
|
/** @type {Remote<BridgeHandler>} */
|
|
165
295
|
let hndlr;
|
|
166
296
|
let lcaExecuteTxSequence = 0;
|
|
297
|
+
let accountsCreated = 0;
|
|
167
298
|
return zone.exo('Fake Localchain Bridge Manager', undefined, {
|
|
168
299
|
getBridgeId: () => 'vlocalchain',
|
|
169
300
|
toBridge: async obj => {
|
|
@@ -171,38 +302,21 @@ export const makeFakeLocalchainBridge = (zone, onToBridge = () => {}) => {
|
|
|
171
302
|
const { method, type, ...params } = obj;
|
|
172
303
|
trace('toBridge', type, method, params);
|
|
173
304
|
switch (type) {
|
|
174
|
-
case 'VLOCALCHAIN_ALLOCATE_ADDRESS':
|
|
175
|
-
|
|
305
|
+
case 'VLOCALCHAIN_ALLOCATE_ADDRESS': {
|
|
306
|
+
const address = `${LOCALCHAIN_DEFAULT_ADDRESS}${accountsCreated || ''}`;
|
|
307
|
+
accountsCreated += 1;
|
|
308
|
+
return address;
|
|
309
|
+
}
|
|
176
310
|
case 'VLOCALCHAIN_EXECUTE_TX': {
|
|
177
311
|
lcaExecuteTxSequence += 1;
|
|
178
|
-
return obj.messages.map(message =>
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
// like `JsonSafe<MsgTransferResponse>`, but bigints are converted to numbers
|
|
188
|
-
// XXX should vlocalchain return a string instead of number for bigint?
|
|
189
|
-
return {
|
|
190
|
-
sequence: lcaExecuteTxSequence,
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
case '/cosmos.staking.v1beta1.MsgDelegate': {
|
|
194
|
-
return /** @type {JsonSafe<MsgDelegateResponse>} */ ({});
|
|
195
|
-
}
|
|
196
|
-
case '/cosmos.staking.v1beta1.MsgUndelegate': {
|
|
197
|
-
return /** @type {JsonSafe<MsgUndelegateResponse>} */ ({
|
|
198
|
-
completionTime: new Date().toJSON(),
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
// returns one empty object per message unless specified
|
|
202
|
-
default:
|
|
203
|
-
return {};
|
|
204
|
-
}
|
|
205
|
-
});
|
|
312
|
+
return obj.messages.map(message =>
|
|
313
|
+
fakeLocalChainBridgeTxMsgHandler(message, lcaExecuteTxSequence),
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
case 'VLOCALCHAIN_QUERY_MANY': {
|
|
317
|
+
return obj.messages.map(message =>
|
|
318
|
+
fakeLocalChainBridgeQueryHandler(message),
|
|
319
|
+
);
|
|
206
320
|
}
|
|
207
321
|
default:
|
|
208
322
|
Fail`unknown type ${type}`;
|