@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/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/casting",
|
|
3
|
-
"version": "0.5.0",
|
|
3
|
+
"version": "0.5.1-upgrade-23-dev-bd79330.0.bd79330",
|
|
4
4
|
"description": "Agoric's OCap broadcasting system",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/main.js",
|
|
7
7
|
"repository": "https://github.com/Agoric/agoric-sdk",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "exit 0",
|
|
10
|
-
"prepack": "yarn run -T
|
|
11
|
-
"postpack": "
|
|
10
|
+
"prepack": "yarn run -T prepack-package",
|
|
11
|
+
"postpack": "yarn run -T postpack-package",
|
|
12
12
|
"demo": "node -e 'import(\"./test/fake-rpc-server.js\").then(ns => ns.develop())'",
|
|
13
13
|
"test": "ava",
|
|
14
14
|
"test:c8": "c8 --all ${C8_OPTIONS:-} ava",
|
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
"lint-fix": "yarn lint:eslint --fix",
|
|
17
17
|
"lint": "yarn run -T run-s --continue-on-error 'lint:*'",
|
|
18
18
|
"lint:types": "yarn run -T tsc",
|
|
19
|
-
"lint:eslint": "
|
|
19
|
+
"lint:eslint": "node ../../scripts/eslint-repo.mjs ."
|
|
20
20
|
},
|
|
21
21
|
"keywords": [],
|
|
22
22
|
"author": "Agoric",
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agoric/internal": "0.4.0",
|
|
26
|
-
"@agoric/notifier": "0.7.0",
|
|
27
|
-
"@agoric/store": "0.10.0",
|
|
25
|
+
"@agoric/internal": "0.4.1-upgrade-23-dev-bd79330.0.bd79330",
|
|
26
|
+
"@agoric/notifier": "0.7.1-upgrade-23-dev-bd79330.0.bd79330",
|
|
27
|
+
"@agoric/store": "0.10.1-upgrade-23-dev-bd79330.0.bd79330",
|
|
28
28
|
"@cosmjs/encoding": "^0.36.0",
|
|
29
29
|
"@cosmjs/proto-signing": "^0.36.0",
|
|
30
30
|
"@cosmjs/stargate": "^0.36.0",
|
|
@@ -37,14 +37,17 @@
|
|
|
37
37
|
"@endo/promise-kit": "^1.1.13"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@agoric/cosmic-proto": "0.5.0",
|
|
40
|
+
"@agoric/cosmic-proto": "0.5.1-upgrade-23-dev-bd79330.0.bd79330",
|
|
41
41
|
"@endo/ses-ava": "^1.3.2",
|
|
42
|
-
"ava": "^
|
|
42
|
+
"ava": "^6.4.1",
|
|
43
43
|
"c8": "^10.1.3",
|
|
44
44
|
"express": "^5.0.1",
|
|
45
45
|
"tsd": "^0.33.0",
|
|
46
46
|
"ws": "^7.2.0"
|
|
47
47
|
},
|
|
48
|
+
"files": [
|
|
49
|
+
"src"
|
|
50
|
+
],
|
|
48
51
|
"publishConfig": {
|
|
49
52
|
"access": "public"
|
|
50
53
|
},
|
|
@@ -55,11 +58,10 @@
|
|
|
55
58
|
"files": [
|
|
56
59
|
"test/**/*.test.*"
|
|
57
60
|
],
|
|
58
|
-
"timeout": "20m"
|
|
59
|
-
"workerThreads": false
|
|
61
|
+
"timeout": "20m"
|
|
60
62
|
},
|
|
61
63
|
"typeCoverage": {
|
|
62
64
|
"atLeast": 89.19
|
|
63
65
|
},
|
|
64
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "bd79330f78dae2faf9cc3d8b10063567700da07b"
|
|
65
67
|
}
|
package/src/casting-spec.d.ts
CHANGED
|
@@ -2,15 +2,18 @@ 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 { VStorageKey } from '@agoric/internal/src/lib-chainStorage.js';
|
|
17
|
+
import type { CastingSpec } from './types.js';
|
|
18
|
+
import type { ERef } from '@agoric/vow';
|
|
16
19
|
//# 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":"AAmDO,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,KAAK,GAAG,CAAC,GACP,OAAO,CAAC,WAAW,CAAC,CAKhC;AAQM,yCAHI,KAAK,OAAO,CAAC,GACX,OAAO,CAAC,WAAW,CAAC,CAgBhC;iCA7J6B,0CAA0C;iCAD1C,YAAY;0BAEnB,aAAa"}
|
package/src/casting-spec.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
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
|
+
* @import {VStorageKey} from '@agoric/internal/src/lib-chainStorage.js';
|
|
7
|
+
* @import {ERef} from '@agoric/vow';
|
|
8
|
+
*/
|
|
9
|
+
|
|
4
10
|
const { toAscii } = encodingStar;
|
|
5
11
|
|
|
6
12
|
/**
|
|
7
13
|
* @param {string} storagePath
|
|
8
|
-
* @returns {
|
|
14
|
+
* @returns {CastingSpec}
|
|
9
15
|
*/
|
|
10
16
|
const swingsetPathToCastingSpec = storagePath =>
|
|
11
17
|
harden({
|
|
@@ -22,7 +28,7 @@ const NO_DATA_VALUE = new Uint8Array([255]);
|
|
|
22
28
|
/**
|
|
23
29
|
* @param {string} storagePath
|
|
24
30
|
* @param {string} [storeName]
|
|
25
|
-
* @returns {
|
|
31
|
+
* @returns {CastingSpec}
|
|
26
32
|
*/
|
|
27
33
|
const vstoragePathToCastingSpec = (storagePath, storeName = 'vstorage') => {
|
|
28
34
|
const elems = storagePath ? storagePath.split('.') : [];
|
|
@@ -58,7 +64,7 @@ export const vstorageKeySpecToPath = ({ storeName, storeSubkey }) => {
|
|
|
58
64
|
export const DEFAULT_PATH_CONVERTER = vstoragePathToCastingSpec;
|
|
59
65
|
|
|
60
66
|
/**
|
|
61
|
-
* @type {Record<string, (path: string) =>
|
|
67
|
+
* @type {Record<string, (path: string) => CastingSpec>}
|
|
62
68
|
*/
|
|
63
69
|
export const pathPrefixToConverters = harden({
|
|
64
70
|
'swingset:': swingsetPathToCastingSpec,
|
|
@@ -68,7 +74,7 @@ export const pathPrefixToConverters = harden({
|
|
|
68
74
|
|
|
69
75
|
/**
|
|
70
76
|
* @param {string} specString
|
|
71
|
-
* @returns {
|
|
77
|
+
* @returns {CastingSpec}
|
|
72
78
|
*/
|
|
73
79
|
export const makeCastingSpecFromString = specString => {
|
|
74
80
|
assert.typeof(specString, 'string');
|
|
@@ -88,7 +94,7 @@ const te = new TextEncoder();
|
|
|
88
94
|
|
|
89
95
|
/**
|
|
90
96
|
* @param {any} specObj
|
|
91
|
-
* @returns {
|
|
97
|
+
* @returns {CastingSpec}
|
|
92
98
|
*/
|
|
93
99
|
export const makeCastingSpecFromObject = specObj => {
|
|
94
100
|
const {
|
|
@@ -127,7 +133,7 @@ export const makeCastingSpecFromObject = specObj => {
|
|
|
127
133
|
|
|
128
134
|
/**
|
|
129
135
|
* @param {ERef<any>} specCap
|
|
130
|
-
* @returns {Promise<
|
|
136
|
+
* @returns {Promise<CastingSpec>}
|
|
131
137
|
*/
|
|
132
138
|
export const makeCastingSpecFromRef = async specCap => {
|
|
133
139
|
const specObj = await E(specCap).getStoreKey();
|
|
@@ -138,7 +144,7 @@ export const makeCastingSpecFromRef = async specCap => {
|
|
|
138
144
|
* Create an abstract type from a given source representation
|
|
139
145
|
*
|
|
140
146
|
* @param {ERef<unknown>} sourceP
|
|
141
|
-
* @returns {Promise<
|
|
147
|
+
* @returns {Promise<CastingSpec>}
|
|
142
148
|
*/
|
|
143
149
|
export const makeCastingSpec = async sourceP => {
|
|
144
150
|
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,7 @@
|
|
|
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 { ERef } from '@agoric/vow';
|
|
4
|
+
import type { LeaderOrMaker } from './types.js';
|
|
5
|
+
import type { FollowerOptions } from './types.js';
|
|
6
|
+
import type { ValueFollower } from './follower-cosmjs.js';
|
|
2
7
|
//# 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":"AAoEO,6BANM,CAAC,SACH,KAAK,WAAW,CAAC,GAAG,MAAM,kBAC1B,aAAa,YACb,eAAe,GACb,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CASrC;iCAjE6B,YAAY;0BAMnB,aAAa;mCAHJ,YAAY;qCACV,YAAY;mCACd,sBAAsB"}
|
package/src/follower.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// @jessie-check
|
|
2
|
-
|
|
3
1
|
import { Far } from '@endo/far';
|
|
4
2
|
import {
|
|
5
3
|
mapAsyncIterable,
|
|
@@ -9,14 +7,24 @@ import {
|
|
|
9
7
|
import { makeCosmjsFollower } from './follower-cosmjs.js';
|
|
10
8
|
import { makeCastingSpec } from './casting-spec.js';
|
|
11
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @import {CastingSpec} from './types.js';
|
|
12
|
+
* @import {Follower} from './types.js';
|
|
13
|
+
* @import {ValueFollowerElement} from './types.js';
|
|
14
|
+
* @import {LeaderOrMaker} from './types.js';
|
|
15
|
+
* @import {FollowerOptions} from './types.js';
|
|
16
|
+
* @import {ValueFollower} from './follower-cosmjs.js';
|
|
17
|
+
* @import {ERef} from '@agoric/vow';
|
|
18
|
+
*/
|
|
19
|
+
|
|
12
20
|
/**
|
|
13
21
|
* @template T
|
|
14
|
-
* @param {ERef<
|
|
22
|
+
* @param {ERef<CastingSpec>} spec
|
|
15
23
|
*/
|
|
16
24
|
const makeSubscriptionFollower = spec => {
|
|
17
25
|
const transform = value =>
|
|
18
26
|
harden({ value, blockHeight: NaN, currentBlockHeight: NaN });
|
|
19
|
-
/** @type {
|
|
27
|
+
/** @type {Follower<ValueFollowerElement<T>>} */
|
|
20
28
|
const follower = Far('subscription/notifier follower', {
|
|
21
29
|
getLatestIterable: async () => {
|
|
22
30
|
const { notifier, subscription } = await spec;
|
|
@@ -53,10 +61,10 @@ const makeSubscriptionFollower = spec => {
|
|
|
53
61
|
|
|
54
62
|
/**
|
|
55
63
|
* @template T
|
|
56
|
-
* @param {ERef<
|
|
57
|
-
* @param {
|
|
58
|
-
* @param {
|
|
59
|
-
* @returns {Promise<
|
|
64
|
+
* @param {ERef<CastingSpec> | string} specP
|
|
65
|
+
* @param {LeaderOrMaker} [leaderOrMaker]
|
|
66
|
+
* @param {FollowerOptions} [options]
|
|
67
|
+
* @returns {Promise<ValueFollower<T>>}
|
|
60
68
|
*/
|
|
61
69
|
export const makeFollower = async (specP, leaderOrMaker, options) => {
|
|
62
70
|
const spec = await makeCastingSpec(specP);
|
package/src/iterable.d.ts
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
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 { ERef } from '@agoric/vow';
|
|
25
|
+
import type { IterateEachOptions } from './types.js';
|
|
23
26
|
export { subscribeEach, subscribeLatest } from "@agoric/notifier/subscribe.js";
|
|
24
27
|
//# 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":"AAiBO,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,KAAK,SAAS,CAAC,CAAC,CAAC;IAKxB,kCAAkC;kCAApB,aAAa,CAAC,CAAC,CAAC;;IAA9B,kCAAkC;kCAApB,aAAa,CAAC,CAAC,CAAC;GAQ9B;AASG,4BAJM,CAAC,YACH,KAAK,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,KAAK,SAAS,CAAC,CAAC,CAAC,YACjB,kBAAkB;IAKzB,kCAAkC;kCAApB,aAAa,CAAC,CAAC,CAAC;;IAA9B,kCAAkC;kCAApB,aAAa,CAAC,CAAC,CAAC;GAQ9B;8BA/EuB,YAAY;0BAEhB,aAAa;wCADC,YAAY"}
|
package/src/iterable.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { E, Far } from '@endo/far';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @import {Follower} from './types.js';
|
|
5
|
+
* @import {IterateEachOptions} from './types.js';
|
|
6
|
+
* @import {ERef} from '@agoric/vow';
|
|
7
|
+
*/
|
|
8
|
+
|
|
3
9
|
export { subscribeEach, subscribeLatest } from '@agoric/notifier/subscribe.js';
|
|
4
10
|
|
|
5
11
|
/**
|
|
@@ -23,7 +29,7 @@ export const mapAsyncIterable = (iterable, transform) => {
|
|
|
23
29
|
* TODO: Remove this function when we have an @endo/publish-kit that suppports pull topics
|
|
24
30
|
*
|
|
25
31
|
* @template T
|
|
26
|
-
* @param {ERef<
|
|
32
|
+
* @param {ERef<Follower<T>>} follower
|
|
27
33
|
*/
|
|
28
34
|
export const iterateLatest = follower =>
|
|
29
35
|
// For now, just pass through the iterable.
|
|
@@ -42,8 +48,8 @@ export const iterateLatest = follower =>
|
|
|
42
48
|
* TODO: Remove this function when we have an @endo/publish-kit that suppports pull topics
|
|
43
49
|
*
|
|
44
50
|
* @template T
|
|
45
|
-
* @param {ERef<
|
|
46
|
-
* @param {
|
|
51
|
+
* @param {ERef<Follower<T>>} follower
|
|
52
|
+
* @param {IterateEachOptions} [options]
|
|
47
53
|
*/
|
|
48
54
|
export const iterateEach = (follower, options) =>
|
|
49
55
|
// For now, just pass through the iterable.
|
|
@@ -60,8 +66,8 @@ export const iterateEach = (follower, options) =>
|
|
|
60
66
|
|
|
61
67
|
/**
|
|
62
68
|
* @template T
|
|
63
|
-
* @param {ERef<
|
|
64
|
-
* @param {
|
|
69
|
+
* @param {ERef<Follower<T>>} follower
|
|
70
|
+
* @param {IterateEachOptions} [options]
|
|
65
71
|
*/
|
|
66
72
|
export const iterateReverse = (follower, options) =>
|
|
67
73
|
// For now, just pass through the iterable.
|
|
@@ -1,4 +1,7 @@
|
|
|
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';
|
|
6
|
+
import type { ERef } from '@agoric/vow';
|
|
4
7
|
//# 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":"AAqBO,qDAJI,MAAM,EAAE,kBACR,aAAa,GACX,MAAM,CAelB;AAMM,0DAHI,MAAM,YACN,aAAa,gBAmCvB;AAOM,uCAJI,MAAM,YACN,aAAa,GACX,KAAK,MAAM,CAAC,CAOxB;mCA1E+B,YAAY;4BACnB,YAAY;0BACd,aAAa"}
|
package/src/leader-netconfig.js
CHANGED
|
@@ -8,10 +8,16 @@ 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
|
+
* @import {ERef} from '@agoric/vow';
|
|
15
|
+
*/
|
|
16
|
+
|
|
11
17
|
/**
|
|
12
18
|
* @param {string[]} rpcAddrs
|
|
13
|
-
* @param {
|
|
14
|
-
* @returns {
|
|
19
|
+
* @param {LeaderOptions} [leaderOptions]
|
|
20
|
+
* @returns {Leader}
|
|
15
21
|
*/
|
|
16
22
|
export const makeLeaderFromRpcAddresses = (rpcAddrs, leaderOptions) => {
|
|
17
23
|
Array.isArray(rpcAddrs) || Fail`rpcAddrs ${rpcAddrs} must be an array`;
|
|
@@ -30,12 +36,12 @@ export const makeLeaderFromRpcAddresses = (rpcAddrs, leaderOptions) => {
|
|
|
30
36
|
|
|
31
37
|
/**
|
|
32
38
|
* @param {string} netconfigURL
|
|
33
|
-
* @param {
|
|
39
|
+
* @param {LeaderOptions} [options]
|
|
34
40
|
*/
|
|
35
41
|
export const makeLeaderFromNetworkConfig = (netconfigURL, options = {}) => {
|
|
36
42
|
const { retryCallback = DEFAULT_RETRY_CALLBACK, jitter = DEFAULT_JITTER } =
|
|
37
43
|
options;
|
|
38
|
-
/** @type {
|
|
44
|
+
/** @type {LeaderOptions['retryCallback']} */
|
|
39
45
|
const retry = async (where, err, attempt) => {
|
|
40
46
|
if (retryCallback) {
|
|
41
47
|
return retryCallback(where, err, attempt);
|
|
@@ -69,8 +75,8 @@ export const makeLeaderFromNetworkConfig = (netconfigURL, options = {}) => {
|
|
|
69
75
|
|
|
70
76
|
/**
|
|
71
77
|
* @param {string} [bootstrap]
|
|
72
|
-
* @param {
|
|
73
|
-
* @returns {ERef<
|
|
78
|
+
* @param {LeaderOptions} [options]
|
|
79
|
+
* @returns {ERef<Leader>}
|
|
74
80
|
*/
|
|
75
81
|
export const makeLeader = (bootstrap = DEFAULT_BOOTSTRAP, options) => {
|
|
76
82
|
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"}
|