@d9-network/spec 1.2.4 → 1.2.6

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.
Files changed (33) hide show
  1. package/dist/index.cjs +46 -2
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +34 -1
  4. package/dist/index.d.mts +34 -1
  5. package/dist/index.mjs +46 -4
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +5 -9
  8. package/.papi/descriptors/.gitignore +0 -3
  9. package/.papi/descriptors/package.json +0 -24
  10. package/node_modules/@polkadot-api/descriptors/dist/chunk-7P6ASYW6.mjs +0 -9
  11. package/node_modules/@polkadot-api/descriptors/dist/common-types.d.ts +0 -3371
  12. package/node_modules/@polkadot-api/descriptors/dist/common.d.ts +0 -1
  13. package/node_modules/@polkadot-api/descriptors/dist/contracts/burnManager.d.ts +0 -183
  14. package/node_modules/@polkadot-api/descriptors/dist/contracts/burnMining.d.ts +0 -184
  15. package/node_modules/@polkadot-api/descriptors/dist/contracts/crossChainTransfer.d.ts +0 -249
  16. package/node_modules/@polkadot-api/descriptors/dist/contracts/index.d.ts +0 -8
  17. package/node_modules/@polkadot-api/descriptors/dist/contracts/marketMaker.d.ts +0 -209
  18. package/node_modules/@polkadot-api/descriptors/dist/contracts/merchantMining.d.ts +0 -263
  19. package/node_modules/@polkadot-api/descriptors/dist/contracts/miningPool.d.ts +0 -159
  20. package/node_modules/@polkadot-api/descriptors/dist/contracts/nodeReward.d.ts +0 -172
  21. package/node_modules/@polkadot-api/descriptors/dist/contracts/usdt.d.ts +0 -145
  22. package/node_modules/@polkadot-api/descriptors/dist/d9.d.ts +0 -3346
  23. package/node_modules/@polkadot-api/descriptors/dist/d9_metadata-EHIEZLL5.mjs +0 -8
  24. package/node_modules/@polkadot-api/descriptors/dist/d9_metadata.d.ts +0 -2
  25. package/node_modules/@polkadot-api/descriptors/dist/descriptors-JQ4ZJQ4V.mjs +0 -29
  26. package/node_modules/@polkadot-api/descriptors/dist/descriptors.d.ts +0 -1
  27. package/node_modules/@polkadot-api/descriptors/dist/index.d.ts +0 -11
  28. package/node_modules/@polkadot-api/descriptors/dist/index.js +0 -200
  29. package/node_modules/@polkadot-api/descriptors/dist/index.mjs +0 -115
  30. package/node_modules/@polkadot-api/descriptors/dist/metadataTypes-32V7BYUB.mjs +0 -8
  31. package/node_modules/@polkadot-api/descriptors/dist/metadataTypes.d.ts +0 -2
  32. package/node_modules/@polkadot-api/descriptors/generated.json +0 -1
  33. package/node_modules/@polkadot-api/descriptors/package.json +0 -24
package/dist/index.cjs CHANGED
@@ -7983,9 +7983,9 @@ var compactEnc = (input) => {
7983
7983
  return result;
7984
7984
  };
7985
7985
  var compact = createCodec(compactEnc, compactDec);
7986
- var textEncoder = new TextEncoder();
7986
+ var textEncoder$1 = new TextEncoder();
7987
7987
  var strEnc = (str2) => {
7988
- const val = textEncoder.encode(str2);
7988
+ const val = textEncoder$1.encode(str2);
7989
7989
  return mergeUint8([compact.enc(val.length), val]);
7990
7990
  };
7991
7991
  var textDecoder = new TextDecoder();
@@ -10396,6 +10396,48 @@ function toD9Address(address) {
10396
10396
  return toNetworkAddress(address, D9_SS58_PREFIX);
10397
10397
  }
10398
10398
 
10399
+ //#endregion
10400
+ //#region src/wallet/verify.ts
10401
+ const textEncoder = new TextEncoder();
10402
+ /**
10403
+ * Verify an SR25519 signature
10404
+ *
10405
+ * @param signature - The signature as a hex string or Uint8Array (64 bytes)
10406
+ * @param message - The message that was signed (string or Uint8Array)
10407
+ * @param publicKey - The public key to verify against (32 bytes)
10408
+ * @returns True if the signature is valid
10409
+ *
10410
+ * @example
10411
+ * ```typescript
10412
+ * const publicKey = ss58DecodePublicKey(address);
10413
+ * const isValid = sr25519Verify(signature, message, publicKey);
10414
+ * ```
10415
+ */
10416
+ function sr25519Verify(signature, message, publicKey) {
10417
+ const sigBytes = typeof signature === "string" ? isHexString(signature) ? hexToBytes(signature) : hexToBytes(`0x${signature}`) : signature;
10418
+ const msgBytes = typeof message === "string" ? textEncoder.encode(message) : message;
10419
+ return _polkadot_labs_hdkd_helpers.sr25519.verify(sigBytes, msgBytes, publicKey);
10420
+ }
10421
+ /**
10422
+ * Verify an SR25519 signature against a wallet address
10423
+ *
10424
+ * Convenience function that decodes the SS58 address and verifies in one step.
10425
+ *
10426
+ * @param walletAddress - The SS58 wallet address
10427
+ * @param signature - The signature as a hex string or Uint8Array
10428
+ * @param message - The message that was signed
10429
+ * @returns True if the signature is valid
10430
+ *
10431
+ * @example
10432
+ * ```typescript
10433
+ * const isValid = verifyWalletSignature(address, signature, message);
10434
+ * ```
10435
+ */
10436
+ function verifyWalletSignature(walletAddress, signature, message) {
10437
+ const [publicKey] = (0, _polkadot_labs_hdkd_helpers.ss58Decode)(walletAddress);
10438
+ return sr25519Verify(signature, message, publicKey);
10439
+ }
10440
+
10399
10441
  //#endregion
10400
10442
  //#region src/utils/balance.ts
10401
10443
  /**
@@ -10811,9 +10853,11 @@ exports.sr25519AddressFromKeypair = sr25519AddressFromKeypair;
10811
10853
  exports.sr25519AddressFromSecretKeyHex = sr25519AddressFromSecretKeyHex;
10812
10854
  exports.sr25519DeriveFromMiniSecret = sr25519DeriveFromMiniSecret;
10813
10855
  exports.sr25519KeypairFromMiniSecret = sr25519KeypairFromMiniSecret;
10856
+ exports.sr25519Verify = sr25519Verify;
10814
10857
  exports.ss58DecodePublicKey = ss58DecodePublicKey;
10815
10858
  exports.ss58Reencode = ss58Reencode;
10816
10859
  exports.toD9Address = toD9Address;
10817
10860
  exports.toNetworkAddress = toNetworkAddress;
10818
10861
  exports.validateMnemonic = validateMnemonic;
10862
+ exports.verifyWalletSignature = verifyWalletSignature;
10819
10863
  //# sourceMappingURL=index.cjs.map