nara-sdk 1.0.89 → 1.0.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nara-sdk",
3
- "version": "1.0.89",
3
+ "version": "1.0.90",
4
4
  "description": "SDK for the Nara chain (Solana-compatible)",
5
5
  "module": "index.ts",
6
6
  "main": "index.ts",
@@ -35,6 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@coral-xyz/anchor": "^0.32.1",
38
+ "@noble/hashes": "^1.5.0",
38
39
  "@solana/spl-token": "^0.4.14",
39
40
  "@solana/web3.js": "^1.98.4",
40
41
  "bn.js": "^5.2.2",
@@ -14,7 +14,7 @@ import * as anchor from "@coral-xyz/anchor";
14
14
  import { Program, AnchorProvider, Wallet } from "@coral-xyz/anchor";
15
15
  import BN from "bn.js";
16
16
  import { getAssociatedTokenAddressSync, TOKEN_2022_PROGRAM_ID } from "@solana/spl-token";
17
- import { createHash } from "node:crypto";
17
+ import { blake3 } from "@noble/hashes/blake3";
18
18
  import bs58 from "bs58";
19
19
  import type { NaraAgentRegistry } from "./idls/nara_agent_registry";
20
20
  import { DEFAULT_AGENT_REGISTRY_PROGRAM_ID } from "./constants";
@@ -199,12 +199,12 @@ function getTreasuryPda(programId: PublicKey): PublicKey {
199
199
  }
200
200
 
201
201
  /**
202
- * SHA-256 of an index string. The chain uses this 32-byte hash both as a PDA
202
+ * BLAKE3 of an index string. The chain uses this 32-byte hash both as a PDA
203
203
  * seed (lifting the 32-byte raw-seed limit) and as an integrity check against
204
204
  * the supplied `index_str` (errors with `AgentIndexHashMismatch` on mismatch).
205
205
  */
206
206
  export function computeIndexHash(indexStr: string): Buffer {
207
- return createHash("sha256").update(indexStr, "utf8").digest();
207
+ return Buffer.from(blake3(Buffer.from(indexStr, "utf8")));
208
208
  }
209
209
 
210
210
  function getAgentIndexPda(programId: PublicKey, indexHash: Buffer | Uint8Array): PublicKey {