@qorechain/sdk 0.5.0 → 0.5.1

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/index.d.cts CHANGED
@@ -409,13 +409,13 @@ declare class QorClient extends JsonRpcClient {
409
409
 
410
410
  /**
411
411
  * Default static-fallback parameters, used when the AI fee oracle is
412
- * unavailable. The gas price (`uqor` per unit of gas) is intentionally
413
- * conservative and matches the relayer default in the core repo
414
- * (`gas_price = 0.025 uqor`).
412
+ * unavailable. The gas price (`uqor` per unit of gas) sits above the chain's
413
+ * genesis min-gas-price (BaseFee) of `0.1uqor` per unit of gas, which is
414
+ * enforced on both networks.
415
415
  */
416
416
  declare const STATIC_FALLBACK: {
417
417
  /** Fallback gas price, in base denom per unit of gas. */
418
- readonly gasPrice: "0.025";
418
+ readonly gasPrice: "0.15";
419
419
  /** Base denomination fees are paid in. */
420
420
  readonly denom: "uqor";
421
421
  /** Default gas limit when the caller does not supply one. */
@@ -575,8 +575,13 @@ declare function calculateFee(gas: number | string, gasPrice: GasPrice | string)
575
575
  declare const MSG_SEND_TYPE_URL = "/cosmos.bank.v1beta1.MsgSend";
576
576
  /** Default gas-used safety multiplier applied to a simulation result. */
577
577
  declare const DEFAULT_GAS_MULTIPLIER = 1.4;
578
- /** Default gas price for the auto-fee path (conservative, matches `tx/fees`). */
579
- declare const DEFAULT_GAS_PRICE = "0.025uqor";
578
+ /**
579
+ * Default gas price for the auto-fee path (matches `tx/fees`).
580
+ *
581
+ * The chain enforces a genesis min-gas-price (BaseFee) of `0.1uqor` per unit
582
+ * of gas on both networks; the default sits above the floor for headroom.
583
+ */
584
+ declare const DEFAULT_GAS_PRICE = "0.15uqor";
580
585
  /**
581
586
  * A fee that is either an explicit {@link StdFee} or the literal `"auto"`, which
582
587
  * triggers simulation-based gas estimation and fee computation.
@@ -736,7 +741,7 @@ declare class TxClient {
736
741
  *
737
742
  * `fee` may be an explicit {@link StdFee} or the literal `"auto"`, which
738
743
  * simulates the tx to estimate gas and computes the fee from a gas
739
- * multiplier (default 1.4) and gas price (default `0.025uqor`); tune both via
744
+ * multiplier (default 1.4) and gas price (default `0.15uqor`); tune both via
740
745
  * `opts.autoFee`.
741
746
  *
742
747
  * Broadcast mode maps onto cosmjs transports:
@@ -1439,18 +1444,24 @@ interface Signer {
1439
1444
  * assemble or broadcast transactions — the tx-builder attaches the extension
1440
1445
  * the {@link buildHybridSignatureExtension} result describes.
1441
1446
  *
1442
- * Crypto is delegated entirely to the audited, pure-TS `@noble/post-quantum`
1443
- * (`ml_dsa87`). No primitives are reimplemented here.
1447
+ * Crypto is delegated entirely to `@qorechain/pqc` (`mldsa87`, wrapping the
1448
+ * audited, pure-TS `@noble/post-quantum`). No primitives are reimplemented
1449
+ * here.
1450
+ *
1451
+ * Signing is DETERMINISTIC (FIPS-204 §3.4, rnd = 32 zero bytes) by default:
1452
+ * the chain's on-chain PQC verifier accepts ONLY deterministic ML-DSA-87
1453
+ * signatures (hedged signatures are rejected with codespace `pqc`), so this
1454
+ * default is consensus-critical. Pass `{ hedged: true }` to {@link pqcSign}
1455
+ * only for off-chain uses that want side-channel hedging.
1444
1456
  */
1445
1457
 
1446
1458
  /**
1447
1459
  * ML-DSA-87 (Dilithium-5) byte lengths.
1448
1460
  *
1449
1461
  * These are fixed by NIST FIPS 204 and match the chain's `x/pqc` constants
1450
- * exactly. The installed `@noble/post-quantum` `ml_dsa87` does not expose these
1451
- * as runtime properties, so we encode the standard's values directly; the test
1452
- * suite asserts that the library actually produces keys/signatures of these
1453
- * lengths, guarding against any future library drift.
1462
+ * exactly. We encode the standard's values directly; the test suite asserts
1463
+ * that the library actually produces keys/signatures of these lengths,
1464
+ * guarding against any future library drift.
1454
1465
  */
1455
1466
  /** ML-DSA-87 public-key length, in bytes (FIPS 204 / core: 2592). */
1456
1467
  declare const ML_DSA_87_PUBLIC_KEY_LENGTH = 2592;
@@ -1481,8 +1492,17 @@ interface PqcKeypair {
1481
1492
  * Must be exactly {@link ML_DSA_87_SEED_LENGTH} bytes if provided.
1482
1493
  */
1483
1494
  declare function generatePqcKeypair(seed?: Uint8Array): PqcKeypair;
1484
- /** Sign a message with an ML-DSA-87 (Dilithium-5) secret key. */
1485
- declare function pqcSign(secretKey: Uint8Array, message: Uint8Array): Uint8Array;
1495
+ /**
1496
+ * Sign a message with an ML-DSA-87 (Dilithium-5) secret key.
1497
+ *
1498
+ * DETERMINISTIC (FIPS-204 §3.4, rnd = 32 zero bytes) by default — the same
1499
+ * `(secretKey, message)` always yields the same signature. The chain's PQC
1500
+ * verifier accepts ONLY deterministic signatures, so do not pass
1501
+ * `{ hedged: true }` for anything that goes on-chain.
1502
+ */
1503
+ declare function pqcSign(secretKey: Uint8Array, message: Uint8Array, opts?: {
1504
+ hedged?: boolean;
1505
+ }): Uint8Array;
1486
1506
  /** Verify an ML-DSA-87 (Dilithium-5) signature over a message. */
1487
1507
  declare function pqcVerify(publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array): boolean;
1488
1508
  /**
@@ -8006,7 +8026,7 @@ declare function createCrossVMClient(tx: TxClient, opts?: CreateCrossVMClientOpt
8006
8026
  *
8007
8027
  * QoreChain treats post-quantum cryptography (PQC) as a first-class signature
8008
8028
  * scheme: an account registers an ML-DSA-87 (Dilithium-5) key on-chain
8009
- * (`MsgRegisterPQCKey`), after which its transactions can carry a hybrid
8029
+ * (`MsgRegisterPQCKeyV2`), after which its transactions can carry a hybrid
8010
8030
  * (classical secp256k1 + ML-DSA-87) signature that the ante handler verifies in
8011
8031
  * full. The low-level primitives already exist — {@link generatePqcKeypair},
8012
8032
  * {@link buildHybridTx}, {@link signAndBroadcastHybrid}, the
@@ -8086,7 +8106,7 @@ interface EnsurePqcRegisteredOptions {
8086
8106
  * whose classical key is already known on-chain.
8087
8107
  */
8088
8108
  ecdsaPubkey?: Uint8Array;
8089
- /** Key-type tag forwarded to `MsgRegisterPQCKey` (default `"hybrid"`). */
8109
+ /** Key-type tag forwarded to `MsgRegisterPQCKeyV2` (default `"hybrid"`). */
8090
8110
  keyType?: string;
8091
8111
  /** Fee: explicit `StdFee` or `"auto"` (simulate + price). Default `"auto"`. */
8092
8112
  fee?: FeeInput$1;
@@ -8116,10 +8136,12 @@ interface EnsurePqcRegisteredResult {
8116
8136
  result?: BroadcastResult;
8117
8137
  }
8118
8138
  /**
8119
- * Build the `MsgRegisterPQCKey` for a signer without broadcasting.
8139
+ * Build the `MsgRegisterPQCKeyV2` for a signer without broadcasting.
8120
8140
  *
8121
8141
  * Useful for packing registration into a larger transaction body, or for the
8122
- * offline build path.
8142
+ * offline build path. Uses `/qorechain.pqc.v1.MsgRegisterPQCKeyV2` — the
8143
+ * chain's current (classical-exempt bootstrap) registration path — with an
8144
+ * explicit `algorithmId` (ML-DSA-87 / Dilithium-5).
8123
8145
  */
8124
8146
  declare function buildRegisterPqcKeyMsg(sender: string, opts: Pick<EnsurePqcRegisteredOptions, "pqcKeypair" | "ecdsaPubkey" | "keyType">): EncodeObject;
8125
8147
  /**
@@ -8128,7 +8150,7 @@ declare function buildRegisterPqcKeyMsg(sender: string, opts: Pick<EnsurePqcRegi
8128
8150
  * If a {@link EnsurePqcRegisteredOptions.statusSource} (or pre-read `status`) is
8129
8151
  * supplied and the key is already registered, this returns
8130
8152
  * `{ alreadyRegistered: true }` WITHOUT broadcasting. Otherwise it builds and
8131
- * broadcasts `MsgRegisterPQCKey` with the signer's Dilithium public key (from
8153
+ * broadcasts `MsgRegisterPQCKeyV2` with the signer's Dilithium public key (from
8132
8154
  * `pqcKeypair`) plus the supplied ECDSA public key.
8133
8155
  *
8134
8156
  * This is the single call that makes a dApp quantum-safe: run it once at startup
package/dist/index.d.ts CHANGED
@@ -409,13 +409,13 @@ declare class QorClient extends JsonRpcClient {
409
409
 
410
410
  /**
411
411
  * Default static-fallback parameters, used when the AI fee oracle is
412
- * unavailable. The gas price (`uqor` per unit of gas) is intentionally
413
- * conservative and matches the relayer default in the core repo
414
- * (`gas_price = 0.025 uqor`).
412
+ * unavailable. The gas price (`uqor` per unit of gas) sits above the chain's
413
+ * genesis min-gas-price (BaseFee) of `0.1uqor` per unit of gas, which is
414
+ * enforced on both networks.
415
415
  */
416
416
  declare const STATIC_FALLBACK: {
417
417
  /** Fallback gas price, in base denom per unit of gas. */
418
- readonly gasPrice: "0.025";
418
+ readonly gasPrice: "0.15";
419
419
  /** Base denomination fees are paid in. */
420
420
  readonly denom: "uqor";
421
421
  /** Default gas limit when the caller does not supply one. */
@@ -575,8 +575,13 @@ declare function calculateFee(gas: number | string, gasPrice: GasPrice | string)
575
575
  declare const MSG_SEND_TYPE_URL = "/cosmos.bank.v1beta1.MsgSend";
576
576
  /** Default gas-used safety multiplier applied to a simulation result. */
577
577
  declare const DEFAULT_GAS_MULTIPLIER = 1.4;
578
- /** Default gas price for the auto-fee path (conservative, matches `tx/fees`). */
579
- declare const DEFAULT_GAS_PRICE = "0.025uqor";
578
+ /**
579
+ * Default gas price for the auto-fee path (matches `tx/fees`).
580
+ *
581
+ * The chain enforces a genesis min-gas-price (BaseFee) of `0.1uqor` per unit
582
+ * of gas on both networks; the default sits above the floor for headroom.
583
+ */
584
+ declare const DEFAULT_GAS_PRICE = "0.15uqor";
580
585
  /**
581
586
  * A fee that is either an explicit {@link StdFee} or the literal `"auto"`, which
582
587
  * triggers simulation-based gas estimation and fee computation.
@@ -736,7 +741,7 @@ declare class TxClient {
736
741
  *
737
742
  * `fee` may be an explicit {@link StdFee} or the literal `"auto"`, which
738
743
  * simulates the tx to estimate gas and computes the fee from a gas
739
- * multiplier (default 1.4) and gas price (default `0.025uqor`); tune both via
744
+ * multiplier (default 1.4) and gas price (default `0.15uqor`); tune both via
740
745
  * `opts.autoFee`.
741
746
  *
742
747
  * Broadcast mode maps onto cosmjs transports:
@@ -1439,18 +1444,24 @@ interface Signer {
1439
1444
  * assemble or broadcast transactions — the tx-builder attaches the extension
1440
1445
  * the {@link buildHybridSignatureExtension} result describes.
1441
1446
  *
1442
- * Crypto is delegated entirely to the audited, pure-TS `@noble/post-quantum`
1443
- * (`ml_dsa87`). No primitives are reimplemented here.
1447
+ * Crypto is delegated entirely to `@qorechain/pqc` (`mldsa87`, wrapping the
1448
+ * audited, pure-TS `@noble/post-quantum`). No primitives are reimplemented
1449
+ * here.
1450
+ *
1451
+ * Signing is DETERMINISTIC (FIPS-204 §3.4, rnd = 32 zero bytes) by default:
1452
+ * the chain's on-chain PQC verifier accepts ONLY deterministic ML-DSA-87
1453
+ * signatures (hedged signatures are rejected with codespace `pqc`), so this
1454
+ * default is consensus-critical. Pass `{ hedged: true }` to {@link pqcSign}
1455
+ * only for off-chain uses that want side-channel hedging.
1444
1456
  */
1445
1457
 
1446
1458
  /**
1447
1459
  * ML-DSA-87 (Dilithium-5) byte lengths.
1448
1460
  *
1449
1461
  * These are fixed by NIST FIPS 204 and match the chain's `x/pqc` constants
1450
- * exactly. The installed `@noble/post-quantum` `ml_dsa87` does not expose these
1451
- * as runtime properties, so we encode the standard's values directly; the test
1452
- * suite asserts that the library actually produces keys/signatures of these
1453
- * lengths, guarding against any future library drift.
1462
+ * exactly. We encode the standard's values directly; the test suite asserts
1463
+ * that the library actually produces keys/signatures of these lengths,
1464
+ * guarding against any future library drift.
1454
1465
  */
1455
1466
  /** ML-DSA-87 public-key length, in bytes (FIPS 204 / core: 2592). */
1456
1467
  declare const ML_DSA_87_PUBLIC_KEY_LENGTH = 2592;
@@ -1481,8 +1492,17 @@ interface PqcKeypair {
1481
1492
  * Must be exactly {@link ML_DSA_87_SEED_LENGTH} bytes if provided.
1482
1493
  */
1483
1494
  declare function generatePqcKeypair(seed?: Uint8Array): PqcKeypair;
1484
- /** Sign a message with an ML-DSA-87 (Dilithium-5) secret key. */
1485
- declare function pqcSign(secretKey: Uint8Array, message: Uint8Array): Uint8Array;
1495
+ /**
1496
+ * Sign a message with an ML-DSA-87 (Dilithium-5) secret key.
1497
+ *
1498
+ * DETERMINISTIC (FIPS-204 §3.4, rnd = 32 zero bytes) by default — the same
1499
+ * `(secretKey, message)` always yields the same signature. The chain's PQC
1500
+ * verifier accepts ONLY deterministic signatures, so do not pass
1501
+ * `{ hedged: true }` for anything that goes on-chain.
1502
+ */
1503
+ declare function pqcSign(secretKey: Uint8Array, message: Uint8Array, opts?: {
1504
+ hedged?: boolean;
1505
+ }): Uint8Array;
1486
1506
  /** Verify an ML-DSA-87 (Dilithium-5) signature over a message. */
1487
1507
  declare function pqcVerify(publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array): boolean;
1488
1508
  /**
@@ -8006,7 +8026,7 @@ declare function createCrossVMClient(tx: TxClient, opts?: CreateCrossVMClientOpt
8006
8026
  *
8007
8027
  * QoreChain treats post-quantum cryptography (PQC) as a first-class signature
8008
8028
  * scheme: an account registers an ML-DSA-87 (Dilithium-5) key on-chain
8009
- * (`MsgRegisterPQCKey`), after which its transactions can carry a hybrid
8029
+ * (`MsgRegisterPQCKeyV2`), after which its transactions can carry a hybrid
8010
8030
  * (classical secp256k1 + ML-DSA-87) signature that the ante handler verifies in
8011
8031
  * full. The low-level primitives already exist — {@link generatePqcKeypair},
8012
8032
  * {@link buildHybridTx}, {@link signAndBroadcastHybrid}, the
@@ -8086,7 +8106,7 @@ interface EnsurePqcRegisteredOptions {
8086
8106
  * whose classical key is already known on-chain.
8087
8107
  */
8088
8108
  ecdsaPubkey?: Uint8Array;
8089
- /** Key-type tag forwarded to `MsgRegisterPQCKey` (default `"hybrid"`). */
8109
+ /** Key-type tag forwarded to `MsgRegisterPQCKeyV2` (default `"hybrid"`). */
8090
8110
  keyType?: string;
8091
8111
  /** Fee: explicit `StdFee` or `"auto"` (simulate + price). Default `"auto"`. */
8092
8112
  fee?: FeeInput$1;
@@ -8116,10 +8136,12 @@ interface EnsurePqcRegisteredResult {
8116
8136
  result?: BroadcastResult;
8117
8137
  }
8118
8138
  /**
8119
- * Build the `MsgRegisterPQCKey` for a signer without broadcasting.
8139
+ * Build the `MsgRegisterPQCKeyV2` for a signer without broadcasting.
8120
8140
  *
8121
8141
  * Useful for packing registration into a larger transaction body, or for the
8122
- * offline build path.
8142
+ * offline build path. Uses `/qorechain.pqc.v1.MsgRegisterPQCKeyV2` — the
8143
+ * chain's current (classical-exempt bootstrap) registration path — with an
8144
+ * explicit `algorithmId` (ML-DSA-87 / Dilithium-5).
8123
8145
  */
8124
8146
  declare function buildRegisterPqcKeyMsg(sender: string, opts: Pick<EnsurePqcRegisteredOptions, "pqcKeypair" | "ecdsaPubkey" | "keyType">): EncodeObject;
8125
8147
  /**
@@ -8128,7 +8150,7 @@ declare function buildRegisterPqcKeyMsg(sender: string, opts: Pick<EnsurePqcRegi
8128
8150
  * If a {@link EnsurePqcRegisteredOptions.statusSource} (or pre-read `status`) is
8129
8151
  * supplied and the key is already registered, this returns
8130
8152
  * `{ alreadyRegistered: true }` WITHOUT broadcasting. Otherwise it builds and
8131
- * broadcasts `MsgRegisterPQCKey` with the signer's Dilithium public key (from
8153
+ * broadcasts `MsgRegisterPQCKeyV2` with the signer's Dilithium public key (from
8132
8154
  * `pqcKeypair`) plus the supplied ECDSA public key.
8133
8155
  *
8134
8156
  * This is the single call that makes a dApp quantum-safe: run it once at startup
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import { wordlist } from '@scure/bip39/wordlists/english';
14
14
  import { HDKey as HDKey$1 } from '@scure/bip32';
15
15
  import { HDKey } from 'micro-key-producer/slip10.js';
16
16
  import { secp256k1 } from '@noble/curves/secp256k1';
17
- import { ml_dsa87 } from '@noble/post-quantum/ml-dsa.js';
17
+ import { mldsa87 } from '@qorechain/pqc';
18
18
  import { randomBytes } from '@noble/hashes/utils';
19
19
  export { AI_ANOMALY_CHECK_ADDRESS, AI_RISK_SCORE_ADDRESS, RISK_LEVEL_UNSAFE_THRESHOLD, ai, aiAnomalyCheck, aiRiskScore, simulateWithRiskScore } from '@qorechain/evm';
20
20
  import { connectComet } from '@cosmjs/tendermint-rpc';
@@ -441,7 +441,7 @@ var QorClient = class extends JsonRpcClient {
441
441
  // src/tx/fees.ts
442
442
  var STATIC_FALLBACK = {
443
443
  /** Fallback gas price, in base denom per unit of gas. */
444
- gasPrice: "0.025",
444
+ gasPrice: "0.15",
445
445
  /** Base denomination fees are paid in. */
446
446
  denom: "uqor",
447
447
  /** Default gas limit when the caller does not supply one. */
@@ -9714,7 +9714,7 @@ function calculateFee(gas, gasPrice) {
9714
9714
  // src/tx/builder.ts
9715
9715
  var MSG_SEND_TYPE_URL = "/cosmos.bank.v1beta1.MsgSend";
9716
9716
  var DEFAULT_GAS_MULTIPLIER = 1.4;
9717
- var DEFAULT_GAS_PRICE = "0.025uqor";
9717
+ var DEFAULT_GAS_PRICE = "0.15uqor";
9718
9718
  function buildAminoTypes(extra) {
9719
9719
  return new AminoTypes({
9720
9720
  ...createDefaultAminoConverters(),
@@ -9793,7 +9793,7 @@ var TxClient = class _TxClient {
9793
9793
  *
9794
9794
  * `fee` may be an explicit {@link StdFee} or the literal `"auto"`, which
9795
9795
  * simulates the tx to estimate gas and computes the fee from a gas
9796
- * multiplier (default 1.4) and gas price (default `0.025uqor`); tune both via
9796
+ * multiplier (default 1.4) and gas price (default `0.15uqor`); tune both via
9797
9797
  * `opts.autoFee`.
9798
9798
  *
9799
9799
  * Broadcast mode maps onto cosmjs transports:
@@ -10449,14 +10449,14 @@ function generatePqcKeypair(seed) {
10449
10449
  );
10450
10450
  }
10451
10451
  const xi = seed ?? randomBytes(ML_DSA_87_SEED_LENGTH);
10452
- const kp = ml_dsa87.keygen(xi);
10452
+ const kp = mldsa87.keygen(xi);
10453
10453
  return { publicKey: kp.publicKey, secretKey: kp.secretKey };
10454
10454
  }
10455
- function pqcSign(secretKey, message) {
10456
- return ml_dsa87.sign(secretKey, message);
10455
+ function pqcSign(secretKey, message, opts) {
10456
+ return mldsa87.sign(secretKey, message, opts);
10457
10457
  }
10458
10458
  function pqcVerify(publicKey, message, signature) {
10459
- return ml_dsa87.verify(publicKey, message, signature);
10459
+ return mldsa87.verify(publicKey, message, signature);
10460
10460
  }
10461
10461
  function buildHybridSignatureExtension(args) {
10462
10462
  const { algorithmId, signature, publicKey } = args;
@@ -19154,7 +19154,7 @@ function suggestChainInfo(network) {
19154
19154
  };
19155
19155
  const feeCurrency = {
19156
19156
  ...currency,
19157
- gasPriceStep: { low: 0.01, average: 0.025, high: 0.04 }
19157
+ gasPriceStep: { low: 0.1, average: 0.15, high: 0.25 }
19158
19158
  };
19159
19159
  return {
19160
19160
  chainId,
@@ -19762,9 +19762,10 @@ async function isPqcRegistered(source, address) {
19762
19762
  return status.registered;
19763
19763
  }
19764
19764
  function buildRegisterPqcKeyMsg(sender, opts) {
19765
- return pqc.registerPqcKey({
19765
+ return pqc.registerPqcKeyV2({
19766
19766
  sender,
19767
- dilithiumPubkey: opts.pqcKeypair.publicKey,
19767
+ publicKey: opts.pqcKeypair.publicKey,
19768
+ algorithmId: AlgorithmDilithium5,
19768
19769
  ecdsaPubkey: opts.ecdsaPubkey ?? new Uint8Array(0),
19769
19770
  keyType: opts.keyType ?? "hybrid"
19770
19771
  });