@qorechain/sdk 0.4.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/LICENSE +201 -0
- package/README.md +180 -10
- package/dist/index.cjs +264 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +396 -17
- package/dist/index.d.ts +396 -17
- package/dist/index.js +228 -11
- package/dist/index.js.map +1 -1
- package/package.json +27 -13
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as _cosmjs_proto_signing from '@cosmjs/proto-signing';
|
|
2
2
|
import { EncodeObject, OfflineSigner, GeneratedType, Registry, OfflineDirectSigner } from '@cosmjs/proto-signing';
|
|
3
|
+
export { EncodeObject } from '@cosmjs/proto-signing';
|
|
3
4
|
import { Coin as Coin$1, StdFee } from '@cosmjs/amino';
|
|
4
5
|
export { Coin, StdFee } from '@cosmjs/amino';
|
|
5
6
|
import { DeliverTxResponse, AminoTypes, AminoConverters, SigningStargateClientOptions, QueryClient, ProtobufRpcClient } from '@cosmjs/stargate';
|
|
6
7
|
import { CosmWasmClient, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate';
|
|
8
|
+
export { AI_ANOMALY_CHECK_ADDRESS, AI_RISK_SCORE_ADDRESS, AiAnomalyCheck, AiRiskScore, PreflightResult, PreflightTx, RISK_LEVEL_UNSAFE_THRESHOLD, ai, aiAnomalyCheck, aiRiskScore, simulateWithRiskScore } from '@qorechain/evm';
|
|
7
9
|
import { Any } from 'cosmjs-types/google/protobuf/any';
|
|
8
10
|
import { TxBody, TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
|
|
9
11
|
import { BinaryWriter, BinaryReader } from '@bufbuild/protobuf/wire';
|
|
@@ -407,13 +409,13 @@ declare class QorClient extends JsonRpcClient {
|
|
|
407
409
|
|
|
408
410
|
/**
|
|
409
411
|
* Default static-fallback parameters, used when the AI fee oracle is
|
|
410
|
-
* unavailable. The gas price (`uqor` per unit of gas)
|
|
411
|
-
*
|
|
412
|
-
*
|
|
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.
|
|
413
415
|
*/
|
|
414
416
|
declare const STATIC_FALLBACK: {
|
|
415
417
|
/** Fallback gas price, in base denom per unit of gas. */
|
|
416
|
-
readonly gasPrice: "0.
|
|
418
|
+
readonly gasPrice: "0.15";
|
|
417
419
|
/** Base denomination fees are paid in. */
|
|
418
420
|
readonly denom: "uqor";
|
|
419
421
|
/** Default gas limit when the caller does not supply one. */
|
|
@@ -573,8 +575,13 @@ declare function calculateFee(gas: number | string, gasPrice: GasPrice | string)
|
|
|
573
575
|
declare const MSG_SEND_TYPE_URL = "/cosmos.bank.v1beta1.MsgSend";
|
|
574
576
|
/** Default gas-used safety multiplier applied to a simulation result. */
|
|
575
577
|
declare const DEFAULT_GAS_MULTIPLIER = 1.4;
|
|
576
|
-
/**
|
|
577
|
-
|
|
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";
|
|
578
585
|
/**
|
|
579
586
|
* A fee that is either an explicit {@link StdFee} or the literal `"auto"`, which
|
|
580
587
|
* triggers simulation-based gas estimation and fee computation.
|
|
@@ -734,7 +741,7 @@ declare class TxClient {
|
|
|
734
741
|
*
|
|
735
742
|
* `fee` may be an explicit {@link StdFee} or the literal `"auto"`, which
|
|
736
743
|
* simulates the tx to estimate gas and computes the fee from a gas
|
|
737
|
-
* multiplier (default 1.4) and gas price (default `0.
|
|
744
|
+
* multiplier (default 1.4) and gas price (default `0.15uqor`); tune both via
|
|
738
745
|
* `opts.autoFee`.
|
|
739
746
|
*
|
|
740
747
|
* Broadcast mode maps onto cosmjs transports:
|
|
@@ -1437,18 +1444,24 @@ interface Signer {
|
|
|
1437
1444
|
* assemble or broadcast transactions — the tx-builder attaches the extension
|
|
1438
1445
|
* the {@link buildHybridSignatureExtension} result describes.
|
|
1439
1446
|
*
|
|
1440
|
-
* Crypto is delegated entirely to
|
|
1441
|
-
*
|
|
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.
|
|
1442
1456
|
*/
|
|
1443
1457
|
|
|
1444
1458
|
/**
|
|
1445
1459
|
* ML-DSA-87 (Dilithium-5) byte lengths.
|
|
1446
1460
|
*
|
|
1447
1461
|
* These are fixed by NIST FIPS 204 and match the chain's `x/pqc` constants
|
|
1448
|
-
* exactly.
|
|
1449
|
-
*
|
|
1450
|
-
*
|
|
1451
|
-
* 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.
|
|
1452
1465
|
*/
|
|
1453
1466
|
/** ML-DSA-87 public-key length, in bytes (FIPS 204 / core: 2592). */
|
|
1454
1467
|
declare const ML_DSA_87_PUBLIC_KEY_LENGTH = 2592;
|
|
@@ -1479,8 +1492,17 @@ interface PqcKeypair {
|
|
|
1479
1492
|
* Must be exactly {@link ML_DSA_87_SEED_LENGTH} bytes if provided.
|
|
1480
1493
|
*/
|
|
1481
1494
|
declare function generatePqcKeypair(seed?: Uint8Array): PqcKeypair;
|
|
1482
|
-
/**
|
|
1483
|
-
|
|
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;
|
|
1484
1506
|
/** Verify an ML-DSA-87 (Dilithium-5) signature over a message. */
|
|
1485
1507
|
declare function pqcVerify(publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array): boolean;
|
|
1486
1508
|
/**
|
|
@@ -7851,6 +7873,363 @@ interface CreateRollupClientOptions {
|
|
|
7851
7873
|
*/
|
|
7852
7874
|
declare function createRollupClient(tx: TxClient, opts?: CreateRollupClientOptions): RollupClient;
|
|
7853
7875
|
|
|
7876
|
+
/**
|
|
7877
|
+
* High-level Cross-VM client — unified calls across QoreChain's three VMs.
|
|
7878
|
+
*
|
|
7879
|
+
* QoreChain runs EVM, SVM, and CosmWasm side by side and lets a single native
|
|
7880
|
+
* account invoke a contract on any of them through the `x/crossvm` module's
|
|
7881
|
+
* {@link MsgCrossVMCall}. This helper wraps that message — and the cross-VM query
|
|
7882
|
+
* client — so an app developer never hand-builds a `{ typeUrl, value }`, encodes a
|
|
7883
|
+
* payload by hand, or remembers a service/method name.
|
|
7884
|
+
*
|
|
7885
|
+
* The headline capability is {@link CrossVMClient.callAtomic}: pack several
|
|
7886
|
+
* `MsgCrossVMCall` messages into ONE transaction body so they execute atomically
|
|
7887
|
+
* under a single signature — e.g. an EVM call, an SVM call, and a CosmWasm call
|
|
7888
|
+
* that all land together or not at all.
|
|
7889
|
+
*
|
|
7890
|
+
* Per-VM payload encoding (pick exactly one shape per call):
|
|
7891
|
+
* - `{ payload }` — raw bytes / hex, passed through unchanged.
|
|
7892
|
+
* - `{ evm: { abi, functionName, args } }` — ABI-encoded with viem's
|
|
7893
|
+
* `encodeFunctionData` (selector + args). Requires the optional `viem` peer.
|
|
7894
|
+
* - `{ cosmwasm: object }` — `JSON.stringify` then UTF-8 bytes (the CosmWasm
|
|
7895
|
+
* execute-msg convention).
|
|
7896
|
+
* - `{ svm: { data } }` — raw bytes / hex (already an SVM instruction blob).
|
|
7897
|
+
*
|
|
7898
|
+
* Construct one with {@link createCrossVMClient}, passing a connected
|
|
7899
|
+
* {@link TxClient} (for writes) and, optionally, a {@link CrossVmQueryClient}
|
|
7900
|
+
* and/or a {@link QorClient} for the reads.
|
|
7901
|
+
*/
|
|
7902
|
+
|
|
7903
|
+
/** The three execution environments a cross-VM call can target. */
|
|
7904
|
+
type VMType = "evm" | "cosmwasm" | "svm";
|
|
7905
|
+
/** The set of supported VM type strings. */
|
|
7906
|
+
declare const VM_TYPES: readonly ["evm", "cosmwasm", "svm"];
|
|
7907
|
+
/** A hex string (`0x`-prefixed) as accepted for raw payloads. */
|
|
7908
|
+
type Hex = `0x${string}`;
|
|
7909
|
+
/** Raw, pre-encoded payload — passed through to the chain unchanged. */
|
|
7910
|
+
interface RawPayload {
|
|
7911
|
+
/** The opaque payload bytes (raw `Uint8Array` or `0x`-hex). */
|
|
7912
|
+
payload: Uint8Array | Hex;
|
|
7913
|
+
}
|
|
7914
|
+
/** EVM payload built by ABI-encoding a function call with viem. */
|
|
7915
|
+
interface EvmPayload {
|
|
7916
|
+
evm: {
|
|
7917
|
+
/** The contract ABI (viem `Abi`-compatible array). */
|
|
7918
|
+
abi: readonly unknown[];
|
|
7919
|
+
/** The function to call. */
|
|
7920
|
+
functionName: string;
|
|
7921
|
+
/** The call arguments. */
|
|
7922
|
+
args?: readonly unknown[];
|
|
7923
|
+
};
|
|
7924
|
+
}
|
|
7925
|
+
/** CosmWasm payload: a JSON execute-message object (stringified to UTF-8). */
|
|
7926
|
+
interface CosmWasmPayload {
|
|
7927
|
+
/** The CosmWasm execute message (e.g. `{ transfer: { ... } }`). */
|
|
7928
|
+
cosmwasm: object;
|
|
7929
|
+
}
|
|
7930
|
+
/** SVM payload: a pre-built instruction blob (raw bytes / hex). */
|
|
7931
|
+
interface SvmPayload {
|
|
7932
|
+
svm: {
|
|
7933
|
+
/** The SVM instruction data (raw `Uint8Array` or `0x`-hex). */
|
|
7934
|
+
data: Uint8Array | Hex;
|
|
7935
|
+
};
|
|
7936
|
+
}
|
|
7937
|
+
/** Exactly one of the supported payload shapes. */
|
|
7938
|
+
type PayloadInput = RawPayload | EvmPayload | CosmWasmPayload | SvmPayload;
|
|
7939
|
+
/** Shared write-path options forwarded to {@link TxClient.signAndBroadcast}. */
|
|
7940
|
+
interface CrossVMWriteOptions {
|
|
7941
|
+
/** Fee: an explicit `StdFee` or `"auto"` (simulate + price). Default `"auto"`. */
|
|
7942
|
+
fee?: FeeInput$1;
|
|
7943
|
+
/** Optional memo string. */
|
|
7944
|
+
memo?: string;
|
|
7945
|
+
/** Auto-fee tuning (gas multiplier / gas price) when `fee` is `"auto"`. */
|
|
7946
|
+
autoFee?: AutoFeeOptions;
|
|
7947
|
+
}
|
|
7948
|
+
/** Common cross-VM call fields (without the payload or write options). */
|
|
7949
|
+
interface CrossVMCallBase {
|
|
7950
|
+
/** The VM the call originates from. Defaults to `"evm"`. */
|
|
7951
|
+
sourceVm?: VMType;
|
|
7952
|
+
/** The VM the call targets. */
|
|
7953
|
+
targetVm: VMType;
|
|
7954
|
+
/** The target contract address/identifier on `targetVm`. */
|
|
7955
|
+
targetContract: string;
|
|
7956
|
+
/** Optional funds (coins) to forward with the call. */
|
|
7957
|
+
funds?: Coin$1[];
|
|
7958
|
+
}
|
|
7959
|
+
/** Options for a single cross-VM call (base + payload). */
|
|
7960
|
+
type CrossVMCallOptions = CrossVMCallBase & PayloadInput;
|
|
7961
|
+
/** Options for {@link CrossVMClient.call} (adds write-path options). */
|
|
7962
|
+
type CallOptions = CrossVMCallOptions & CrossVMWriteOptions;
|
|
7963
|
+
/** Result of a single {@link CrossVMClient.call}. */
|
|
7964
|
+
interface CrossVMCallResult {
|
|
7965
|
+
/** The cross-VM message id assigned by the chain (parsed from tx events). */
|
|
7966
|
+
messageId: string;
|
|
7967
|
+
/** The raw broadcast result. */
|
|
7968
|
+
result: BroadcastResult;
|
|
7969
|
+
}
|
|
7970
|
+
/** Result of an atomic {@link CrossVMClient.callAtomic} batch. */
|
|
7971
|
+
interface CrossVMAtomicResult {
|
|
7972
|
+
/** The cross-VM message ids assigned by the chain (best-effort, from events). */
|
|
7973
|
+
messageIds: string[];
|
|
7974
|
+
/** The raw broadcast result for the single packing transaction. */
|
|
7975
|
+
result: BroadcastResult;
|
|
7976
|
+
}
|
|
7977
|
+
/**
|
|
7978
|
+
* Ergonomic client for the `x/crossvm` module.
|
|
7979
|
+
*
|
|
7980
|
+
* Writes build + sign + broadcast a {@link MsgCrossVMCall}; {@link callAtomic}
|
|
7981
|
+
* packs several into one body. {@link buildCall} is the offline build-only path.
|
|
7982
|
+
* Reads return the typed query response (or the `qor_` JSON-RPC fallback).
|
|
7983
|
+
*/
|
|
7984
|
+
interface CrossVMClient {
|
|
7985
|
+
/** Build, sign, and broadcast a single cross-VM call. */
|
|
7986
|
+
call(opts: CallOptions): Promise<CrossVMCallResult>;
|
|
7987
|
+
/** Build a single `MsgCrossVMCall` without broadcasting. */
|
|
7988
|
+
buildCall(opts: CrossVMCallOptions): EncodeObject;
|
|
7989
|
+
/**
|
|
7990
|
+
* Pack multiple cross-VM calls into ONE transaction body so they execute
|
|
7991
|
+
* atomically under a single signature (the triple-VM headline).
|
|
7992
|
+
*/
|
|
7993
|
+
callAtomic(calls: CrossVMCallOptions[], opts?: CrossVMWriteOptions): Promise<CrossVMAtomicResult>;
|
|
7994
|
+
/**
|
|
7995
|
+
* Read a cross-VM message by id. Uses the typed query client when provided,
|
|
7996
|
+
* otherwise falls back to the `qor_getCrossVMMessage` JSON-RPC method.
|
|
7997
|
+
*/
|
|
7998
|
+
getMessage(id: string): Promise<QueryMessageResponse | Record<string, unknown>>;
|
|
7999
|
+
}
|
|
8000
|
+
/** Options for {@link createCrossVMClient}. */
|
|
8001
|
+
interface CreateCrossVMClientOptions {
|
|
8002
|
+
/**
|
|
8003
|
+
* Typed query client for {@link CrossVMClient.getMessage} (preferred). Obtain
|
|
8004
|
+
* it via {@link connectQueryClients} / {@link createQueryClients}.
|
|
8005
|
+
*/
|
|
8006
|
+
query?: CrossVmQueryClient;
|
|
8007
|
+
/**
|
|
8008
|
+
* `qor_` JSON-RPC client used as the {@link CrossVMClient.getMessage} fallback
|
|
8009
|
+
* (via `qor_getCrossVMMessage`) when no typed query client is supplied.
|
|
8010
|
+
*/
|
|
8011
|
+
qor?: QorClient;
|
|
8012
|
+
}
|
|
8013
|
+
/**
|
|
8014
|
+
* Create a {@link CrossVMClient} bound to a connected {@link TxClient}.
|
|
8015
|
+
*
|
|
8016
|
+
* The `TxClient`'s sender address is used as the message `sender`, so the caller
|
|
8017
|
+
* never repeats their address. `sourceVm` defaults to `"evm"`.
|
|
8018
|
+
*
|
|
8019
|
+
* @param tx - A connected signing client (from `client.connectTx(signer)`).
|
|
8020
|
+
* @param opts - Optional typed query client and/or `qor_` client for reads.
|
|
8021
|
+
*/
|
|
8022
|
+
declare function createCrossVMClient(tx: TxClient, opts?: CreateCrossVMClientOptions): CrossVMClient;
|
|
8023
|
+
|
|
8024
|
+
/**
|
|
8025
|
+
* High-level quantum-safe developer-experience helpers.
|
|
8026
|
+
*
|
|
8027
|
+
* QoreChain treats post-quantum cryptography (PQC) as a first-class signature
|
|
8028
|
+
* scheme: an account registers an ML-DSA-87 (Dilithium-5) key on-chain
|
|
8029
|
+
* (`MsgRegisterPQCKeyV2`), after which its transactions can carry a hybrid
|
|
8030
|
+
* (classical secp256k1 + ML-DSA-87) signature that the ante handler verifies in
|
|
8031
|
+
* full. The low-level primitives already exist — {@link generatePqcKeypair},
|
|
8032
|
+
* {@link buildHybridTx}, {@link signAndBroadcastHybrid}, the
|
|
8033
|
+
* `msg.pqc.registerPqcKey` composer, and the `qor_getPQCKeyStatus` read. This
|
|
8034
|
+
* module wraps them into a tiny, idempotent surface so a dApp becomes
|
|
8035
|
+
* **quantum-safe by default**: one call to be PQC-protected.
|
|
8036
|
+
*
|
|
8037
|
+
* The headline calls:
|
|
8038
|
+
* - {@link isPqcRegistered} / {@link getPqcStatus} — read whether an address has
|
|
8039
|
+
* a registered PQC key (via `qor_getPQCKeyStatus`).
|
|
8040
|
+
* - {@link ensurePqcRegistered} — register the signer's Dilithium key if (and
|
|
8041
|
+
* only if) it is not already registered. Idempotent: safe to call on every
|
|
8042
|
+
* app start.
|
|
8043
|
+
* - {@link migrateToHybrid} — ensure registration, then hand back a hybrid send
|
|
8044
|
+
* path wired to {@link buildHybridTx} / {@link signAndBroadcastHybrid}.
|
|
8045
|
+
* - {@link migratePqcKey} — rotate an account's PQC key (`MsgMigratePQCKey`).
|
|
8046
|
+
*
|
|
8047
|
+
* Reads accept either a {@link QorClient} or anything exposing a `qor`
|
|
8048
|
+
* sub-client (e.g. the composed `QoreChainClient` from `createClient`). Writes
|
|
8049
|
+
* take a connected {@link TxClient}.
|
|
8050
|
+
*
|
|
8051
|
+
* Precompile alternative: the same status is readable on the EVM side via the
|
|
8052
|
+
* `pqcKeyStatus(address) returns (bool registered, uint8 algorithmId, bytes
|
|
8053
|
+
* pubkey)` precompile at `0x0000000000000000000000000000000000000A02` (exposed
|
|
8054
|
+
* as `pqcKeyStatus` in `@qorechain/evm`). The helpers below prefer the
|
|
8055
|
+
* `qor_getPQCKeyStatus` JSON-RPC method, which needs no viem peer; the
|
|
8056
|
+
* precompile is the documented alternative for callers already on the EVM side.
|
|
8057
|
+
*/
|
|
8058
|
+
|
|
8059
|
+
/** EVM precompile address for the `pqcKeyStatus` read (documented alternative). */
|
|
8060
|
+
declare const PQC_KEY_STATUS_PRECOMPILE_ADDRESS = "0x0000000000000000000000000000000000000A02";
|
|
8061
|
+
/**
|
|
8062
|
+
* A source for PQC status reads: either a {@link QorClient} directly, or any
|
|
8063
|
+
* object exposing one as `.qor` (e.g. the composed `QoreChainClient`).
|
|
8064
|
+
*/
|
|
8065
|
+
type PqcStatusSource = QorClient | {
|
|
8066
|
+
qor: QorClient;
|
|
8067
|
+
};
|
|
8068
|
+
/** Normalized PQC registration status for an address. */
|
|
8069
|
+
interface PqcStatus {
|
|
8070
|
+
/** Whether the address has a registered PQC key. */
|
|
8071
|
+
registered: boolean;
|
|
8072
|
+
/** The registered algorithm id, when known (Dilithium-5 = {@link AlgorithmDilithium5}). */
|
|
8073
|
+
algorithmId?: number;
|
|
8074
|
+
/** The registered PQC public key, when the chain returns it (hex or bytes). */
|
|
8075
|
+
pubkey?: string | Uint8Array;
|
|
8076
|
+
}
|
|
8077
|
+
/**
|
|
8078
|
+
* Read the PQC registration status of an address via `qor_getPQCKeyStatus`.
|
|
8079
|
+
*
|
|
8080
|
+
* The chain returns a rich JSON object; this helper normalizes the common
|
|
8081
|
+
* fields (`registered`, `algorithmId`/`algorithm_id`, `pubkey`/`public_key`)
|
|
8082
|
+
* into a {@link PqcStatus}. Unknown shapes degrade to `{ registered: false }`.
|
|
8083
|
+
*
|
|
8084
|
+
* Alternative: on the EVM side, call the `pqcKeyStatus(address)` precompile at
|
|
8085
|
+
* {@link PQC_KEY_STATUS_PRECOMPILE_ADDRESS} (via `@qorechain/evm`).
|
|
8086
|
+
*/
|
|
8087
|
+
declare function getPqcStatus(source: PqcStatusSource, address: string): Promise<PqcStatus>;
|
|
8088
|
+
/**
|
|
8089
|
+
* Whether `address` has a registered PQC key.
|
|
8090
|
+
*
|
|
8091
|
+
* Thin boolean wrapper over {@link getPqcStatus} using `qor_getPQCKeyStatus`
|
|
8092
|
+
* (preferred). The EVM `pqcKeyStatus` precompile is the documented alternative.
|
|
8093
|
+
*/
|
|
8094
|
+
declare function isPqcRegistered(source: PqcStatusSource, address: string): Promise<boolean>;
|
|
8095
|
+
/** Options for {@link ensurePqcRegistered}. */
|
|
8096
|
+
interface EnsurePqcRegisteredOptions {
|
|
8097
|
+
/**
|
|
8098
|
+
* The signer's ML-DSA-87 (Dilithium-5) keypair. Its `publicKey` is registered
|
|
8099
|
+
* on-chain as the account's Dilithium key.
|
|
8100
|
+
*/
|
|
8101
|
+
pqcKeypair: PqcKeypair;
|
|
8102
|
+
/**
|
|
8103
|
+
* The account's classical ECDSA (secp256k1) public key, registered alongside
|
|
8104
|
+
* the Dilithium key. When omitted, an empty key is sent — the chain binds the
|
|
8105
|
+
* registration to the transaction signer, so this is optional for accounts
|
|
8106
|
+
* whose classical key is already known on-chain.
|
|
8107
|
+
*/
|
|
8108
|
+
ecdsaPubkey?: Uint8Array;
|
|
8109
|
+
/** Key-type tag forwarded to `MsgRegisterPQCKeyV2` (default `"hybrid"`). */
|
|
8110
|
+
keyType?: string;
|
|
8111
|
+
/** Fee: explicit `StdFee` or `"auto"` (simulate + price). Default `"auto"`. */
|
|
8112
|
+
fee?: FeeInput$1;
|
|
8113
|
+
/** Optional memo string. */
|
|
8114
|
+
memo?: string;
|
|
8115
|
+
/** Auto-fee tuning when `fee` is `"auto"`. */
|
|
8116
|
+
autoFee?: AutoFeeOptions;
|
|
8117
|
+
/**
|
|
8118
|
+
* A pre-read status to avoid a redundant `qor_getPQCKeyStatus` round-trip. When
|
|
8119
|
+
* provided and `registered`, the registration is skipped.
|
|
8120
|
+
*/
|
|
8121
|
+
status?: PqcStatus;
|
|
8122
|
+
/**
|
|
8123
|
+
* A status source for the pre-flight registration check. When omitted, the
|
|
8124
|
+
* registration message is broadcast unconditionally (relying on the chain's
|
|
8125
|
+
* own idempotency) — pass `{ qor }` to make the helper truly idempotent.
|
|
8126
|
+
*/
|
|
8127
|
+
statusSource?: PqcStatusSource;
|
|
8128
|
+
}
|
|
8129
|
+
/** Result of {@link ensurePqcRegistered}. */
|
|
8130
|
+
interface EnsurePqcRegisteredResult {
|
|
8131
|
+
/** `true` when the key was already registered (no transaction was sent). */
|
|
8132
|
+
alreadyRegistered: boolean;
|
|
8133
|
+
/** The registration transaction hash, when a registration was broadcast. */
|
|
8134
|
+
txHash?: string;
|
|
8135
|
+
/** The raw broadcast result, when a registration was broadcast. */
|
|
8136
|
+
result?: BroadcastResult;
|
|
8137
|
+
}
|
|
8138
|
+
/**
|
|
8139
|
+
* Build the `MsgRegisterPQCKeyV2` for a signer without broadcasting.
|
|
8140
|
+
*
|
|
8141
|
+
* Useful for packing registration into a larger transaction body, or for the
|
|
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).
|
|
8145
|
+
*/
|
|
8146
|
+
declare function buildRegisterPqcKeyMsg(sender: string, opts: Pick<EnsurePqcRegisteredOptions, "pqcKeypair" | "ecdsaPubkey" | "keyType">): EncodeObject;
|
|
8147
|
+
/**
|
|
8148
|
+
* Register the signer's PQC key if it is not already registered — idempotent.
|
|
8149
|
+
*
|
|
8150
|
+
* If a {@link EnsurePqcRegisteredOptions.statusSource} (or pre-read `status`) is
|
|
8151
|
+
* supplied and the key is already registered, this returns
|
|
8152
|
+
* `{ alreadyRegistered: true }` WITHOUT broadcasting. Otherwise it builds and
|
|
8153
|
+
* broadcasts `MsgRegisterPQCKeyV2` with the signer's Dilithium public key (from
|
|
8154
|
+
* `pqcKeypair`) plus the supplied ECDSA public key.
|
|
8155
|
+
*
|
|
8156
|
+
* This is the single call that makes a dApp quantum-safe: run it once at startup
|
|
8157
|
+
* (or before the first hybrid tx) and the account is PQC-protected thereafter.
|
|
8158
|
+
*
|
|
8159
|
+
* @param tx - A connected signing client (the sender address is its identity).
|
|
8160
|
+
* @param opts - The signer's PQC keypair, optional ECDSA pubkey, and write opts.
|
|
8161
|
+
*/
|
|
8162
|
+
declare function ensurePqcRegistered(tx: TxClient, opts: EnsurePqcRegisteredOptions): Promise<EnsurePqcRegisteredResult>;
|
|
8163
|
+
/** Options for {@link migratePqcKey} (PQC key rotation). */
|
|
8164
|
+
interface MigratePqcKeyOptions {
|
|
8165
|
+
/** The current (old) PQC public key being rotated out. */
|
|
8166
|
+
oldPublicKey: Uint8Array;
|
|
8167
|
+
/** The new PQC public key to register. */
|
|
8168
|
+
newPublicKey: Uint8Array;
|
|
8169
|
+
/** The new key's algorithm id (default {@link AlgorithmDilithium5}). */
|
|
8170
|
+
newAlgorithmId?: number;
|
|
8171
|
+
/** Signature by the OLD key proving ownership of the rotation request. */
|
|
8172
|
+
oldSignature: Uint8Array;
|
|
8173
|
+
/** Signature by the NEW key proving ownership of the new key. */
|
|
8174
|
+
newSignature: Uint8Array;
|
|
8175
|
+
/** Fee: explicit `StdFee` or `"auto"`. Default `"auto"`. */
|
|
8176
|
+
fee?: FeeInput$1;
|
|
8177
|
+
/** Optional memo string. */
|
|
8178
|
+
memo?: string;
|
|
8179
|
+
/** Auto-fee tuning when `fee` is `"auto"`. */
|
|
8180
|
+
autoFee?: AutoFeeOptions;
|
|
8181
|
+
}
|
|
8182
|
+
/**
|
|
8183
|
+
* Rotate an account's PQC key via `MsgMigratePQCKey`.
|
|
8184
|
+
*
|
|
8185
|
+
* The chain proves ownership of BOTH the old and new keys (the caller supplies
|
|
8186
|
+
* `oldSignature` / `newSignature` per the chain's migration contract), so key
|
|
8187
|
+
* rotation never strands an account. Use this when upgrading algorithms or
|
|
8188
|
+
* rolling a compromised key.
|
|
8189
|
+
*/
|
|
8190
|
+
declare function migratePqcKey(tx: TxClient, opts: MigratePqcKeyOptions): Promise<BroadcastResult>;
|
|
8191
|
+
/** Options for {@link migrateToHybrid}. */
|
|
8192
|
+
interface MigrateToHybridOptions extends EnsurePqcRegisteredOptions {
|
|
8193
|
+
/**
|
|
8194
|
+
* A status source used both for the registration pre-flight and (when omitted
|
|
8195
|
+
* elsewhere) the idempotency check. Forwarded to {@link ensurePqcRegistered}.
|
|
8196
|
+
*/
|
|
8197
|
+
statusSource?: PqcStatusSource;
|
|
8198
|
+
}
|
|
8199
|
+
/**
|
|
8200
|
+
* A hybrid send path returned by {@link migrateToHybrid}: the PQC key is
|
|
8201
|
+
* guaranteed registered, and these methods build / broadcast hybrid (classical +
|
|
8202
|
+
* ML-DSA-87) transactions via {@link buildHybridTx} / {@link signAndBroadcastHybrid}.
|
|
8203
|
+
*
|
|
8204
|
+
* The `pqcKeypair` is bound, so callers pass everything else hybrid signing
|
|
8205
|
+
* needs (registry, classical signer, chainId, account number, sequence, ...).
|
|
8206
|
+
*/
|
|
8207
|
+
interface HybridSendPath {
|
|
8208
|
+
/** Whether the PQC key was already registered before this call. */
|
|
8209
|
+
alreadyRegistered: boolean;
|
|
8210
|
+
/** The registration tx hash, when a registration was broadcast. */
|
|
8211
|
+
registrationTxHash?: string;
|
|
8212
|
+
/** The bound ML-DSA-87 keypair used for the hybrid half. */
|
|
8213
|
+
pqcKeypair: PqcKeypair;
|
|
8214
|
+
/** Build a fully signed hybrid tx (PQC keypair pre-bound). */
|
|
8215
|
+
buildHybridTx(opts: Omit<BuildHybridTxOptions, "pqcKeypair">): Promise<BuiltHybridTx>;
|
|
8216
|
+
/** Build, sign, and broadcast a hybrid tx (PQC keypair pre-bound). */
|
|
8217
|
+
signAndBroadcastHybrid(opts: Omit<SignAndBroadcastHybridOptions, "pqcKeypair">): Promise<BroadcastResult>;
|
|
8218
|
+
}
|
|
8219
|
+
/**
|
|
8220
|
+
* Make an account quantum-safe and hand back a hybrid send path.
|
|
8221
|
+
*
|
|
8222
|
+
* Ensures the signer's PQC key is registered (idempotent — see
|
|
8223
|
+
* {@link ensurePqcRegistered}), then returns a {@link HybridSendPath} with the
|
|
8224
|
+
* keypair pre-bound to the existing {@link buildHybridTx} /
|
|
8225
|
+
* {@link signAndBroadcastHybrid} builders. After this call, the dApp's
|
|
8226
|
+
* transactions can carry a verified hybrid signature.
|
|
8227
|
+
*
|
|
8228
|
+
* @param tx - A connected signing client (used for the registration tx).
|
|
8229
|
+
* @param opts - The PQC keypair and registration/idempotency options.
|
|
8230
|
+
*/
|
|
8231
|
+
declare function migrateToHybrid(tx: TxClient, opts: MigrateToHybridOptions): Promise<HybridSendPath>;
|
|
8232
|
+
|
|
7854
8233
|
/**
|
|
7855
8234
|
* `@qorechain/sdk` public API.
|
|
7856
8235
|
*
|
|
@@ -7860,6 +8239,6 @@ declare function createRollupClient(tx: TxClient, opts?: CreateRollupClientOptio
|
|
|
7860
8239
|
* callers who want to compose them directly. Internal helpers are not exported.
|
|
7861
8240
|
*/
|
|
7862
8241
|
/** SDK version. */
|
|
7863
|
-
declare const VERSION = "0.
|
|
8242
|
+
declare const VERSION = "0.5.0";
|
|
7864
8243
|
|
|
7865
|
-
export { type Account, AlgorithmDilithium5, type AlgorithmID, AlgorithmMLKEM1024, AlgorithmUnspecified, type AllBalancesResponse, type AnchorStateOptions, type AttachHybridOptions, type AutoFeeOptions, type BalanceResponse, type BankSendOptions, type Bech32Config, type Bech32Prefixes, type BridgeQueryClient, type BroadcastMode, type BroadcastResult, type BuildHybridTxOptions, type BuiltHybridTx, type ChallengeBatchOptions, type ClientFees, type CoinInfo, type ConnectTxOptions, type ContractMsg, type CosmWasmReadClient, type CosmWasmSigningClient, type CosmosWalletConnection, type CosmosWalletName, type CreateClientOptions, type CreateMultilayerClientOptions, type CreateRollupClientOptions, type CreateRollupOptions, type CrossVmMessage, type CrossVmMessageResponse, type CrossVmParamsResponse, type CrossVmQueryClient, DEFAULT_GAS_MULTIPLIER, DEFAULT_GAS_PRICE, type DecodedTxError, type DenomOptions, type DerivationOptions, type Ed25519Account, type EstimateFeeOptions, type EventFilters, type EventStream, type ExecuteWithdrawalOptions, type ExplorerConfig, type FaucetConfig, type FeeInput, type FeeUrgency, type FetchLike, GasPrice, type GetBlockResponse, type GetCosmosWalletOptions, type GetJsonOptions, type GetTxFn, type GetTxResponse, HYBRID_SIG_TYPE_URL, type Handler, type HashInput, type HttpOptions, type HybridBroadcaster, type HybridPlacement, HybridSigner, type IncludedTx, type InjectedCosmosWallet, type InstantiateOpts, JsonRpcClient, type JsonRpcClientOptions, JsonRpcError, type JsonRpcErrorObject, type JsonRpcResponse, type KeplrChainInfo, type KeplrCurrency, type KeplrFeeCurrency, type KeyType, type LightNodeQueryClient, ML_DSA_87_PUBLIC_KEY_LENGTH, ML_DSA_87_SECRET_KEY_LENGTH, ML_DSA_87_SEED_LENGTH, ML_DSA_87_SIGNATURE_LENGTH, MSG_SEND_TYPE_URL, type MultilayerClient, type MultilayerQueryClient, type MultilayerWriteOptions, NETWORKS, type NetworkConfig, type NetworkEndpoints, type NetworkName, type NewBlockEventLike, type PQCHybridSignature, type PageResponse, type PaginatedOptions, type Pagination, type PendingCrossVmMessagesResponse, type PqcKeypair, type PqcQueryClient, type PqcSignaturePart, PqcSigner, type QcaQueryClient, QorClient, type QoreChainClient, type QoreChainQueryClients, QoreHttpError, QoreTxError, type QueryValue, type RdkQueryClient, type RegisterPaychainOptions, type RegisterSidechainOptions, type ReputationQueryClient, type RequestFaucetOptions, type ResolveChallengeOptions, RestClient, type RestClientOptions, type RetryOptions, type RlConsensusQueryClient, type RollupClient, type RollupLifecycleOptions, type RollupWriteOptions, type RouteTransactionOptions, STATIC_FALLBACK, type SearchTxsOptions, type SearchTxsResponse, type Secp256k1Account, type SignAndBroadcastHybridOptions, type SignAndBroadcastOptions, type SignOutput, type SignatureMode, type Signer, type SigningClientLike, type SimulateOptions, type SubmitBatchOptions, type SubscriptionClient, type SvmQueryClient, type SyncBroadcaster, TxClient, type TxClientOptions, type TxConnectOptions, type TxErrorInput, type TxEventLike, type FeeInput$1 as TxFeeInput, type TxOrderBy, type TxQueryFilters, type TxResultLike, type Unsubscribe, VERSION, type WaitForTxOptions, abstractaccount, algorithmName, amm, attachHybridExtension, authz, bank, bech32ToHex, bridge, broadcastAndWait, buildAminoTypes, buildEventsQuery, buildHybridSignatureExtension, buildHybridTx, buildTxQuery, buildUrl, bytesToBech32, calculateFee, clearAdmin, connectCosmWasmSigner, connectQueryClients, createClient, createCosmWasmClient, createMultilayerClient, createQueryClients, createRollupClient, createSubscriptionClient, crossvm, decodeTxError, deriveEvmAccount, deriveNativeAccount, deriveSvmAccount, directSignerFromPrivateKey, distribution, encodeHybridExtension, estimateFee, evmToQor, execute, explorerAddressUrl, explorerBlockUrl, explorerTxUrl, feegrant, formatUnits, fromBase, generateMnemonic, generatePqcKeypair, getBlock, getCodeDetails, getCodes, getContractInfo, getContracts, getCosmosWallet, getCrossVmMessage, getCrossVmParams, getJson, getLatestBlock, getNetwork, getPendingCrossVmMessages, getTx, gov, hexToBech32, ibc, instantiate, instantiate2, isChecksumAddress, isSignatureAlgorithm, isTxFailure, isValidBech32, isValidEvmAddress, isValidSvmAddress, joinUrl, keccak256, keccak256Hex, license, lightnode, listNetworks, migrate, msg, multilayer, parseUnits, postJsonRpc, pqc as pqcMsg, pqcSign, pqcVerify, qorToEvm, qorechainRegistry, qorechainRegistryTypes, index as qorechainTypes, queryContractSmart, rdk, requestFaucet, ripemd160, ripemd160Hex, rlconsensus, searchTxs, sha256, sha256Hex, signAndBroadcastHybrid, staking, subscribeNewBlocks, subscribeTx, suggestChainInfo, svm, toBase, toChecksumAddress, toHex, txErrorFrom, updateAdmin, uploadCode, validateMnemonic, waitForTx, withRetry };
|
|
8244
|
+
export { type Account, AlgorithmDilithium5, type AlgorithmID, AlgorithmMLKEM1024, AlgorithmUnspecified, type AllBalancesResponse, type AnchorStateOptions, type AttachHybridOptions, type AutoFeeOptions, type BalanceResponse, type BankSendOptions, type Bech32Config, type Bech32Prefixes, type BridgeQueryClient, type BroadcastMode, type BroadcastResult, type BuildHybridTxOptions, type BuiltHybridTx, type CallOptions, type ChallengeBatchOptions, type ClientFees, type CoinInfo, type ConnectTxOptions, type ContractMsg, type CosmWasmPayload, type CosmWasmReadClient, type CosmWasmSigningClient, type CosmosWalletConnection, type CosmosWalletName, type CreateClientOptions, type CreateCrossVMClientOptions, type CreateMultilayerClientOptions, type CreateRollupClientOptions, type CreateRollupOptions, type CrossVMAtomicResult, type CrossVMCallBase, type CrossVMCallOptions, type CrossVMCallResult, type CrossVMClient, type CrossVMWriteOptions, type CrossVmMessage, type CrossVmMessageResponse, type CrossVmParamsResponse, type CrossVmQueryClient, DEFAULT_GAS_MULTIPLIER, DEFAULT_GAS_PRICE, type DecodedTxError, type DenomOptions, type DerivationOptions, type Ed25519Account, type EnsurePqcRegisteredOptions, type EnsurePqcRegisteredResult, type EstimateFeeOptions, type EventFilters, type EventStream, type EvmPayload, type ExecuteWithdrawalOptions, type ExplorerConfig, type FaucetConfig, type FeeInput, type FeeUrgency, type FetchLike, GasPrice, type GetBlockResponse, type GetCosmosWalletOptions, type GetJsonOptions, type GetTxFn, type GetTxResponse, HYBRID_SIG_TYPE_URL, type Handler, type HashInput, type HttpOptions, type HybridBroadcaster, type HybridPlacement, type HybridSendPath, HybridSigner, type IncludedTx, type InjectedCosmosWallet, type InstantiateOpts, JsonRpcClient, type JsonRpcClientOptions, JsonRpcError, type JsonRpcErrorObject, type JsonRpcResponse, type KeplrChainInfo, type KeplrCurrency, type KeplrFeeCurrency, type KeyType, type LightNodeQueryClient, ML_DSA_87_PUBLIC_KEY_LENGTH, ML_DSA_87_SECRET_KEY_LENGTH, ML_DSA_87_SEED_LENGTH, ML_DSA_87_SIGNATURE_LENGTH, MSG_SEND_TYPE_URL, type MigratePqcKeyOptions, type MigrateToHybridOptions, type MultilayerClient, type MultilayerQueryClient, type MultilayerWriteOptions, NETWORKS, type NetworkConfig, type NetworkEndpoints, type NetworkName, type NewBlockEventLike, type PQCHybridSignature, PQC_KEY_STATUS_PRECOMPILE_ADDRESS, type PageResponse, type PaginatedOptions, type Pagination, type PayloadInput, type PendingCrossVmMessagesResponse, type PqcKeypair, type PqcQueryClient, type PqcSignaturePart, PqcSigner, type PqcStatus, type PqcStatusSource, type QcaQueryClient, QorClient, type QoreChainClient, type QoreChainQueryClients, QoreHttpError, QoreTxError, type QueryValue, type RawPayload, type RdkQueryClient, type RegisterPaychainOptions, type RegisterSidechainOptions, type ReputationQueryClient, type RequestFaucetOptions, type ResolveChallengeOptions, RestClient, type RestClientOptions, type RetryOptions, type RlConsensusQueryClient, type RollupClient, type RollupLifecycleOptions, type RollupWriteOptions, type RouteTransactionOptions, STATIC_FALLBACK, type SearchTxsOptions, type SearchTxsResponse, type Secp256k1Account, type SignAndBroadcastHybridOptions, type SignAndBroadcastOptions, type SignOutput, type SignatureMode, type Signer, type SigningClientLike, type SimulateOptions, type SubmitBatchOptions, type SubscriptionClient, type SvmPayload, type SvmQueryClient, type SyncBroadcaster, TxClient, type TxClientOptions, type TxConnectOptions, type TxErrorInput, type TxEventLike, type FeeInput$1 as TxFeeInput, type TxOrderBy, type TxQueryFilters, type TxResultLike, type Unsubscribe, VERSION, type VMType, VM_TYPES, type WaitForTxOptions, abstractaccount, algorithmName, amm, attachHybridExtension, authz, bank, bech32ToHex, bridge, broadcastAndWait, buildAminoTypes, buildEventsQuery, buildHybridSignatureExtension, buildHybridTx, buildRegisterPqcKeyMsg, buildTxQuery, buildUrl, bytesToBech32, calculateFee, clearAdmin, connectCosmWasmSigner, connectQueryClients, createClient, createCosmWasmClient, createCrossVMClient, createMultilayerClient, createQueryClients, createRollupClient, createSubscriptionClient, crossvm, decodeTxError, deriveEvmAccount, deriveNativeAccount, deriveSvmAccount, directSignerFromPrivateKey, distribution, encodeHybridExtension, ensurePqcRegistered, estimateFee, evmToQor, execute, explorerAddressUrl, explorerBlockUrl, explorerTxUrl, feegrant, formatUnits, fromBase, generateMnemonic, generatePqcKeypair, getBlock, getCodeDetails, getCodes, getContractInfo, getContracts, getCosmosWallet, getCrossVmMessage, getCrossVmParams, getJson, getLatestBlock, getNetwork, getPendingCrossVmMessages, getPqcStatus, getTx, gov, hexToBech32, ibc, instantiate, instantiate2, isChecksumAddress, isPqcRegistered, isSignatureAlgorithm, isTxFailure, isValidBech32, isValidEvmAddress, isValidSvmAddress, joinUrl, keccak256, keccak256Hex, license, lightnode, listNetworks, migrate, migratePqcKey, migrateToHybrid, msg, multilayer, parseUnits, postJsonRpc, pqc as pqcMsg, pqcSign, pqcVerify, qorToEvm, qorechainRegistry, qorechainRegistryTypes, index as qorechainTypes, queryContractSmart, rdk, requestFaucet, ripemd160, ripemd160Hex, rlconsensus, searchTxs, sha256, sha256Hex, signAndBroadcastHybrid, staking, subscribeNewBlocks, subscribeTx, suggestChainInfo, svm, toBase, toChecksumAddress, toHex, txErrorFrom, updateAdmin, uploadCode, validateMnemonic, waitForTx, withRetry };
|