@agoric/orchestration 0.1.1-dev-699cb28.0.699cb28 → 0.1.1-dev-de52d49.0.de52d49
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/orchestration",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-de52d49.0.de52d49",
|
|
4
4
|
"description": "Chain abstraction for Agoric's orchestration clients",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -35,18 +35,18 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@agoric/async-flow": "0.1.1-dev-
|
|
39
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
40
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
41
|
-
"@agoric/internal": "0.3.3-dev-
|
|
42
|
-
"@agoric/network": "0.1.1-dev-
|
|
43
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
44
|
-
"@agoric/store": "0.9.3-dev-
|
|
45
|
-
"@agoric/time": "0.3.3-dev-
|
|
46
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
47
|
-
"@agoric/vow": "0.1.1-dev-
|
|
48
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
49
|
-
"@agoric/zone": "0.2.3-dev-
|
|
38
|
+
"@agoric/async-flow": "0.1.1-dev-de52d49.0.de52d49",
|
|
39
|
+
"@agoric/cosmic-proto": "0.4.1-dev-de52d49.0.de52d49",
|
|
40
|
+
"@agoric/ertp": "0.16.3-dev-de52d49.0.de52d49",
|
|
41
|
+
"@agoric/internal": "0.3.3-dev-de52d49.0.de52d49",
|
|
42
|
+
"@agoric/network": "0.1.1-dev-de52d49.0.de52d49",
|
|
43
|
+
"@agoric/notifier": "0.6.3-dev-de52d49.0.de52d49",
|
|
44
|
+
"@agoric/store": "0.9.3-dev-de52d49.0.de52d49",
|
|
45
|
+
"@agoric/time": "0.3.3-dev-de52d49.0.de52d49",
|
|
46
|
+
"@agoric/vat-data": "0.5.3-dev-de52d49.0.de52d49",
|
|
47
|
+
"@agoric/vow": "0.1.1-dev-de52d49.0.de52d49",
|
|
48
|
+
"@agoric/zoe": "0.26.3-dev-de52d49.0.de52d49",
|
|
49
|
+
"@agoric/zone": "0.2.3-dev-de52d49.0.de52d49",
|
|
50
50
|
"@cosmjs/encoding": "^0.36.0",
|
|
51
51
|
"@endo/base64": "^1.1.1",
|
|
52
52
|
"@endo/common": "^1.4.0",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"bs58": "^6.0.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
65
|
-
"@agoric/vats": "0.15.2-dev-
|
|
66
|
-
"@agoric/xsnap": "0.14.3-dev-
|
|
64
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-de52d49.0.de52d49",
|
|
65
|
+
"@agoric/vats": "0.15.2-dev-de52d49.0.de52d49",
|
|
66
|
+
"@agoric/xsnap": "0.14.3-dev-de52d49.0.de52d49",
|
|
67
67
|
"@chain-registry/client": "^1.53.194",
|
|
68
68
|
"@cosmjs/amino": "^0.36.0",
|
|
69
69
|
"@cosmjs/proto-signing": "^0.36.0",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"typeCoverage": {
|
|
101
101
|
"atLeast": 96.68
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "de52d4955e1c4543faa041e631f7cdf0b7fe477e"
|
|
104
104
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Helpers for quoting or describing values in e.g. error messages
|
|
3
|
+
* and test descriptions.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Quotes and escapes an identifier (a struct/field type or field name) for
|
|
7
|
+
* embedding in an error message. Escaping via `JSON.stringify` happens
|
|
8
|
+
* *after* truncating and covers the whole (possibly-annotated) result, so
|
|
9
|
+
* an embedded quote, backslash, or newline in the identifier can't break
|
|
10
|
+
* out of the message's own quoting, and the `(N chars total)` annotation
|
|
11
|
+
* can't itself get chopped off by a later truncation step (there isn't
|
|
12
|
+
* one).
|
|
13
|
+
*/
|
|
14
|
+
export declare const quoteName: (str: string) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Quotes and escapes each name in `names` (see `quoteName`) and joins them
|
|
17
|
+
* for an error message -- bounding not just each individual name's length
|
|
18
|
+
* but also, since attacker-controlled data can make the *list itself*
|
|
19
|
+
* arbitrarily long (e.g. very many extra fields on a struct), the number of
|
|
20
|
+
* items included. Cuts off whole items rather than slicing the joined
|
|
21
|
+
* string's raw characters, so the result can never end mid-quote the way
|
|
22
|
+
* `truncate`-ing an already-joined-and-quoted string could.
|
|
23
|
+
*/
|
|
24
|
+
export declare const quoteNameList: (names: readonly string[]) => string;
|
|
25
|
+
/**
|
|
26
|
+
* A short, bounded description of a value for error messages. Only
|
|
27
|
+
* `string`/`number`/`bigint` can be arbitrarily long themselves; anything
|
|
28
|
+
* else is described by shape/type rather than rendered.
|
|
29
|
+
*/
|
|
30
|
+
export declare const describeValue: (value: unknown) => string;
|
|
31
|
+
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["meta.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+BH;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,KAAG,MAAuC,CAAC;AAEhF;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,SAAS,MAAM,EAAE,KAAG,MAIxD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,MAqB9C,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Helpers for quoting or describing values in e.g. error messages
|
|
3
|
+
* and test descriptions.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const MAX_DESCRIBED_LENGTH = 100;
|
|
7
|
+
const MAX_DESCRIBED_ITEMS = 10;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Slices `str` to at most `MAX_DESCRIBED_LENGTH` characters, appending
|
|
11
|
+
* `...` if it was cut. Bounds length only -- doesn't escape or annotate;
|
|
12
|
+
* `truncate` and `describeValue`'s string case each build on this
|
|
13
|
+
* differently (an appended `(N chars total)` annotation, or JSON escaping,
|
|
14
|
+
* respectively), so the raw slicing lives in one place.
|
|
15
|
+
*/
|
|
16
|
+
const truncateRaw = (str ) =>
|
|
17
|
+
str.length > MAX_DESCRIBED_LENGTH
|
|
18
|
+
? `${str.slice(0, MAX_DESCRIBED_LENGTH)}...`
|
|
19
|
+
: str;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Bounds a string embedded in an error message -- `message` (and, in
|
|
23
|
+
* 'throw' mode, `types`) can come from an untrusted source, so a field
|
|
24
|
+
* name, value, or joined list of them could otherwise be arbitrarily large.
|
|
25
|
+
* Bounds length only, and doesn't escape the result -- see `quoteName` for
|
|
26
|
+
* a quoted-and-escaped identifier suitable for embedding directly in a
|
|
27
|
+
* message (manually wrapping this in literal quotes instead is unsafe: an
|
|
28
|
+
* embedded quote character in `str` would break out of them).
|
|
29
|
+
*/
|
|
30
|
+
const truncate = (str ) =>
|
|
31
|
+
str.length > MAX_DESCRIBED_LENGTH
|
|
32
|
+
? `${truncateRaw(str)}(${str.length} chars total)`
|
|
33
|
+
: str;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Quotes and escapes an identifier (a struct/field type or field name) for
|
|
37
|
+
* embedding in an error message. Escaping via `JSON.stringify` happens
|
|
38
|
+
* *after* truncating and covers the whole (possibly-annotated) result, so
|
|
39
|
+
* an embedded quote, backslash, or newline in the identifier can't break
|
|
40
|
+
* out of the message's own quoting, and the `(N chars total)` annotation
|
|
41
|
+
* can't itself get chopped off by a later truncation step (there isn't
|
|
42
|
+
* one).
|
|
43
|
+
*/
|
|
44
|
+
export const quoteName = (str ) => JSON.stringify(truncate(str));
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Quotes and escapes each name in `names` (see `quoteName`) and joins them
|
|
48
|
+
* for an error message -- bounding not just each individual name's length
|
|
49
|
+
* but also, since attacker-controlled data can make the *list itself*
|
|
50
|
+
* arbitrarily long (e.g. very many extra fields on a struct), the number of
|
|
51
|
+
* items included. Cuts off whole items rather than slicing the joined
|
|
52
|
+
* string's raw characters, so the result can never end mid-quote the way
|
|
53
|
+
* `truncate`-ing an already-joined-and-quoted string could.
|
|
54
|
+
*/
|
|
55
|
+
export const quoteNameList = (names ) => {
|
|
56
|
+
const shown = names.slice(0, MAX_DESCRIBED_ITEMS).map(quoteName).join(', ');
|
|
57
|
+
const omitted = names.length - MAX_DESCRIBED_ITEMS;
|
|
58
|
+
return omitted > 0 ? `${shown}, and ${omitted} more` : shown;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A short, bounded description of a value for error messages. Only
|
|
63
|
+
* `string`/`number`/`bigint` can be arbitrarily long themselves; anything
|
|
64
|
+
* else is described by shape/type rather than rendered.
|
|
65
|
+
*/
|
|
66
|
+
export const describeValue = (value ) => {
|
|
67
|
+
if (value === null) return 'null';
|
|
68
|
+
if (typeof value === 'string') {
|
|
69
|
+
if (value.length > MAX_DESCRIBED_LENGTH) {
|
|
70
|
+
// The `(N chars total)` annotation goes *outside* the JSON-quoted,
|
|
71
|
+
// truncated value (unlike `quoteName`), so it reads as metadata about
|
|
72
|
+
// the value rather than part of it.
|
|
73
|
+
return `${JSON.stringify(truncateRaw(value))}(${value.length} chars total)`;
|
|
74
|
+
}
|
|
75
|
+
return JSON.stringify(value);
|
|
76
|
+
}
|
|
77
|
+
// Truncate the digits *before* appending the `n` suffix -- appending
|
|
78
|
+
// first and truncating the combined string risks slicing the `n` itself
|
|
79
|
+
// off a long enough value, leaving output that no longer looks like a
|
|
80
|
+
// bigint.
|
|
81
|
+
if (typeof value === 'bigint') return `${truncate(`${value}`)}n`;
|
|
82
|
+
if (typeof value === 'number') return truncate(String(value));
|
|
83
|
+
if (value instanceof Uint8Array)
|
|
84
|
+
return `a Uint8Array with ${value.length} byte(s)`;
|
|
85
|
+
if (Array.isArray(value)) return `an array with ${value.length} element(s)`;
|
|
86
|
+
return `a ${typeof value}`;
|
|
87
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eip712-normalize.d.ts","sourceRoot":"","sources":["eip712-normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"eip712-normalize.d.ts","sourceRoot":"","sources":["eip712-normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGxD,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,kBAAkB,EAAE,CAAC,CAAC;AAEjE,MAAM,MAAM,mCAAmC,GAAG;IAChD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,KAAK,EAAE,WAAW,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,qCAAqC,GAAG;IAClD,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IACzC;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;CACtD,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,KAAK,EAAE,WAAW,CAAC;CACpB,CAAC;AA4CF;;;;;;;;;GASG;AACH,eAAO,MAAM,6BAA6B,QAAO,MACf,CAAC;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,MAAM,CAAC;AAIpD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAG,MAAM,GAAG,SAc5D,CAAC;AAeF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,wBAAwB,GACnC,WAAW,MAAM,EACjB,OAAO,OAAO,KACb,OAgFF,CAAC;AAwLF,eAAO,MAAM,8BAA8B,GACzC,OAAO,mCAAmC,EAC1C,UAAS,qCAA0C,KAClD,oCA+EF,CAAC"}
|
|
@@ -65,16 +65,17 @@
|
|
|
65
65
|
* than converted to the equivalent hex string.
|
|
66
66
|
*/
|
|
67
67
|
|
|
68
|
+
import { describeValue, quoteName, quoteNameList } from '../meta.js';
|
|
68
69
|
|
|
69
|
-
|
|
70
|
+
;
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
;
|
|
72
73
|
|
|
73
74
|
|
|
74
75
|
|
|
75
76
|
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
;
|
|
78
79
|
|
|
79
80
|
|
|
80
81
|
|
|
@@ -87,7 +88,7 @@
|
|
|
87
88
|
|
|
88
89
|
|
|
89
90
|
|
|
90
|
-
|
|
91
|
+
;
|
|
91
92
|
|
|
92
93
|
|
|
93
94
|
|
|
@@ -157,90 +158,6 @@ export const EIP712_INTEGER_STRING_MAX_LENGTH = 100;
|
|
|
157
158
|
// abitype types `(u)int<M>` values as `number` for `M <= 48`, else `bigint`.
|
|
158
159
|
const MAX_NUMBER_INTEGER_BITS = 48;
|
|
159
160
|
|
|
160
|
-
const MAX_DESCRIBED_LENGTH = 100;
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Slices `str` to at most `MAX_DESCRIBED_LENGTH` characters, appending
|
|
164
|
-
* `...` if it was cut. Bounds length only -- doesn't escape or annotate;
|
|
165
|
-
* `truncate` and `describeValue`'s string case each build on this
|
|
166
|
-
* differently (an appended `(N chars total)` annotation, or JSON escaping,
|
|
167
|
-
* respectively), so the raw slicing lives in one place.
|
|
168
|
-
*/
|
|
169
|
-
const truncateRaw = (str ) =>
|
|
170
|
-
str.length > MAX_DESCRIBED_LENGTH
|
|
171
|
-
? `${str.slice(0, MAX_DESCRIBED_LENGTH)}...`
|
|
172
|
-
: str;
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Bounds a string embedded in an error message -- `message` (and, in
|
|
176
|
-
* 'throw' mode, `types`) can come from an untrusted source, so a field
|
|
177
|
-
* name, value, or joined list of them could otherwise be arbitrarily large.
|
|
178
|
-
* Bounds length only, and doesn't escape the result -- see `quoteName` for
|
|
179
|
-
* a quoted-and-escaped identifier suitable for embedding directly in a
|
|
180
|
-
* message (manually wrapping this in literal quotes instead is unsafe: an
|
|
181
|
-
* embedded quote character in `str` would break out of them).
|
|
182
|
-
*/
|
|
183
|
-
const truncate = (str ) =>
|
|
184
|
-
str.length > MAX_DESCRIBED_LENGTH
|
|
185
|
-
? `${truncateRaw(str)}(${str.length} chars total)`
|
|
186
|
-
: str;
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Quotes and escapes an identifier (a struct/field type or field name) for
|
|
190
|
-
* embedding in an error message. Escaping via `JSON.stringify` happens
|
|
191
|
-
* *after* truncating and covers the whole (possibly-annotated) result, so
|
|
192
|
-
* an embedded quote, backslash, or newline in the identifier can't break
|
|
193
|
-
* out of the message's own quoting, and the `(N chars total)` annotation
|
|
194
|
-
* can't itself get chopped off by a later truncation step (there isn't
|
|
195
|
-
* one).
|
|
196
|
-
*/
|
|
197
|
-
const quoteName = (str ) => JSON.stringify(truncate(str));
|
|
198
|
-
|
|
199
|
-
const MAX_DESCRIBED_ITEMS = 10;
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Quotes and escapes each name in `names` (see `quoteName`) and joins them
|
|
203
|
-
* for an error message -- bounding not just each individual name's length
|
|
204
|
-
* but also, since attacker-controlled data can make the *list itself*
|
|
205
|
-
* arbitrarily long (e.g. very many extra fields on a struct), the number of
|
|
206
|
-
* items included. Cuts off whole items rather than slicing the joined
|
|
207
|
-
* string's raw characters, so the result can never end mid-quote the way
|
|
208
|
-
* `truncate`-ing an already-joined-and-quoted string could.
|
|
209
|
-
*/
|
|
210
|
-
const quoteNameList = (names ) => {
|
|
211
|
-
const shown = names.slice(0, MAX_DESCRIBED_ITEMS).map(quoteName).join(', ');
|
|
212
|
-
const omitted = names.length - MAX_DESCRIBED_ITEMS;
|
|
213
|
-
return omitted > 0 ? `${shown}, and ${omitted} more` : shown;
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* A short, bounded description of a value for error messages. Only
|
|
218
|
-
* `string`/`number`/`bigint` can be arbitrarily long themselves; anything
|
|
219
|
-
* else is described by shape/type rather than rendered.
|
|
220
|
-
*/
|
|
221
|
-
const describeValue = (value ) => {
|
|
222
|
-
if (value === null) return 'null';
|
|
223
|
-
if (typeof value === 'string') {
|
|
224
|
-
if (value.length > MAX_DESCRIBED_LENGTH) {
|
|
225
|
-
// The `(N chars total)` annotation goes *outside* the JSON-quoted,
|
|
226
|
-
// truncated value (unlike `quoteName`), so it reads as metadata about
|
|
227
|
-
// the value rather than part of it.
|
|
228
|
-
return `${JSON.stringify(truncateRaw(value))}(${value.length} chars total)`;
|
|
229
|
-
}
|
|
230
|
-
return JSON.stringify(value);
|
|
231
|
-
}
|
|
232
|
-
// Truncate the digits *before* appending the `n` suffix -- appending
|
|
233
|
-
// first and truncating the combined string risks slicing the `n` itself
|
|
234
|
-
// off a long enough value, leaving output that no longer looks like a
|
|
235
|
-
// bigint.
|
|
236
|
-
if (typeof value === 'bigint') return `${truncate(`${value}`)}n`;
|
|
237
|
-
if (typeof value === 'number') return truncate(String(value));
|
|
238
|
-
if (value instanceof Uint8Array)
|
|
239
|
-
return `a Uint8Array with ${value.length} byte(s)`;
|
|
240
|
-
if (Array.isArray(value)) return `an array with ${value.length} element(s)`;
|
|
241
|
-
return `a ${typeof value}`;
|
|
242
|
-
};
|
|
243
|
-
|
|
244
161
|
/**
|
|
245
162
|
* Parses an integer given in one of the JS representations accepted for an
|
|
246
163
|
* EIP-712 `(u)int<M>` value: a `bigint`, a safe integer `number`, or a
|