@icp-sdk/core 5.4.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/agent/actor.d.ts +7 -3
- package/lib/cjs/agent/actor.d.ts.map +1 -1
- package/lib/cjs/agent/actor.js +18 -5
- package/lib/cjs/agent/actor.js.map +1 -1
- package/lib/cjs/agent/agent/api.d.ts +71 -10
- package/lib/cjs/agent/agent/api.d.ts.map +1 -1
- package/lib/cjs/agent/agent/api.js +6 -1
- package/lib/cjs/agent/agent/api.js.map +1 -1
- package/lib/cjs/agent/agent/http/index.d.ts +9 -12
- package/lib/cjs/agent/agent/http/index.d.ts.map +1 -1
- package/lib/cjs/agent/agent/http/index.js +224 -176
- package/lib/cjs/agent/agent/http/index.js.map +1 -1
- package/lib/cjs/agent/auth.d.ts +6 -5
- package/lib/cjs/agent/auth.d.ts.map +1 -1
- package/lib/cjs/agent/auth.js +3 -3
- package/lib/cjs/agent/auth.js.map +1 -1
- package/lib/cjs/agent/canisterStatus/index.d.ts +2 -3
- package/lib/cjs/agent/canisterStatus/index.d.ts.map +1 -1
- package/lib/cjs/agent/canisterStatus/index.js +65 -122
- package/lib/cjs/agent/canisterStatus/index.js.map +1 -1
- package/lib/cjs/agent/cbor.d.ts +2 -1
- package/lib/cjs/agent/cbor.d.ts.map +1 -1
- package/lib/cjs/agent/cbor.js +4 -1
- package/lib/cjs/agent/cbor.js.map +1 -1
- package/lib/cjs/agent/certificate.d.ts +6 -5
- package/lib/cjs/agent/certificate.d.ts.map +1 -1
- package/lib/cjs/agent/certificate.js +14 -18
- package/lib/cjs/agent/certificate.js.map +1 -1
- package/lib/cjs/agent/der.d.ts +3 -2
- package/lib/cjs/agent/der.d.ts.map +1 -1
- package/lib/cjs/agent/der.js.map +1 -1
- package/lib/cjs/agent/errors.d.ts +7 -1
- package/lib/cjs/agent/errors.d.ts.map +1 -1
- package/lib/cjs/agent/errors.js +34 -16
- package/lib/cjs/agent/errors.js.map +1 -1
- package/lib/cjs/agent/polling/index.d.ts +7 -7
- package/lib/cjs/agent/polling/index.d.ts.map +1 -1
- package/lib/cjs/agent/polling/index.js +19 -20
- package/lib/cjs/agent/polling/index.js.map +1 -1
- package/lib/cjs/agent/polling/strategy.d.ts.map +1 -1
- package/lib/cjs/agent/polling/strategy.js +6 -6
- package/lib/cjs/agent/polling/strategy.js.map +1 -1
- package/lib/cjs/agent/polling/types.d.ts +3 -4
- package/lib/cjs/agent/polling/types.d.ts.map +1 -1
- package/lib/cjs/agent/public_key.d.ts +3 -2
- package/lib/cjs/agent/public_key.d.ts.map +1 -1
- package/lib/cjs/agent/public_key.js +2 -2
- package/lib/cjs/agent/public_key.js.map +1 -1
- package/lib/cjs/agent/request_id.js +10 -10
- package/lib/cjs/agent/request_id.js.map +1 -1
- package/lib/cjs/agent/subnetStatus/index.d.ts +3 -2
- package/lib/cjs/agent/subnetStatus/index.d.ts.map +1 -1
- package/lib/cjs/agent/subnetStatus/index.js +65 -88
- package/lib/cjs/agent/subnetStatus/index.js.map +1 -1
- package/lib/cjs/agent/utils/bls.d.ts.map +1 -1
- package/lib/cjs/agent/utils/bls.js +7 -6
- package/lib/cjs/agent/utils/bls.js.map +1 -1
- package/lib/cjs/agent/utils/readState.d.ts +104 -15
- package/lib/cjs/agent/utils/readState.d.ts.map +1 -1
- package/lib/cjs/agent/utils/readState.js +106 -17
- package/lib/cjs/agent/utils/readState.js.map +1 -1
- package/lib/cjs/agent/utils/target.d.ts +15 -0
- package/lib/cjs/agent/utils/target.d.ts.map +1 -0
- package/lib/cjs/agent/utils/target.js +27 -0
- package/lib/cjs/agent/utils/target.js.map +1 -0
- package/lib/cjs/candid/utils/buffer.d.ts +2 -1
- package/lib/cjs/candid/utils/buffer.d.ts.map +1 -1
- package/lib/cjs/candid/utils/buffer.js +5 -2
- package/lib/cjs/candid/utils/buffer.js.map +1 -1
- package/lib/cjs/identity/identity/delegation.d.ts +10 -3
- package/lib/cjs/identity/identity/delegation.d.ts.map +1 -1
- package/lib/cjs/identity/identity/delegation.js +25 -12
- package/lib/cjs/identity/identity/delegation.js.map +1 -1
- package/lib/cjs/identity/identity/ecdsa.d.ts +2 -2
- package/lib/cjs/identity/identity/ecdsa.d.ts.map +1 -1
- package/lib/cjs/identity/identity/ecdsa.js +3 -2
- package/lib/cjs/identity/identity/ecdsa.js.map +1 -1
- package/lib/cjs/identity/identity/ed25519.d.ts +3 -2
- package/lib/cjs/identity/identity/ed25519.d.ts.map +1 -1
- package/lib/cjs/identity/identity/ed25519.js +18 -15
- package/lib/cjs/identity/identity/ed25519.js.map +1 -1
- package/lib/cjs/identity/identity/webauthn.d.ts +4 -3
- package/lib/cjs/identity/identity/webauthn.d.ts.map +1 -1
- package/lib/cjs/identity/identity/webauthn.js +12 -11
- package/lib/cjs/identity/identity/webauthn.js.map +1 -1
- package/lib/cjs/identity/secp256k1/der.d.ts +2 -1
- package/lib/cjs/identity/secp256k1/der.d.ts.map +1 -1
- package/lib/cjs/identity/secp256k1/der.js.map +1 -1
- package/lib/cjs/identity/secp256k1/pem.d.ts +4 -3
- package/lib/cjs/identity/secp256k1/pem.d.ts.map +1 -1
- package/lib/cjs/identity/secp256k1/pem.js +2 -2
- package/lib/cjs/identity/secp256k1/pem.js.map +1 -1
- package/lib/cjs/identity/secp256k1/secp256k1.d.ts +5 -4
- package/lib/cjs/identity/secp256k1/secp256k1.d.ts.map +1 -1
- package/lib/cjs/identity/secp256k1/secp256k1.js +17 -20
- package/lib/cjs/identity/secp256k1/secp256k1.js.map +1 -1
- package/lib/cjs/principal/principal.js +5 -5
- package/lib/cjs/principal/principal.js.map +1 -1
- package/lib/esm/agent/actor.d.ts +7 -3
- package/lib/esm/agent/actor.d.ts.map +1 -1
- package/lib/esm/agent/actor.js +18 -5
- package/lib/esm/agent/actor.js.map +1 -1
- package/lib/esm/agent/agent/api.d.ts +71 -10
- package/lib/esm/agent/agent/api.d.ts.map +1 -1
- package/lib/esm/agent/agent/api.js +1 -0
- package/lib/esm/agent/agent/api.js.map +1 -1
- package/lib/esm/agent/agent/http/index.d.ts +9 -12
- package/lib/esm/agent/agent/http/index.d.ts.map +1 -1
- package/lib/esm/agent/agent/http/index.js +218 -170
- package/lib/esm/agent/agent/http/index.js.map +1 -1
- package/lib/esm/agent/auth.d.ts +6 -5
- package/lib/esm/agent/auth.d.ts.map +1 -1
- package/lib/esm/agent/auth.js +1 -1
- package/lib/esm/agent/auth.js.map +1 -1
- package/lib/esm/agent/canister-env/index.js +1 -1
- package/lib/esm/agent/canister-env/index.js.map +1 -1
- package/lib/esm/agent/canisterStatus/index.d.ts +2 -3
- package/lib/esm/agent/canisterStatus/index.d.ts.map +1 -1
- package/lib/esm/agent/canisterStatus/index.js +66 -122
- package/lib/esm/agent/canisterStatus/index.js.map +1 -1
- package/lib/esm/agent/cbor.d.ts +2 -1
- package/lib/esm/agent/cbor.d.ts.map +1 -1
- package/lib/esm/agent/cbor.js +4 -1
- package/lib/esm/agent/cbor.js.map +1 -1
- package/lib/esm/agent/certificate.d.ts +6 -5
- package/lib/esm/agent/certificate.d.ts.map +1 -1
- package/lib/esm/agent/certificate.js +5 -9
- package/lib/esm/agent/certificate.js.map +1 -1
- package/lib/esm/agent/der.d.ts +3 -2
- package/lib/esm/agent/der.d.ts.map +1 -1
- package/lib/esm/agent/der.js.map +1 -1
- package/lib/esm/agent/errors.d.ts +7 -1
- package/lib/esm/agent/errors.d.ts.map +1 -1
- package/lib/esm/agent/errors.js +18 -1
- package/lib/esm/agent/errors.js.map +1 -1
- package/lib/esm/agent/polling/index.d.ts +7 -7
- package/lib/esm/agent/polling/index.d.ts.map +1 -1
- package/lib/esm/agent/polling/index.js +19 -20
- package/lib/esm/agent/polling/index.js.map +1 -1
- package/lib/esm/agent/polling/strategy.d.ts.map +1 -1
- package/lib/esm/agent/polling/strategy.js +6 -6
- package/lib/esm/agent/polling/strategy.js.map +1 -1
- package/lib/esm/agent/polling/types.d.ts +3 -4
- package/lib/esm/agent/polling/types.d.ts.map +1 -1
- package/lib/esm/agent/public_key.d.ts +3 -2
- package/lib/esm/agent/public_key.d.ts.map +1 -1
- package/lib/esm/agent/public_key.js +2 -2
- package/lib/esm/agent/public_key.js.map +1 -1
- package/lib/esm/agent/request_id.js +2 -2
- package/lib/esm/agent/request_id.js.map +1 -1
- package/lib/esm/agent/subnetStatus/index.d.ts +3 -2
- package/lib/esm/agent/subnetStatus/index.d.ts.map +1 -1
- package/lib/esm/agent/subnetStatus/index.js +63 -86
- package/lib/esm/agent/subnetStatus/index.js.map +1 -1
- package/lib/esm/agent/utils/bls.d.ts.map +1 -1
- package/lib/esm/agent/utils/bls.js +7 -6
- package/lib/esm/agent/utils/bls.js.map +1 -1
- package/lib/esm/agent/utils/readState.d.ts +104 -15
- package/lib/esm/agent/utils/readState.d.ts.map +1 -1
- package/lib/esm/agent/utils/readState.js +103 -16
- package/lib/esm/agent/utils/readState.js.map +1 -1
- package/lib/esm/agent/utils/target.d.ts +15 -0
- package/lib/esm/agent/utils/target.d.ts.map +1 -0
- package/lib/esm/agent/utils/target.js +23 -0
- package/lib/esm/agent/utils/target.js.map +1 -0
- package/lib/esm/candid/utils/buffer.d.ts +2 -1
- package/lib/esm/candid/utils/buffer.d.ts.map +1 -1
- package/lib/esm/candid/utils/buffer.js +5 -2
- package/lib/esm/candid/utils/buffer.js.map +1 -1
- package/lib/esm/identity/identity/delegation.d.ts +10 -3
- package/lib/esm/identity/identity/delegation.d.ts.map +1 -1
- package/lib/esm/identity/identity/delegation.js +22 -9
- package/lib/esm/identity/identity/delegation.js.map +1 -1
- package/lib/esm/identity/identity/ecdsa.d.ts +2 -2
- package/lib/esm/identity/identity/ecdsa.d.ts.map +1 -1
- package/lib/esm/identity/identity/ecdsa.js +3 -2
- package/lib/esm/identity/identity/ecdsa.js.map +1 -1
- package/lib/esm/identity/identity/ed25519.d.ts +3 -2
- package/lib/esm/identity/identity/ed25519.d.ts.map +1 -1
- package/lib/esm/identity/identity/ed25519.js +10 -7
- package/lib/esm/identity/identity/ed25519.js.map +1 -1
- package/lib/esm/identity/identity/webauthn.d.ts +4 -3
- package/lib/esm/identity/identity/webauthn.d.ts.map +1 -1
- package/lib/esm/identity/identity/webauthn.js +8 -7
- package/lib/esm/identity/identity/webauthn.js.map +1 -1
- package/lib/esm/identity/secp256k1/der.d.ts +2 -1
- package/lib/esm/identity/secp256k1/der.d.ts.map +1 -1
- package/lib/esm/identity/secp256k1/der.js.map +1 -1
- package/lib/esm/identity/secp256k1/pem.d.ts +4 -3
- package/lib/esm/identity/secp256k1/pem.d.ts.map +1 -1
- package/lib/esm/identity/secp256k1/pem.js +2 -2
- package/lib/esm/identity/secp256k1/pem.js.map +1 -1
- package/lib/esm/identity/secp256k1/secp256k1.d.ts +5 -4
- package/lib/esm/identity/secp256k1/secp256k1.d.ts.map +1 -1
- package/lib/esm/identity/secp256k1/secp256k1.js +10 -13
- package/lib/esm/identity/secp256k1/secp256k1.js.map +1 -1
- package/lib/esm/principal/principal.js +2 -2
- package/lib/esm/principal/principal.js.map +1 -1
- package/package.json +20 -10
- package/src/agent/actor.ts +0 -524
- package/src/agent/agent/api.ts +0 -310
- package/src/agent/agent/http/expiry.ts +0 -107
- package/src/agent/agent/http/index.ts +0 -1724
- package/src/agent/agent/http/transforms.ts +0 -54
- package/src/agent/agent/http/types.ts +0 -145
- package/src/agent/agent/index.ts +0 -4
- package/src/agent/auth.ts +0 -147
- package/src/agent/canister-env/index.ts +0 -192
- package/src/agent/canisterStatus/index.ts +0 -260
- package/src/agent/cbor.ts +0 -63
- package/src/agent/certificate.ts +0 -1058
- package/src/agent/constants.ts +0 -24
- package/src/agent/der.ts +0 -191
- package/src/agent/errors.ts +0 -962
- package/src/agent/fetch_candid.ts +0 -37
- package/src/agent/index.ts +0 -130
- package/src/agent/observable.ts +0 -49
- package/src/agent/polling/backoff.ts +0 -129
- package/src/agent/polling/index.ts +0 -238
- package/src/agent/polling/strategy.ts +0 -140
- package/src/agent/polling/types.ts +0 -28
- package/src/agent/public_key.ts +0 -65
- package/src/agent/request_id.ts +0 -99
- package/src/agent/subnetStatus/index.ts +0 -263
- package/src/agent/utils/bls.ts +0 -18
- package/src/agent/utils/buffer.ts +0 -64
- package/src/agent/utils/certificateReject.ts +0 -25
- package/src/agent/utils/createExpirableStore.ts +0 -31
- package/src/agent/utils/expirableStore.ts +0 -47
- package/src/agent/utils/inMemoryExpirableStore.ts +0 -49
- package/src/agent/utils/indexedDBExpirableStore.ts +0 -191
- package/src/agent/utils/leb.ts +0 -14
- package/src/agent/utils/random.ts +0 -30
- package/src/agent/utils/readState.ts +0 -180
- package/src/candid/candid-core.ts +0 -274
- package/src/candid/candid-ui.ts +0 -281
- package/src/candid/idl.ts +0 -2654
- package/src/candid/index.ts +0 -35
- package/src/candid/types.ts +0 -7
- package/src/candid/utils/bigint-math.ts +0 -26
- package/src/candid/utils/buffer.ts +0 -221
- package/src/candid/utils/hash.ts +0 -31
- package/src/candid/utils/leb128.ts +0 -233
- package/src/identity/identity/attributes.ts +0 -91
- package/src/identity/identity/delegation.ts +0 -411
- package/src/identity/identity/ecdsa.ts +0 -162
- package/src/identity/identity/ed25519.ts +0 -246
- package/src/identity/identity/partial.ts +0 -60
- package/src/identity/identity/webauthn.ts +0 -265
- package/src/identity/index.ts +0 -44
- package/src/identity/secp256k1/der.ts +0 -177
- package/src/identity/secp256k1/index.ts +0 -52
- package/src/identity/secp256k1/pem.ts +0 -39
- package/src/identity/secp256k1/secp256k1.ts +0 -276
- package/src/index.ts +0 -3
- package/src/principal/index.ts +0 -19
- package/src/principal/principal.ts +0 -181
- package/src/principal/utils/base32.ts +0 -101
- package/src/principal/utils/getCrc.ts +0 -52
|
@@ -41,19 +41,48 @@ const _principal_1 = require("../../principal/index.js");
|
|
|
41
41
|
const errors_ts_1 = require("../errors.js");
|
|
42
42
|
const certificate_ts_1 = require("../certificate.js");
|
|
43
43
|
const cbor = __importStar(require("../cbor.js"));
|
|
44
|
-
const
|
|
45
|
-
const utils_1 = require("@noble/hashes/utils");
|
|
44
|
+
const utils_js_1 = require("@noble/hashes/utils.js");
|
|
46
45
|
const readState_ts_1 = require("../utils/readState.js");
|
|
47
46
|
// Re-export shared types and functions
|
|
48
47
|
var readState_ts_2 = require("../utils/readState.js");
|
|
49
48
|
Object.defineProperty(exports, "CustomPath", { enumerable: true, get: function () { return readState_ts_2.CustomPath; } });
|
|
50
49
|
Object.defineProperty(exports, "IC_ROOT_SUBNET_ID", { enumerable: true, get: function () { return readState_ts_2.IC_ROOT_SUBNET_ID; } });
|
|
50
|
+
/**
|
|
51
|
+
* Build the {@link KnownPath} for a named (non-`nodeKeys`) subnet status path. `nodeKeys` is handled
|
|
52
|
+
* separately, as its value is derived from the raw certificate.
|
|
53
|
+
* @param path the named subnet status path
|
|
54
|
+
* @param subnetId the subnet the request targets
|
|
55
|
+
*/
|
|
56
|
+
const namedToKnown = (path, subnetId) => {
|
|
57
|
+
switch (path) {
|
|
58
|
+
case 'time':
|
|
59
|
+
return readState_ts_1.StatePaths.time;
|
|
60
|
+
case 'publicKey':
|
|
61
|
+
return readState_ts_1.StatePaths.subnetPublicKey(subnetId);
|
|
62
|
+
case 'canisterRanges':
|
|
63
|
+
return readState_ts_1.StatePaths.subnetCanisterRanges(subnetId);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Translate a user-provided {@link CustomPath} into a {@link KnownPath} that {@link HttpAgent.readState}
|
|
68
|
+
* can encode and decode. A string or single-buffer path names a segment under the subnet subtree.
|
|
69
|
+
* @param custom the user-provided custom path
|
|
70
|
+
* @param subnetId the subnet to scope a simple path to
|
|
71
|
+
*/
|
|
72
|
+
const customToKnown = (custom, subnetId) => {
|
|
73
|
+
const decode = (bytes) => (0, readState_ts_1.decodeValue)(bytes, custom.decodeStrategy);
|
|
74
|
+
if (typeof custom.path === 'string' || custom.path instanceof Uint8Array) {
|
|
75
|
+
return new readState_ts_1.KnownPath(['subnet', subnetId.toUint8Array(), custom.path], decode);
|
|
76
|
+
}
|
|
77
|
+
return new readState_ts_1.KnownPath(custom.path, decode);
|
|
78
|
+
};
|
|
51
79
|
/**
|
|
52
80
|
* Requests information from a subnet's `read_state` endpoint.
|
|
53
81
|
* Can be used to request information about the subnet's time, canister ranges, public key, node keys, and metrics.
|
|
54
82
|
* @param {SubnetStatusOptions} options The configuration for the subnet status request.
|
|
55
83
|
* @see {@link SubnetStatusOptions} for detailed options.
|
|
56
84
|
* @returns {Promise<StatusMap>} A map populated with data from the requested paths. Each path is a key in the map, and the value is the data obtained from the certificate for that path.
|
|
85
|
+
* @deprecated Use {@link HttpAgent.readState} directly with {@link StatePaths} instead. This function will be removed in a future release.
|
|
57
86
|
* @example
|
|
58
87
|
* const status = await subnetStatus.request({
|
|
59
88
|
* subnetId: IC_ROOT_SUBNET_ID,
|
|
@@ -67,91 +96,38 @@ Object.defineProperty(exports, "IC_ROOT_SUBNET_ID", { enumerable: true, get: fun
|
|
|
67
96
|
async function request(options) {
|
|
68
97
|
const { agent, paths, disableCertificateTimeVerification = false } = options;
|
|
69
98
|
const subnetId = _principal_1.Principal.from(options.subnetId);
|
|
70
|
-
const uniquePaths = [...new Set(paths)];
|
|
99
|
+
const uniquePaths = [...new Set(paths ?? [])];
|
|
71
100
|
const status = new Map();
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const rootKey = agent.rootKey;
|
|
80
|
-
const response = await agent.readSubnetState(subnetId, {
|
|
81
|
-
paths: [encodedPath],
|
|
82
|
-
});
|
|
83
|
-
const certificate = await certificate_ts_1.Certificate.create({
|
|
84
|
-
certificate: response.certificate,
|
|
85
|
-
rootKey,
|
|
86
|
-
principal: { subnetId },
|
|
101
|
+
const keyOf = (path) => (typeof path === 'string' ? path : path.key);
|
|
102
|
+
const promises = uniquePaths.map(async (path) => {
|
|
103
|
+
try {
|
|
104
|
+
// The nodeKeys path resolves to per-node public keys, which require parsing the raw certificate.
|
|
105
|
+
if (path === 'nodeKeys') {
|
|
106
|
+
const { verifiedCertificate } = await agent.readState({ subnetId }, {
|
|
107
|
+
paths: [[(0, utils_js_1.utf8ToBytes)('subnet'), subnetId.toUint8Array(), (0, utils_js_1.utf8ToBytes)('node')]],
|
|
87
108
|
disableTimeVerification: disableCertificateTimeVerification,
|
|
88
|
-
agent,
|
|
89
109
|
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
// For node keys, we need to parse the certificate directly
|
|
93
|
-
const data = (0, readState_ts_1.lookupNodeKeysFromCertificate)(cert.cert, subnetId);
|
|
94
|
-
return {
|
|
95
|
-
path: lookupPath,
|
|
96
|
-
data,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
return {
|
|
100
|
-
path: lookupPath,
|
|
101
|
-
data: (0, certificate_ts_1.lookupResultToBuffer)(cert.lookup_path(encodedPath)),
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
const { path, data } = lookup(certificate, uniquePaths[index]);
|
|
105
|
-
if (!data) {
|
|
106
|
-
if (typeof path === 'string') {
|
|
107
|
-
status.set(path, null);
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
status.set(path.key, null);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
switch (path) {
|
|
115
|
-
case 'time': {
|
|
116
|
-
status.set(path, (0, leb_ts_1.decodeTime)(data));
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
case 'canisterRanges': {
|
|
120
|
-
status.set(path, (0, certificate_ts_1.decodeCanisterRanges)(data));
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
case 'publicKey': {
|
|
124
|
-
status.set(path, data);
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
case 'nodeKeys': {
|
|
128
|
-
status.set(path, data);
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
default: {
|
|
132
|
-
// Check for CustomPath signature
|
|
133
|
-
if ((0, readState_ts_1.isCustomPath)(path)) {
|
|
134
|
-
status.set(path.key, (0, readState_ts_1.decodeValue)(data, path.decodeStrategy));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
110
|
+
status.set('nodeKeys', (0, readState_ts_1.lookupNodeKeysFromCertificate)(verifiedCertificate.cert, subnetId));
|
|
111
|
+
return;
|
|
139
112
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
113
|
+
// Translate to a KnownPath and let readState encode and decode it.
|
|
114
|
+
const known = typeof path === 'string' ? namedToKnown(path, subnetId) : customToKnown(path, subnetId);
|
|
115
|
+
const { values } = await agent.readState({ subnetId }, {
|
|
116
|
+
paths: [known],
|
|
117
|
+
disableTimeVerification: disableCertificateTimeVerification,
|
|
118
|
+
});
|
|
119
|
+
status.set(keyOf(path), values.get(known));
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
// Throw on certificate errors
|
|
123
|
+
if (error instanceof errors_ts_1.AgentError &&
|
|
124
|
+
(error.hasCode(errors_ts_1.CertificateVerificationErrorCode) ||
|
|
125
|
+
error.hasCode(errors_ts_1.CertificateTimeErrorCode) ||
|
|
126
|
+
error.hasCode(errors_ts_1.MissingRootKeyErrorCode))) {
|
|
127
|
+
throw error;
|
|
153
128
|
}
|
|
154
|
-
|
|
129
|
+
status.set(keyOf(path), null);
|
|
130
|
+
}
|
|
155
131
|
});
|
|
156
132
|
// Fetch all values separately, as each option can fail
|
|
157
133
|
await Promise.all(promises);
|
|
@@ -182,6 +158,7 @@ function lookupSubnetPublicKey(certificate, subnetId) {
|
|
|
182
158
|
}
|
|
183
159
|
/**
|
|
184
160
|
* Encode a path for subnet state queries
|
|
161
|
+
* @deprecated Use {@link HttpAgent.readState} directly with {@link StatePaths} instead
|
|
185
162
|
* @param path the path to encode
|
|
186
163
|
* @param subnetId the subnet ID
|
|
187
164
|
* @returns the encoded path as an array of Uint8Arrays
|
|
@@ -190,20 +167,20 @@ function encodePath(path, subnetId) {
|
|
|
190
167
|
const subnetUint8Array = subnetId.toUint8Array();
|
|
191
168
|
switch (path) {
|
|
192
169
|
case 'time':
|
|
193
|
-
return [(0,
|
|
170
|
+
return [(0, utils_js_1.utf8ToBytes)('time')];
|
|
194
171
|
case 'canisterRanges':
|
|
195
|
-
return [(0,
|
|
172
|
+
return [(0, utils_js_1.utf8ToBytes)('subnet'), subnetUint8Array, (0, utils_js_1.utf8ToBytes)('canister_ranges')];
|
|
196
173
|
case 'publicKey':
|
|
197
|
-
return [(0,
|
|
174
|
+
return [(0, utils_js_1.utf8ToBytes)('subnet'), subnetUint8Array, (0, utils_js_1.utf8ToBytes)('public_key')];
|
|
198
175
|
case 'nodeKeys':
|
|
199
|
-
return [(0,
|
|
176
|
+
return [(0, utils_js_1.utf8ToBytes)('subnet'), subnetUint8Array, (0, utils_js_1.utf8ToBytes)('node')];
|
|
200
177
|
default: {
|
|
201
178
|
// Check for CustomPath signature
|
|
202
179
|
if ((0, readState_ts_1.isCustomPath)(path)) {
|
|
203
180
|
if (typeof path['path'] === 'string' || path['path'] instanceof Uint8Array) {
|
|
204
181
|
// For string paths, treat as a subnet path segment
|
|
205
|
-
const encoded = typeof path['path'] === 'string' ? (0,
|
|
206
|
-
return [(0,
|
|
182
|
+
const encoded = typeof path['path'] === 'string' ? (0, utils_js_1.utf8ToBytes)(path['path']) : path['path'];
|
|
183
|
+
return [(0, utils_js_1.utf8ToBytes)('subnet'), subnetUint8Array, encoded];
|
|
207
184
|
}
|
|
208
185
|
// For non-simple paths, return the provided custom path
|
|
209
186
|
return path['path'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/agent/subnetStatus/index.ts"],"names":[],"mappings":";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CAAC,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,UAAU,EAAE,CAAC;oBAC3E,mDAAmD;oBACnD,MAAM,OAAO,GACX,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAA,sBAAW,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBAC9E,OAAO,CAAC,IAAA,sBAAW,EAAC,QAAQ,CAAC,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC;gBAC5D,CAAC;gBACD,wDAAwD;gBACxD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;YACtB,CAAC;QACH,CAAC;IACH,CAAC;IACD,MAAM,wBAAY,CAAC,QAAQ,CACzB,IAAI,+BAAmB,CACrB,kFAAkF,IAAI,2BAA2B,CAClH,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bls.d.ts","sourceRoot":"","sources":["../../../../src/agent/utils/bls.ts"],"names":[],"mappings":"AAGA,eAAO,IAAI,MAAM,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,KAAK,OAAO,CAAC;AAEjF;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"bls.d.ts","sourceRoot":"","sources":["../../../../src/agent/utils/bls.ts"],"names":[],"mappings":"AAGA,eAAO,IAAI,MAAM,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,KAAK,OAAO,CAAC;AAEjF;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAMnF"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.verify = void 0;
|
|
4
4
|
exports.blsVerify = blsVerify;
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const bls12_381_js_1 = require("@noble/curves/bls12-381.js");
|
|
6
|
+
const utils_js_1 = require("@noble/hashes/utils.js");
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
9
|
* @param pk primary key: Uint8Array
|
|
@@ -12,9 +12,10 @@ const utils_1 = require("@noble/hashes/utils");
|
|
|
12
12
|
* @returns boolean
|
|
13
13
|
*/
|
|
14
14
|
function blsVerify(pk, sig, msg) {
|
|
15
|
-
const primaryKey = typeof pk === 'string' ?
|
|
16
|
-
const signature = typeof sig === 'string' ?
|
|
17
|
-
const message = typeof msg === 'string' ?
|
|
18
|
-
|
|
15
|
+
const primaryKey = typeof pk === 'string' ? (0, utils_js_1.hexToBytes)(pk) : pk;
|
|
16
|
+
const signature = typeof sig === 'string' ? (0, utils_js_1.hexToBytes)(sig) : sig;
|
|
17
|
+
const message = typeof msg === 'string' ? (0, utils_js_1.hexToBytes)(msg) : msg;
|
|
18
|
+
const blss = bls12_381_js_1.bls12_381.shortSignatures;
|
|
19
|
+
return blss.verify(signature, blss.hash(message), primaryKey);
|
|
19
20
|
}
|
|
20
21
|
//# sourceMappingURL=bls.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bls.js","sourceRoot":"","sources":["../../../../src/agent/utils/bls.ts"],"names":[],"mappings":";;;AAYA,
|
|
1
|
+
{"version":3,"file":"bls.js","sourceRoot":"","sources":["../../../../src/agent/utils/bls.ts"],"names":[],"mappings":";;;AAYA,8BAMC;AAlBD,6DAAuD;AACvD,qDAAoD;AAIpD;;;;;;GAMG;AACH,SAAgB,SAAS,CAAC,EAAc,EAAE,GAAe,EAAE,GAAe;IACxE,MAAM,UAAU,GAAG,OAAO,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAA,qBAAU,EAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAChE,MAAM,SAAS,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAA,qBAAU,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAClE,MAAM,OAAO,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAA,qBAAU,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAChE,MAAM,IAAI,GAAG,wBAAS,CAAC,eAAe,CAAC;IACvC,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Principal } from '../../principal/index.js';
|
|
2
2
|
import type { DerEncodedPublicKey } from '../auth.ts';
|
|
3
|
-
import { type Cert } from '../certificate.ts';
|
|
3
|
+
import { type Cert, type CanisterRanges } from '../certificate.ts';
|
|
4
4
|
/**
|
|
5
5
|
* The root subnet ID for IC mainnet
|
|
6
6
|
*/
|
|
@@ -29,21 +29,117 @@ export interface BaseSubnetStatus {
|
|
|
29
29
|
*/
|
|
30
30
|
export type BaseStatus = string | Uint8Array | Date | Uint8Array[] | Principal[] | bigint | null;
|
|
31
31
|
/**
|
|
32
|
-
* Decode strategy for
|
|
32
|
+
* Decode strategy for a {@link CustomPath}. `'raw'` returns the looked-up bytes unchanged.
|
|
33
33
|
*/
|
|
34
34
|
export type DecodeStrategy = 'cbor' | 'hex' | 'leb128' | 'utf-8' | 'raw';
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* A strongly-typed, structured `read_state` path.
|
|
37
|
+
*
|
|
38
|
+
* Builders for the well-known paths are available on {@link StatePaths}, e.g. {@link StatePaths.time}
|
|
39
|
+
* is a `KnownPath<Date>` and {@link StatePaths.canisterControllers} builds a `KnownPath<Principal[]>`
|
|
40
|
+
* for a given canister. Construct your own for arbitrary paths: `path` is the fully-formed sequence
|
|
41
|
+
* of label segments (strings are UTF-8 encoded), including any `['canister', <id>]` or
|
|
42
|
+
* `['subnet', <id>]` prefix.
|
|
43
|
+
*
|
|
44
|
+
* The value at the path is decoded with the `decode` function, and looked up from the response
|
|
45
|
+
* by passing the instance to {@link StateValues.get}.
|
|
46
|
+
* @template T the type produced by decoding the value at this path
|
|
47
|
+
*/
|
|
48
|
+
export declare class KnownPath<T> {
|
|
49
|
+
readonly decode: (bytes: Uint8Array) => T;
|
|
50
|
+
/**
|
|
51
|
+
* A unique token identifying this path in {@link StateValues}.
|
|
52
|
+
*/
|
|
53
|
+
readonly key: symbol;
|
|
54
|
+
readonly path: Uint8Array[];
|
|
55
|
+
constructor(path: (Uint8Array | string)[] | Uint8Array | string, decode: (bytes: Uint8Array) => T);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A `read_state` path defined by the user, with a string {@link DecodeStrategy}. Consumed by the
|
|
59
|
+
* status utilities (e.g. `CanisterStatus.request`), which translate it into a {@link KnownPath}
|
|
60
|
+
* before calling `Agent.readState`.
|
|
37
61
|
* @param {string} key the key to use to access the returned value in the status map
|
|
38
|
-
* @param {Uint8Array[]} path the path to the desired value
|
|
39
|
-
* @param {
|
|
62
|
+
* @param {Uint8Array[] | Uint8Array | string} path the path to the desired value
|
|
63
|
+
* @param {DecodeStrategy} decodeStrategy the strategy used to decode the returned value
|
|
64
|
+
* @deprecated Use {@link KnownPath} with `Agent.readState` instead.
|
|
40
65
|
*/
|
|
41
|
-
export declare class CustomPath
|
|
66
|
+
export declare class CustomPath {
|
|
42
67
|
key: string;
|
|
43
|
-
path: Uint8Array[] | string;
|
|
68
|
+
path: Uint8Array[] | Uint8Array | string;
|
|
44
69
|
decodeStrategy: DecodeStrategy;
|
|
45
|
-
constructor(key: string, path: Uint8Array[] | string, decodeStrategy: DecodeStrategy);
|
|
70
|
+
constructor(key: string, path: Uint8Array[] | Uint8Array | string, decodeStrategy: DecodeStrategy);
|
|
46
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* A path to read from the `read_state` endpoint.
|
|
74
|
+
*
|
|
75
|
+
* May be a {@link KnownPath} (see {@link StatePaths} for the well-known ones) or a raw encoded
|
|
76
|
+
* path (an array of buffers) which is passed through unchanged.
|
|
77
|
+
* `Agent.readState` accepts these directly, encoding them internally.
|
|
78
|
+
*/
|
|
79
|
+
export type Path = KnownPath<unknown> | Uint8Array[];
|
|
80
|
+
/**
|
|
81
|
+
* Builders for the well-known state paths, producing {@link KnownPath}s accepted directly
|
|
82
|
+
* by `Agent.readState`.
|
|
83
|
+
*
|
|
84
|
+
* The `canister*` and `subnet*` entries are functions taking the target ID, since it is baked into
|
|
85
|
+
* the path. Pass the `subnet*` paths when reading state from a subnet (`readState({ subnetId }, …)`)
|
|
86
|
+
* and the `canister*` paths when reading from a canister.
|
|
87
|
+
*/
|
|
88
|
+
export declare const StatePaths: {
|
|
89
|
+
/** The canister's or subnet's time, as a {@link Date}. */
|
|
90
|
+
readonly time: KnownPath<Date>;
|
|
91
|
+
/**
|
|
92
|
+
* The given canister's controllers, as {@link Principal}s.
|
|
93
|
+
* @param canisterId the canister to scope the path to
|
|
94
|
+
*/
|
|
95
|
+
readonly canisterControllers: (canisterId: Principal) => KnownPath<Principal[]>;
|
|
96
|
+
/**
|
|
97
|
+
* The given canister's module hash.
|
|
98
|
+
* @param canisterId the canister to scope the path to
|
|
99
|
+
*/
|
|
100
|
+
readonly canisterModuleHash: (canisterId: Principal) => KnownPath<Uint8Array>;
|
|
101
|
+
/**
|
|
102
|
+
* The given canister's `candid:service` metadata, as a UTF-8 string.
|
|
103
|
+
* @param canisterId the canister to scope the path to
|
|
104
|
+
*/
|
|
105
|
+
readonly canisterCandid: (canisterId: Principal) => KnownPath<string>;
|
|
106
|
+
/**
|
|
107
|
+
* The given canister's metadata entry, as a UTF-8 string.
|
|
108
|
+
* @param canisterId the canister to scope the path to
|
|
109
|
+
* @param key the metadata key to read
|
|
110
|
+
*/
|
|
111
|
+
readonly canisterMetadataString: (canisterId: Principal, key: string) => KnownPath<string>;
|
|
112
|
+
/**
|
|
113
|
+
* The given subnet's canister ID ranges.
|
|
114
|
+
* @param subnetId the subnet to scope the path to
|
|
115
|
+
*/
|
|
116
|
+
readonly subnetCanisterRanges: (subnetId: Principal) => KnownPath<CanisterRanges>;
|
|
117
|
+
/**
|
|
118
|
+
* The given subnet's public key, as raw bytes.
|
|
119
|
+
* @param subnetId the subnet to scope the path to
|
|
120
|
+
*/
|
|
121
|
+
readonly subnetPublicKey: (subnetId: Principal) => KnownPath<Uint8Array>;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* The decoded values returned by `Agent.readState`, keyed by {@link KnownPath}.
|
|
125
|
+
* Look values up by passing the same {@link KnownPath} instance that
|
|
126
|
+
* was requested; the return type follows the path's type parameter.
|
|
127
|
+
*/
|
|
128
|
+
export declare class StateValues {
|
|
129
|
+
#private;
|
|
130
|
+
constructor(values?: Map<symbol, unknown>);
|
|
131
|
+
/**
|
|
132
|
+
* The decoded value for `path`, or `null` if it was absent from the certificate or not requested.
|
|
133
|
+
* @param path the {@link KnownPath} whose value to read
|
|
134
|
+
*/
|
|
135
|
+
get<T>(path: KnownPath<T>): T | null;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Encode a {@link Path} into the raw path expected by the `read_state` endpoint.
|
|
139
|
+
* @param path the path to encode
|
|
140
|
+
* @returns the encoded path, as an array of buffers
|
|
141
|
+
*/
|
|
142
|
+
export declare function encodePath(path: Path): Uint8Array[];
|
|
47
143
|
/**
|
|
48
144
|
* Decode a value based on the specified strategy
|
|
49
145
|
* @param data the raw data to decode
|
|
@@ -57,13 +153,6 @@ export declare function decodeValue(data: Uint8Array, strategy: DecodeStrategy):
|
|
|
57
153
|
* @returns an array of principal IDs
|
|
58
154
|
*/
|
|
59
155
|
export declare function decodeControllers(buf: Uint8Array): Principal[];
|
|
60
|
-
/**
|
|
61
|
-
* Encode a metadata path for canister metadata queries
|
|
62
|
-
* @param metaPath the metadata path (string or Uint8Array)
|
|
63
|
-
* @param canisterUint8Array the canister ID as Uint8Array
|
|
64
|
-
* @returns the encoded path
|
|
65
|
-
*/
|
|
66
|
-
export declare function encodeMetadataPath(metaPath: string | Uint8Array, canisterUint8Array: Uint8Array): Uint8Array[];
|
|
67
156
|
/**
|
|
68
157
|
* Check if a path object has custom path signature (has 'key' and 'path' properties)
|
|
69
158
|
* @param path the path to check
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readState.d.ts","sourceRoot":"","sources":["../../../../src/agent/utils/readState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EACL,KAAK,IAAI,
|
|
1
|
+
{"version":3,"file":"readState.d.ts","sourceRoot":"","sources":["../../../../src/agent/utils/readState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EACL,KAAK,IAAI,EACT,KAAK,cAAc,EAQpB,MAAM,mBAAmB,CAAC;AAS3B;;GAEG;AACH,eAAO,MAAM,iBAAiB,WAE7B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,cAAc,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB;AAED;;;GAGG;AACH,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AAC,MAAM,CAAC;IAI/E;;;OAGG;8CAC8B,SAAS,KAAG,SAAS,CAAC,cAAc,CAAC;IAEtE;;;OAGG;yCACyB,SAAS,KAAG,SAAS,CAAC,UAAU,CAAC;CAErD,CAAC;AAEX;;;;GAIG;AACH,qBAAa,WAAW;;gBAEV,MAAM,GAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAa;IAIpD;;;OAGG;IACH,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI;CAGrC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,UAAU,EAAE,CAGnD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,GAAG,UAAU,CAalF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,EAAE,CAK9D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAEnF;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,IAAI,EACjB,QAAQ,EAAE,SAAS,GAClB,cAAc,CAoChB"}
|
|
@@ -33,16 +33,16 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.CustomPath = exports.IC_ROOT_SUBNET_ID = void 0;
|
|
36
|
+
exports.StateValues = exports.StatePaths = exports.CustomPath = exports.KnownPath = exports.IC_ROOT_SUBNET_ID = void 0;
|
|
37
|
+
exports.encodePath = encodePath;
|
|
37
38
|
exports.decodeValue = decodeValue;
|
|
38
39
|
exports.decodeControllers = decodeControllers;
|
|
39
|
-
exports.encodeMetadataPath = encodeMetadataPath;
|
|
40
40
|
exports.isCustomPath = isCustomPath;
|
|
41
41
|
exports.lookupNodeKeysFromCertificate = lookupNodeKeysFromCertificate;
|
|
42
42
|
const _principal_1 = require("../../principal/index.js");
|
|
43
43
|
const cbor = __importStar(require("../cbor.js"));
|
|
44
44
|
const leb_ts_1 = require("../utils/leb.js");
|
|
45
|
-
const
|
|
45
|
+
const utils_js_1 = require("@noble/hashes/utils.js");
|
|
46
46
|
const certificate_ts_1 = require("../certificate.js");
|
|
47
47
|
const errors_ts_1 = require("../errors.js");
|
|
48
48
|
/**
|
|
@@ -50,10 +50,38 @@ const errors_ts_1 = require("../errors.js");
|
|
|
50
50
|
*/
|
|
51
51
|
exports.IC_ROOT_SUBNET_ID = _principal_1.Principal.fromText('tdb26-jop6k-aogll-7ltgs-eruif-6kk7m-qpktf-gdiqx-mxtrf-vb5e6-eqe');
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* A strongly-typed, structured `read_state` path.
|
|
54
|
+
*
|
|
55
|
+
* Builders for the well-known paths are available on {@link StatePaths}, e.g. {@link StatePaths.time}
|
|
56
|
+
* is a `KnownPath<Date>` and {@link StatePaths.canisterControllers} builds a `KnownPath<Principal[]>`
|
|
57
|
+
* for a given canister. Construct your own for arbitrary paths: `path` is the fully-formed sequence
|
|
58
|
+
* of label segments (strings are UTF-8 encoded), including any `['canister', <id>]` or
|
|
59
|
+
* `['subnet', <id>]` prefix.
|
|
60
|
+
*
|
|
61
|
+
* The value at the path is decoded with the `decode` function, and looked up from the response
|
|
62
|
+
* by passing the instance to {@link StateValues.get}.
|
|
63
|
+
* @template T the type produced by decoding the value at this path
|
|
64
|
+
*/
|
|
65
|
+
class KnownPath {
|
|
66
|
+
constructor(path, decode) {
|
|
67
|
+
this.decode = decode;
|
|
68
|
+
/**
|
|
69
|
+
* A unique token identifying this path in {@link StateValues}.
|
|
70
|
+
*/
|
|
71
|
+
this.key = Symbol();
|
|
72
|
+
const segments = Array.isArray(path) ? path : [path];
|
|
73
|
+
this.path = segments.map(segment => typeof segment === 'string' ? (0, utils_js_1.utf8ToBytes)(segment) : segment);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.KnownPath = KnownPath;
|
|
77
|
+
/**
|
|
78
|
+
* A `read_state` path defined by the user, with a string {@link DecodeStrategy}. Consumed by the
|
|
79
|
+
* status utilities (e.g. `CanisterStatus.request`), which translate it into a {@link KnownPath}
|
|
80
|
+
* before calling `Agent.readState`.
|
|
54
81
|
* @param {string} key the key to use to access the returned value in the status map
|
|
55
|
-
* @param {Uint8Array[]} path the path to the desired value
|
|
56
|
-
* @param {
|
|
82
|
+
* @param {Uint8Array[] | Uint8Array | string} path the path to the desired value
|
|
83
|
+
* @param {DecodeStrategy} decodeStrategy the strategy used to decode the returned value
|
|
84
|
+
* @deprecated Use {@link KnownPath} with `Agent.readState` instead.
|
|
57
85
|
*/
|
|
58
86
|
class CustomPath {
|
|
59
87
|
constructor(key, path, decodeStrategy) {
|
|
@@ -63,6 +91,77 @@ class CustomPath {
|
|
|
63
91
|
}
|
|
64
92
|
}
|
|
65
93
|
exports.CustomPath = CustomPath;
|
|
94
|
+
/**
|
|
95
|
+
* Builders for the well-known state paths, producing {@link KnownPath}s accepted directly
|
|
96
|
+
* by `Agent.readState`.
|
|
97
|
+
*
|
|
98
|
+
* The `canister*` and `subnet*` entries are functions taking the target ID, since it is baked into
|
|
99
|
+
* the path. Pass the `subnet*` paths when reading state from a subnet (`readState({ subnetId }, …)`)
|
|
100
|
+
* and the `canister*` paths when reading from a canister.
|
|
101
|
+
*/
|
|
102
|
+
exports.StatePaths = {
|
|
103
|
+
/** The canister's or subnet's time, as a {@link Date}. */
|
|
104
|
+
time: new KnownPath(['time'], leb_ts_1.decodeTime),
|
|
105
|
+
/**
|
|
106
|
+
* The given canister's controllers, as {@link Principal}s.
|
|
107
|
+
* @param canisterId the canister to scope the path to
|
|
108
|
+
*/
|
|
109
|
+
canisterControllers: (canisterId) => new KnownPath(['canister', canisterId.toUint8Array(), 'controllers'], decodeControllers),
|
|
110
|
+
/**
|
|
111
|
+
* The given canister's module hash.
|
|
112
|
+
* @param canisterId the canister to scope the path to
|
|
113
|
+
*/
|
|
114
|
+
canisterModuleHash: (canisterId) => new KnownPath(['canister', canisterId.toUint8Array(), 'module_hash'], x => x),
|
|
115
|
+
/**
|
|
116
|
+
* The given canister's `candid:service` metadata, as a UTF-8 string.
|
|
117
|
+
* @param canisterId the canister to scope the path to
|
|
118
|
+
*/
|
|
119
|
+
canisterCandid: (canisterId) => exports.StatePaths.canisterMetadataString(canisterId, 'candid:service'),
|
|
120
|
+
/**
|
|
121
|
+
* The given canister's metadata entry, as a UTF-8 string.
|
|
122
|
+
* @param canisterId the canister to scope the path to
|
|
123
|
+
* @param key the metadata key to read
|
|
124
|
+
*/
|
|
125
|
+
canisterMetadataString: (canisterId, key) => new KnownPath(['canister', canisterId.toUint8Array(), 'metadata', key], bytes => new TextDecoder().decode(bytes)),
|
|
126
|
+
/**
|
|
127
|
+
* The given subnet's canister ID ranges.
|
|
128
|
+
* @param subnetId the subnet to scope the path to
|
|
129
|
+
*/
|
|
130
|
+
subnetCanisterRanges: (subnetId) => new KnownPath(['subnet', subnetId.toUint8Array(), 'canister_ranges'], certificate_ts_1.decodeCanisterRanges),
|
|
131
|
+
/**
|
|
132
|
+
* The given subnet's public key, as raw bytes.
|
|
133
|
+
* @param subnetId the subnet to scope the path to
|
|
134
|
+
*/
|
|
135
|
+
subnetPublicKey: (subnetId) => new KnownPath(['subnet', subnetId.toUint8Array(), 'public_key'], bytes => bytes),
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* The decoded values returned by `Agent.readState`, keyed by {@link KnownPath}.
|
|
139
|
+
* Look values up by passing the same {@link KnownPath} instance that
|
|
140
|
+
* was requested; the return type follows the path's type parameter.
|
|
141
|
+
*/
|
|
142
|
+
class StateValues {
|
|
143
|
+
#values;
|
|
144
|
+
constructor(values = new Map()) {
|
|
145
|
+
this.#values = values;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The decoded value for `path`, or `null` if it was absent from the certificate or not requested.
|
|
149
|
+
* @param path the {@link KnownPath} whose value to read
|
|
150
|
+
*/
|
|
151
|
+
get(path) {
|
|
152
|
+
return (this.#values.get(path.key) ?? null);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
exports.StateValues = StateValues;
|
|
156
|
+
/**
|
|
157
|
+
* Encode a {@link Path} into the raw path expected by the `read_state` endpoint.
|
|
158
|
+
* @param path the path to encode
|
|
159
|
+
* @returns the encoded path, as an array of buffers
|
|
160
|
+
*/
|
|
161
|
+
function encodePath(path) {
|
|
162
|
+
// A raw encoded path passes through unchanged; a KnownPath is already fully-formed.
|
|
163
|
+
return Array.isArray(path) ? path : path.path;
|
|
164
|
+
}
|
|
66
165
|
/**
|
|
67
166
|
* Decode a value based on the specified strategy
|
|
68
167
|
* @param data the raw data to decode
|
|
@@ -78,7 +177,7 @@ function decodeValue(data, strategy) {
|
|
|
78
177
|
case 'cbor':
|
|
79
178
|
return cbor.decode(data);
|
|
80
179
|
case 'hex':
|
|
81
|
-
return (0,
|
|
180
|
+
return (0, utils_js_1.bytesToHex)(data);
|
|
82
181
|
case 'utf-8':
|
|
83
182
|
return new TextDecoder().decode(data);
|
|
84
183
|
}
|
|
@@ -94,16 +193,6 @@ function decodeControllers(buf) {
|
|
|
94
193
|
return _principal_1.Principal.fromUint8Array(buf);
|
|
95
194
|
});
|
|
96
195
|
}
|
|
97
|
-
/**
|
|
98
|
-
* Encode a metadata path for canister metadata queries
|
|
99
|
-
* @param metaPath the metadata path (string or Uint8Array)
|
|
100
|
-
* @param canisterUint8Array the canister ID as Uint8Array
|
|
101
|
-
* @returns the encoded path
|
|
102
|
-
*/
|
|
103
|
-
function encodeMetadataPath(metaPath, canisterUint8Array) {
|
|
104
|
-
const encoded = typeof metaPath === 'string' ? (0, utils_1.utf8ToBytes)(metaPath) : metaPath;
|
|
105
|
-
return [(0, utils_1.utf8ToBytes)('canister'), canisterUint8Array, (0, utils_1.utf8ToBytes)('metadata'), encoded];
|
|
106
|
-
}
|
|
107
196
|
/**
|
|
108
197
|
* Check if a path object has custom path signature (has 'key' and 'path' properties)
|
|
109
198
|
* @param path the path to check
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readState.js","sourceRoot":"","sources":["../../../../src/agent/utils/readState.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"readState.js","sourceRoot":"","sources":["../../../../src/agent/utils/readState.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0MA,gCAGC;AAQD,kCAaC;AAOD,8CAKC;AAOD,oCAEC;AASD,sEAuCC;AAvSD,2CAAuC;AACvC,iDAAmC;AACnC,4CAA2D;AAC3D,qDAAiE;AAEjE,sDAU2B;AAC3B,4CAMsB;AAEtB;;GAEG;AACU,QAAA,iBAAiB,GAAG,sBAAS,CAAC,QAAQ,CACjD,iEAAiE,CAClE,CAAC;AAiCF;;;;;;;;;;;;GAYG;AACH,MAAa,SAAS;IAMpB,YACE,IAAmD,EACnC,MAAgC;QAAhC,WAAM,GAAN,MAAM,CAA0B;QAPlD;;WAEG;QACa,QAAG,GAAW,MAAM,EAAE,CAAC;QAMrC,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CACjC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAA,sBAAW,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAC7D,CAAC;IACJ,CAAC;C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