@agoric/casting 0.5.0 → 0.5.1-upgrade-23-dev-bd79330.0.bd79330
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 +14 -12
- package/src/casting-spec.d.ts +11 -8
- package/src/casting-spec.d.ts.map +1 -1
- package/src/casting-spec.js +13 -7
- package/src/change-follower.d.ts +4 -1
- package/src/change-follower.d.ts.map +1 -1
- package/src/change-follower.js +8 -2
- package/src/defaults.d.ts +6 -2
- package/src/defaults.d.ts.map +1 -1
- package/src/defaults.js +5 -1
- package/src/follower-cosmjs.d.ts +6 -2
- package/src/follower-cosmjs.d.ts.map +1 -1
- package/src/follower-cosmjs.js +17 -8
- package/src/follower.d.ts +6 -1
- package/src/follower.d.ts.map +1 -1
- package/src/follower.js +16 -8
- package/src/iterable.d.ts +6 -3
- package/src/iterable.d.ts.map +1 -1
- package/src/iterable.js +11 -5
- package/src/leader-netconfig.d.ts +6 -3
- package/src/leader-netconfig.d.ts.map +1 -1
- package/src/leader-netconfig.js +12 -6
- package/src/leader.d.ts +3 -1
- package/src/leader.d.ts.map +1 -1
- package/src/leader.js +7 -2
- package/src/main.js +0 -4
- package/src/makeHttpClient.d.ts +3 -2
- package/src/makeHttpClient.d.ts.map +1 -1
- package/src/makeHttpClient.js +7 -2
- package/src/netconfig.d.ts.map +1 -1
- package/src/netconfig.js +0 -2
- package/src/types.d.ts +8 -5
- package/src/types.d.ts.map +1 -1
- package/src/types.js +6 -5
- package/CHANGELOG.md +0 -124
- package/test/deploy.js +0 -35
- package/test/fake-rpc-server.js +0 -306
- package/test/interpose-net-access.test.js +0 -122
- package/test/lockdown.js +0 -2
- package/test/mvp.test.js +0 -233
- package/test/net-access-fixture.js +0 -196
- package/test/netconfig.test.js +0 -48
- package/test/prepare-test-env-ava.js +0 -6
- package/test/types.test-d.ts +0 -31
- package/tsconfig.build.json +0 -6
- package/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.json +0 -11
package/src/makeHttpClient.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @import {RpcClient} from '@cosmjs/tendermint-rpc';
|
|
5
|
+
* @import {JsonRpcRequest} from '@cosmjs/json-rpc';
|
|
6
|
+
*/
|
|
7
|
+
|
|
3
8
|
const { freeze } = Object;
|
|
4
9
|
|
|
5
10
|
const filterBadStatus = res => {
|
|
@@ -23,7 +28,7 @@ const filterBadStatus = res => {
|
|
|
23
28
|
*
|
|
24
29
|
* @param {string} url
|
|
25
30
|
* @param {typeof window.fetch} fetch
|
|
26
|
-
* @returns {
|
|
31
|
+
* @returns {RpcClient}
|
|
27
32
|
*/
|
|
28
33
|
export const makeTendermintRpcClient = (url, fetch) => {
|
|
29
34
|
const headers = {}; // XXX needed?
|
|
@@ -37,7 +42,7 @@ export const makeTendermintRpcClient = (url, fetch) => {
|
|
|
37
42
|
},
|
|
38
43
|
|
|
39
44
|
/**
|
|
40
|
-
* @param {
|
|
45
|
+
* @param {JsonRpcRequest} request
|
|
41
46
|
*/
|
|
42
47
|
execute: async request => {
|
|
43
48
|
const settings = {
|
package/src/netconfig.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"netconfig.d.ts","sourceRoot":"","sources":["netconfig.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"netconfig.d.ts","sourceRoot":"","sources":["netconfig.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,kEAWE;AAQK,8CAJI,OAAO,GACL,QAAQ,QAAQ,IAAI,aAAa,CAIL;;;;;;;;;;cA3B3B,MAAM,EAAE;;;;eACR,MAAM"}
|
package/src/netconfig.js
CHANGED
package/src/types.d.ts
CHANGED
|
@@ -30,23 +30,23 @@ export type ValueFollowerElement<T> = ValueFollowerBase & ({
|
|
|
30
30
|
value: undefined;
|
|
31
31
|
error: any;
|
|
32
32
|
});
|
|
33
|
-
export type Unserializer = Pick<
|
|
33
|
+
export type Unserializer = Pick<Marshal<unknown>, "fromCapData" | "unserialize">;
|
|
34
34
|
export type Crasher = {
|
|
35
35
|
crash: (...args: unknown[]) => void;
|
|
36
36
|
};
|
|
37
37
|
export type FollowerOptions = {
|
|
38
|
-
unserializer?:
|
|
38
|
+
unserializer?: FarRef<Unserializer> | null | undefined;
|
|
39
39
|
decode?: ((text: string) => any) | undefined;
|
|
40
40
|
proof?: "none" | "strict" | "optimistic" | undefined;
|
|
41
|
-
crasher?:
|
|
41
|
+
crasher?: FarRef<Crasher> | undefined;
|
|
42
42
|
};
|
|
43
43
|
export type CastingSpec = {
|
|
44
44
|
storeName?: string | undefined;
|
|
45
45
|
storeSubkey?: Uint8Array<ArrayBufferLike> | undefined;
|
|
46
46
|
dataPrefixBytes?: Uint8Array<ArrayBufferLike> | undefined;
|
|
47
47
|
noDataValue?: Uint8Array<ArrayBufferLike> | undefined;
|
|
48
|
-
subscription?:
|
|
49
|
-
notifier?:
|
|
48
|
+
subscription?: ERef<Subscription<any>> | undefined;
|
|
49
|
+
notifier?: ERef<Notifier<any>> | undefined;
|
|
50
50
|
};
|
|
51
51
|
export type IterateEachOptions = {
|
|
52
52
|
height?: number | undefined;
|
|
@@ -55,6 +55,9 @@ export type StreamCell<T> = {
|
|
|
55
55
|
blockHeight: number;
|
|
56
56
|
values: Array<T>;
|
|
57
57
|
};
|
|
58
|
+
import type { ERef } from '@agoric/vow';
|
|
59
|
+
import type { Marshal } from '@endo/marshal';
|
|
60
|
+
import type { FarRef } from '@endo/far';
|
|
58
61
|
import type { Subscription } from '@agoric/notifier';
|
|
59
62
|
import type { Notifier } from '@agoric/notifier';
|
|
60
63
|
//# sourceMappingURL=types.d.ts.map
|
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":";6BAY8B,MAAM,OAAO,GAAG,YAAY,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;sBAC5D,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;2BACxB,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC;;;;YAMnC,UAAU,EAAE;;;WAKZ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;YAC9D,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;gBAChC,MAAM,aAAa;kBACnB,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC;kBAC9E,CAAC,IAAI,EAAE,KAAK,WAAW,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;;4BAG7D,KAAK,MAAM,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;qBAGpC,CAAC;uBAEA,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;qBAC/B,CAAC,OAAO,CAAC,EAAE,kBAAkB,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;wBAC3D,CAAC,OAAO,CAAC,EAAE,kBAAkB,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;;;iBAK3D,MAAM;wBACN,MAAM;;iCAKP,CAAC,IACD,iBAAiB,GAAG,CAAC;IAAE,KAAK,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,GAAG,CAAA;CAAE,CAAC;2BAIrE,IAAI,CAAC,QAAQ,OAAO,CAAC,EAAE,aAAa,GAAG,aAAa,CAAC;;WAKpD,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI;;;;qBAMrB,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;uBAqBtB,CAAC;iBAEA,MAAM;YACN,KAAK,CAAC,CAAC,CAAC;;0BAnFC,aAAa;6BAFV,eAAe;4BAChB,WAAW;kCAFK,kBAAkB;8BAAlB,kBAAkB"}
|
package/src/types.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
// @jessie-check
|
|
2
|
-
|
|
3
1
|
// Ensure this is a module.
|
|
4
2
|
export {};
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* @import {Notifier, Subscription} from '@agoric/notifier';
|
|
6
|
+
* @import {Marshal} from '@endo/marshal';
|
|
7
|
+
* @import {FarRef} from '@endo/far';
|
|
8
|
+
* @import {ERef} from '@agoric/vow';
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -52,7 +53,7 @@ export {};
|
|
|
52
53
|
*/
|
|
53
54
|
|
|
54
55
|
/**
|
|
55
|
-
* @typedef {Pick<
|
|
56
|
+
* @typedef {Pick<Marshal<unknown>, 'fromCapData' | 'unserialize'>} Unserializer
|
|
56
57
|
*/
|
|
57
58
|
|
|
58
59
|
/**
|
|
@@ -62,10 +63,10 @@ export {};
|
|
|
62
63
|
|
|
63
64
|
/**
|
|
64
65
|
* @typedef {object} FollowerOptions
|
|
65
|
-
* @property {null |
|
|
66
|
+
* @property {null | FarRef<Unserializer>} [unserializer]
|
|
66
67
|
* @property {(text: string) => any} [decode]
|
|
67
68
|
* @property {'strict'|'optimistic'|'none'} [proof]
|
|
68
|
-
* @property {
|
|
69
|
+
* @property {FarRef<Crasher>} [crasher]
|
|
69
70
|
*/
|
|
70
71
|
|
|
71
72
|
/**
|
package/CHANGELOG.md
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
## [0.5.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/casting@0.5.0-u22.2...@agoric/casting@0.5.0) (2026-04-02)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @agoric/casting
|
|
9
|
-
|
|
10
|
-
## [0.5.0-u22.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/casting@0.5.0-u22.1...@agoric/casting@0.5.0-u22.2) (2025-09-09)
|
|
11
|
-
|
|
12
|
-
**Note:** Version bump only for package @agoric/casting
|
|
13
|
-
|
|
14
|
-
## [0.5.0-u22.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/casting@0.5.0-u22.0...@agoric/casting@0.5.0-u22.1) (2025-09-09)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @agoric/casting
|
|
17
|
-
|
|
18
|
-
## [0.5.0-u22.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/casting@0.4.2...@agoric/casting@0.5.0-u22.0) (2025-09-08)
|
|
19
|
-
|
|
20
|
-
### ⚠ BREAKING CHANGES
|
|
21
|
-
|
|
22
|
-
* drop support for verified queries
|
|
23
|
-
|
|
24
|
-
### Features
|
|
25
|
-
|
|
26
|
-
* **casting:** makeHttpClient for explicit net access with cosmjs ([5bc5138](https://github.com/Agoric/agoric-sdk/commit/5bc513853d144f2967d9c2fc5b21fa2c4e284982))
|
|
27
|
-
* makeTendermintRpcClient ([129516a](https://github.com/Agoric/agoric-sdk/commit/129516a8f3ae58f16d17460f58d2c69ee215a584))
|
|
28
|
-
* **types:** ambient exports from agoric/internal ([71d18c4](https://github.com/Agoric/agoric-sdk/commit/71d18c4221f63f1c0e7c45562b5a0a86a0b4b5c0))
|
|
29
|
-
* **types:** explicit exports from notifier ([0bc72a8](https://github.com/Agoric/agoric-sdk/commit/0bc72a88c7d91ff1b2f00ee5cabeb58c6315598e))
|
|
30
|
-
|
|
31
|
-
### Bug Fixes
|
|
32
|
-
|
|
33
|
-
* **casting:** dont crash on bad capdata ([8f4ba3a](https://github.com/Agoric/agoric-sdk/commit/8f4ba3a2f56174161d88f57280513ee5a0f5d4d9))
|
|
34
|
-
* **casting:** explicitly harden prototypes ([833c9b3](https://github.com/Agoric/agoric-sdk/commit/833c9b3f63bb83362789bc1261eabf71a8e88ea2))
|
|
35
|
-
* **casting:** properly follow an unpopulated state entry ([97be818](https://github.com/Agoric/agoric-sdk/commit/97be818c4f5c507830f70392f334fa60dd6d7f94))
|
|
36
|
-
* update for `[@jessie](https://github.com/jessie).js/safe-await-separator` ([94c6b3c](https://github.com/Agoric/agoric-sdk/commit/94c6b3c83a5326594f1e2886ae01d6a703a7a68f))
|
|
37
|
-
|
|
38
|
-
### Miscellaneous Chores
|
|
39
|
-
|
|
40
|
-
* drop support for verified queries ([72715c5](https://github.com/Agoric/agoric-sdk/commit/72715c5de745df1be86accbff7aa915a6c9abfaf))
|
|
41
|
-
|
|
42
|
-
### [0.4.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/casting@0.4.1...@agoric/casting@0.4.2) (2023-06-02)
|
|
43
|
-
|
|
44
|
-
**Note:** Version bump only for package @agoric/casting
|
|
45
|
-
|
|
46
|
-
### [0.4.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/casting@0.4.0...@agoric/casting@0.4.1) (2023-05-24)
|
|
47
|
-
|
|
48
|
-
**Note:** Version bump only for package @agoric/casting
|
|
49
|
-
|
|
50
|
-
## [0.4.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/casting@0.3.2...@agoric/casting@0.4.0) (2023-05-19)
|
|
51
|
-
|
|
52
|
-
### ⚠ BREAKING CHANGES
|
|
53
|
-
|
|
54
|
-
* emit smallcaps-format data in all marshallers
|
|
55
|
-
* **AMM:** remove the AMM and cleanup bootstrap etc. dependencies (#7074)
|
|
56
|
-
* rename 'fit' to 'mustMatch'
|
|
57
|
-
|
|
58
|
-
### Features
|
|
59
|
-
|
|
60
|
-
* **internal:** makeFakeStorageKit supports "get" and "entries" ([6a69aab](https://github.com/Agoric/agoric-sdk/commit/6a69aab5cb54faae5af631bbc2281e4fc4ede8e0))
|
|
61
|
-
* emit smallcaps-format data in all marshallers ([1753df8](https://github.com/Agoric/agoric-sdk/commit/1753df83465785b5ee71b250770c9b012d750ffc)), closes [#6822](https://github.com/Agoric/agoric-sdk/issues/6822)
|
|
62
|
-
* **AMM:** remove the AMM and cleanup bootstrap etc. dependencies ([#7074](https://github.com/Agoric/agoric-sdk/issues/7074)) ([ed5ee58](https://github.com/Agoric/agoric-sdk/commit/ed5ee58a276fce3c55f19e4f6f662ed579896c2c)), closes [#7047](https://github.com/Agoric/agoric-sdk/issues/7047)
|
|
63
|
-
* **casting:** handle noData value encoding ([530bc41](https://github.com/Agoric/agoric-sdk/commit/530bc41854cc7f5e5749e97e87fabc6163a17864))
|
|
64
|
-
* assertNetworkConfig ([9762b19](https://github.com/Agoric/agoric-sdk/commit/9762b19b25ebcb4678faa389d39c4bab91e0c25c))
|
|
65
|
-
* getEachIterable skip height fetch ([77b1bb5](https://github.com/Agoric/agoric-sdk/commit/77b1bb589e90462bc7514347b8c62c236d72922e))
|
|
66
|
-
* getLatestIterable skip height fetch ([aff3354](https://github.com/Agoric/agoric-sdk/commit/aff335417d9553182d50a5b84a4aa7c7fb6ae430))
|
|
67
|
-
* getReverseIterable skip height fetch ([edbc8ec](https://github.com/Agoric/agoric-sdk/commit/edbc8ec2fab4a71e2675f5cc608f25d27b43b524))
|
|
68
|
-
* vstorageKeySpecToPath ([9db1fbb](https://github.com/Agoric/agoric-sdk/commit/9db1fbb1328c28282db972b3e130e2ee3515b87d))
|
|
69
|
-
|
|
70
|
-
### Bug Fixes
|
|
71
|
-
|
|
72
|
-
* **casting:** use new subscriber tools ([cb1f739](https://github.com/Agoric/agoric-sdk/commit/cb1f739c36c28befa2ab097bfc9b86686dbe57c3))
|
|
73
|
-
* require chainName ([5c5e661](https://github.com/Agoric/agoric-sdk/commit/5c5e661f444add3e1544c931c475a3a266a080de))
|
|
74
|
-
|
|
75
|
-
### Miscellaneous Chores
|
|
76
|
-
|
|
77
|
-
* rename 'fit' to 'mustMatch' ([9fa3232](https://github.com/Agoric/agoric-sdk/commit/9fa32324f84bfb85de9e99e0c9ad277b8017b50e)), closes [#6844](https://github.com/Agoric/agoric-sdk/issues/6844)
|
|
78
|
-
|
|
79
|
-
### [0.3.4](https://github.com/Agoric/agoric-sdk/compare/@agoric/casting@0.3.3...@agoric/casting@0.3.4) (2023-02-17)
|
|
80
|
-
|
|
81
|
-
**Note:** Version bump only for package @agoric/casting
|
|
82
|
-
|
|
83
|
-
### [0.3.3](https://github.com/Agoric/agoric-sdk/compare/@agoric/casting@0.3.2...@agoric/casting@0.3.3) (2022-12-14)
|
|
84
|
-
|
|
85
|
-
**Note:** Version bump only for package @agoric/casting
|
|
86
|
-
|
|
87
|
-
### [0.3.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/casting@0.3.1...@agoric/casting@0.3.2) (2022-10-18)
|
|
88
|
-
|
|
89
|
-
**Note:** Version bump only for package @agoric/casting
|
|
90
|
-
|
|
91
|
-
### [0.3.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/casting@0.3.0...@agoric/casting@0.3.1) (2022-10-08)
|
|
92
|
-
|
|
93
|
-
**Note:** Version bump only for package @agoric/casting
|
|
94
|
-
|
|
95
|
-
## [0.3.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/casting@0.2.0...@agoric/casting@0.3.0) (2022-10-05)
|
|
96
|
-
|
|
97
|
-
### Features
|
|
98
|
-
|
|
99
|
-
* **cli:** show status of invitations ([8506e6d](https://github.com/Agoric/agoric-sdk/commit/8506e6d87ef331e781c9d2e2251fdcf48e784e04))
|
|
100
|
-
|
|
101
|
-
## 0.2.0 (2022-09-20)
|
|
102
|
-
|
|
103
|
-
### ⚠ BREAKING CHANGES
|
|
104
|
-
|
|
105
|
-
* **casting:** enable an implicit default follower of the local chain
|
|
106
|
-
|
|
107
|
-
### Features
|
|
108
|
-
|
|
109
|
-
* **casting:** enable an implicit default follower of the local chain ([41d4c0c](https://github.com/Agoric/agoric-sdk/commit/41d4c0c0326ec71ede4a6a5b101ae5c8a4339aa0))
|
|
110
|
-
* **casting:** provide reverse iteration ([65906f5](https://github.com/Agoric/agoric-sdk/commit/65906f553908ae5200a96307e78ec505060cb43b))
|
|
111
|
-
* **casting:** Update to consume stream cells ([35db0da](https://github.com/Agoric/agoric-sdk/commit/35db0daed7f8315222fa87cbf9c50e4e2ee8d225)), closes [#5366](https://github.com/Agoric/agoric-sdk/issues/5366)
|
|
112
|
-
* **wallet:** some feedback when no smart wallet ([8057c35](https://github.com/Agoric/agoric-sdk/commit/8057c35d2a89b9d80d31c1da10279c248b3c6e68))
|
|
113
|
-
* **wallet-connection:** Connect dapp directly to wallet UI ([#5750](https://github.com/Agoric/agoric-sdk/issues/5750)) ([1dd584b](https://github.com/Agoric/agoric-sdk/commit/1dd584b195212705b1f74a8c89b7f3f121640e41))
|
|
114
|
-
* contract for single on-chain wallet ([0184a89](https://github.com/Agoric/agoric-sdk/commit/0184a89403a3719f21dc61de37865512cdc819ae))
|
|
115
|
-
|
|
116
|
-
### Bug Fixes
|
|
117
|
-
|
|
118
|
-
* **casting:** Align cosmjs deps ([0ba7a1f](https://github.com/Agoric/agoric-sdk/commit/0ba7a1f7a18d4f83afa04b3637f432fdd72f3cd8))
|
|
119
|
-
* **casting:** correct backoff timer logic ([1b41ef5](https://github.com/Agoric/agoric-sdk/commit/1b41ef56bec54f89296376a0677c421f66baabba))
|
|
120
|
-
* **casting:** implement getReverseIterable ([7f5a791](https://github.com/Agoric/agoric-sdk/commit/7f5a79170a11560567406ebb02234dbef20ca07a))
|
|
121
|
-
* **casting:** iterateLatest erroneously adapted getEachIterable ([b1937cf](https://github.com/Agoric/agoric-sdk/commit/b1937cf8fbd8685b5078ad5d312b4aa1b173a9ae))
|
|
122
|
-
* **casting:** Update each and latest iterators for stream cells. ([231d37c](https://github.com/Agoric/agoric-sdk/commit/231d37c4cd87785c20b70eb270384a50e010b3b7))
|
|
123
|
-
* avoid relying on bound `E` proxy methods ([#5998](https://github.com/Agoric/agoric-sdk/issues/5998)) ([497d157](https://github.com/Agoric/agoric-sdk/commit/497d157d29cc8dda58eca9e07c24b57731647074))
|
|
124
|
-
* makePublishKit ([#5435](https://github.com/Agoric/agoric-sdk/issues/5435)) ([d8228d2](https://github.com/Agoric/agoric-sdk/commit/d8228d272cfe18aa2fba713fb5acc4e84eaa1e39))
|
package/test/deploy.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { E } from '@endo/far';
|
|
2
|
-
import { iterateLatest, makeFollower } from '../src/main.js';
|
|
3
|
-
|
|
4
|
-
const COLLATERAL = 'ATOM';
|
|
5
|
-
const getVaultManagerMetrics = async (homeP, { cache, lookup }) => {
|
|
6
|
-
const zoe = E.get(homeP).zoe;
|
|
7
|
-
const publicFacet = cache(`publicFacet.vault`, () =>
|
|
8
|
-
E(zoe).getPublicFacet(lookup('agoricNames', 'instance', 'VaultFactory')),
|
|
9
|
-
);
|
|
10
|
-
const brand = await cache(`brand.${COLLATERAL}`, () =>
|
|
11
|
-
lookup('agoricNames', 'brand', COLLATERAL),
|
|
12
|
-
);
|
|
13
|
-
const manager = cache([`vault.manager`, brand], () =>
|
|
14
|
-
E(publicFacet).getCollateralManager(brand),
|
|
15
|
-
);
|
|
16
|
-
const subscription = cache([`subscription`, brand], () =>
|
|
17
|
-
E(manager).getMetrics(),
|
|
18
|
-
);
|
|
19
|
-
return cache([`subscription.key2`, brand], () =>
|
|
20
|
-
E(subscription).getStoreKey(),
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default async (homeP, { cache, lookup, makeDefaultLeader }) => {
|
|
25
|
-
// const storeKey = getStoreKeyFromCache(homeP, { cache, lookup });
|
|
26
|
-
const storeKey = getVaultManagerMetrics(homeP, { cache, lookup });
|
|
27
|
-
|
|
28
|
-
console.log('storeKey', await storeKey);
|
|
29
|
-
|
|
30
|
-
const leader = makeDefaultLeader();
|
|
31
|
-
const follower = makeFollower(storeKey, leader);
|
|
32
|
-
for await (const { value } of iterateLatest(follower)) {
|
|
33
|
-
console.log(`here's a value`, value);
|
|
34
|
-
}
|
|
35
|
-
};
|
package/test/fake-rpc-server.js
DELETED
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
import { Buffer } from 'buffer';
|
|
2
|
-
import './lockdown.js';
|
|
3
|
-
|
|
4
|
-
import { makeMarshal } from '@endo/marshal';
|
|
5
|
-
|
|
6
|
-
import express from 'express';
|
|
7
|
-
// import morgan from 'morgan';
|
|
8
|
-
|
|
9
|
-
import { toAscii, toBase64 } from '@cosmjs/encoding';
|
|
10
|
-
|
|
11
|
-
const chainName = 'fakeChain';
|
|
12
|
-
|
|
13
|
-
let lastPort = 8989;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @param {number} min
|
|
17
|
-
* @param {number} max
|
|
18
|
-
* @param {number} n
|
|
19
|
-
*/
|
|
20
|
-
const clamp = (min, max, n) => Math.max(min, Math.min(max, n));
|
|
21
|
-
|
|
22
|
-
const fakeStatusResult = {
|
|
23
|
-
node_info: {
|
|
24
|
-
protocol_version: {
|
|
25
|
-
p2p: '7',
|
|
26
|
-
block: '10',
|
|
27
|
-
app: '0',
|
|
28
|
-
},
|
|
29
|
-
id: '5576458aef205977e18fd50b274e9b5d9014525a',
|
|
30
|
-
listen_addr: 'tcp://0.0.0.0:26656',
|
|
31
|
-
network: 'cosmoshub-2',
|
|
32
|
-
version: '0.32.1',
|
|
33
|
-
channels: '4020212223303800',
|
|
34
|
-
moniker: 'moniker-node',
|
|
35
|
-
other: {
|
|
36
|
-
tx_index: 'on',
|
|
37
|
-
rpc_address: 'tcp://0.0.0.0:26657',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
sync_info: {
|
|
41
|
-
latest_block_hash:
|
|
42
|
-
'790BA84C3545FCCC49A5C629CEE6EA58A6E875C3862175BDC11EE7AF54703501',
|
|
43
|
-
latest_app_hash:
|
|
44
|
-
'C9AEBB441B787D9F1D846DE51F3826F4FD386108B59B08239653ABF59455C3F8',
|
|
45
|
-
latest_block_height: '1262196',
|
|
46
|
-
latest_block_time: '2019-08-01T11:52:22.818762194Z',
|
|
47
|
-
earliest_block_hash:
|
|
48
|
-
'790BA84C3545FCCC49A5C629CEE6EA58A6E875C3862175BDC11EE7AF54703501',
|
|
49
|
-
earliest_app_hash:
|
|
50
|
-
'C9AEBB441B787D9F1D846DE51F3826F4FD386108B59B08239653ABF59455C3F8',
|
|
51
|
-
earliest_block_height: '1262196',
|
|
52
|
-
earliest_block_time: '2019-08-01T11:52:22.818762194Z',
|
|
53
|
-
max_leader_block_height: '1262196',
|
|
54
|
-
catching_up: false,
|
|
55
|
-
total_synced_time: '1000000000',
|
|
56
|
-
remaining_time: '0',
|
|
57
|
-
total_snapshots: '10',
|
|
58
|
-
chunk_process_avg_time: '1000000000',
|
|
59
|
-
snapshot_height: '1262196',
|
|
60
|
-
snapshot_chunks_count: '10',
|
|
61
|
-
snapshot_chunks_total: '100',
|
|
62
|
-
backfilled_blocks: '10',
|
|
63
|
-
backfill_blocks_total: '100',
|
|
64
|
-
},
|
|
65
|
-
validator_info: {
|
|
66
|
-
address: '5D6A51A8E9899C44079C6AF90618BA0369070E6E',
|
|
67
|
-
pub_key: {
|
|
68
|
-
type: 'tendermint/PubKeyEd25519',
|
|
69
|
-
value: 'A6DoBUypNtUAyEHWtQ9bFjfNg8Bo9CrnkUGl6k6OHN4=',
|
|
70
|
-
},
|
|
71
|
-
voting_power: '0',
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
/** @typedef {Partial<import('ava').ExecutionContext<{cleanups: Array<() => void>}>> & {context}} FakeServerTestContext */
|
|
76
|
-
/**
|
|
77
|
-
* @param {FakeServerTestContext} t
|
|
78
|
-
* @param {Array<{any}>} fakeValues
|
|
79
|
-
* @param {object} [options]
|
|
80
|
-
* @param {Marshaller} [options.marshaller]
|
|
81
|
-
* @param {number} [options.batchSize] count of stream-cell results per response, or 0/absent to return lone naked values
|
|
82
|
-
*/
|
|
83
|
-
export const startFakeServer = (t, fakeValues, options = {}) => {
|
|
84
|
-
const { log = console.log } = t;
|
|
85
|
-
lastPort += 1;
|
|
86
|
-
const PORT = lastPort;
|
|
87
|
-
const { marshaller = makeMarshal(), batchSize = 0 } = options;
|
|
88
|
-
return new Promise(resolve => {
|
|
89
|
-
log('starting http server on port', PORT);
|
|
90
|
-
const app = express();
|
|
91
|
-
// app.use(morgan());
|
|
92
|
-
app.use((req, _res, next) => {
|
|
93
|
-
log('request', req.method, req.url);
|
|
94
|
-
next();
|
|
95
|
-
});
|
|
96
|
-
app.use(express.json());
|
|
97
|
-
app.get('/bad-network-config', (req, res) => {
|
|
98
|
-
res.json({
|
|
99
|
-
chainName,
|
|
100
|
-
rpcAddrs: 'not an array',
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
app.get('/network-config', (req, res) => {
|
|
104
|
-
res.json({
|
|
105
|
-
chainName,
|
|
106
|
-
rpcAddrs: [`http://localhost:${PORT}/tendermint-rpc`],
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
const dataPrefix = new Uint8Array([0]);
|
|
111
|
-
const encode = obj => {
|
|
112
|
-
const str = JSON.stringify(obj);
|
|
113
|
-
const ascii = toAscii(str);
|
|
114
|
-
const buf = new Uint8Array(dataPrefix.length + ascii.length);
|
|
115
|
-
buf.set(dataPrefix);
|
|
116
|
-
buf.set(ascii, dataPrefix.length);
|
|
117
|
-
return toBase64(buf);
|
|
118
|
-
};
|
|
119
|
-
const fakeBlocksStartHeight = 74863;
|
|
120
|
-
let blockHeight = fakeBlocksStartHeight;
|
|
121
|
-
app.post('/tendermint-rpc', (req, res) => {
|
|
122
|
-
log('received', req.path, req.body, req.params);
|
|
123
|
-
const reply = result => {
|
|
124
|
-
log('response', result);
|
|
125
|
-
res.json({
|
|
126
|
-
jsonrpc: '2.0',
|
|
127
|
-
id: req.body.id,
|
|
128
|
-
result,
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
log('req.body', req.body);
|
|
132
|
-
switch (req.body.method) {
|
|
133
|
-
case 'status': {
|
|
134
|
-
reply(fakeStatusResult);
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
case 'abci_info': {
|
|
138
|
-
const result = {
|
|
139
|
-
response: {
|
|
140
|
-
data: 'agoric',
|
|
141
|
-
version: '0.32.1',
|
|
142
|
-
last_block_height: blockHeight,
|
|
143
|
-
last_block_app_hash: '',
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
reply(result);
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
case 'abci_query': {
|
|
150
|
-
const desiredHeight = req.body.height ?? blockHeight;
|
|
151
|
-
const values = [];
|
|
152
|
-
for (
|
|
153
|
-
let batchIndex = 0;
|
|
154
|
-
batchIndex < Math.max(1, batchSize);
|
|
155
|
-
batchIndex += 1
|
|
156
|
-
) {
|
|
157
|
-
const fakeIndex = clamp(
|
|
158
|
-
0,
|
|
159
|
-
fakeValues.length - 1,
|
|
160
|
-
desiredHeight - fakeBlocksStartHeight + batchIndex,
|
|
161
|
-
);
|
|
162
|
-
values.push(fakeValues[fakeIndex]);
|
|
163
|
-
}
|
|
164
|
-
let responseValue;
|
|
165
|
-
if (batchSize > 0) {
|
|
166
|
-
// Return a JSON stream cell.
|
|
167
|
-
const serializedValues = values.map(val =>
|
|
168
|
-
JSON.stringify(marshaller.toCapData(val)),
|
|
169
|
-
);
|
|
170
|
-
responseValue = {
|
|
171
|
-
blockHeight: String(desiredHeight - 1),
|
|
172
|
-
values: serializedValues,
|
|
173
|
-
};
|
|
174
|
-
} else {
|
|
175
|
-
// Return a single naked value.
|
|
176
|
-
responseValue = marshaller.toCapData(values[0]);
|
|
177
|
-
}
|
|
178
|
-
const responseValueBase64 = encode(responseValue);
|
|
179
|
-
const result = {
|
|
180
|
-
response: {
|
|
181
|
-
code: 0,
|
|
182
|
-
log: '',
|
|
183
|
-
info: '',
|
|
184
|
-
index: '0',
|
|
185
|
-
key: Buffer.from(
|
|
186
|
-
'swingset/data:mailbox.agoric1foobarbaz',
|
|
187
|
-
).toString('base64'),
|
|
188
|
-
value: responseValueBase64,
|
|
189
|
-
proofOps: null,
|
|
190
|
-
height: String(blockHeight),
|
|
191
|
-
codespace: '',
|
|
192
|
-
},
|
|
193
|
-
};
|
|
194
|
-
reply(result);
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
default: {
|
|
198
|
-
res.sendStatus(400);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
const controller = {
|
|
203
|
-
advance(offset) {
|
|
204
|
-
blockHeight += offset;
|
|
205
|
-
},
|
|
206
|
-
};
|
|
207
|
-
const listener = app.listen(PORT, () => {
|
|
208
|
-
log('started http server on', PORT);
|
|
209
|
-
const cleanup = () => {
|
|
210
|
-
log('shutting down http server on', PORT);
|
|
211
|
-
listener.close();
|
|
212
|
-
};
|
|
213
|
-
t.context.cleanups.push(cleanup);
|
|
214
|
-
resolve({ controller, PORT });
|
|
215
|
-
});
|
|
216
|
-
});
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
export const jsonPairs = harden([
|
|
220
|
-
// Justin is the same as the JSON encoding but without unnecessary quoting
|
|
221
|
-
['[1,2]', '[1,2]'],
|
|
222
|
-
['{"foo":1}', '{foo:1}'],
|
|
223
|
-
['{"a":1,"b":2}', '{a:1,b:2}'],
|
|
224
|
-
['{"a":1,"b":{"c":3}}', '{a:1,b:{c:3}}'],
|
|
225
|
-
['true', 'true'],
|
|
226
|
-
['1', '1'],
|
|
227
|
-
['"abc"', '"abc"'],
|
|
228
|
-
['null', 'null'],
|
|
229
|
-
|
|
230
|
-
// Primitives not representable in JSON
|
|
231
|
-
['{"@qclass":"undefined"}', 'undefined'],
|
|
232
|
-
['{"@qclass":"NaN"}', 'NaN'],
|
|
233
|
-
['{"@qclass":"Infinity"}', 'Infinity'],
|
|
234
|
-
['{"@qclass":"-Infinity"}', '-Infinity'],
|
|
235
|
-
['{"@qclass":"bigint","digits":"4"}', '4n'],
|
|
236
|
-
['{"@qclass":"bigint","digits":"9007199254740993"}', '9007199254740993n'],
|
|
237
|
-
['{"@qclass":"symbol","name":"@@asyncIterator"}', 'Symbol.asyncIterator'],
|
|
238
|
-
['{"@qclass":"symbol","name":"@@match"}', 'Symbol.match'],
|
|
239
|
-
['{"@qclass":"symbol","name":"foo"}', 'Symbol.for("foo")'],
|
|
240
|
-
['{"@qclass":"symbol","name":"@@@@foo"}', 'Symbol.for("@@foo")'],
|
|
241
|
-
|
|
242
|
-
// Arrays and objects
|
|
243
|
-
['[{"@qclass":"undefined"}]', '[undefined]'],
|
|
244
|
-
['{"foo":{"@qclass":"undefined"}}', '{foo:undefined}'],
|
|
245
|
-
['{"@qclass":"error","message":"","name":"Error"}', 'Error("")'],
|
|
246
|
-
[
|
|
247
|
-
'{"@qclass":"error","message":"msg","name":"ReferenceError"}',
|
|
248
|
-
'ReferenceError("msg")',
|
|
249
|
-
],
|
|
250
|
-
|
|
251
|
-
// The one case where JSON is not a semantic subset of JS
|
|
252
|
-
['{"__proto__":8}', '{["__proto__"]:8}'],
|
|
253
|
-
|
|
254
|
-
// The Hilbert Hotel is always tricky
|
|
255
|
-
['{"@qclass":"hilbert","original":8}', '{"@qclass":8}'],
|
|
256
|
-
['{"@qclass":"hilbert","original":"@qclass"}', '{"@qclass":"@qclass"}'],
|
|
257
|
-
[
|
|
258
|
-
'{"@qclass":"hilbert","original":{"@qclass":"hilbert","original":8}}',
|
|
259
|
-
'{"@qclass":{"@qclass":8}}',
|
|
260
|
-
],
|
|
261
|
-
[
|
|
262
|
-
'{"@qclass":"hilbert","original":{"@qclass":"hilbert","original":8,"rest":{"foo":"foo1"}},"rest":{"bar":{"@qclass":"hilbert","original":{"@qclass":"undefined"}}}}',
|
|
263
|
-
'{"@qclass":{"@qclass":8,foo:"foo1"},bar:{"@qclass":undefined}}',
|
|
264
|
-
],
|
|
265
|
-
|
|
266
|
-
// tagged
|
|
267
|
-
['{"@qclass":"tagged","tag":"x","payload":8}', 'makeTagged("x",8)'],
|
|
268
|
-
[
|
|
269
|
-
'{"@qclass":"tagged","tag":"x","payload":{"@qclass":"undefined"}}',
|
|
270
|
-
'makeTagged("x",undefined)',
|
|
271
|
-
],
|
|
272
|
-
|
|
273
|
-
// Slots
|
|
274
|
-
[
|
|
275
|
-
'[{"@qclass":"slot","iface":"Alleged: for testing Justin","index":0}]',
|
|
276
|
-
'[slot(0,"Alleged: for testing Justin")]',
|
|
277
|
-
],
|
|
278
|
-
// Tests https://github.com/endojs/endo/issues/1185 fix
|
|
279
|
-
[
|
|
280
|
-
'[{"@qclass":"slot","iface":"Alleged: for testing Justin","index":0},{"@qclass":"slot","index":0}]',
|
|
281
|
-
'[slot(0,"Alleged: for testing Justin"),slot(0)]',
|
|
282
|
-
],
|
|
283
|
-
]);
|
|
284
|
-
|
|
285
|
-
export const develop = async () => {
|
|
286
|
-
const { unserialize } = makeMarshal();
|
|
287
|
-
const fakeValues = harden(
|
|
288
|
-
jsonPairs.map(([jsonMarshalled]) =>
|
|
289
|
-
unserialize({ body: jsonMarshalled, slots: [] }),
|
|
290
|
-
),
|
|
291
|
-
);
|
|
292
|
-
const mockT = /** @type {FakeServerTestContext} */ (
|
|
293
|
-
/** @type {unknown} */ ({
|
|
294
|
-
log: console.log,
|
|
295
|
-
context: { cleanups: [] },
|
|
296
|
-
})
|
|
297
|
-
);
|
|
298
|
-
const { PORT } = await startFakeServer(mockT, [...fakeValues]);
|
|
299
|
-
console.log(
|
|
300
|
-
`Try this in another terminal:
|
|
301
|
-
agoric follow :fake.path --bootstrap=http://localhost:${PORT}/network-config --sleep=0.5 --proof=none`,
|
|
302
|
-
);
|
|
303
|
-
console.warn(`Control-C to interrupt...`);
|
|
304
|
-
// Wait forever.
|
|
305
|
-
await new Promise(() => {});
|
|
306
|
-
};
|