@agoric/casting 0.4.3-other-dev-fbe72e7.0.fbe72e7 → 0.4.3-other-dev-d15096d.0.d15096d
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 +6 -6
- package/src/casting-spec.d.ts +9 -8
- package/src/casting-spec.d.ts.map +1 -1
- package/src/casting-spec.js +11 -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 +5 -1
- package/src/follower.d.ts.map +1 -1
- package/src/follower.js +15 -6
- package/src/iterable.d.ts +5 -3
- package/src/iterable.d.ts.map +1 -1
- package/src/iterable.js +10 -5
- package/src/leader-netconfig.d.ts +5 -3
- package/src/leader-netconfig.d.ts.map +1 -1
- package/src/leader-netconfig.js +11 -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 +1 -1
- package/src/makeHttpClient.d.ts +3 -2
- package/src/makeHttpClient.d.ts.map +1 -1
- package/src/makeHttpClient.js +7 -2
- package/src/types.d.ts +5 -3
- package/src/types.d.ts.map +1 -1
- package/src/types.js +5 -3
- package/test/fake-rpc-server.js +5 -1
- package/test/interpose-net-access.test.js +2 -1
- package/test/mvp.test.js +9 -4
- package/test/netconfig.test.js +6 -2
- package/tsconfig.build.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/casting",
|
|
3
|
-
"version": "0.4.3-other-dev-
|
|
3
|
+
"version": "0.4.3-other-dev-d15096d.0.d15096d",
|
|
4
4
|
"description": "Agoric's OCap broadcasting system",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/main.js",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"author": "Agoric",
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agoric/internal": "0.3.3-other-dev-
|
|
26
|
-
"@agoric/notifier": "0.6.3-other-dev-
|
|
27
|
-
"@agoric/store": "0.9.3-other-dev-
|
|
25
|
+
"@agoric/internal": "0.3.3-other-dev-d15096d.0.d15096d",
|
|
26
|
+
"@agoric/notifier": "0.6.3-other-dev-d15096d.0.d15096d",
|
|
27
|
+
"@agoric/store": "0.9.3-other-dev-d15096d.0.d15096d",
|
|
28
28
|
"@cosmjs/encoding": "^0.36.0",
|
|
29
29
|
"@cosmjs/proto-signing": "^0.36.0",
|
|
30
30
|
"@cosmjs/stargate": "^0.36.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@endo/promise-kit": "^1.1.13"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@agoric/cosmic-proto": "0.4.1-other-dev-
|
|
40
|
+
"@agoric/cosmic-proto": "0.4.1-other-dev-d15096d.0.d15096d",
|
|
41
41
|
"@endo/ses-ava": "^1.3.2",
|
|
42
42
|
"ava": "^5.3.0",
|
|
43
43
|
"c8": "^10.1.3",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"typeCoverage": {
|
|
62
62
|
"atLeast": 89.19
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "d15096dc4ff8b96e9b6cd11954c20d3a9efbb393"
|
|
65
65
|
}
|
package/src/casting-spec.d.ts
CHANGED
|
@@ -2,15 +2,16 @@ export function vstorageKeySpecToPath({ storeName, storeSubkey }: VStorageKey):
|
|
|
2
2
|
/**
|
|
3
3
|
* @param {string} storagePath
|
|
4
4
|
* @param {string} [storeName]
|
|
5
|
-
* @returns {
|
|
5
|
+
* @returns {CastingSpec}
|
|
6
6
|
*/
|
|
7
|
-
export function DEFAULT_PATH_CONVERTER(storagePath: string, storeName?: string):
|
|
7
|
+
export function DEFAULT_PATH_CONVERTER(storagePath: string, storeName?: string): CastingSpec;
|
|
8
8
|
/**
|
|
9
|
-
* @type {Record<string, (path: string) =>
|
|
9
|
+
* @type {Record<string, (path: string) => CastingSpec>}
|
|
10
10
|
*/
|
|
11
|
-
export const pathPrefixToConverters: Record<string, (path: string) =>
|
|
12
|
-
export function makeCastingSpecFromString(specString: string):
|
|
13
|
-
export function makeCastingSpecFromObject(specObj: any):
|
|
14
|
-
export function makeCastingSpecFromRef(specCap: ERef<any>): Promise<
|
|
15
|
-
export function makeCastingSpec(sourceP: ERef<unknown>): Promise<
|
|
11
|
+
export const pathPrefixToConverters: Record<string, (path: string) => CastingSpec>;
|
|
12
|
+
export function makeCastingSpecFromString(specString: string): CastingSpec;
|
|
13
|
+
export function makeCastingSpecFromObject(specObj: any): CastingSpec;
|
|
14
|
+
export function makeCastingSpecFromRef(specCap: ERef<any>): Promise<CastingSpec>;
|
|
15
|
+
export function makeCastingSpec(sourceP: ERef<unknown>): Promise<CastingSpec>;
|
|
16
|
+
import type { CastingSpec } from './types.js';
|
|
16
17
|
//# sourceMappingURL=casting-spec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"casting-spec.d.ts","sourceRoot":"","sources":["casting-spec.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"casting-spec.d.ts","sourceRoot":"","sources":["casting-spec.js"],"names":[],"mappings":"AAiDO,kEAHI,WAAW,GACT,MAAM,CAYlB;AAlCD;;;;GAIG;AACH,oDAJW,MAAM,cACN,MAAM,GACJ,WAAW,CAavB;AAsBD;;GAEG;AACH,qCAFU,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,WAAW,CAAC,CAMpD;AAMI,sDAHI,MAAM,GACJ,WAAW,CAcvB;AAQM,mDAHI,GAAG,GACD,WAAW,CAmCvB;AAMM,gDAHI,IAAI,CAAC,GAAG,CAAC,GACP,OAAO,CAAC,WAAW,CAAC,CAKhC;AAQM,yCAHI,IAAI,CAAC,OAAO,CAAC,GACX,OAAO,CAAC,WAAW,CAAC,CAgBhC;iCA5J6B,YAAY"}
|
package/src/casting-spec.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import * as encodingStar from '@cosmjs/encoding';
|
|
2
2
|
import { E, getInterfaceOf } from '@endo/far';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @import {CastingSpec} from './types.js';
|
|
6
|
+
*/
|
|
7
|
+
|
|
4
8
|
const { toAscii } = encodingStar;
|
|
5
9
|
|
|
6
10
|
/**
|
|
7
11
|
* @param {string} storagePath
|
|
8
|
-
* @returns {
|
|
12
|
+
* @returns {CastingSpec}
|
|
9
13
|
*/
|
|
10
14
|
const swingsetPathToCastingSpec = storagePath =>
|
|
11
15
|
harden({
|
|
@@ -22,7 +26,7 @@ const NO_DATA_VALUE = new Uint8Array([255]);
|
|
|
22
26
|
/**
|
|
23
27
|
* @param {string} storagePath
|
|
24
28
|
* @param {string} [storeName]
|
|
25
|
-
* @returns {
|
|
29
|
+
* @returns {CastingSpec}
|
|
26
30
|
*/
|
|
27
31
|
const vstoragePathToCastingSpec = (storagePath, storeName = 'vstorage') => {
|
|
28
32
|
const elems = storagePath ? storagePath.split('.') : [];
|
|
@@ -58,7 +62,7 @@ export const vstorageKeySpecToPath = ({ storeName, storeSubkey }) => {
|
|
|
58
62
|
export const DEFAULT_PATH_CONVERTER = vstoragePathToCastingSpec;
|
|
59
63
|
|
|
60
64
|
/**
|
|
61
|
-
* @type {Record<string, (path: string) =>
|
|
65
|
+
* @type {Record<string, (path: string) => CastingSpec>}
|
|
62
66
|
*/
|
|
63
67
|
export const pathPrefixToConverters = harden({
|
|
64
68
|
'swingset:': swingsetPathToCastingSpec,
|
|
@@ -68,7 +72,7 @@ export const pathPrefixToConverters = harden({
|
|
|
68
72
|
|
|
69
73
|
/**
|
|
70
74
|
* @param {string} specString
|
|
71
|
-
* @returns {
|
|
75
|
+
* @returns {CastingSpec}
|
|
72
76
|
*/
|
|
73
77
|
export const makeCastingSpecFromString = specString => {
|
|
74
78
|
assert.typeof(specString, 'string');
|
|
@@ -88,7 +92,7 @@ const te = new TextEncoder();
|
|
|
88
92
|
|
|
89
93
|
/**
|
|
90
94
|
* @param {any} specObj
|
|
91
|
-
* @returns {
|
|
95
|
+
* @returns {CastingSpec}
|
|
92
96
|
*/
|
|
93
97
|
export const makeCastingSpecFromObject = specObj => {
|
|
94
98
|
const {
|
|
@@ -127,7 +131,7 @@ export const makeCastingSpecFromObject = specObj => {
|
|
|
127
131
|
|
|
128
132
|
/**
|
|
129
133
|
* @param {ERef<any>} specCap
|
|
130
|
-
* @returns {Promise<
|
|
134
|
+
* @returns {Promise<CastingSpec>}
|
|
131
135
|
*/
|
|
132
136
|
export const makeCastingSpecFromRef = async specCap => {
|
|
133
137
|
const specObj = await E(specCap).getStoreKey();
|
|
@@ -138,7 +142,7 @@ export const makeCastingSpecFromRef = async specCap => {
|
|
|
138
142
|
* Create an abstract type from a given source representation
|
|
139
143
|
*
|
|
140
144
|
* @param {ERef<unknown>} sourceP
|
|
141
|
-
* @returns {Promise<
|
|
145
|
+
* @returns {Promise<CastingSpec>}
|
|
142
146
|
*/
|
|
143
147
|
export const makeCastingSpec = async sourceP => {
|
|
144
148
|
const spec = await sourceP;
|
package/src/change-follower.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export function makePollingChangeFollower(leader:
|
|
1
|
+
export function makePollingChangeFollower(leader: Leader): Promise<Follower<CastingChange>>;
|
|
2
|
+
import type { Leader } from './types.js';
|
|
3
|
+
import type { CastingChange } from './types.js';
|
|
4
|
+
import type { Follower } from './types.js';
|
|
2
5
|
//# sourceMappingURL=change-follower.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-follower.d.ts","sourceRoot":"","sources":["change-follower.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"change-follower.d.ts","sourceRoot":"","sources":["change-follower.js"],"names":[],"mappings":"AAeO,kDAHI,MAAM,GACJ,OAAO,CAAC,SAAS,aAAa,CAAC,CAAC,CA6C5C;4BAtDwB,YAAY;mCAEL,YAAY;8BADjB,YAAY"}
|
package/src/change-follower.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { E, Far } from '@endo/far';
|
|
2
2
|
import { DEFAULT_KEEP_POLLING } from './defaults.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @import {Leader} from './types.js';
|
|
6
|
+
* @import {Follower} from './types.js';
|
|
7
|
+
* @import {CastingChange} from './types.js';
|
|
8
|
+
*/
|
|
9
|
+
|
|
4
10
|
/**
|
|
5
11
|
* Just return an unspecified allegedValue every poll period.
|
|
6
12
|
*
|
|
7
|
-
* @param {
|
|
8
|
-
* @returns {Promise<
|
|
13
|
+
* @param {Leader} leader
|
|
14
|
+
* @returns {Promise<Follower<CastingChange>>}
|
|
9
15
|
*/
|
|
10
16
|
export const makePollingChangeFollower = async leader => {
|
|
11
17
|
const { keepPolling = DEFAULT_KEEP_POLLING } = await E(leader).getOptions();
|
package/src/defaults.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {Unserializer} from './types.js';
|
|
3
|
+
*/
|
|
1
4
|
/**
|
|
2
5
|
* Default to the local chain.
|
|
3
6
|
*/
|
|
@@ -19,7 +22,8 @@ export function MAKE_DEFAULT_DECODER(): (str: any) => any;
|
|
|
19
22
|
/**
|
|
20
23
|
* Unserialize the JSONable data.
|
|
21
24
|
*
|
|
22
|
-
* @type {() =>
|
|
25
|
+
* @type {() => Unserializer}
|
|
23
26
|
*/
|
|
24
|
-
export const MAKE_DEFAULT_UNSERIALIZER: () =>
|
|
27
|
+
export const MAKE_DEFAULT_UNSERIALIZER: () => Unserializer;
|
|
28
|
+
import type { Unserializer } from './types.js';
|
|
25
29
|
//# sourceMappingURL=defaults.d.ts.map
|
package/src/defaults.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["defaults.js"],"names":[],"mappings":"AAIA;;GAEG;AACH,gCAAiC,wBAAwB,CAAC;AAE1D,qCAAsC,CAAC,CAAC;AAExC,+CAAgD,GAAG,CAAC;AAEpD,2CAA4C,CAAC,CAAC;AAE9C;;GAEG;AACH,kCAAmC,IAAK,CAAC;AAUlC,0BAHI,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAEgD;AAMnE,qCAHI,MAAM,QACN,MAAM,UAIhB;AAOM,6CAJI,MAAM,SACN,MAAM,QACN,MAAM,UAQhB;AAQM,sCAHI,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAMzB;AAUM,8CALI,MAAM,OACN,GAAG,YACH,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CASzB;AAOM,wCAFM,OAAO,CAAC,OAAO,CAAC,CAGgD;AAEtE,0DAaN;AAED;;;;GAIG;AACH,wCAFU,MAAM,
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["defaults.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,gCAAiC,wBAAwB,CAAC;AAE1D,qCAAsC,CAAC,CAAC;AAExC,+CAAgD,GAAG,CAAC;AAEpD,2CAA4C,CAAC,CAAC;AAE9C;;GAEG;AACH,kCAAmC,IAAK,CAAC;AAUlC,0BAHI,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAEgD;AAMnE,qCAHI,MAAM,QACN,MAAM,UAIhB;AAOM,6CAJI,MAAM,SACN,MAAM,QACN,MAAM,UAQhB;AAQM,sCAHI,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAMzB;AAUM,8CALI,MAAM,OACN,GAAG,YACH,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CASzB;AAOM,wCAFM,OAAO,CAAC,OAAO,CAAC,CAGgD;AAEtE,0DAaN;AAED;;;;GAIG;AACH,wCAFU,MAAM,YAAY,CA2B1B;kCApI6B,YAAY"}
|
package/src/defaults.js
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
import { Far } from '@endo/far';
|
|
3
3
|
import { makeMarshal } from '@endo/marshal';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @import {Unserializer} from './types.js';
|
|
7
|
+
*/
|
|
8
|
+
|
|
5
9
|
/**
|
|
6
10
|
* Default to the local chain.
|
|
7
11
|
*/
|
|
@@ -104,7 +108,7 @@ export const MAKE_DEFAULT_DECODER = () => {
|
|
|
104
108
|
/**
|
|
105
109
|
* Unserialize the JSONable data.
|
|
106
110
|
*
|
|
107
|
-
* @type {() =>
|
|
111
|
+
* @type {() => Unserializer}
|
|
108
112
|
*/
|
|
109
113
|
export const MAKE_DEFAULT_UNSERIALIZER = () => {
|
|
110
114
|
const ifaceAllegedPrefix = 'Alleged: ';
|
package/src/follower-cosmjs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export function makeCosmjsFollower<T>(sourceP: any, leaderOrMaker?:
|
|
2
|
-
export type ValueFollower<T> =
|
|
1
|
+
export function makeCosmjsFollower<T>(sourceP: any, leaderOrMaker?: LeaderOrMaker, options?: FollowerOptions): ValueFollower<T>;
|
|
2
|
+
export type ValueFollower<T> = Follower<ValueFollowerElement<T>>;
|
|
3
3
|
/**
|
|
4
4
|
* The response of an ABCI query to Tendermint.
|
|
5
5
|
* This is a subset of `tendermint34.AbciQueryResponse` in order
|
|
@@ -9,4 +9,8 @@ export type QueryStoreResponse = {
|
|
|
9
9
|
readonly value: Uint8Array;
|
|
10
10
|
readonly height: number;
|
|
11
11
|
};
|
|
12
|
+
import type { LeaderOrMaker } from './types.js';
|
|
13
|
+
import type { FollowerOptions } from './types.js';
|
|
14
|
+
import type { ValueFollowerElement } from './types.js';
|
|
15
|
+
import type { Follower } from './types.js';
|
|
12
16
|
//# sourceMappingURL=follower-cosmjs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"follower-cosmjs.d.ts","sourceRoot":"","sources":["follower-cosmjs.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"follower-cosmjs.d.ts","sourceRoot":"","sources":["follower-cosmjs.js"],"names":[],"mappings":"AAqHO,mCANM,CAAC,WACH,GAAG,kBACH,aAAa,YACb,eAAe,GACb,aAAa,CAAC,CAAC,CAAC,CA4f5B;0BA7kBa,CAAC,IAAW,SAAS,qBAAqB,CAAC,CAAC,CAAC;;;;;;iCAI9C;IACZ,QAAY,CAAC,KAAK,EAAE,UAAU,CAAC;IAC/B,QAAY,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;mCA1B4B,YAAY;qCACV,YAAY;0CAFP,YAAY;8BADxB,YAAY"}
|
package/src/follower-cosmjs.js
CHANGED
|
@@ -10,6 +10,15 @@ import { MAKE_DEFAULT_DECODER, MAKE_DEFAULT_UNSERIALIZER } from './defaults.js';
|
|
|
10
10
|
import { makeCastingSpec } from './casting-spec.js';
|
|
11
11
|
import { makeLeader as defaultMakeLeader } from './leader-netconfig.js';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @import {Follower} from './types.js';
|
|
15
|
+
* @import {ValueFollowerElement} from './types.js';
|
|
16
|
+
* @import {LeaderOrMaker} from './types.js';
|
|
17
|
+
* @import {FollowerOptions} from './types.js';
|
|
18
|
+
* @import {QueryClient} from '@cosmjs/stargate';
|
|
19
|
+
* @import {StreamCell} from './types.js';
|
|
20
|
+
*/
|
|
21
|
+
|
|
13
22
|
// A lot of cosmjs classes end up hardened through instances shared by this
|
|
14
23
|
// package so preemptively harden them all.
|
|
15
24
|
// However we cannot directly harden a module namespace object (exotic behavior
|
|
@@ -23,7 +32,7 @@ const { QueryClient } = stargateStar;
|
|
|
23
32
|
const { Tendermint34Client } = tendermint34;
|
|
24
33
|
const textDecoder = new TextDecoder();
|
|
25
34
|
|
|
26
|
-
/** @template T @typedef {
|
|
35
|
+
/** @template T @typedef {Follower<ValueFollowerElement<T>>} ValueFollower */
|
|
27
36
|
|
|
28
37
|
// Copied from https://github.com/cosmos/cosmjs/pull/1328/files until release
|
|
29
38
|
/**
|
|
@@ -102,8 +111,8 @@ const proofs = ['strict', 'none', 'optimistic'];
|
|
|
102
111
|
/**
|
|
103
112
|
* @template T
|
|
104
113
|
* @param {any} sourceP
|
|
105
|
-
* @param {
|
|
106
|
-
* @param {
|
|
114
|
+
* @param {LeaderOrMaker} [leaderOrMaker]
|
|
115
|
+
* @param {FollowerOptions} [options]
|
|
107
116
|
* @returns {ValueFollower<T>}
|
|
108
117
|
*/
|
|
109
118
|
export const makeCosmjsFollower = (
|
|
@@ -151,7 +160,7 @@ export const makeCosmjsFollower = (
|
|
|
151
160
|
return clientP;
|
|
152
161
|
};
|
|
153
162
|
|
|
154
|
-
/** @type {Map<string,
|
|
163
|
+
/** @type {Map<string, QueryClient>} */
|
|
155
164
|
const endpointToQueryClient = new Map();
|
|
156
165
|
|
|
157
166
|
/**
|
|
@@ -342,7 +351,7 @@ export const makeCosmjsFollower = (
|
|
|
342
351
|
* @param {any} data
|
|
343
352
|
* @param {number} blockHeight
|
|
344
353
|
* @param {number} currentBlockHeight
|
|
345
|
-
* @returns {Promise<
|
|
354
|
+
* @returns {Promise<ValueFollowerElement<T>>}
|
|
346
355
|
*/
|
|
347
356
|
const followerElementFromStreamCellValue = async (
|
|
348
357
|
data,
|
|
@@ -362,7 +371,7 @@ export const makeCosmjsFollower = (
|
|
|
362
371
|
};
|
|
363
372
|
|
|
364
373
|
/**
|
|
365
|
-
* @param {
|
|
374
|
+
* @param {StreamCell<T>} streamCell
|
|
366
375
|
* @param {number} currentBlockHeight
|
|
367
376
|
* @yields {ValueFollowerElement<T>}
|
|
368
377
|
*/
|
|
@@ -378,7 +387,7 @@ export const makeCosmjsFollower = (
|
|
|
378
387
|
harden(allValuesFromCell);
|
|
379
388
|
|
|
380
389
|
/**
|
|
381
|
-
* @param {
|
|
390
|
+
* @param {StreamCell<T>} streamCell
|
|
382
391
|
* @param {number} currentBlockHeight
|
|
383
392
|
* @yields {ValueFollowerElement<T>}
|
|
384
393
|
*/
|
|
@@ -394,7 +403,7 @@ export const makeCosmjsFollower = (
|
|
|
394
403
|
harden(reverseValuesFromCell);
|
|
395
404
|
|
|
396
405
|
/**
|
|
397
|
-
* @param {
|
|
406
|
+
* @param {StreamCell<T>} streamCell
|
|
398
407
|
* @param {number} currentBlockHeight
|
|
399
408
|
* @yields {ValueFollowerElement<T>}
|
|
400
409
|
*/
|
package/src/follower.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export function makeFollower<T>(specP: ERef<
|
|
1
|
+
export function makeFollower<T>(specP: ERef<CastingSpec> | string, leaderOrMaker?: LeaderOrMaker, options?: FollowerOptions): Promise<ValueFollower<T>>;
|
|
2
|
+
import type { CastingSpec } from './types.js';
|
|
3
|
+
import type { LeaderOrMaker } from './types.js';
|
|
4
|
+
import type { FollowerOptions } from './types.js';
|
|
5
|
+
import type { ValueFollower } from './follower-cosmjs.js';
|
|
2
6
|
//# sourceMappingURL=follower.d.ts.map
|
package/src/follower.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"follower.d.ts","sourceRoot":"","sources":["follower.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"follower.d.ts","sourceRoot":"","sources":["follower.js"],"names":[],"mappings":"AAqEO,6BANM,CAAC,SACH,IAAI,CAAC,WAAW,CAAC,GAAG,MAAM,kBAC1B,aAAa,YACb,eAAe,GACb,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CASrC;iCAhE6B,YAAY;mCAGV,YAAY;qCACV,YAAY;mCACd,sBAAsB"}
|
package/src/follower.js
CHANGED
|
@@ -9,14 +9,23 @@ import {
|
|
|
9
9
|
import { makeCosmjsFollower } from './follower-cosmjs.js';
|
|
10
10
|
import { makeCastingSpec } from './casting-spec.js';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @import {CastingSpec} from './types.js';
|
|
14
|
+
* @import {Follower} from './types.js';
|
|
15
|
+
* @import {ValueFollowerElement} from './types.js';
|
|
16
|
+
* @import {LeaderOrMaker} from './types.js';
|
|
17
|
+
* @import {FollowerOptions} from './types.js';
|
|
18
|
+
* @import {ValueFollower} from './follower-cosmjs.js';
|
|
19
|
+
*/
|
|
20
|
+
|
|
12
21
|
/**
|
|
13
22
|
* @template T
|
|
14
|
-
* @param {ERef<
|
|
23
|
+
* @param {ERef<CastingSpec>} spec
|
|
15
24
|
*/
|
|
16
25
|
const makeSubscriptionFollower = spec => {
|
|
17
26
|
const transform = value =>
|
|
18
27
|
harden({ value, blockHeight: NaN, currentBlockHeight: NaN });
|
|
19
|
-
/** @type {
|
|
28
|
+
/** @type {Follower<ValueFollowerElement<T>>} */
|
|
20
29
|
const follower = Far('subscription/notifier follower', {
|
|
21
30
|
getLatestIterable: async () => {
|
|
22
31
|
const { notifier, subscription } = await spec;
|
|
@@ -53,10 +62,10 @@ const makeSubscriptionFollower = spec => {
|
|
|
53
62
|
|
|
54
63
|
/**
|
|
55
64
|
* @template T
|
|
56
|
-
* @param {ERef<
|
|
57
|
-
* @param {
|
|
58
|
-
* @param {
|
|
59
|
-
* @returns {Promise<
|
|
65
|
+
* @param {ERef<CastingSpec> | string} specP
|
|
66
|
+
* @param {LeaderOrMaker} [leaderOrMaker]
|
|
67
|
+
* @param {FollowerOptions} [options]
|
|
68
|
+
* @returns {Promise<ValueFollower<T>>}
|
|
60
69
|
*/
|
|
61
70
|
export const makeFollower = async (specP, leaderOrMaker, options) => {
|
|
62
71
|
const spec = await makeCastingSpec(specP);
|
package/src/iterable.d.ts
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
export function mapAsyncIterable<TIn, TOut>(iterable: AsyncIterable<TIn>, transform: (value: TIn) => TOut): AsyncIterable<TOut>;
|
|
2
|
-
export function iterateLatest<T>(follower: ERef<
|
|
2
|
+
export function iterateLatest<T>(follower: ERef<Follower<T>>): {
|
|
3
3
|
/** @returns {AsyncIterator<T>} */
|
|
4
4
|
[Symbol.asyncIterator]: () => AsyncIterator<T>;
|
|
5
5
|
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
6
6
|
/** @returns {AsyncIterator<T>} */
|
|
7
7
|
[Symbol.asyncIterator]: () => AsyncIterator<T>;
|
|
8
8
|
}>;
|
|
9
|
-
export function iterateEach<T>(follower: ERef<
|
|
9
|
+
export function iterateEach<T>(follower: ERef<Follower<T>>, options?: IterateEachOptions): {
|
|
10
10
|
/** @returns {AsyncIterator<T>} */
|
|
11
11
|
[Symbol.asyncIterator]: () => AsyncIterator<T>;
|
|
12
12
|
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
13
13
|
/** @returns {AsyncIterator<T>} */
|
|
14
14
|
[Symbol.asyncIterator]: () => AsyncIterator<T>;
|
|
15
15
|
}>;
|
|
16
|
-
export function iterateReverse<T>(follower: ERef<
|
|
16
|
+
export function iterateReverse<T>(follower: ERef<Follower<T>>, options?: IterateEachOptions): {
|
|
17
17
|
/** @returns {AsyncIterator<T>} */
|
|
18
18
|
[Symbol.asyncIterator]: () => AsyncIterator<T>;
|
|
19
19
|
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
20
20
|
/** @returns {AsyncIterator<T>} */
|
|
21
21
|
[Symbol.asyncIterator]: () => AsyncIterator<T>;
|
|
22
22
|
}>;
|
|
23
|
+
import type { Follower } from './types.js';
|
|
24
|
+
import type { IterateEachOptions } from './types.js';
|
|
23
25
|
export { subscribeEach, subscribeLatest } from "@agoric/notifier/subscribe.js";
|
|
24
26
|
//# sourceMappingURL=iterable.d.ts.map
|
package/src/iterable.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iterable.d.ts","sourceRoot":"","sources":["iterable.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"iterable.d.ts","sourceRoot":"","sources":["iterable.js"],"names":[],"mappings":"AAgBO,iCANM,GAAG,EACH,IAAI,YACN,aAAa,CAAC,GAAG,CAAC,aAClB,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,GAClB,aAAa,CAAC,IAAI,CAAC,CAU/B;AAQM,8BAHM,CAAC,YACH,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAKxB,kCAAkC;kCAApB,aAAa,CAAC,CAAC,CAAC;;IAA9B,kCAAkC;kCAApB,aAAa,CAAC,CAAC,CAAC;GAQ9B;AASG,4BAJM,CAAC,YACH,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,YACjB,kBAAkB;IAKzB,kCAAkC;kCAApB,aAAa,CAAC,CAAC,CAAC;;IAA9B,kCAAkC;kCAApB,aAAa,CAAC,CAAC,CAAC;GAQ9B;AAOG,+BAJM,CAAC,YACH,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,YACjB,kBAAkB;IAKzB,kCAAkC;kCAApB,aAAa,CAAC,CAAC,CAAC;;IAA9B,kCAAkC;kCAApB,aAAa,CAAC,CAAC,CAAC;GAQ9B;8BA9EuB,YAAY;wCACF,YAAY"}
|
package/src/iterable.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { E, Far } from '@endo/far';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @import {Follower} from './types.js';
|
|
5
|
+
* @import {IterateEachOptions} from './types.js';
|
|
6
|
+
*/
|
|
7
|
+
|
|
3
8
|
export { subscribeEach, subscribeLatest } from '@agoric/notifier/subscribe.js';
|
|
4
9
|
|
|
5
10
|
/**
|
|
@@ -23,7 +28,7 @@ export const mapAsyncIterable = (iterable, transform) => {
|
|
|
23
28
|
* TODO: Remove this function when we have an @endo/publish-kit that suppports pull topics
|
|
24
29
|
*
|
|
25
30
|
* @template T
|
|
26
|
-
* @param {ERef<
|
|
31
|
+
* @param {ERef<Follower<T>>} follower
|
|
27
32
|
*/
|
|
28
33
|
export const iterateLatest = follower =>
|
|
29
34
|
// For now, just pass through the iterable.
|
|
@@ -42,8 +47,8 @@ export const iterateLatest = follower =>
|
|
|
42
47
|
* TODO: Remove this function when we have an @endo/publish-kit that suppports pull topics
|
|
43
48
|
*
|
|
44
49
|
* @template T
|
|
45
|
-
* @param {ERef<
|
|
46
|
-
* @param {
|
|
50
|
+
* @param {ERef<Follower<T>>} follower
|
|
51
|
+
* @param {IterateEachOptions} [options]
|
|
47
52
|
*/
|
|
48
53
|
export const iterateEach = (follower, options) =>
|
|
49
54
|
// For now, just pass through the iterable.
|
|
@@ -60,8 +65,8 @@ export const iterateEach = (follower, options) =>
|
|
|
60
65
|
|
|
61
66
|
/**
|
|
62
67
|
* @template T
|
|
63
|
-
* @param {ERef<
|
|
64
|
-
* @param {
|
|
68
|
+
* @param {ERef<Follower<T>>} follower
|
|
69
|
+
* @param {IterateEachOptions} [options]
|
|
65
70
|
*/
|
|
66
71
|
export const iterateReverse = (follower, options) =>
|
|
67
72
|
// For now, just pass through the iterable.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export function makeLeaderFromRpcAddresses(rpcAddrs: string[], leaderOptions?:
|
|
2
|
-
export function makeLeaderFromNetworkConfig(netconfigURL: string, options?:
|
|
3
|
-
export function makeLeader(bootstrap?: string, options?:
|
|
1
|
+
export function makeLeaderFromRpcAddresses(rpcAddrs: string[], leaderOptions?: LeaderOptions): Leader;
|
|
2
|
+
export function makeLeaderFromNetworkConfig(netconfigURL: string, options?: LeaderOptions): Promise<any>;
|
|
3
|
+
export function makeLeader(bootstrap?: string, options?: LeaderOptions): ERef<Leader>;
|
|
4
|
+
import type { LeaderOptions } from './types.js';
|
|
5
|
+
import type { Leader } from './types.js';
|
|
4
6
|
//# sourceMappingURL=leader-netconfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leader-netconfig.d.ts","sourceRoot":"","sources":["leader-netconfig.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"leader-netconfig.d.ts","sourceRoot":"","sources":["leader-netconfig.js"],"names":[],"mappings":"AAoBO,qDAJI,MAAM,EAAE,kBACR,aAAa,GACX,MAAM,CAelB;AAMM,0DAHI,MAAM,YACN,aAAa,gBAmCvB;AAOM,uCAJI,MAAM,YACN,aAAa,GACX,IAAI,CAAC,MAAM,CAAC,CAOxB;mCAzE+B,YAAY;4BACnB,YAAY"}
|
package/src/leader-netconfig.js
CHANGED
|
@@ -8,10 +8,15 @@ import {
|
|
|
8
8
|
} from './defaults.js';
|
|
9
9
|
import { assertNetworkConfig } from './netconfig.js';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @import {LeaderOptions} from './types.js';
|
|
13
|
+
* @import {Leader} from './types.js';
|
|
14
|
+
*/
|
|
15
|
+
|
|
11
16
|
/**
|
|
12
17
|
* @param {string[]} rpcAddrs
|
|
13
|
-
* @param {
|
|
14
|
-
* @returns {
|
|
18
|
+
* @param {LeaderOptions} [leaderOptions]
|
|
19
|
+
* @returns {Leader}
|
|
15
20
|
*/
|
|
16
21
|
export const makeLeaderFromRpcAddresses = (rpcAddrs, leaderOptions) => {
|
|
17
22
|
Array.isArray(rpcAddrs) || Fail`rpcAddrs ${rpcAddrs} must be an array`;
|
|
@@ -30,12 +35,12 @@ export const makeLeaderFromRpcAddresses = (rpcAddrs, leaderOptions) => {
|
|
|
30
35
|
|
|
31
36
|
/**
|
|
32
37
|
* @param {string} netconfigURL
|
|
33
|
-
* @param {
|
|
38
|
+
* @param {LeaderOptions} [options]
|
|
34
39
|
*/
|
|
35
40
|
export const makeLeaderFromNetworkConfig = (netconfigURL, options = {}) => {
|
|
36
41
|
const { retryCallback = DEFAULT_RETRY_CALLBACK, jitter = DEFAULT_JITTER } =
|
|
37
42
|
options;
|
|
38
|
-
/** @type {
|
|
43
|
+
/** @type {LeaderOptions['retryCallback']} */
|
|
39
44
|
const retry = async (where, err, attempt) => {
|
|
40
45
|
if (retryCallback) {
|
|
41
46
|
return retryCallback(where, err, attempt);
|
|
@@ -69,8 +74,8 @@ export const makeLeaderFromNetworkConfig = (netconfigURL, options = {}) => {
|
|
|
69
74
|
|
|
70
75
|
/**
|
|
71
76
|
* @param {string} [bootstrap]
|
|
72
|
-
* @param {
|
|
73
|
-
* @returns {ERef<
|
|
77
|
+
* @param {LeaderOptions} [options]
|
|
78
|
+
* @returns {ERef<Leader>}
|
|
74
79
|
*/
|
|
75
80
|
export const makeLeader = (bootstrap = DEFAULT_BOOTSTRAP, options) => {
|
|
76
81
|
if (bootstrap.includes('network-config')) {
|
package/src/leader.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export function makeRoundRobinLeader(endpoints: string[], leaderOptions?:
|
|
1
|
+
export function makeRoundRobinLeader(endpoints: string[], leaderOptions?: LeaderOptions): Leader;
|
|
2
|
+
import type { LeaderOptions } from './types.js';
|
|
3
|
+
import type { Leader } from './types.js';
|
|
2
4
|
//# sourceMappingURL=leader.d.ts.map
|
package/src/leader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leader.d.ts","sourceRoot":"","sources":["leader.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"leader.d.ts","sourceRoot":"","sources":["leader.js"],"names":[],"mappings":"AAgBO,gDAHI,MAAM,EAAE,kBACR,aAAa,UAuEvB;mCA/E+B,YAAY;4BACnB,YAAY"}
|
package/src/leader.js
CHANGED
|
@@ -3,11 +3,16 @@ import { DEFAULT_RETRY_CALLBACK, DEFAULT_JITTER } from './defaults.js';
|
|
|
3
3
|
import { shuffle } from './shuffle.js';
|
|
4
4
|
import { makePollingChangeFollower } from './change-follower.js';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @import {LeaderOptions} from './types.js';
|
|
8
|
+
* @import {Leader} from './types.js';
|
|
9
|
+
*/
|
|
10
|
+
|
|
6
11
|
/**
|
|
7
12
|
* Create a chain leader that rotates through a list of endpoints.
|
|
8
13
|
*
|
|
9
14
|
* @param {string[]} endpoints
|
|
10
|
-
* @param {
|
|
15
|
+
* @param {LeaderOptions} leaderOptions
|
|
11
16
|
*/
|
|
12
17
|
export const makeRoundRobinLeader = (endpoints, leaderOptions = {}) => {
|
|
13
18
|
const { retryCallback = DEFAULT_RETRY_CALLBACK, jitter = DEFAULT_JITTER } =
|
|
@@ -21,7 +26,7 @@ export const makeRoundRobinLeader = (endpoints, leaderOptions = {}) => {
|
|
|
21
26
|
let thisAttempt = 0;
|
|
22
27
|
let retrying;
|
|
23
28
|
|
|
24
|
-
/** @type {
|
|
29
|
+
/** @type {Leader} */
|
|
25
30
|
const leader = Far('round robin leader', {
|
|
26
31
|
getOptions: () => leaderOptions,
|
|
27
32
|
jitter: async where => jitter && jitter(where),
|
package/src/main.js
CHANGED
package/src/makeHttpClient.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export function makeTendermintRpcClient(url: string, fetch: typeof window.fetch):
|
|
2
|
-
export function makeHttpClient(url: string, fetch: typeof window.fetch):
|
|
1
|
+
export function makeTendermintRpcClient(url: string, fetch: typeof window.fetch): RpcClient;
|
|
2
|
+
export function makeHttpClient(url: string, fetch: typeof window.fetch): RpcClient;
|
|
3
|
+
import type { RpcClient } from '@cosmjs/tendermint-rpc';
|
|
3
4
|
//# sourceMappingURL=makeHttpClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeHttpClient.d.ts","sourceRoot":"","sources":["makeHttpClient.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"makeHttpClient.d.ts","sourceRoot":"","sources":["makeHttpClient.js"],"names":[],"mappings":"AAgCO,6CAJI,MAAM,SACN,OAAO,MAAM,CAAC,KAAK,GACjB,SAAS,CA8BrB;AA5BM,oCAJI,MAAM,SACN,OAAO,MAAM,CAAC,KAAK,GACjB,SAAS,CA8BrB;+BAzD2B,wBAAwB"}
|
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/types.d.ts
CHANGED
|
@@ -30,15 +30,15 @@ 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;
|
|
@@ -55,6 +55,8 @@ export type StreamCell<T> = {
|
|
|
55
55
|
blockHeight: number;
|
|
56
56
|
values: Array<T>;
|
|
57
57
|
};
|
|
58
|
+
import type { Marshal } from '@endo/marshal';
|
|
59
|
+
import type { FarRef } from '@endo/far';
|
|
58
60
|
import type { Subscription } from '@agoric/notifier';
|
|
59
61
|
import type { Notifier } from '@agoric/notifier';
|
|
60
62
|
//# 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":";6BAa8B,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,IAAI,CAAC,WAAW,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;;4BAG7D,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,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;;6BApFI,eAAe;4BAChB,WAAW;kCAFK,kBAAkB;8BAAlB,kBAAkB"}
|
package/src/types.js
CHANGED
|
@@ -5,6 +5,8 @@ export {};
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @import {Notifier, Subscription} from '@agoric/notifier';
|
|
8
|
+
* @import {Marshal} from '@endo/marshal';
|
|
9
|
+
* @import {FarRef} from '@endo/far';
|
|
8
10
|
*/
|
|
9
11
|
|
|
10
12
|
/**
|
|
@@ -52,7 +54,7 @@ export {};
|
|
|
52
54
|
*/
|
|
53
55
|
|
|
54
56
|
/**
|
|
55
|
-
* @typedef {Pick<
|
|
57
|
+
* @typedef {Pick<Marshal<unknown>, 'fromCapData' | 'unserialize'>} Unserializer
|
|
56
58
|
*/
|
|
57
59
|
|
|
58
60
|
/**
|
|
@@ -62,10 +64,10 @@ export {};
|
|
|
62
64
|
|
|
63
65
|
/**
|
|
64
66
|
* @typedef {object} FollowerOptions
|
|
65
|
-
* @property {null |
|
|
67
|
+
* @property {null | FarRef<Unserializer>} [unserializer]
|
|
66
68
|
* @property {(text: string) => any} [decode]
|
|
67
69
|
* @property {'strict'|'optimistic'|'none'} [proof]
|
|
68
|
-
* @property {
|
|
70
|
+
* @property {FarRef<Crasher>} [crasher]
|
|
69
71
|
*/
|
|
70
72
|
|
|
71
73
|
/**
|
package/test/fake-rpc-server.js
CHANGED
|
@@ -8,6 +8,10 @@ import express from 'express';
|
|
|
8
8
|
|
|
9
9
|
import { toAscii, toBase64 } from '@cosmjs/encoding';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @import {ExecutionContext} from 'ava';
|
|
13
|
+
*/
|
|
14
|
+
|
|
11
15
|
const chainName = 'fakeChain';
|
|
12
16
|
|
|
13
17
|
let lastPort = 8989;
|
|
@@ -72,7 +76,7 @@ const fakeStatusResult = {
|
|
|
72
76
|
},
|
|
73
77
|
};
|
|
74
78
|
|
|
75
|
-
/** @typedef {Partial<
|
|
79
|
+
/** @typedef {Partial<ExecutionContext<{cleanups: Array<() => void>}>> & {context}} FakeServerTestContext */
|
|
76
80
|
/**
|
|
77
81
|
* @param {FakeServerTestContext} t
|
|
78
82
|
* @param {Array<{any}>} fakeValues
|
|
@@ -17,9 +17,10 @@ import { captureIO, replayIO, web1, web2 } from './net-access-fixture.js';
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* @import {EReturn} from '@endo/far';
|
|
20
|
+
* @import {TestFn} from 'ava';
|
|
20
21
|
*/
|
|
21
22
|
|
|
22
|
-
/** @type {
|
|
23
|
+
/** @type {TestFn<EReturn<typeof makeTestContext>>} */
|
|
23
24
|
const test = /** @type {any} */ (anyTest);
|
|
24
25
|
|
|
25
26
|
const RECORDING = false;
|
package/test/mvp.test.js
CHANGED
|
@@ -16,6 +16,11 @@ import {
|
|
|
16
16
|
import { delay } from '../src/defaults.js';
|
|
17
17
|
import { startFakeServer } from './fake-rpc-server.js';
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @import {LeaderOptions} from '../src/types.js';
|
|
21
|
+
* @import {FollowerOptions} from '../src/types.js';
|
|
22
|
+
*/
|
|
23
|
+
|
|
19
24
|
// TODO: Replace with test.macro({title, exec}).
|
|
20
25
|
const testHappyPath = (label, ...input) => {
|
|
21
26
|
// eslint-disable-next-line no-shadow
|
|
@@ -31,13 +36,13 @@ const testHappyPath = (label, ...input) => {
|
|
|
31
36
|
options,
|
|
32
37
|
);
|
|
33
38
|
controller.advance(start);
|
|
34
|
-
/** @type {
|
|
39
|
+
/** @type {LeaderOptions} */
|
|
35
40
|
const lo = {
|
|
36
41
|
retryCallback: null, // fail fast, no retries
|
|
37
42
|
keepPolling: () => delay(1000).then(() => true), // poll really quickly
|
|
38
43
|
jitter: null, // no jitter
|
|
39
44
|
};
|
|
40
|
-
/** @type {
|
|
45
|
+
/** @type {FollowerOptions} */
|
|
41
46
|
const so = {
|
|
42
47
|
proof: 'none',
|
|
43
48
|
};
|
|
@@ -186,13 +191,13 @@ test('yields error on bad capdata without terminating', async t => {
|
|
|
186
191
|
options,
|
|
187
192
|
);
|
|
188
193
|
controller.advance(0);
|
|
189
|
-
/** @type {
|
|
194
|
+
/** @type {LeaderOptions} */
|
|
190
195
|
const lo = {
|
|
191
196
|
retryCallback: null, // fail fast, no retries
|
|
192
197
|
keepPolling: () => delay(1000).then(() => true), // poll really quickly
|
|
193
198
|
jitter: null, // no jitter
|
|
194
199
|
};
|
|
195
|
-
/** @type {
|
|
200
|
+
/** @type {FollowerOptions} */
|
|
196
201
|
const so = {
|
|
197
202
|
proof: 'none',
|
|
198
203
|
};
|
package/test/netconfig.test.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { test } from './prepare-test-env-ava.js';
|
|
2
2
|
import { assertNetworkConfig } from '../src/netconfig.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @import {NetworkConfig} from '@agoric/casting/src/netconfig.js';
|
|
6
|
+
*/
|
|
7
|
+
|
|
4
8
|
test('https://main.agoric.net/network-config 2022-10-27', t => {
|
|
5
9
|
/**
|
|
6
|
-
* @type {
|
|
10
|
+
* @type {NetworkConfig}
|
|
7
11
|
*/
|
|
8
12
|
const specimen = {
|
|
9
13
|
chainName: 'agoric-3',
|
|
@@ -23,7 +27,7 @@ test('https://main.agoric.net/network-config 2022-10-27', t => {
|
|
|
23
27
|
|
|
24
28
|
test('https://ollinet.agoric.net/network-config 2022-10-27', t => {
|
|
25
29
|
/**
|
|
26
|
-
* @type {
|
|
30
|
+
* @type {NetworkConfig}
|
|
27
31
|
*/
|
|
28
32
|
const specimen = {
|
|
29
33
|
chainName: 'agoricollinet-44',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/casting-spec.js","./src/change-follower.js","./src/defaults.js","./src/follower-cosmjs.js","./src/follower.js","./src/iterable.js","./src/leader-netconfig.js","./src/leader.js","./src/main.js","./src/makeHttpClient.js","./src/netconfig.js","./src/shuffle.js","./src/types.js"],"version":"5.9.
|
|
1
|
+
{"root":["./src/casting-spec.js","./src/change-follower.js","./src/defaults.js","./src/follower-cosmjs.js","./src/follower.js","./src/iterable.js","./src/leader-netconfig.js","./src/leader.js","./src/main.js","./src/makeHttpClient.js","./src/netconfig.js","./src/shuffle.js","./src/types.js"],"version":"5.9.3"}
|