@hashgraphonline/standards-sdk 0.1.143-feat-solana-register.canary.2844378.65 → 0.1.143-feat-solana-register.canary.b3bfd5e.67
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/hcs-16/browser.d.ts +4 -0
- package/dist/cjs/hcs-16/browser.d.ts.map +1 -1
- package/dist/cjs/hcs-16/sdk.d.ts +5 -0
- package/dist/cjs/hcs-16/sdk.d.ts.map +1 -1
- package/dist/cjs/hcs-16/tx.d.ts +5 -1
- package/dist/cjs/hcs-16/tx.d.ts.map +1 -1
- package/dist/cjs/hcs-17/base-client.d.ts +1 -0
- package/dist/cjs/hcs-17/base-client.d.ts.map +1 -1
- package/dist/cjs/hcs-17/sdk.d.ts.map +1 -1
- package/dist/cjs/hcs-17/tx.d.ts +2 -0
- package/dist/cjs/hcs-17/tx.d.ts.map +1 -1
- package/dist/cjs/hcs-17/types.d.ts +6 -2
- package/dist/cjs/hcs-17/types.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/schemas.d.ts +96 -96
- package/dist/cjs/standards-sdk.cjs +2 -2
- package/dist/cjs/standards-sdk.cjs.map +1 -1
- package/dist/es/hcs-16/browser.d.ts +4 -0
- package/dist/es/hcs-16/browser.d.ts.map +1 -1
- package/dist/es/hcs-16/sdk.d.ts +5 -0
- package/dist/es/hcs-16/sdk.d.ts.map +1 -1
- package/dist/es/hcs-16/tx.d.ts +5 -1
- package/dist/es/hcs-16/tx.d.ts.map +1 -1
- package/dist/es/hcs-17/base-client.d.ts +1 -0
- package/dist/es/hcs-17/base-client.d.ts.map +1 -1
- package/dist/es/hcs-17/sdk.d.ts.map +1 -1
- package/dist/es/hcs-17/tx.d.ts +2 -0
- package/dist/es/hcs-17/tx.d.ts.map +1 -1
- package/dist/es/hcs-17/types.d.ts +6 -2
- package/dist/es/hcs-17/types.d.ts.map +1 -1
- package/dist/es/services/registry-broker/schemas.d.ts +96 -96
- package/dist/es/standards-sdk.es100.js +2 -1
- package/dist/es/standards-sdk.es100.js.map +1 -1
- package/dist/es/standards-sdk.es111.js +5 -5
- package/dist/es/standards-sdk.es121.js +1 -1
- package/dist/es/standards-sdk.es122.js +1 -1
- package/dist/es/standards-sdk.es123.js +5 -5
- package/dist/es/standards-sdk.es128.js +1 -1
- package/dist/es/standards-sdk.es131.js +1 -1
- package/dist/es/standards-sdk.es138.js +1 -1
- package/dist/es/standards-sdk.es148.js +15 -54
- package/dist/es/standards-sdk.es148.js.map +1 -1
- package/dist/es/standards-sdk.es149.js +48 -74
- package/dist/es/standards-sdk.es149.js.map +1 -1
- package/dist/es/standards-sdk.es150.js +71 -161
- package/dist/es/standards-sdk.es150.js.map +1 -1
- package/dist/es/standards-sdk.es151.js +139 -289
- package/dist/es/standards-sdk.es151.js.map +1 -1
- package/dist/es/standards-sdk.es152.js +274 -298
- package/dist/es/standards-sdk.es152.js.map +1 -1
- package/dist/es/standards-sdk.es153.js +262 -369
- package/dist/es/standards-sdk.es153.js.map +1 -1
- package/dist/es/standards-sdk.es154.js +316 -194
- package/dist/es/standards-sdk.es154.js.map +1 -1
- package/dist/es/standards-sdk.es155.js +319 -64
- package/dist/es/standards-sdk.es155.js.map +1 -1
- package/dist/es/standards-sdk.es156.js +74 -15
- package/dist/es/standards-sdk.es156.js.map +1 -1
- package/dist/es/standards-sdk.es57.js +1 -1
- package/dist/es/standards-sdk.es59.js +1 -1
- package/dist/es/standards-sdk.es60.js +1 -1
- package/dist/es/standards-sdk.es63.js +1 -1
- package/dist/es/standards-sdk.es65.js +1 -1
- package/dist/es/standards-sdk.es66.js +1 -1
- package/dist/es/standards-sdk.es92.js +13 -8
- package/dist/es/standards-sdk.es92.js.map +1 -1
- package/dist/es/standards-sdk.es93.js +19 -1
- package/dist/es/standards-sdk.es93.js.map +1 -1
- package/dist/es/standards-sdk.es94.js.map +1 -1
- package/dist/es/standards-sdk.es96.js +1 -0
- package/dist/es/standards-sdk.es96.js.map +1 -1
- package/dist/es/standards-sdk.es97.js +2 -0
- package/dist/es/standards-sdk.es97.js.map +1 -1
- package/dist/es/standards-sdk.es98.js +3 -1
- package/dist/es/standards-sdk.es98.js.map +1 -1
- package/package.json +1 -1
|
@@ -16,7 +16,8 @@ function buildHcs17MessageTx(params) {
|
|
|
16
16
|
state_hash: params.stateHash,
|
|
17
17
|
topics: params.topics,
|
|
18
18
|
account_id: params.accountId,
|
|
19
|
-
|
|
19
|
+
epoch: params.epoch,
|
|
20
|
+
timestamp: params.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
20
21
|
m: params.memo
|
|
21
22
|
};
|
|
22
23
|
return buildMessageTx({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es100.js","sources":["../../src/hcs-17/tx.ts"],"sourcesContent":["import {\n PublicKey,\n KeyList,\n TopicMessageSubmitTransaction,\n TopicCreateTransaction,\n} from '@hashgraph/sdk';\nimport { buildTopicCreateTx, buildMessageTx } from '../common/tx/tx-utils';\nimport { generateHCS17Memo, StateHashMessage } from './types';\n\n/**\n * Build a TopicCreateTransaction for HCS‑17 state topics.\n */\nexport function buildHcs17CreateTopicTx(params: {\n ttl: number;\n adminKey?: boolean | string | PublicKey | KeyList;\n submitKey?: boolean | string | PublicKey | KeyList;\n operatorPublicKey?: PublicKey;\n}): TopicCreateTransaction {\n const memo = generateHCS17Memo(params.ttl);\n return buildTopicCreateTx({\n memo,\n adminKey: params.adminKey,\n submitKey: params.submitKey,\n operatorPublicKey: params.operatorPublicKey,\n });\n}\n\n/**\n * Build a TopicMessageSubmitTransaction for HCS‑17 messages.\n */\n/**\n * Build a TopicMessageSubmitTransaction for HCS‑17 messages.\n */\nexport function buildHcs17MessageTx(params: {\n topicId: string;\n stateHash: string;\n accountId: string;\n topics: string[];\n memo?: string;\n transactionMemo?: string;\n}): TopicMessageSubmitTransaction {\n const payload: StateHashMessage = {\n p: 'hcs-17',\n op: 'state_hash',\n state_hash: params.stateHash,\n topics: params.topics,\n account_id: params.accountId,\n timestamp: new Date().toISOString(),\n m: params.memo,\n };\n return buildMessageTx({\n topicId: params.topicId,\n message: JSON.stringify(payload),\n transactionMemo: params.transactionMemo,\n });\n}\n"],"names":[],"mappings":";;AAYO,SAAS,wBAAwB,QAKb;AACzB,QAAM,OAAO,kBAAkB,OAAO,GAAG;AACzC,SAAO,mBAAmB;AAAA,IACxB;AAAA,IACA,UAAU,OAAO;AAAA,IACjB,WAAW,OAAO;AAAA,IAClB,mBAAmB,OAAO;AAAA,EAAA,CAC3B;AACH;AAQO,SAAS,oBAAoB,
|
|
1
|
+
{"version":3,"file":"standards-sdk.es100.js","sources":["../../src/hcs-17/tx.ts"],"sourcesContent":["import {\n PublicKey,\n KeyList,\n TopicMessageSubmitTransaction,\n TopicCreateTransaction,\n} from '@hashgraph/sdk';\nimport { buildTopicCreateTx, buildMessageTx } from '../common/tx/tx-utils';\nimport { generateHCS17Memo, StateHashMessage } from './types';\n\n/**\n * Build a TopicCreateTransaction for HCS‑17 state topics.\n */\nexport function buildHcs17CreateTopicTx(params: {\n ttl: number;\n adminKey?: boolean | string | PublicKey | KeyList;\n submitKey?: boolean | string | PublicKey | KeyList;\n operatorPublicKey?: PublicKey;\n}): TopicCreateTransaction {\n const memo = generateHCS17Memo(params.ttl);\n return buildTopicCreateTx({\n memo,\n adminKey: params.adminKey,\n submitKey: params.submitKey,\n operatorPublicKey: params.operatorPublicKey,\n });\n}\n\n/**\n * Build a TopicMessageSubmitTransaction for HCS‑17 messages.\n */\n/**\n * Build a TopicMessageSubmitTransaction for HCS‑17 messages.\n */\nexport function buildHcs17MessageTx(params: {\n topicId: string;\n stateHash: string;\n accountId: string;\n topics: string[];\n memo?: string;\n epoch?: number;\n timestamp?: string;\n transactionMemo?: string;\n}): TopicMessageSubmitTransaction {\n const payload: StateHashMessage = {\n p: 'hcs-17',\n op: 'state_hash',\n state_hash: params.stateHash,\n topics: params.topics,\n account_id: params.accountId,\n epoch: params.epoch,\n timestamp: params.timestamp ?? new Date().toISOString(),\n m: params.memo,\n };\n return buildMessageTx({\n topicId: params.topicId,\n message: JSON.stringify(payload),\n transactionMemo: params.transactionMemo,\n });\n}\n"],"names":[],"mappings":";;AAYO,SAAS,wBAAwB,QAKb;AACzB,QAAM,OAAO,kBAAkB,OAAO,GAAG;AACzC,SAAO,mBAAmB;AAAA,IACxB;AAAA,IACA,UAAU,OAAO;AAAA,IACjB,WAAW,OAAO;AAAA,IAClB,mBAAmB,OAAO;AAAA,EAAA,CAC3B;AACH;AAQO,SAAS,oBAAoB,QASF;AAChC,QAAM,UAA4B;AAAA,IAChC,GAAG;AAAA,IACH,IAAI;AAAA,IACJ,YAAY,OAAO;AAAA,IACnB,QAAQ,OAAO;AAAA,IACf,YAAY,OAAO;AAAA,IACnB,OAAO,OAAO;AAAA,IACd,WAAW,OAAO,cAAa,oBAAI,KAAA,GAAO,YAAA;AAAA,IAC1C,GAAG,OAAO;AAAA,EAAA;AAEZ,SAAO,eAAe;AAAA,IACpB,SAAS,OAAO;AAAA,IAChB,SAAS,KAAK,UAAU,OAAO;AAAA,IAC/B,iBAAiB,OAAO;AAAA,EAAA,CACzB;AACH;"}
|
|
@@ -5,11 +5,11 @@ import { ethers } from "ethers";
|
|
|
5
5
|
import { TransactionParsingError } from "./standards-sdk.es112.js";
|
|
6
6
|
import { resolveTransactionSummary } from "./standards-sdk.es113.js";
|
|
7
7
|
import { HTSParser } from "./standards-sdk.es121.js";
|
|
8
|
-
import { HCSParser } from "./standards-sdk.
|
|
9
|
-
import { FileParser } from "./standards-sdk.
|
|
10
|
-
import { CryptoParser } from "./standards-sdk.
|
|
11
|
-
import { SCSParser } from "./standards-sdk.
|
|
12
|
-
import { UtilParser } from "./standards-sdk.
|
|
8
|
+
import { HCSParser } from "./standards-sdk.es151.js";
|
|
9
|
+
import { FileParser } from "./standards-sdk.es152.js";
|
|
10
|
+
import { CryptoParser } from "./standards-sdk.es153.js";
|
|
11
|
+
import { SCSParser } from "./standards-sdk.es154.js";
|
|
12
|
+
import { UtilParser } from "./standards-sdk.es155.js";
|
|
13
13
|
import { ScheduleParser } from "./standards-sdk.es122.js";
|
|
14
14
|
import { transactionParserRegistry } from "./standards-sdk.es123.js";
|
|
15
15
|
import { getTransactionTypeFromBody, getHumanReadableTransactionType } from "./standards-sdk.es124.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proto } from "@hashgraph/proto";
|
|
2
2
|
import { AccountId, Long, TokenId } from "@hashgraph/sdk";
|
|
3
|
-
import { parseKey, hasTransactionType, extractTransactionBody } from "./standards-sdk.
|
|
3
|
+
import { parseKey, hasTransactionType, extractTransactionBody } from "./standards-sdk.es156.js";
|
|
4
4
|
import { Buffer } from "buffer";
|
|
5
5
|
class HTSParser {
|
|
6
6
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proto } from "@hashgraph/proto";
|
|
2
|
-
import { hasTransactionType, parseKey } from "./standards-sdk.
|
|
2
|
+
import { hasTransactionType, parseKey } from "./standards-sdk.es156.js";
|
|
3
3
|
import { AccountId, Long, ScheduleId } from "@hashgraph/sdk";
|
|
4
4
|
class ScheduleParser {
|
|
5
5
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { HTSParser } from "./standards-sdk.es121.js";
|
|
2
|
-
import { HCSParser } from "./standards-sdk.
|
|
3
|
-
import { CryptoParser } from "./standards-sdk.
|
|
4
|
-
import { FileParser } from "./standards-sdk.
|
|
5
|
-
import { SCSParser } from "./standards-sdk.
|
|
2
|
+
import { HCSParser } from "./standards-sdk.es151.js";
|
|
3
|
+
import { CryptoParser } from "./standards-sdk.es153.js";
|
|
4
|
+
import { FileParser } from "./standards-sdk.es152.js";
|
|
5
|
+
import { SCSParser } from "./standards-sdk.es154.js";
|
|
6
6
|
import { ScheduleParser } from "./standards-sdk.es122.js";
|
|
7
|
-
import { UtilParser } from "./standards-sdk.
|
|
7
|
+
import { UtilParser } from "./standards-sdk.es155.js";
|
|
8
8
|
const transactionParserRegistry = {
|
|
9
9
|
TOKENCREATE: {
|
|
10
10
|
bodyField: "tokenCreation",
|
|
@@ -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.es157.js";
|
|
6
|
-
import { optionalImport } from "./standards-sdk.
|
|
6
|
+
import { optionalImport } from "./standards-sdk.es150.js";
|
|
7
7
|
import { RegistryBrokerClient } from "./standards-sdk.es136.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.es157.js";
|
|
2
2
|
import { RegistryBrokerClient } from "./standards-sdk.es136.js";
|
|
3
3
|
import { normalizeHexPrivateKey } from "./standards-sdk.es158.js";
|
|
4
|
-
import { optionalImport } from "./standards-sdk.
|
|
4
|
+
import { optionalImport } from "./standards-sdk.es150.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 { optionalImportSync } from "./standards-sdk.
|
|
1
|
+
import { optionalImportSync } from "./standards-sdk.es150.js";
|
|
2
2
|
const unsupported = (method) => new Error(`${method} is not supported by the in-memory signer`);
|
|
3
3
|
const createPrivateKeySigner = (options) => {
|
|
4
4
|
const sdk = 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.es106.js";
|
|
2
|
+
import { HederaMirrorNode } from "./standards-sdk.es127.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.es148.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es148.js","sources":["../../src/hcs-
|
|
1
|
+
{"version":3,"file":"standards-sdk.es148.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,85 +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) {
|
|
49
|
-
if (isBrowser) {
|
|
50
|
-
return dynamicImport(specifier);
|
|
51
|
-
}
|
|
52
|
-
const requireFn = await resolveNodeRequire();
|
|
53
|
-
if (requireFn) {
|
|
54
|
-
try {
|
|
55
|
-
return requireFn(specifier);
|
|
56
|
-
} catch (error) {
|
|
57
|
-
if (!isModuleNotFound(specifier, error)) {
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
16
|
+
while (carry > 0) {
|
|
17
|
+
digits.push(carry % BASE);
|
|
18
|
+
carry = carry / BASE | 0;
|
|
60
19
|
}
|
|
61
20
|
}
|
|
62
|
-
|
|
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;
|
|
63
25
|
}
|
|
64
|
-
function
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
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;
|
|
73
40
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
41
|
+
while (carry > 0) {
|
|
42
|
+
b256.push(carry & 255);
|
|
43
|
+
carry >>= 8;
|
|
77
44
|
}
|
|
78
45
|
}
|
|
79
|
-
|
|
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));
|
|
80
53
|
}
|
|
81
54
|
export {
|
|
82
|
-
|
|
83
|
-
|
|
55
|
+
base58Decode,
|
|
56
|
+
base58Encode,
|
|
57
|
+
multibaseB58btcDecode
|
|
84
58
|
};
|
|
85
59
|
//# sourceMappingURL=standards-sdk.es149.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es149.js","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es149.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,175 +1,85 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (!body) return void 0;
|
|
7
|
-
const data = {};
|
|
8
|
-
if (body.memo) {
|
|
9
|
-
data.memo = body.memo;
|
|
10
|
-
}
|
|
11
|
-
data.adminKey = parseKey(body.adminKey);
|
|
12
|
-
data.submitKey = parseKey(body.submitKey);
|
|
13
|
-
if (body.autoRenewPeriod?.seconds) {
|
|
14
|
-
data.autoRenewPeriod = Long.fromValue(
|
|
15
|
-
body.autoRenewPeriod.seconds
|
|
16
|
-
).toString();
|
|
17
|
-
}
|
|
18
|
-
if (body.autoRenewAccount) {
|
|
19
|
-
data.autoRenewAccountId = new AccountId(
|
|
20
|
-
body.autoRenewAccount.shardNum ?? 0,
|
|
21
|
-
body.autoRenewAccount.realmNum ?? 0,
|
|
22
|
-
body.autoRenewAccount.accountNum ?? 0
|
|
23
|
-
).toString();
|
|
24
|
-
}
|
|
25
|
-
return data;
|
|
1
|
+
import { isBrowser } from "./standards-sdk.es119.js";
|
|
2
|
+
let nodeRequire;
|
|
3
|
+
function isModuleNotFound(specifier, error) {
|
|
4
|
+
if (!error || typeof error !== "object") {
|
|
5
|
+
return false;
|
|
26
6
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
if (body.message?.length > 0) {
|
|
34
|
-
const messageBuffer = Buffer.from(body.message);
|
|
35
|
-
const utf8String = messageBuffer.toString("utf8");
|
|
36
|
-
if (/[\x00-\x08\x0B\x0E-\x1F\x7F]/.test(utf8String) || utf8String.includes("�")) {
|
|
37
|
-
data.message = messageBuffer.toString("base64");
|
|
38
|
-
data.messageEncoding = "base64";
|
|
39
|
-
} else {
|
|
40
|
-
data.message = utf8String;
|
|
41
|
-
data.messageEncoding = "utf8";
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (body.chunkInfo) {
|
|
45
|
-
if (body.chunkInfo.initialTransactionID) {
|
|
46
|
-
const txId = body.chunkInfo.initialTransactionID.accountID;
|
|
47
|
-
const taValidStart = body.chunkInfo.initialTransactionID.transactionValidStart;
|
|
48
|
-
if (txId && taValidStart) {
|
|
49
|
-
data.chunkInfoInitialTransactionID = `${txId.shardNum ?? 0}.${txId.realmNum ?? 0}.${txId.accountNum ?? 0}@${taValidStart.seconds ?? 0}.${taValidStart.nanos ?? 0}`;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (body.chunkInfo.number !== void 0 && body.chunkInfo.number !== null) {
|
|
53
|
-
data.chunkInfoNumber = body.chunkInfo.number;
|
|
54
|
-
}
|
|
55
|
-
if (body.chunkInfo.total !== void 0 && body.chunkInfo.total !== null) {
|
|
56
|
-
data.chunkInfoTotal = body.chunkInfo.total;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return data;
|
|
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);
|
|
60
12
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
data.topicId = `${body.topicID.shardNum}.${body.topicID.realmNum}.${body.topicID.topicNum}`;
|
|
66
|
-
}
|
|
67
|
-
if (body.memo?.value !== void 0) {
|
|
68
|
-
data.memo = body.memo.value;
|
|
69
|
-
}
|
|
70
|
-
if (body.adminKey === null) {
|
|
71
|
-
data.clearAdminKey = true;
|
|
72
|
-
data.adminKey = void 0;
|
|
73
|
-
} else if (body.adminKey) {
|
|
74
|
-
data.adminKey = parseKey(body.adminKey);
|
|
75
|
-
} else {
|
|
76
|
-
data.adminKey = void 0;
|
|
77
|
-
}
|
|
78
|
-
if (body.submitKey === null) {
|
|
79
|
-
data.clearSubmitKey = true;
|
|
80
|
-
data.submitKey = void 0;
|
|
81
|
-
} else if (body.submitKey) {
|
|
82
|
-
data.submitKey = parseKey(body.submitKey);
|
|
83
|
-
} else {
|
|
84
|
-
data.submitKey = void 0;
|
|
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());
|
|
85
17
|
}
|
|
86
|
-
if (body.autoRenewPeriod?.seconds) {
|
|
87
|
-
data.autoRenewPeriod = Long.fromValue(
|
|
88
|
-
body.autoRenewPeriod.seconds
|
|
89
|
-
).toString();
|
|
90
|
-
}
|
|
91
|
-
if (body.autoRenewAccount) {
|
|
92
|
-
data.autoRenewAccountId = new AccountId(
|
|
93
|
-
body.autoRenewAccount.shardNum ?? 0,
|
|
94
|
-
body.autoRenewAccount.realmNum ?? 0,
|
|
95
|
-
body.autoRenewAccount.accountNum ?? 0
|
|
96
|
-
).toString();
|
|
97
|
-
}
|
|
98
|
-
return data;
|
|
99
18
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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;
|
|
105
44
|
}
|
|
106
|
-
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function optionalImport(specifier) {
|
|
49
|
+
if (isBrowser) {
|
|
50
|
+
return dynamicImport(specifier);
|
|
107
51
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
* This is the unified entry point that handles both protobuf and internal field extraction
|
|
111
|
-
*/
|
|
112
|
-
static parseFromTransactionObject(transaction) {
|
|
52
|
+
const requireFn = await resolveNodeRequire();
|
|
53
|
+
if (requireFn) {
|
|
113
54
|
try {
|
|
114
|
-
|
|
115
|
-
if (!transactionBody) {
|
|
116
|
-
return {};
|
|
117
|
-
}
|
|
118
|
-
if (transactionBody.consensusCreateTopic) {
|
|
119
|
-
const consensusCreateTopic = this.parseConsensusCreateTopic(
|
|
120
|
-
transactionBody.consensusCreateTopic
|
|
121
|
-
);
|
|
122
|
-
if (consensusCreateTopic) {
|
|
123
|
-
return {
|
|
124
|
-
type: "TOPICCREATE",
|
|
125
|
-
humanReadableType: "Topic Create",
|
|
126
|
-
consensusCreateTopic
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
if (transactionBody.consensusSubmitMessage) {
|
|
131
|
-
const consensusSubmitMessage = this.parseConsensusSubmitMessage(
|
|
132
|
-
transactionBody.consensusSubmitMessage
|
|
133
|
-
);
|
|
134
|
-
if (consensusSubmitMessage) {
|
|
135
|
-
return {
|
|
136
|
-
type: "CONSENSUSSUBMITMESSAGE",
|
|
137
|
-
humanReadableType: "Submit Message",
|
|
138
|
-
consensusSubmitMessage
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
if (transactionBody.consensusUpdateTopic) {
|
|
143
|
-
const consensusUpdateTopic = this.parseConsensusUpdateTopic(
|
|
144
|
-
transactionBody.consensusUpdateTopic
|
|
145
|
-
);
|
|
146
|
-
if (consensusUpdateTopic) {
|
|
147
|
-
return {
|
|
148
|
-
type: "TOPICUPDATE",
|
|
149
|
-
humanReadableType: "Topic Update",
|
|
150
|
-
consensusUpdateTopic
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (transactionBody.consensusDeleteTopic) {
|
|
155
|
-
const consensusDeleteTopic = this.parseConsensusDeleteTopic(
|
|
156
|
-
transactionBody.consensusDeleteTopic
|
|
157
|
-
);
|
|
158
|
-
if (consensusDeleteTopic) {
|
|
159
|
-
return {
|
|
160
|
-
type: "TOPICDELETE",
|
|
161
|
-
humanReadableType: "Topic Delete",
|
|
162
|
-
consensusDeleteTopic
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return {};
|
|
55
|
+
return requireFn(specifier);
|
|
167
56
|
} catch (error) {
|
|
168
|
-
|
|
57
|
+
if (!isModuleNotFound(specifier, error)) {
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return dynamicImport(specifier);
|
|
63
|
+
}
|
|
64
|
+
function optionalImportSync(specifier) {
|
|
65
|
+
if (isBrowser) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
const globalObject = typeof global !== "undefined" ? global : globalThis;
|
|
70
|
+
const req = globalObject.process?.mainModule?.require ?? globalObject.require;
|
|
71
|
+
if (typeof req === "function" && typeof req.resolve === "function") {
|
|
72
|
+
return req(specifier);
|
|
73
|
+
}
|
|
74
|
+
} catch (error) {
|
|
75
|
+
if (!isModuleNotFound(specifier, error)) {
|
|
76
|
+
throw error;
|
|
169
77
|
}
|
|
170
78
|
}
|
|
79
|
+
return null;
|
|
171
80
|
}
|
|
172
81
|
export {
|
|
173
|
-
|
|
82
|
+
optionalImport,
|
|
83
|
+
optionalImportSync
|
|
174
84
|
};
|
|
175
85
|
//# sourceMappingURL=standards-sdk.es150.js.map
|