@eclesia/indexer-engine 2.8.2 → 2.9.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/dist/emitter/index.cjs +8 -0
- package/dist/emitter/index.cjs.map +1 -1
- package/dist/emitter/index.d.cts +12 -0
- package/dist/emitter/index.d.cts.map +1 -1
- package/dist/emitter/index.d.ts +12 -0
- package/dist/emitter/index.d.ts.map +1 -1
- package/dist/emitter/index.js +8 -0
- package/dist/emitter/index.js.map +1 -1
- package/dist/indexer/index.cjs +11 -2
- package/dist/indexer/index.cjs.map +1 -1
- package/dist/indexer/index.d.cts +23 -1
- package/dist/indexer/index.d.cts.map +1 -1
- package/dist/indexer/index.d.ts +23 -1
- package/dist/indexer/index.d.ts.map +1 -1
- package/dist/indexer/index.js +11 -2
- package/dist/indexer/index.js.map +1 -1
- package/dist/promise-queue/index.cjs +12 -1
- package/dist/promise-queue/index.cjs.map +1 -1
- package/dist/promise-queue/index.d.cts +26 -0
- package/dist/promise-queue/index.d.cts.map +1 -1
- package/dist/promise-queue/index.d.ts +26 -0
- package/dist/promise-queue/index.d.ts.map +1 -1
- package/dist/promise-queue/index.js +12 -1
- package/dist/promise-queue/index.js.map +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +8 -1
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.ts +8 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/bech32.cjs +17 -0
- package/dist/utils/bech32.cjs.map +1 -1
- package/dist/utils/bech32.d.cts +17 -0
- package/dist/utils/bech32.d.cts.map +1 -1
- package/dist/utils/bech32.d.ts +17 -0
- package/dist/utils/bech32.d.ts.map +1 -1
- package/dist/utils/bech32.js +17 -0
- package/dist/utils/bech32.js.map +1 -1
- package/dist/utils/bigint.cjs +6 -0
- package/dist/utils/bigint.cjs.map +1 -1
- package/dist/utils/bigint.d.cts +6 -0
- package/dist/utils/bigint.d.cts.map +1 -1
- package/dist/utils/bigint.d.ts +6 -0
- package/dist/utils/bigint.d.ts.map +1 -1
- package/dist/utils/bigint.js +6 -0
- package/dist/utils/bigint.js.map +1 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/text.cjs +6 -0
- package/dist/utils/text.cjs.map +1 -1
- package/dist/utils/text.d.cts +6 -0
- package/dist/utils/text.d.cts.map +1 -1
- package/dist/utils/text.d.ts +6 -0
- package/dist/utils/text.d.ts.map +1 -1
- package/dist/utils/text.js +6 -0
- package/dist/utils/text.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;KAsBY,oBAAA;;;;;gCAKoB;;;8BAGF;;;;;eAKf;0BACW;EAdd,cAAA,EAAA,CAAA,MAAoB,EAAA,OAAA,EAAA,GAeO,OAfP,CAAA,IAAA,CAAA;CAAA;;AAQF,KAWlB,cAAA,GAAiB,cAXC,CAAA,CAWe,aAXf,EAW8B,oBAX9B,EAWoD,UAXpD,CAAA,CAAA;;AAMJ,KAQd,iBAAA,GAAoB,cARN,CAAA,CAQsB,aARtB,EAQqC,oBARrC,CAAA,CAAA;;AACoB,KAUlC,UAAA,GAAa,cAVqB,GAUJ,iBAVI;AAI9C;AAA0B,KASd,iBATc,CAAA,CAAA,CAAA,GAAA,QAAmB,MAU/B,CAV+B,GAU3B,CAV2B,CAUzB,CAVyB,CAAA,GAAA;EAAe,IAAA,CAAA,EAAA,MAAA;EAAsB,MAAA,CAAA,EAAA,MAAA;EAArD,SAAA,CAAA,EAAA,MAAA;AAAc,CAAA,EAG3C;;AAAgD,KAepC,QAfoC,CAAA,UAAA,MAeX,iBAfW,CAeO,QAfP,CAAA,CAAA,GAAA,CAAA,CAAA,EAgB3C,CAhB2C,EAAA,CAAA,EAiB3C,iBAjB2C,CAiBzB,QAjByB,CAAA,CAiBf,CAjBe,CAAA,EAAA,GAkB3C,OAlB2C,CAAA,IAAA,GAAA,IAAA,EAAA,CAAA;AAAe,KAoBnD,QAAA,GApBmD;MAA/B,EAAA,KAAA,GAAA,MAAA,GAAA,SAAA,GAAA,OAAA,GAAA,SAAA,GAAA,WAAA;EAAc,OAAA,EAAA,MAAA;AAG9C,CAAA;AAAsB,KAqBV,SAAA,GArBU;MAAG,EAAA,MAAA;OAAiB,CAAA,EAAA,MAAA;EAAiB,MAAA,EAAA,OAAA;AAG3D,CAAA;AAA6B,KAuBjB,MAAA,GAvBiB;KACf,EAuBP,QAvBO;MAAI,EAwBV,SAxBU;aAAE,EAAA;IAAC,KAAA,EAAA;MAQT,MAAQ,EAmBN,oBAnBM,CAAA,kBAAA,CAAA;MAAA,UAAA,EAoBF,SApBE,EAAA,GAAA,SAAA;IAAmC,CAAA;;OAClD,EAAA;IACkB,KAAA,EAAA;MAAlB,KAAA,EAwBQ,aAxBR;MAA4B,aAAA,EAyBZ,oBAzBY;IAC5B,CAAA;EAAO,CAAA;EAEA,SAAA,EAAQ;IAIR,KAAA,EAsBD,oBAtBU,CAAA,gBAAA,CAAA;EAKT,CAAA;EAAM,SAAA,EAAA;IACX,KAAA,EAmBI,oBAnBJ,CAAA,SAAA,CAAA;;SAIO,EAAA;IACI,KAAA,EAAA;MAML,MAAA,EAAA,MAAA;MACQ,MAAA,EAYP,MAZO;IAIV,CAAA;;YAQG,EAAA;IAAM,IAAA,EAAA,MAAA;IAiBR,KAAA,EAAQ,OAAA;EAAA,CAAA;eACd,EAAA;IACI,KAAA,EAAA,IAAA;EAAK,CAAA;EAIE,cAAA,EAAA;IAAc,KAAA,EAAA,IAAA;;iBAKhB,EAAA;IAAO,KAAA,EAAA,IAAA;;;KAXV;MACN;UACI;;;UAIO,cAAA;WACN;;;;eAII"}
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":["/* eslint-disable @stylistic/no-multi-spaces */\nimport {\n BlockResponse, BlockResultsResponse,\n} from \"@cosmjs/tendermint-rpc\";\nimport {\n Event,\n} from \"@cosmjs/tendermint-rpc/build/comet38/responses\";\nimport {\n Validator,\n} from \"cosmjs-types/cosmos/staking/v1beta1/staking\";\nimport {\n TxBody,\n} from \"cosmjs-types/cosmos/tx/v1beta1/tx\";\n\nimport {\n EcleciaIndexer,\n} from \"../indexer\";\nimport {\n CircularBuffer,\n} from \"../promise-queue\";\n\n/** Configuration interface for the Eclesia indexer */\nexport type EcleciaIndexerConfig = {\n startHeight?: number // Block height to start indexing from\n endHeight?: number // Block height to stop indexing at (optional)\n batchSize: number // Number of blocks to process in parallel\n modules: string[] // List of module names to enable\n getNextHeight: () => number | PromiseLike<number> // Function to determine next block to process\n logLevel: \"error\" | \"warn\" | \"info\" | \"http\" | \"verbose\" | \"debug\" | \"silly\" // Logging verbosity level\n rpcUrl: string // Tendermint RPC endpoint URL\n shouldProcessGenesis: () => Promise<boolean> // Whether to process genesis state\n genesisPath?: string // Path to genesis file\n usePolling?: boolean // Use polling instead of WebSocket subscription\n pollingInterval?: number // Interval between polls in milliseconds\n minimal?: boolean // Use minimal indexing mode (blocks only)\n init?: () => Promise<void> // Custom initialization function\n beginTransaction: () => Promise<void> // Function to begin database transaction\n endTransaction: (status: boolean) => Promise<void> // Function to end database transaction\n};\n\n/** Queue for full indexing mode with validator data */\nexport type FullBlockQueue = CircularBuffer<[BlockResponse, BlockResultsResponse, Uint8Array]>;\n\n/** Queue for minimal indexing mode without validator data */\nexport type MinimalBlockQueue = CircularBuffer<[BlockResponse, BlockResultsResponse]>;\n\n/** Union type for block queues */\nexport type BlockQueue = FullBlockQueue | MinimalBlockQueue;\n\n/** Utility type to add height, timestamp, and UUID to event types */\nexport type WithHeightAndUUID<T> = {\n [K in keyof T]: T[K] & {\n uuid?: string // Unique identifier for event tracking\n height?: number // Block height when event occurred\n timestamp?: string // Block timestamp when event occurred\n };\n};\n\n/** Function signature for emitting events asynchronously */\nexport type EmitFunc<K extends keyof WithHeightAndUUID<EventMap>> = (\n t: K,\n e: WithHeightAndUUID<EventMap>[K]\n) => Promise<void | void[]>;\n\nexport type LogEvent = {\n type: \"log\" | \"info\" | \"warning\" | \"error\" | \"verbose\" | \"transient\"\n message: string\n};\nexport type UUIDEvent = {\n uuid: string\n error?: string\n status: boolean\n};\nexport type Events = {\n log: LogEvent\n uuid: UUIDEvent\n begin_block: {\n value: {\n events: BlockResultsResponse[\"beginBlockEvents\"]\n validators: Validator[] | undefined\n }\n }\n\n block: {\n value: {\n block: BlockResponse\n block_results: BlockResultsResponse\n }\n }\n end_block: {\n value: BlockResultsResponse[\"endBlockEvents\"]\n }\n tx_events: {\n value: BlockResultsResponse[\"results\"]\n }\n tx_memo: {\n value: {\n txHash: string\n txBody: TxBody\n }\n }\n _unhandled: {\n type: string\n event: unknown\n }\n \"periodic/50\": {\n value: null\n }\n \"periodic/100\": {\n value: null\n }\n \"periodic/1000\": {\n value: null\n }\n};\nexport type TxResult<T> = {\n tx: T\n events: Event[]\n};\n\n/** Interface that all indexing modules must implement */\nexport interface IndexingModule {\n indexer: EcleciaIndexer // Reference to the main indexer instance\n name: string // Unique module name\n depends: string[] // Array of module names this module depends on\n provides: string[] // Array of capabilities this module provides\n setup: () => Promise<void> // Async setup function for database schema initialization\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n init: (...args: any[]) => void // Initialization function called by the indexer\n}\n"],"mappings":""}
|
package/dist/utils/bech32.cjs
CHANGED
|
@@ -3,11 +3,22 @@ let bech32 = require("bech32");
|
|
|
3
3
|
bech32 = require_rolldown_runtime.__toESM(bech32);
|
|
4
4
|
|
|
5
5
|
//#region src/utils/bech32.ts
|
|
6
|
+
/**
|
|
7
|
+
* Converts a byte array to a hexadecimal string representation
|
|
8
|
+
* @param byteArray - Array of bytes to convert
|
|
9
|
+
* @returns Hexadecimal string
|
|
10
|
+
*/
|
|
6
11
|
function toHexString(byteArray) {
|
|
7
12
|
return Array.prototype.map.call(byteArray, (byte) => {
|
|
8
13
|
return ("0" + (byte & 255).toString(16)).slice(-2);
|
|
9
14
|
}).join("");
|
|
10
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Extracts the key hash from a bech32-encoded address
|
|
18
|
+
* @param address - Bech32-encoded address string
|
|
19
|
+
* @returns Hexadecimal key hash
|
|
20
|
+
* @throws Error if address cannot be decoded
|
|
21
|
+
*/
|
|
11
22
|
function keyHashfromAddress(address) {
|
|
12
23
|
try {
|
|
13
24
|
return toHexString(bech32.bech32.fromWords(bech32.bech32.decode(address).words));
|
|
@@ -15,6 +26,12 @@ function keyHashfromAddress(address) {
|
|
|
15
26
|
throw new Error("Could not decode address");
|
|
16
27
|
}
|
|
17
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Creates a bech32-encoded address from a key hash and prefix
|
|
31
|
+
* @param prefix - Address prefix (e.g., "cosmos", "cosmosvalcons")
|
|
32
|
+
* @param keyhash - Hexadecimal key hash
|
|
33
|
+
* @returns Bech32-encoded address or empty string if keyhash is empty
|
|
34
|
+
*/
|
|
18
35
|
function chainAddressfromKeyhash(prefix, keyhash) {
|
|
19
36
|
const words = bech32.bech32.toWords(Buffer.from(keyhash, "hex"));
|
|
20
37
|
return keyhash !== "" ? bech32.bech32.encode(prefix, words) : "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bech32.cjs","names":[],"sources":["../../src/utils/bech32.ts"],"sourcesContent":["import {\n bech32,\n} from \"bech32\";\n\nfunction toHexString(byteArray: number[]) {\n return Array.prototype.map\n .call(\n byteArray, (byte) => {\n return (\"0\" + (byte & 0xff).toString(16)).slice(-2);\n },\n )\n .join(\"\");\n}\nfunction keyHashfromAddress(address: string): string {\n try {\n return toHexString(bech32.fromWords(bech32.decode(address).words));\n }\n catch (_e) {\n throw new Error(\"Could not decode address\");\n }\n}\nfunction chainAddressfromKeyhash(prefix: string, keyhash: string) {\n const words = bech32.toWords(Buffer.from(\n keyhash, \"hex\",\n ));\n\n return keyhash !== \"\"\n ? bech32.encode(\n prefix, words,\n )\n : \"\";\n}\n\nexport {\n chainAddressfromKeyhash, keyHashfromAddress, toHexString,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"bech32.cjs","names":[],"sources":["../../src/utils/bech32.ts"],"sourcesContent":["import {\n bech32,\n} from \"bech32\";\n\n/**\n * Converts a byte array to a hexadecimal string representation\n * @param byteArray - Array of bytes to convert\n * @returns Hexadecimal string\n */\nfunction toHexString(byteArray: number[]) {\n return Array.prototype.map\n .call(\n byteArray, (byte) => {\n return (\"0\" + (byte & 0xff).toString(16)).slice(-2);\n },\n )\n .join(\"\");\n}\n\n/**\n * Extracts the key hash from a bech32-encoded address\n * @param address - Bech32-encoded address string\n * @returns Hexadecimal key hash\n * @throws Error if address cannot be decoded\n */\nfunction keyHashfromAddress(address: string): string {\n try {\n return toHexString(bech32.fromWords(bech32.decode(address).words));\n }\n catch (_e) {\n throw new Error(\"Could not decode address\");\n }\n}\n\n/**\n * Creates a bech32-encoded address from a key hash and prefix\n * @param prefix - Address prefix (e.g., \"cosmos\", \"cosmosvalcons\")\n * @param keyhash - Hexadecimal key hash\n * @returns Bech32-encoded address or empty string if keyhash is empty\n */\nfunction chainAddressfromKeyhash(prefix: string, keyhash: string) {\n const words = bech32.toWords(Buffer.from(\n keyhash, \"hex\",\n ));\n\n return keyhash !== \"\"\n ? bech32.encode(\n prefix, words,\n )\n : \"\";\n}\n\nexport {\n chainAddressfromKeyhash, keyHashfromAddress, toHexString,\n};\n"],"mappings":";;;;;;;;;;AASA,SAAS,YAAY,WAAqB;AACxC,QAAO,MAAM,UAAU,IACpB,KACC,YAAY,SAAS;AACnB,UAAQ,OAAO,OAAO,KAAM,SAAS,GAAG,EAAE,MAAM,GAAG;GAEtD,CACA,KAAK,GAAG;;;;;;;;AASb,SAAS,mBAAmB,SAAyB;AACnD,KAAI;AACF,SAAO,YAAY,cAAO,UAAU,cAAO,OAAO,QAAQ,CAAC,MAAM,CAAC;UAE7D,IAAI;AACT,QAAM,IAAI,MAAM,2BAA2B;;;;;;;;;AAU/C,SAAS,wBAAwB,QAAgB,SAAiB;CAChE,MAAM,QAAQ,cAAO,QAAQ,OAAO,KAClC,SAAS,MACV,CAAC;AAEF,QAAO,YAAY,KACf,cAAO,OACP,QAAQ,MACT,GACC"}
|
package/dist/utils/bech32.d.cts
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
//#region src/utils/bech32.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts a byte array to a hexadecimal string representation
|
|
4
|
+
* @param byteArray - Array of bytes to convert
|
|
5
|
+
* @returns Hexadecimal string
|
|
6
|
+
*/
|
|
2
7
|
declare function toHexString(byteArray: number[]): string;
|
|
8
|
+
/**
|
|
9
|
+
* Extracts the key hash from a bech32-encoded address
|
|
10
|
+
* @param address - Bech32-encoded address string
|
|
11
|
+
* @returns Hexadecimal key hash
|
|
12
|
+
* @throws Error if address cannot be decoded
|
|
13
|
+
*/
|
|
3
14
|
declare function keyHashfromAddress(address: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a bech32-encoded address from a key hash and prefix
|
|
17
|
+
* @param prefix - Address prefix (e.g., "cosmos", "cosmosvalcons")
|
|
18
|
+
* @param keyhash - Hexadecimal key hash
|
|
19
|
+
* @returns Bech32-encoded address or empty string if keyhash is empty
|
|
20
|
+
*/
|
|
4
21
|
declare function chainAddressfromKeyhash(prefix: string, keyhash: string): string;
|
|
5
22
|
//#endregion
|
|
6
23
|
export { chainAddressfromKeyhash, keyHashfromAddress, toHexString };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bech32.d.cts","names":[],"sources":["../../src/utils/bech32.ts"],"sourcesContent":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"bech32.d.cts","names":[],"sources":["../../src/utils/bech32.ts"],"sourcesContent":[],"mappings":";;;AASoB;AAgBO;;iBAhBlB,WAAA;;;;;;;iBAgBA,kBAAA;;;;;;;iBAeA,uBAAA"}
|
package/dist/utils/bech32.d.ts
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
//#region src/utils/bech32.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts a byte array to a hexadecimal string representation
|
|
4
|
+
* @param byteArray - Array of bytes to convert
|
|
5
|
+
* @returns Hexadecimal string
|
|
6
|
+
*/
|
|
2
7
|
declare function toHexString(byteArray: number[]): string;
|
|
8
|
+
/**
|
|
9
|
+
* Extracts the key hash from a bech32-encoded address
|
|
10
|
+
* @param address - Bech32-encoded address string
|
|
11
|
+
* @returns Hexadecimal key hash
|
|
12
|
+
* @throws Error if address cannot be decoded
|
|
13
|
+
*/
|
|
3
14
|
declare function keyHashfromAddress(address: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a bech32-encoded address from a key hash and prefix
|
|
17
|
+
* @param prefix - Address prefix (e.g., "cosmos", "cosmosvalcons")
|
|
18
|
+
* @param keyhash - Hexadecimal key hash
|
|
19
|
+
* @returns Bech32-encoded address or empty string if keyhash is empty
|
|
20
|
+
*/
|
|
4
21
|
declare function chainAddressfromKeyhash(prefix: string, keyhash: string): string;
|
|
5
22
|
//#endregion
|
|
6
23
|
export { chainAddressfromKeyhash, keyHashfromAddress, toHexString };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bech32.d.ts","names":[],"sources":["../../src/utils/bech32.ts"],"sourcesContent":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"bech32.d.ts","names":[],"sources":["../../src/utils/bech32.ts"],"sourcesContent":[],"mappings":";;;AASoB;AAgBO;;iBAhBlB,WAAA;;;;;;;iBAgBA,kBAAA;;;;;;;iBAeA,uBAAA"}
|
package/dist/utils/bech32.js
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { bech32 } from "bech32";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/bech32.ts
|
|
4
|
+
/**
|
|
5
|
+
* Converts a byte array to a hexadecimal string representation
|
|
6
|
+
* @param byteArray - Array of bytes to convert
|
|
7
|
+
* @returns Hexadecimal string
|
|
8
|
+
*/
|
|
4
9
|
function toHexString(byteArray) {
|
|
5
10
|
return Array.prototype.map.call(byteArray, (byte) => {
|
|
6
11
|
return ("0" + (byte & 255).toString(16)).slice(-2);
|
|
7
12
|
}).join("");
|
|
8
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Extracts the key hash from a bech32-encoded address
|
|
16
|
+
* @param address - Bech32-encoded address string
|
|
17
|
+
* @returns Hexadecimal key hash
|
|
18
|
+
* @throws Error if address cannot be decoded
|
|
19
|
+
*/
|
|
9
20
|
function keyHashfromAddress(address) {
|
|
10
21
|
try {
|
|
11
22
|
return toHexString(bech32.fromWords(bech32.decode(address).words));
|
|
@@ -13,6 +24,12 @@ function keyHashfromAddress(address) {
|
|
|
13
24
|
throw new Error("Could not decode address");
|
|
14
25
|
}
|
|
15
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Creates a bech32-encoded address from a key hash and prefix
|
|
29
|
+
* @param prefix - Address prefix (e.g., "cosmos", "cosmosvalcons")
|
|
30
|
+
* @param keyhash - Hexadecimal key hash
|
|
31
|
+
* @returns Bech32-encoded address or empty string if keyhash is empty
|
|
32
|
+
*/
|
|
16
33
|
function chainAddressfromKeyhash(prefix, keyhash) {
|
|
17
34
|
const words = bech32.toWords(Buffer.from(keyhash, "hex"));
|
|
18
35
|
return keyhash !== "" ? bech32.encode(prefix, words) : "";
|
package/dist/utils/bech32.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bech32.js","names":[],"sources":["../../src/utils/bech32.ts"],"sourcesContent":["import {\n bech32,\n} from \"bech32\";\n\nfunction toHexString(byteArray: number[]) {\n return Array.prototype.map\n .call(\n byteArray, (byte) => {\n return (\"0\" + (byte & 0xff).toString(16)).slice(-2);\n },\n )\n .join(\"\");\n}\nfunction keyHashfromAddress(address: string): string {\n try {\n return toHexString(bech32.fromWords(bech32.decode(address).words));\n }\n catch (_e) {\n throw new Error(\"Could not decode address\");\n }\n}\nfunction chainAddressfromKeyhash(prefix: string, keyhash: string) {\n const words = bech32.toWords(Buffer.from(\n keyhash, \"hex\",\n ));\n\n return keyhash !== \"\"\n ? bech32.encode(\n prefix, words,\n )\n : \"\";\n}\n\nexport {\n chainAddressfromKeyhash, keyHashfromAddress, toHexString,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"bech32.js","names":[],"sources":["../../src/utils/bech32.ts"],"sourcesContent":["import {\n bech32,\n} from \"bech32\";\n\n/**\n * Converts a byte array to a hexadecimal string representation\n * @param byteArray - Array of bytes to convert\n * @returns Hexadecimal string\n */\nfunction toHexString(byteArray: number[]) {\n return Array.prototype.map\n .call(\n byteArray, (byte) => {\n return (\"0\" + (byte & 0xff).toString(16)).slice(-2);\n },\n )\n .join(\"\");\n}\n\n/**\n * Extracts the key hash from a bech32-encoded address\n * @param address - Bech32-encoded address string\n * @returns Hexadecimal key hash\n * @throws Error if address cannot be decoded\n */\nfunction keyHashfromAddress(address: string): string {\n try {\n return toHexString(bech32.fromWords(bech32.decode(address).words));\n }\n catch (_e) {\n throw new Error(\"Could not decode address\");\n }\n}\n\n/**\n * Creates a bech32-encoded address from a key hash and prefix\n * @param prefix - Address prefix (e.g., \"cosmos\", \"cosmosvalcons\")\n * @param keyhash - Hexadecimal key hash\n * @returns Bech32-encoded address or empty string if keyhash is empty\n */\nfunction chainAddressfromKeyhash(prefix: string, keyhash: string) {\n const words = bech32.toWords(Buffer.from(\n keyhash, \"hex\",\n ));\n\n return keyhash !== \"\"\n ? bech32.encode(\n prefix, words,\n )\n : \"\";\n}\n\nexport {\n chainAddressfromKeyhash, keyHashfromAddress, toHexString,\n};\n"],"mappings":";;;;;;;;AASA,SAAS,YAAY,WAAqB;AACxC,QAAO,MAAM,UAAU,IACpB,KACC,YAAY,SAAS;AACnB,UAAQ,OAAO,OAAO,KAAM,SAAS,GAAG,EAAE,MAAM,GAAG;GAEtD,CACA,KAAK,GAAG;;;;;;;;AASb,SAAS,mBAAmB,SAAyB;AACnD,KAAI;AACF,SAAO,YAAY,OAAO,UAAU,OAAO,OAAO,QAAQ,CAAC,MAAM,CAAC;UAE7D,IAAI;AACT,QAAM,IAAI,MAAM,2BAA2B;;;;;;;;;AAU/C,SAAS,wBAAwB,QAAgB,SAAiB;CAChE,MAAM,QAAQ,OAAO,QAAQ,OAAO,KAClC,SAAS,MACV,CAAC;AAEF,QAAO,YAAY,KACf,OAAO,OACP,QAAQ,MACT,GACC"}
|
package/dist/utils/bigint.cjs
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
//#region src/utils/bigint.ts
|
|
3
|
+
/**
|
|
4
|
+
* Converts an object containing BigInt values to a plain JavaScript object
|
|
5
|
+
* BigInt values are converted to strings to maintain precision in JSON serialization
|
|
6
|
+
* @param obj - Object that may contain BigInt values
|
|
7
|
+
* @returns Plain object with BigInt values converted to strings
|
|
8
|
+
*/
|
|
3
9
|
const toPlainObject = (obj) => {
|
|
4
10
|
return JSON.parse(JSON.stringify(obj, (key, value) => typeof value === "bigint" ? value.toString() : value));
|
|
5
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bigint.cjs","names":[],"sources":["../../src/utils/bigint.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"bigint.cjs","names":[],"sources":["../../src/utils/bigint.ts"],"sourcesContent":["/**\n * Converts an object containing BigInt values to a plain JavaScript object\n * BigInt values are converted to strings to maintain precision in JSON serialization\n * @param obj - Object that may contain BigInt values\n * @returns Plain object with BigInt values converted to strings\n */\nconst toPlainObject = (obj: unknown) => {\n return JSON.parse(JSON.stringify(obj,\n (key, value) => (typeof value === \"bigint\" ? value.toString() : value), // return everything else unchanged\n ));\n};\nexport {\n toPlainObject,\n};\n"],"mappings":";;;;;;;;AAMA,MAAM,iBAAiB,QAAiB;AACtC,QAAO,KAAK,MAAM,KAAK,UAAU,MAC9B,KAAK,UAAW,OAAO,UAAU,WAAW,MAAM,UAAU,GAAG,MACjE,CAAC"}
|
package/dist/utils/bigint.d.cts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
//#region src/utils/bigint.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts an object containing BigInt values to a plain JavaScript object
|
|
4
|
+
* BigInt values are converted to strings to maintain precision in JSON serialization
|
|
5
|
+
* @param obj - Object that may contain BigInt values
|
|
6
|
+
* @returns Plain object with BigInt values converted to strings
|
|
7
|
+
*/
|
|
2
8
|
declare const toPlainObject: (obj: unknown) => any;
|
|
3
9
|
//#endregion
|
|
4
10
|
export { toPlainObject };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bigint.d.cts","names":[],"sources":["../../src/utils/bigint.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bigint.d.cts","names":[],"sources":["../../src/utils/bigint.ts"],"sourcesContent":[],"mappings":";;;;;;;cAMM"}
|
package/dist/utils/bigint.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
//#region src/utils/bigint.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts an object containing BigInt values to a plain JavaScript object
|
|
4
|
+
* BigInt values are converted to strings to maintain precision in JSON serialization
|
|
5
|
+
* @param obj - Object that may contain BigInt values
|
|
6
|
+
* @returns Plain object with BigInt values converted to strings
|
|
7
|
+
*/
|
|
2
8
|
declare const toPlainObject: (obj: unknown) => any;
|
|
3
9
|
//#endregion
|
|
4
10
|
export { toPlainObject };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bigint.d.ts","names":[],"sources":["../../src/utils/bigint.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bigint.d.ts","names":[],"sources":["../../src/utils/bigint.ts"],"sourcesContent":[],"mappings":";;;;;;;cAMM"}
|
package/dist/utils/bigint.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
//#region src/utils/bigint.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts an object containing BigInt values to a plain JavaScript object
|
|
4
|
+
* BigInt values are converted to strings to maintain precision in JSON serialization
|
|
5
|
+
* @param obj - Object that may contain BigInt values
|
|
6
|
+
* @returns Plain object with BigInt values converted to strings
|
|
7
|
+
*/
|
|
2
8
|
const toPlainObject = (obj) => {
|
|
3
9
|
return JSON.parse(JSON.stringify(obj, (key, value) => typeof value === "bigint" ? value.toString() : value));
|
|
4
10
|
};
|
package/dist/utils/bigint.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bigint.js","names":[],"sources":["../../src/utils/bigint.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"bigint.js","names":[],"sources":["../../src/utils/bigint.ts"],"sourcesContent":["/**\n * Converts an object containing BigInt values to a plain JavaScript object\n * BigInt values are converted to strings to maintain precision in JSON serialization\n * @param obj - Object that may contain BigInt values\n * @returns Plain object with BigInt values converted to strings\n */\nconst toPlainObject = (obj: unknown) => {\n return JSON.parse(JSON.stringify(obj,\n (key, value) => (typeof value === \"bigint\" ? value.toString() : value), // return everything else unchanged\n ));\n};\nexport {\n toPlainObject,\n};\n"],"mappings":";;;;;;;AAMA,MAAM,iBAAiB,QAAiB;AACtC,QAAO,KAAK,MAAM,KAAK,UAAU,MAC9B,KAAK,UAAW,OAAO,UAAU,WAAW,MAAM,UAAU,GAAG,MACjE,CAAC"}
|
package/dist/utils/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["// Utility function exports\nexport * from \"./bech32\"; // Bech32 address encoding/decoding utilities\nexport * from \"./bigint\"; // BigInt handling utilities\nexport * from \"./text\"; // Text processing and encoding utilities\n"],"mappings":""}
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["// Utility function exports\nexport * from \"./bech32\"; // Bech32 address encoding/decoding utilities\nexport * from \"./bigint\"; // BigInt handling utilities\nexport * from \"./text\"; // Text processing and encoding utilities\n"],"mappings":""}
|
package/dist/utils/text.cjs
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
//#region src/utils/text.ts
|
|
3
|
+
/**
|
|
4
|
+
* Decodes blockchain event attributes from various formats to strings
|
|
5
|
+
* Handles both string and Uint8Array inputs from Tendermint events
|
|
6
|
+
* @param x - The attribute value to decode (string or Uint8Array)
|
|
7
|
+
* @returns Decoded string value
|
|
8
|
+
*/
|
|
3
9
|
const decodeAttr = (x) => {
|
|
4
10
|
if (typeof x === "string") return x;
|
|
5
11
|
else if (x instanceof Uint8Array) return Buffer.from(x).toString();
|
package/dist/utils/text.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.cjs","names":[],"sources":["../../src/utils/text.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"text.cjs","names":[],"sources":["../../src/utils/text.ts"],"sourcesContent":["/**\n * Decodes blockchain event attributes from various formats to strings\n * Handles both string and Uint8Array inputs from Tendermint events\n * @param x - The attribute value to decode (string or Uint8Array)\n * @returns Decoded string value\n */\nexport const decodeAttr = (x: Uint8Array | string) => {\n if (typeof x === \"string\") {\n return x;\n }\n else if (x instanceof Uint8Array) {\n return Buffer.from(x).toString();\n }\n else {\n return \"\";\n }\n};\n"],"mappings":";;;;;;;;AAMA,MAAa,cAAc,MAA2B;AACpD,KAAI,OAAO,MAAM,SACf,QAAO;UAEA,aAAa,WACpB,QAAO,OAAO,KAAK,EAAE,CAAC,UAAU;KAGhC,QAAO"}
|
package/dist/utils/text.d.cts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
//#region src/utils/text.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Decodes blockchain event attributes from various formats to strings
|
|
4
|
+
* Handles both string and Uint8Array inputs from Tendermint events
|
|
5
|
+
* @param x - The attribute value to decode (string or Uint8Array)
|
|
6
|
+
* @returns Decoded string value
|
|
7
|
+
*/
|
|
2
8
|
declare const decodeAttr: (x: Uint8Array | string) => string;
|
|
3
9
|
//#endregion
|
|
4
10
|
export { decodeAttr };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.cts","names":[],"sources":["../../src/utils/text.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text.d.cts","names":[],"sources":["../../src/utils/text.ts"],"sourcesContent":[],"mappings":";;AAMA;;;;;cAAa,gBAAiB"}
|
package/dist/utils/text.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
//#region src/utils/text.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Decodes blockchain event attributes from various formats to strings
|
|
4
|
+
* Handles both string and Uint8Array inputs from Tendermint events
|
|
5
|
+
* @param x - The attribute value to decode (string or Uint8Array)
|
|
6
|
+
* @returns Decoded string value
|
|
7
|
+
*/
|
|
2
8
|
declare const decodeAttr: (x: Uint8Array | string) => string;
|
|
3
9
|
//#endregion
|
|
4
10
|
export { decodeAttr };
|
package/dist/utils/text.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","names":[],"sources":["../../src/utils/text.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text.d.ts","names":[],"sources":["../../src/utils/text.ts"],"sourcesContent":[],"mappings":";;AAMA;;;;;cAAa,gBAAiB"}
|
package/dist/utils/text.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
//#region src/utils/text.ts
|
|
2
|
+
/**
|
|
3
|
+
* Decodes blockchain event attributes from various formats to strings
|
|
4
|
+
* Handles both string and Uint8Array inputs from Tendermint events
|
|
5
|
+
* @param x - The attribute value to decode (string or Uint8Array)
|
|
6
|
+
* @returns Decoded string value
|
|
7
|
+
*/
|
|
2
8
|
const decodeAttr = (x) => {
|
|
3
9
|
if (typeof x === "string") return x;
|
|
4
10
|
else if (x instanceof Uint8Array) return Buffer.from(x).toString();
|
package/dist/utils/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","names":[],"sources":["../../src/utils/text.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"text.js","names":[],"sources":["../../src/utils/text.ts"],"sourcesContent":["/**\n * Decodes blockchain event attributes from various formats to strings\n * Handles both string and Uint8Array inputs from Tendermint events\n * @param x - The attribute value to decode (string or Uint8Array)\n * @returns Decoded string value\n */\nexport const decodeAttr = (x: Uint8Array | string) => {\n if (typeof x === \"string\") {\n return x;\n }\n else if (x instanceof Uint8Array) {\n return Buffer.from(x).toString();\n }\n else {\n return \"\";\n }\n};\n"],"mappings":";;;;;;;AAMA,MAAa,cAAc,MAA2B;AACpD,KAAI,OAAO,MAAM,SACf,QAAO;UAEA,aAAa,WACpB,QAAO,OAAO,KAAK,EAAE,CAAC,UAAU;KAGhC,QAAO"}
|