@hashgraphonline/standards-sdk 0.1.146-chore-jsr-improvements.canary.74bacb9.89 → 0.1.146-chore-jsr-improvements.canary.46c0c0f.91
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/dist/cjs/jsr-entry.d.ts +31 -11
- package/dist/cjs/jsr-entry.d.ts.map +1 -1
- package/dist/es/jsr-entry.d.ts +31 -11
- package/dist/es/jsr-entry.d.ts.map +1 -1
- package/dist/es/standards-sdk.es127.js +1 -1
- package/dist/es/standards-sdk.es130.js +1 -1
- package/dist/es/standards-sdk.es137.js +1 -1
- package/dist/es/standards-sdk.es151.js +15 -54
- package/dist/es/standards-sdk.es151.js.map +1 -1
- package/dist/es/standards-sdk.es152.js +48 -76
- package/dist/es/standards-sdk.es152.js.map +1 -1
- package/dist/es/standards-sdk.es153.js +82 -15
- package/dist/es/standards-sdk.es153.js.map +1 -1
- package/dist/es/standards-sdk.es56.js +1 -1
- package/dist/es/standards-sdk.es58.js +1 -1
- package/dist/es/standards-sdk.es59.js +1 -1
- package/dist/es/standards-sdk.es62.js +1 -1
- package/dist/es/standards-sdk.es64.js +1 -1
- package/dist/es/standards-sdk.es65.js +1 -1
- package/package.json +1 -1
package/dist/cjs/jsr-entry.d.ts
CHANGED
|
@@ -1,16 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* JSR
|
|
2
|
+
* JSR entry point for @hol-org/standards-sdk
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Full SDK for Hashgraph Consensus Standards including:
|
|
5
|
+
* - HCS-10: Agent Communication
|
|
6
|
+
* - HCS-11: Profiles & Identity
|
|
7
|
+
* - HCS-15: Petals (Profile Accounts)
|
|
8
|
+
* - HCS-16: Floras (AppNet Accounts)
|
|
9
|
+
* - Registry Broker Client
|
|
10
|
+
* - Inscribe utilities
|
|
11
|
+
* - And more
|
|
6
12
|
*
|
|
7
|
-
* For
|
|
8
|
-
*
|
|
13
|
+
* For npm:
|
|
14
|
+
* npm install @hashgraphonline/standards-sdk
|
|
9
15
|
*/
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
+
export * from './hcs-2';
|
|
17
|
+
export * from './hcs-3/src';
|
|
18
|
+
export * from './hcs-5';
|
|
19
|
+
export * from './hcs-6';
|
|
20
|
+
export * from './hcs-7';
|
|
21
|
+
export * from './hcs-10';
|
|
22
|
+
export * from './hcs-11';
|
|
23
|
+
export * from './hcs-12';
|
|
24
|
+
export * from './hcs-14';
|
|
25
|
+
export * from './hcs-15';
|
|
26
|
+
export * from './hcs-16';
|
|
27
|
+
export * from './hcs-17';
|
|
28
|
+
export * from './hcs-18';
|
|
29
|
+
export * from './hcs-20';
|
|
30
|
+
export * from './hcs-21';
|
|
31
|
+
export * from './utils';
|
|
32
|
+
export * from './inscribe';
|
|
33
|
+
export * from './services';
|
|
34
|
+
export * from './fees';
|
|
35
|
+
export * from './content-store';
|
|
16
36
|
//# sourceMappingURL=jsr-entry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsr-entry.d.ts","sourceRoot":"","sources":["../../src/jsr-entry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"jsr-entry.d.ts","sourceRoot":"","sources":["../../src/jsr-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AAGzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC"}
|
package/dist/es/jsr-entry.d.ts
CHANGED
|
@@ -1,16 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* JSR
|
|
2
|
+
* JSR entry point for @hol-org/standards-sdk
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Full SDK for Hashgraph Consensus Standards including:
|
|
5
|
+
* - HCS-10: Agent Communication
|
|
6
|
+
* - HCS-11: Profiles & Identity
|
|
7
|
+
* - HCS-15: Petals (Profile Accounts)
|
|
8
|
+
* - HCS-16: Floras (AppNet Accounts)
|
|
9
|
+
* - Registry Broker Client
|
|
10
|
+
* - Inscribe utilities
|
|
11
|
+
* - And more
|
|
6
12
|
*
|
|
7
|
-
* For
|
|
8
|
-
*
|
|
13
|
+
* For npm:
|
|
14
|
+
* npm install @hashgraphonline/standards-sdk
|
|
9
15
|
*/
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
+
export * from './hcs-2';
|
|
17
|
+
export * from './hcs-3/src';
|
|
18
|
+
export * from './hcs-5';
|
|
19
|
+
export * from './hcs-6';
|
|
20
|
+
export * from './hcs-7';
|
|
21
|
+
export * from './hcs-10';
|
|
22
|
+
export * from './hcs-11';
|
|
23
|
+
export * from './hcs-12';
|
|
24
|
+
export * from './hcs-14';
|
|
25
|
+
export * from './hcs-15';
|
|
26
|
+
export * from './hcs-16';
|
|
27
|
+
export * from './hcs-17';
|
|
28
|
+
export * from './hcs-18';
|
|
29
|
+
export * from './hcs-20';
|
|
30
|
+
export * from './hcs-21';
|
|
31
|
+
export * from './utils';
|
|
32
|
+
export * from './inscribe';
|
|
33
|
+
export * from './services';
|
|
34
|
+
export * from './fees';
|
|
35
|
+
export * from './content-store';
|
|
16
36
|
//# sourceMappingURL=jsr-entry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsr-entry.d.ts","sourceRoot":"","sources":["../../src/jsr-entry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"jsr-entry.d.ts","sourceRoot":"","sources":["../../src/jsr-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AAGzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { Buffer } from "buffer";
|
|
|
3
3
|
import { randomBytes } from "crypto";
|
|
4
4
|
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
5
5
|
import { registerEncryptionKeyResponseSchema } from "./standards-sdk.es149.js";
|
|
6
|
-
import { optionalImport } from "./standards-sdk.
|
|
6
|
+
import { optionalImport } from "./standards-sdk.es153.js";
|
|
7
7
|
import { RegistryBrokerClient } from "./standards-sdk.es135.js";
|
|
8
8
|
const getFs = async () => {
|
|
9
9
|
const fsModule = await optionalImport("node:fs");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { creditPurchaseResponseSchema, x402MinimumsResponseSchema, x402CreditPurchaseResponseSchema } from "./standards-sdk.es149.js";
|
|
2
2
|
import { RegistryBrokerClient } from "./standards-sdk.es135.js";
|
|
3
3
|
import { normalizeHexPrivateKey } from "./standards-sdk.es160.js";
|
|
4
|
-
import { optionalImport } from "./standards-sdk.
|
|
4
|
+
import { optionalImport } from "./standards-sdk.es153.js";
|
|
5
5
|
async function loadX402Dependencies(client) {
|
|
6
6
|
const [{ default: axios }, x402Axios, x402Types] = await Promise.all([
|
|
7
7
|
import("axios"),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { optionalImport, optionalImportSync } from "./standards-sdk.
|
|
1
|
+
import { optionalImport, optionalImportSync } from "./standards-sdk.es153.js";
|
|
2
2
|
const unsupported = (method) => new Error(`${method} is not supported by the in-memory signer`);
|
|
3
3
|
let cachedSdk = null;
|
|
4
4
|
const loadHashgraphSdk = () => {
|
|
@@ -1,59 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
while (carry > 0) {
|
|
17
|
-
digits.push(carry % BASE);
|
|
18
|
-
carry = carry / BASE | 0;
|
|
19
|
-
}
|
|
1
|
+
import { Logger } from "./standards-sdk.es105.js";
|
|
2
|
+
import { HederaMirrorNode } from "./standards-sdk.es126.js";
|
|
3
|
+
class HCS5BaseClient {
|
|
4
|
+
/**
|
|
5
|
+
* Create a new HCS-5 base client
|
|
6
|
+
*/
|
|
7
|
+
constructor(config) {
|
|
8
|
+
this.network = config.network;
|
|
9
|
+
this.logger = config.logger || Logger.getInstance({
|
|
10
|
+
level: config.logLevel || "info",
|
|
11
|
+
module: "HCS5Client",
|
|
12
|
+
silent: config.silent
|
|
13
|
+
});
|
|
14
|
+
this.mirrorNode = new HederaMirrorNode(this.network, this.logger);
|
|
20
15
|
}
|
|
21
|
-
let result = "";
|
|
22
|
-
for (let i = 0; i < zeros; i++) result += "1";
|
|
23
|
-
for (let i = digits.length - 1; i >= 0; i--) result += ALPHABET[digits[i]];
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
26
|
-
function base58Decode(text) {
|
|
27
|
-
if (text.length === 0) return new Uint8Array(0);
|
|
28
|
-
let zeros = 0;
|
|
29
|
-
while (zeros < text.length && text[zeros] === "1") zeros++;
|
|
30
|
-
const b256 = [];
|
|
31
|
-
for (let i = zeros; i < text.length; i++) {
|
|
32
|
-
const ch = text[i];
|
|
33
|
-
const val = ALPHABET.indexOf(ch);
|
|
34
|
-
if (val === -1) throw new Error("Invalid Base58 character");
|
|
35
|
-
let carry = val;
|
|
36
|
-
for (let j = 0; j < b256.length; j++) {
|
|
37
|
-
const x = b256[j] * BASE + carry;
|
|
38
|
-
b256[j] = x & 255;
|
|
39
|
-
carry = x >> 8;
|
|
40
|
-
}
|
|
41
|
-
while (carry > 0) {
|
|
42
|
-
b256.push(carry & 255);
|
|
43
|
-
carry >>= 8;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
for (let i = 0; i < zeros; i++) b256.push(0);
|
|
47
|
-
b256.reverse();
|
|
48
|
-
return Uint8Array.from(b256);
|
|
49
|
-
}
|
|
50
|
-
function multibaseB58btcDecode(zText) {
|
|
51
|
-
if (!zText.startsWith("z")) throw new Error("Invalid multibase base58btc");
|
|
52
|
-
return base58Decode(zText.slice(1));
|
|
53
16
|
}
|
|
54
17
|
export {
|
|
55
|
-
|
|
56
|
-
base58Encode,
|
|
57
|
-
multibaseB58btcDecode
|
|
18
|
+
HCS5BaseClient
|
|
58
19
|
};
|
|
59
20
|
//# sourceMappingURL=standards-sdk.es151.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es151.js","sources":["../../src/hcs-
|
|
1
|
+
{"version":3,"file":"standards-sdk.es151.js","sources":["../../src/hcs-5/base-client.ts"],"sourcesContent":["import { Logger, ILogger } from '../utils/logger';\nimport { HederaMirrorNode } from '../services/mirror-node';\nimport { HCS5ClientConfig } from './types';\nimport { NetworkType } from '../utils/types';\n\n/**\n * Base client for HCS-5 operations\n */\nexport abstract class HCS5BaseClient {\n protected logger: ILogger;\n protected mirrorNode: HederaMirrorNode;\n protected network: NetworkType;\n\n /**\n * Create a new HCS-5 base client\n */\n constructor(config: HCS5ClientConfig) {\n this.network = config.network;\n this.logger =\n config.logger ||\n Logger.getInstance({\n level: config.logLevel || 'info',\n module: 'HCS5Client',\n silent: config.silent,\n });\n\n this.mirrorNode = new HederaMirrorNode(this.network, this.logger);\n }\n}\n"],"names":[],"mappings":";;AAQO,MAAe,eAAe;AAAA;AAAA;AAAA;AAAA,EAQnC,YAAY,QAA0B;AACpC,SAAK,UAAU,OAAO;AACtB,SAAK,SACH,OAAO,UACP,OAAO,YAAY;AAAA,MACjB,OAAO,OAAO,YAAY;AAAA,MAC1B,QAAQ;AAAA,MACR,QAAQ,OAAO;AAAA,IAAA,CAChB;AAEH,SAAK,aAAa,IAAI,iBAAiB,KAAK,SAAS,KAAK,MAAM;AAAA,EAClE;AACF;"}
|
|
@@ -1,87 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
if (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (lowered.includes("cannot find module") || lowered.includes("module not found") || lowered.includes("cannot find package")) {
|
|
16
|
-
return lowered.includes(specifier.toLowerCase());
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
async function resolveNodeRequire() {
|
|
22
|
-
if (nodeRequire !== void 0) {
|
|
23
|
-
return nodeRequire;
|
|
24
|
-
}
|
|
25
|
-
if (isBrowser) {
|
|
26
|
-
nodeRequire = null;
|
|
27
|
-
return nodeRequire;
|
|
28
|
-
}
|
|
29
|
-
try {
|
|
30
|
-
const globalObject = typeof global !== "undefined" ? global : globalThis;
|
|
31
|
-
const req = globalObject.process?.mainModule?.require ?? globalObject.require;
|
|
32
|
-
nodeRequire = typeof req === "function" && typeof req.resolve === "function" ? req : null;
|
|
33
|
-
} catch {
|
|
34
|
-
nodeRequire = null;
|
|
35
|
-
}
|
|
36
|
-
return nodeRequire;
|
|
37
|
-
}
|
|
38
|
-
async function dynamicImport(specifier) {
|
|
39
|
-
try {
|
|
40
|
-
return await import(specifier);
|
|
41
|
-
} catch (error) {
|
|
42
|
-
if (isModuleNotFound(specifier, error)) {
|
|
43
|
-
return null;
|
|
1
|
+
const ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
2
|
+
const BASE = 58;
|
|
3
|
+
function base58Encode(bytes) {
|
|
4
|
+
if (bytes.length === 0) return "";
|
|
5
|
+
let zeros = 0;
|
|
6
|
+
while (zeros < bytes.length && bytes[zeros] === 0) zeros++;
|
|
7
|
+
if (zeros === bytes.length) return "1".repeat(zeros);
|
|
8
|
+
const digits = [0];
|
|
9
|
+
for (let i = zeros; i < bytes.length; i++) {
|
|
10
|
+
let carry = bytes[i];
|
|
11
|
+
for (let j = 0; j < digits.length; j++) {
|
|
12
|
+
const val = (digits[j] << 8) + carry;
|
|
13
|
+
digits[j] = val % BASE;
|
|
14
|
+
carry = val / BASE | 0;
|
|
44
15
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
async function optionalImport(specifier, options = {}) {
|
|
49
|
-
if (isBrowser) {
|
|
50
|
-
return dynamicImport(specifier);
|
|
51
|
-
}
|
|
52
|
-
if (!options.preferImport) {
|
|
53
|
-
const requireFn = await resolveNodeRequire();
|
|
54
|
-
if (requireFn) {
|
|
55
|
-
try {
|
|
56
|
-
return requireFn(specifier);
|
|
57
|
-
} catch (error) {
|
|
58
|
-
if (!isModuleNotFound(specifier, error)) {
|
|
59
|
-
throw error;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
16
|
+
while (carry > 0) {
|
|
17
|
+
digits.push(carry % BASE);
|
|
18
|
+
carry = carry / BASE | 0;
|
|
62
19
|
}
|
|
63
20
|
}
|
|
64
|
-
|
|
21
|
+
let result = "";
|
|
22
|
+
for (let i = 0; i < zeros; i++) result += "1";
|
|
23
|
+
for (let i = digits.length - 1; i >= 0; i--) result += ALPHABET[digits[i]];
|
|
24
|
+
return result;
|
|
65
25
|
}
|
|
66
|
-
function
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
26
|
+
function base58Decode(text) {
|
|
27
|
+
if (text.length === 0) return new Uint8Array(0);
|
|
28
|
+
let zeros = 0;
|
|
29
|
+
while (zeros < text.length && text[zeros] === "1") zeros++;
|
|
30
|
+
const b256 = [];
|
|
31
|
+
for (let i = zeros; i < text.length; i++) {
|
|
32
|
+
const ch = text[i];
|
|
33
|
+
const val = ALPHABET.indexOf(ch);
|
|
34
|
+
if (val === -1) throw new Error("Invalid Base58 character");
|
|
35
|
+
let carry = val;
|
|
36
|
+
for (let j = 0; j < b256.length; j++) {
|
|
37
|
+
const x = b256[j] * BASE + carry;
|
|
38
|
+
b256[j] = x & 255;
|
|
39
|
+
carry = x >> 8;
|
|
75
40
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
41
|
+
while (carry > 0) {
|
|
42
|
+
b256.push(carry & 255);
|
|
43
|
+
carry >>= 8;
|
|
79
44
|
}
|
|
80
45
|
}
|
|
81
|
-
|
|
46
|
+
for (let i = 0; i < zeros; i++) b256.push(0);
|
|
47
|
+
b256.reverse();
|
|
48
|
+
return Uint8Array.from(b256);
|
|
49
|
+
}
|
|
50
|
+
function multibaseB58btcDecode(zText) {
|
|
51
|
+
if (!zText.startsWith("z")) throw new Error("Invalid multibase base58btc");
|
|
52
|
+
return base58Decode(zText.slice(1));
|
|
82
53
|
}
|
|
83
54
|
export {
|
|
84
|
-
|
|
85
|
-
|
|
55
|
+
base58Decode,
|
|
56
|
+
base58Encode,
|
|
57
|
+
multibaseB58btcDecode
|
|
86
58
|
};
|
|
87
59
|
//# sourceMappingURL=standards-sdk.es152.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es152.js","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es152.js","sources":["../../src/hcs-14/base58.ts"],"sourcesContent":["/**\n * Minimal Base58 encoder/decoder (Bitcoin alphabet) with no external dependencies.\n */\n\nconst ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';\nconst BASE = 58;\n\nfunction countLeadingZeros(bytes: Uint8Array): number {\n let zeros = 0;\n for (let i = 0; i < bytes.length && bytes[i] === 0; i++) {\n zeros++;\n }\n return zeros;\n}\n\nexport function base58Encode(bytes: Uint8Array): string {\n if (bytes.length === 0) return '';\n\n let zeros = 0;\n while (zeros < bytes.length && bytes[zeros] === 0) zeros++;\n\n if (zeros === bytes.length) return '1'.repeat(zeros);\n\n const digits: number[] = [0];\n for (let i = zeros; i < bytes.length; i++) {\n let carry = bytes[i];\n for (let j = 0; j < digits.length; j++) {\n const val = (digits[j] << 8) + carry;\n digits[j] = val % BASE;\n carry = (val / BASE) | 0;\n }\n while (carry > 0) {\n digits.push(carry % BASE);\n carry = (carry / BASE) | 0;\n }\n }\n\n let result = '';\n for (let i = 0; i < zeros; i++) result += '1';\n for (let i = digits.length - 1; i >= 0; i--) result += ALPHABET[digits[i]];\n return result;\n}\n\nexport function base58Decode(text: string): Uint8Array {\n if (text.length === 0) return new Uint8Array(0);\n\n let zeros = 0;\n while (zeros < text.length && text[zeros] === '1') zeros++;\n\n const b256: number[] = [];\n for (let i = zeros; i < text.length; i++) {\n const ch = text[i];\n const val = ALPHABET.indexOf(ch);\n if (val === -1) throw new Error('Invalid Base58 character');\n\n let carry = val;\n for (let j = 0; j < b256.length; j++) {\n const x = b256[j] * BASE + carry;\n b256[j] = x & 0xff;\n carry = x >> 8;\n }\n while (carry > 0) {\n b256.push(carry & 0xff);\n carry >>= 8;\n }\n }\n\n for (let i = 0; i < zeros; i++) b256.push(0);\n b256.reverse();\n return Uint8Array.from(b256);\n}\n\nexport function multibaseB58btcDecode(zText: string): Uint8Array {\n if (!zText.startsWith('z')) throw new Error('Invalid multibase base58btc');\n return base58Decode(zText.slice(1));\n}\n"],"names":[],"mappings":"AAIA,MAAM,WAAW;AACjB,MAAM,OAAO;AAUN,SAAS,aAAa,OAA2B;AACtD,MAAI,MAAM,WAAW,EAAG,QAAO;AAE/B,MAAI,QAAQ;AACZ,SAAO,QAAQ,MAAM,UAAU,MAAM,KAAK,MAAM,EAAG;AAEnD,MAAI,UAAU,MAAM,OAAQ,QAAO,IAAI,OAAO,KAAK;AAEnD,QAAM,SAAmB,CAAC,CAAC;AAC3B,WAAS,IAAI,OAAO,IAAI,MAAM,QAAQ,KAAK;AACzC,QAAI,QAAQ,MAAM,CAAC;AACnB,aAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACtC,YAAM,OAAO,OAAO,CAAC,KAAK,KAAK;AAC/B,aAAO,CAAC,IAAI,MAAM;AAClB,cAAS,MAAM,OAAQ;AAAA,IACzB;AACA,WAAO,QAAQ,GAAG;AAChB,aAAO,KAAK,QAAQ,IAAI;AACxB,cAAS,QAAQ,OAAQ;AAAA,IAC3B;AAAA,EACF;AAEA,MAAI,SAAS;AACb,WAAS,IAAI,GAAG,IAAI,OAAO,IAAK,WAAU;AAC1C,WAAS,IAAI,OAAO,SAAS,GAAG,KAAK,GAAG,IAAK,WAAU,SAAS,OAAO,CAAC,CAAC;AACzE,SAAO;AACT;AAEO,SAAS,aAAa,MAA0B;AACrD,MAAI,KAAK,WAAW,EAAG,QAAO,IAAI,WAAW,CAAC;AAE9C,MAAI,QAAQ;AACZ,SAAO,QAAQ,KAAK,UAAU,KAAK,KAAK,MAAM,IAAK;AAEnD,QAAM,OAAiB,CAAA;AACvB,WAAS,IAAI,OAAO,IAAI,KAAK,QAAQ,KAAK;AACxC,UAAM,KAAK,KAAK,CAAC;AACjB,UAAM,MAAM,SAAS,QAAQ,EAAE;AAC/B,QAAI,QAAQ,GAAI,OAAM,IAAI,MAAM,0BAA0B;AAE1D,QAAI,QAAQ;AACZ,aAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,YAAM,IAAI,KAAK,CAAC,IAAI,OAAO;AAC3B,WAAK,CAAC,IAAI,IAAI;AACd,cAAQ,KAAK;AAAA,IACf;AACA,WAAO,QAAQ,GAAG;AAChB,WAAK,KAAK,QAAQ,GAAI;AACtB,gBAAU;AAAA,IACZ;AAAA,EACF;AAEA,WAAS,IAAI,GAAG,IAAI,OAAO,IAAK,MAAK,KAAK,CAAC;AAC3C,OAAK,QAAA;AACL,SAAO,WAAW,KAAK,IAAI;AAC7B;AAEO,SAAS,sBAAsB,OAA2B;AAC/D,MAAI,CAAC,MAAM,WAAW,GAAG,EAAG,OAAM,IAAI,MAAM,6BAA6B;AACzE,SAAO,aAAa,MAAM,MAAM,CAAC,CAAC;AACpC;"}
|
|
@@ -1,20 +1,87 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
constructor(config) {
|
|
8
|
-
this.network = config.network;
|
|
9
|
-
this.logger = config.logger || Logger.getInstance({
|
|
10
|
-
level: config.logLevel || "info",
|
|
11
|
-
module: "HCS5Client",
|
|
12
|
-
silent: config.silent
|
|
13
|
-
});
|
|
14
|
-
this.mirrorNode = new HederaMirrorNode(this.network, this.logger);
|
|
1
|
+
import { isBrowser } from "./standards-sdk.es118.js";
|
|
2
|
+
let nodeRequire;
|
|
3
|
+
function isModuleNotFound(specifier, error) {
|
|
4
|
+
if (!error || typeof error !== "object") {
|
|
5
|
+
return false;
|
|
15
6
|
}
|
|
7
|
+
const code = Reflect.get(error, "code");
|
|
8
|
+
const message = Reflect.get(error, "message");
|
|
9
|
+
const messageText = typeof message === "string" ? message : "";
|
|
10
|
+
if (typeof code === "string" && code.includes("MODULE_NOT_FOUND")) {
|
|
11
|
+
return messageText.includes(specifier);
|
|
12
|
+
}
|
|
13
|
+
if (messageText) {
|
|
14
|
+
const lowered = messageText.toLowerCase();
|
|
15
|
+
if (lowered.includes("cannot find module") || lowered.includes("module not found") || lowered.includes("cannot find package")) {
|
|
16
|
+
return lowered.includes(specifier.toLowerCase());
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
async function resolveNodeRequire() {
|
|
22
|
+
if (nodeRequire !== void 0) {
|
|
23
|
+
return nodeRequire;
|
|
24
|
+
}
|
|
25
|
+
if (isBrowser) {
|
|
26
|
+
nodeRequire = null;
|
|
27
|
+
return nodeRequire;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
const globalObject = typeof global !== "undefined" ? global : globalThis;
|
|
31
|
+
const req = globalObject.process?.mainModule?.require ?? globalObject.require;
|
|
32
|
+
nodeRequire = typeof req === "function" && typeof req.resolve === "function" ? req : null;
|
|
33
|
+
} catch {
|
|
34
|
+
nodeRequire = null;
|
|
35
|
+
}
|
|
36
|
+
return nodeRequire;
|
|
37
|
+
}
|
|
38
|
+
async function dynamicImport(specifier) {
|
|
39
|
+
try {
|
|
40
|
+
return await import(specifier);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
if (isModuleNotFound(specifier, error)) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function optionalImport(specifier, options = {}) {
|
|
49
|
+
if (isBrowser) {
|
|
50
|
+
return dynamicImport(specifier);
|
|
51
|
+
}
|
|
52
|
+
if (!options.preferImport) {
|
|
53
|
+
const requireFn = await resolveNodeRequire();
|
|
54
|
+
if (requireFn) {
|
|
55
|
+
try {
|
|
56
|
+
return requireFn(specifier);
|
|
57
|
+
} catch (error) {
|
|
58
|
+
if (!isModuleNotFound(specifier, error)) {
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return dynamicImport(specifier);
|
|
65
|
+
}
|
|
66
|
+
function optionalImportSync(specifier) {
|
|
67
|
+
if (isBrowser) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
const globalObject = typeof global !== "undefined" ? global : globalThis;
|
|
72
|
+
const req = globalObject.process?.mainModule?.require ?? globalObject.require;
|
|
73
|
+
if (typeof req === "function" && typeof req.resolve === "function") {
|
|
74
|
+
return req(specifier);
|
|
75
|
+
}
|
|
76
|
+
} catch (error) {
|
|
77
|
+
if (!isModuleNotFound(specifier, error)) {
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
16
82
|
}
|
|
17
83
|
export {
|
|
18
|
-
|
|
84
|
+
optionalImport,
|
|
85
|
+
optionalImportSync
|
|
19
86
|
};
|
|
20
87
|
//# sourceMappingURL=standards-sdk.es153.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es153.js","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es153.js","sources":["../../src/utils/dynamic-import.ts"],"sourcesContent":["import { isBrowser } from './is-browser';\n\nlet nodeRequire: NodeRequire | null | undefined;\n\nfunction isModuleNotFound(specifier: string, error: unknown): boolean {\n if (!error || typeof error !== 'object') {\n return false;\n }\n const code = Reflect.get(error, 'code');\n const message = Reflect.get(error, 'message');\n const messageText = typeof message === 'string' ? message : '';\n\n if (typeof code === 'string' && code.includes('MODULE_NOT_FOUND')) {\n return messageText.includes(specifier);\n }\n\n if (messageText) {\n const lowered = messageText.toLowerCase();\n if (\n lowered.includes('cannot find module') ||\n lowered.includes('module not found') ||\n lowered.includes('cannot find package')\n ) {\n return lowered.includes(specifier.toLowerCase());\n }\n }\n\n return false;\n}\n\nasync function resolveNodeRequire(): Promise<NodeRequire | null> {\n if (nodeRequire !== undefined) {\n return nodeRequire;\n }\n\n if (isBrowser) {\n nodeRequire = null;\n return nodeRequire;\n }\n\n try {\n const globalObject =\n typeof global !== 'undefined'\n ? (global as typeof globalThis)\n : globalThis;\n const req =\n globalObject.process?.mainModule?.require ??\n (globalObject as { require?: NodeRequire }).require;\n\n nodeRequire =\n typeof req === 'function' &&\n typeof (req as NodeRequire).resolve === 'function'\n ? (req as NodeRequire)\n : null;\n } catch {\n nodeRequire = null;\n }\n\n return nodeRequire;\n}\n\nasync function dynamicImport<T>(specifier: string): Promise<T | null> {\n try {\n return (await import(specifier)) as T;\n } catch (error) {\n if (isModuleNotFound(specifier, error)) {\n return null;\n }\n throw error as Error;\n }\n}\n\ntype OptionalImportOptions = {\n preferImport?: boolean;\n};\n\nexport async function optionalImport<T>(\n specifier: string,\n options: OptionalImportOptions = {},\n): Promise<T | null> {\n if (isBrowser) {\n return dynamicImport<T>(specifier);\n }\n\n if (!options.preferImport) {\n const requireFn = await resolveNodeRequire();\n if (requireFn) {\n try {\n return requireFn(specifier) as T;\n } catch (error) {\n if (!isModuleNotFound(specifier, error)) {\n throw error as Error;\n }\n }\n }\n }\n\n return dynamicImport<T>(specifier);\n}\n\nexport function optionalImportSync<T>(specifier: string): T | null {\n if (isBrowser) {\n return null;\n }\n\n try {\n const globalObject =\n typeof global !== 'undefined'\n ? (global as typeof globalThis)\n : globalThis;\n const req =\n globalObject.process?.mainModule?.require ??\n (globalObject as { require?: NodeRequire }).require;\n\n if (\n typeof req === 'function' &&\n typeof (req as NodeRequire).resolve === 'function'\n ) {\n return req(specifier) as T;\n }\n } catch (error) {\n if (!isModuleNotFound(specifier, error)) {\n throw error as Error;\n }\n }\n\n return null;\n}\n"],"names":[],"mappings":";AAEA,IAAI;AAEJ,SAAS,iBAAiB,WAAmB,OAAyB;AACpE,MAAI,CAAC,SAAS,OAAO,UAAU,UAAU;AACvC,WAAO;AAAA,EACT;AACA,QAAM,OAAO,QAAQ,IAAI,OAAO,MAAM;AACtC,QAAM,UAAU,QAAQ,IAAI,OAAO,SAAS;AAC5C,QAAM,cAAc,OAAO,YAAY,WAAW,UAAU;AAE5D,MAAI,OAAO,SAAS,YAAY,KAAK,SAAS,kBAAkB,GAAG;AACjE,WAAO,YAAY,SAAS,SAAS;AAAA,EACvC;AAEA,MAAI,aAAa;AACf,UAAM,UAAU,YAAY,YAAA;AAC5B,QACE,QAAQ,SAAS,oBAAoB,KACrC,QAAQ,SAAS,kBAAkB,KACnC,QAAQ,SAAS,qBAAqB,GACtC;AACA,aAAO,QAAQ,SAAS,UAAU,YAAA,CAAa;AAAA,IACjD;AAAA,EACF;AAEA,SAAO;AACT;AAEA,eAAe,qBAAkD;AAC/D,MAAI,gBAAgB,QAAW;AAC7B,WAAO;AAAA,EACT;AAEA,MAAI,WAAW;AACb,kBAAc;AACd,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,eACJ,OAAO,WAAW,cACb,SACD;AACN,UAAM,MACJ,aAAa,SAAS,YAAY,WACjC,aAA2C;AAE9C,kBACE,OAAO,QAAQ,cACf,OAAQ,IAAoB,YAAY,aACnC,MACD;AAAA,EACR,QAAQ;AACN,kBAAc;AAAA,EAChB;AAEA,SAAO;AACT;AAEA,eAAe,cAAiB,WAAsC;AACpE,MAAI;AACF,WAAQ,MAAM,OAAO;AAAA,EACvB,SAAS,OAAO;AACd,QAAI,iBAAiB,WAAW,KAAK,GAAG;AACtC,aAAO;AAAA,IACT;AACA,UAAM;AAAA,EACR;AACF;AAMA,eAAsB,eACpB,WACA,UAAiC,IACd;AACnB,MAAI,WAAW;AACb,WAAO,cAAiB,SAAS;AAAA,EACnC;AAEA,MAAI,CAAC,QAAQ,cAAc;AACzB,UAAM,YAAY,MAAM,mBAAA;AACxB,QAAI,WAAW;AACb,UAAI;AACF,eAAO,UAAU,SAAS;AAAA,MAC5B,SAAS,OAAO;AACd,YAAI,CAAC,iBAAiB,WAAW,KAAK,GAAG;AACvC,gBAAM;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO,cAAiB,SAAS;AACnC;AAEO,SAAS,mBAAsB,WAA6B;AACjE,MAAI,WAAW;AACb,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,eACJ,OAAO,WAAW,cACb,SACD;AACN,UAAM,MACJ,aAAa,SAAS,YAAY,WACjC,aAA2C;AAE9C,QACE,OAAO,QAAQ,cACf,OAAQ,IAAoB,YAAY,YACxC;AACA,aAAO,IAAI,SAAS;AAAA,IACtB;AAAA,EACF,SAAS,OAAO;AACd,QAAI,CAAC,iBAAiB,WAAW,KAAK,GAAG;AACvC,YAAM;AAAA,IACR;AAAA,EACF;AAEA,SAAO;AACT;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getCryptoAdapter } from "./standards-sdk.es119.js";
|
|
2
|
-
import { base58Encode } from "./standards-sdk.
|
|
2
|
+
import { base58Encode } from "./standards-sdk.es152.js";
|
|
3
3
|
import { canonicalizeAgentData } from "./standards-sdk.es55.js";
|
|
4
4
|
function encodeMultibaseB58btc(input) {
|
|
5
5
|
const bytes = Buffer.from(input, "utf8");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HieroDidResolver } from "./standards-sdk.es59.js";
|
|
2
2
|
import { parseHcs14Did } from "./standards-sdk.es56.js";
|
|
3
|
-
import { multibaseB58btcDecode } from "./standards-sdk.
|
|
3
|
+
import { multibaseB58btcDecode } from "./standards-sdk.es152.js";
|
|
4
4
|
class ResolverRegistry {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.resolvers = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HCS5BaseClient } from "./standards-sdk.
|
|
1
|
+
import { HCS5BaseClient } from "./standards-sdk.es151.js";
|
|
2
2
|
import { buildHcs1Hrl } from "./standards-sdk.es63.js";
|
|
3
3
|
import { PrivateKey } from "@hashgraph/sdk";
|
|
4
4
|
import { inscribeWithSigner } from "./standards-sdk.es124.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HCS5BaseClient } from "./standards-sdk.
|
|
1
|
+
import { HCS5BaseClient } from "./standards-sdk.es151.js";
|
|
2
2
|
import { buildHcs1Hrl } from "./standards-sdk.es63.js";
|
|
3
3
|
import { AccountId } from "@hashgraph/sdk";
|
|
4
4
|
import { inscribe } from "./standards-sdk.es124.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashgraphonline/standards-sdk",
|
|
3
|
-
"version": "0.1.146-chore-jsr-improvements.canary.
|
|
3
|
+
"version": "0.1.146-chore-jsr-improvements.canary.46c0c0f.91",
|
|
4
4
|
"description": "The Hashgraph Online Standards SDK provides a complete implementation of the Hiero Consensus Standards (HCS), giving developers all the tools needed to build wonderful decentralized applications on the Hashgraph network. https://hol.org",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|