@thruputchain/client 0.0.0-stage → 0.26.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/LICENSE +201 -0
- package/README.md +953 -2
- package/dist/actions-CXx6qzsv.cjs +513 -0
- package/dist/actions-CXx6qzsv.cjs.map +1 -0
- package/dist/actions-QHgiCqT6.js +430 -0
- package/dist/actions-QHgiCqT6.js.map +1 -0
- package/dist/actions.cjs +23 -0
- package/dist/actions.d.cts +4 -0
- package/dist/actions.d.ts +4 -0
- package/dist/actions.js +3 -0
- package/dist/artifact-BM_MVzhL.d.cts +35 -0
- package/dist/artifact-BM_MVzhL.d.cts.map +1 -0
- package/dist/artifact-BM_MVzhL.d.ts +35 -0
- package/dist/artifact-BM_MVzhL.d.ts.map +1 -0
- package/dist/client-JixxskeH.d.cts +746 -0
- package/dist/client-JixxskeH.d.cts.map +1 -0
- package/dist/client-JixxskeH.d.ts +746 -0
- package/dist/client-JixxskeH.d.ts.map +1 -0
- package/dist/codec-BHKoSaOP.js +9506 -0
- package/dist/codec-BHKoSaOP.js.map +1 -0
- package/dist/codec-C3OlYm98.cjs +9566 -0
- package/dist/codec-C3OlYm98.cjs.map +1 -0
- package/dist/contract-C7T2H2Oi.cjs +1628 -0
- package/dist/contract-C7T2H2Oi.cjs.map +1 -0
- package/dist/contract-DzvyyFCI.js +1472 -0
- package/dist/contract-DzvyyFCI.js.map +1 -0
- package/dist/contract.cjs +63 -0
- package/dist/contract.d.cts +4 -0
- package/dist/contract.d.ts +4 -0
- package/dist/contract.js +2 -0
- package/dist/contracts.cjs +1050 -0
- package/dist/contracts.cjs.map +1 -0
- package/dist/contracts.d.cts +397 -0
- package/dist/contracts.d.cts.map +1 -0
- package/dist/contracts.d.ts +397 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +1030 -0
- package/dist/contracts.js.map +1 -0
- package/dist/dev_wallet-CSMA1PCt.js +497 -0
- package/dist/dev_wallet-CSMA1PCt.js.map +1 -0
- package/dist/dev_wallet-GX-NCAFk.cjs +530 -0
- package/dist/dev_wallet-GX-NCAFk.cjs.map +1 -0
- package/dist/domainSeparator-B_vU_zUD.cjs +102 -0
- package/dist/domainSeparator-B_vU_zUD.cjs.map +1 -0
- package/dist/domainSeparator-CBCvxIj-.js +79 -0
- package/dist/domainSeparator-CBCvxIj-.js.map +1 -0
- package/dist/execution-DYqPDn4O.d.cts +227 -0
- package/dist/execution-DYqPDn4O.d.cts.map +1 -0
- package/dist/execution-Dj6E4B_b.d.ts +227 -0
- package/dist/execution-Dj6E4B_b.d.ts.map +1 -0
- package/dist/hex-DIcaALXL.js +112 -0
- package/dist/hex-DIcaALXL.js.map +1 -0
- package/dist/hex-DkGpiZ5e.cjs +189 -0
- package/dist/hex-DkGpiZ5e.cjs.map +1 -0
- package/dist/index--5LsCotr.d.ts +192 -0
- package/dist/index--5LsCotr.d.ts.map +1 -0
- package/dist/index-1-rFirYe.d.cts +90 -0
- package/dist/index-1-rFirYe.d.cts.map +1 -0
- package/dist/index-B5KqSHeL.d.cts +192 -0
- package/dist/index-B5KqSHeL.d.cts.map +1 -0
- package/dist/index-BraLWObY.d.cts +164 -0
- package/dist/index-BraLWObY.d.cts.map +1 -0
- package/dist/index-ByNNqY7S.d.cts +83 -0
- package/dist/index-ByNNqY7S.d.cts.map +1 -0
- package/dist/index-ByvV2UF6.d.ts +164 -0
- package/dist/index-ByvV2UF6.d.ts.map +1 -0
- package/dist/index-CG2WRtGa.d.cts +164 -0
- package/dist/index-CG2WRtGa.d.cts.map +1 -0
- package/dist/index-CIHK7Ew9.d.cts +303 -0
- package/dist/index-CIHK7Ew9.d.cts.map +1 -0
- package/dist/index-CIHK7Ew9.d.ts +303 -0
- package/dist/index-CIHK7Ew9.d.ts.map +1 -0
- package/dist/index-CVrhB9Dr.d.cts +263 -0
- package/dist/index-CVrhB9Dr.d.cts.map +1 -0
- package/dist/index-D89ur7mO.d.ts +164 -0
- package/dist/index-D89ur7mO.d.ts.map +1 -0
- package/dist/index-DzrLv3EA.d.cts +82 -0
- package/dist/index-DzrLv3EA.d.cts.map +1 -0
- package/dist/index-DzrLv3EA.d.ts +82 -0
- package/dist/index-DzrLv3EA.d.ts.map +1 -0
- package/dist/index-SV-inhhO.d.ts +90 -0
- package/dist/index-SV-inhhO.d.ts.map +1 -0
- package/dist/index-dJ65V8se.d.ts +263 -0
- package/dist/index-dJ65V8se.d.ts.map +1 -0
- package/dist/index-fdTURpBk.d.ts +83 -0
- package/dist/index-fdTURpBk.d.ts.map +1 -0
- package/dist/index.cjs +445 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +174 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +174 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +189 -0
- package/dist/index.js.map +1 -0
- package/dist/provider.cjs +101 -0
- package/dist/provider.cjs.map +1 -0
- package/dist/provider.d.cts +2 -0
- package/dist/provider.d.ts +2 -0
- package/dist/provider.js +76 -0
- package/dist/provider.js.map +1 -0
- package/dist/readError-AoNjzW75.cjs +604 -0
- package/dist/readError-AoNjzW75.cjs.map +1 -0
- package/dist/readError-CZPYcW__.js +551 -0
- package/dist/readError-CZPYcW__.js.map +1 -0
- package/dist/readViews-DJyqc7im.d.cts +604 -0
- package/dist/readViews-DJyqc7im.d.cts.map +1 -0
- package/dist/readViews-DQoaUORa.d.ts +604 -0
- package/dist/readViews-DQoaUORa.d.ts.map +1 -0
- package/dist/rolldown-runtime-D6vf50IK.cjs +28 -0
- package/dist/sendInvocation-BwabRa2N.js +505 -0
- package/dist/sendInvocation-BwabRa2N.js.map +1 -0
- package/dist/sendInvocation-qO8AZcmU.cjs +661 -0
- package/dist/sendInvocation-qO8AZcmU.cjs.map +1 -0
- package/dist/sign-BewmV_EL.cjs +139 -0
- package/dist/sign-BewmV_EL.cjs.map +1 -0
- package/dist/sign-DVIRyW8Y.js +122 -0
- package/dist/sign-DVIRyW8Y.js.map +1 -0
- package/dist/sign-Ve0eetRO.d.ts +48 -0
- package/dist/sign-Ve0eetRO.d.ts.map +1 -0
- package/dist/sign-eUT0iGQG.d.cts +48 -0
- package/dist/sign-eUT0iGQG.d.cts.map +1 -0
- package/dist/signed-op.cjs +9 -0
- package/dist/signed-op.d.cts +3 -0
- package/dist/signed-op.d.ts +3 -0
- package/dist/signed-op.js +3 -0
- package/dist/signedOp-C52gOgpR.js +166 -0
- package/dist/signedOp-C52gOgpR.js.map +1 -0
- package/dist/signedOp-oqAXEqmE.cjs +183 -0
- package/dist/signedOp-oqAXEqmE.cjs.map +1 -0
- package/dist/signed_op-BokEDWr-.js +154 -0
- package/dist/signed_op-BokEDWr-.js.map +1 -0
- package/dist/signed_op-C4lY_TCc.d.ts +58 -0
- package/dist/signed_op-C4lY_TCc.d.ts.map +1 -0
- package/dist/signed_op-DX5WuyEh.d.cts +58 -0
- package/dist/signed_op-DX5WuyEh.d.cts.map +1 -0
- package/dist/signed_op-q8KKSm5e.cjs +175 -0
- package/dist/signed_op-q8KKSm5e.cjs.map +1 -0
- package/dist/signers-BFP84wJP.cjs +137 -0
- package/dist/signers-BFP84wJP.cjs.map +1 -0
- package/dist/signers-CzOSedwJ.js +120 -0
- package/dist/signers-CzOSedwJ.js.map +1 -0
- package/dist/signers.cjs +5 -0
- package/dist/signers.d.cts +3 -0
- package/dist/signers.d.ts +3 -0
- package/dist/signers.js +2 -0
- package/dist/size-506oTE28.js +91 -0
- package/dist/size-506oTE28.js.map +1 -0
- package/dist/size-OAFfOthl.cjs +108 -0
- package/dist/size-OAFfOthl.cjs.map +1 -0
- package/dist/transaction-CwkQxQOx.js +24 -0
- package/dist/transaction-CwkQxQOx.js.map +1 -0
- package/dist/transaction-DrSrCJ5y.cjs +47 -0
- package/dist/transaction-DrSrCJ5y.cjs.map +1 -0
- package/dist/transaction.cjs +13 -0
- package/dist/transaction.d.cts +3 -0
- package/dist/transaction.d.ts +3 -0
- package/dist/transaction.js +4 -0
- package/dist/transactionHash-CO9ajbvU.js +24 -0
- package/dist/transactionHash-CO9ajbvU.js.map +1 -0
- package/dist/transactionHash-D5yf4KoL.cjs +29 -0
- package/dist/transactionHash-D5yf4KoL.cjs.map +1 -0
- package/dist/transport-CBFwAIIv.js +261 -0
- package/dist/transport-CBFwAIIv.js.map +1 -0
- package/dist/transport-tWxKhXUt.cjs +279 -0
- package/dist/transport-tWxKhXUt.cjs.map +1 -0
- package/dist/transport.cjs +19 -0
- package/dist/transport.d.cts +3 -0
- package/dist/transport.d.ts +3 -0
- package/dist/transport.js +4 -0
- package/dist/types-BE40oD_Q.d.cts +18 -0
- package/dist/types-BE40oD_Q.d.cts.map +1 -0
- package/dist/types-BE40oD_Q.d.ts +18 -0
- package/dist/types-BE40oD_Q.d.ts.map +1 -0
- package/dist/validation-4w-vDGAi.cjs +543 -0
- package/dist/validation-4w-vDGAi.cjs.map +1 -0
- package/dist/validation-eXATmgO0.js +411 -0
- package/dist/validation-eXATmgO0.js.map +1 -0
- package/dist/wallet-7RELuTkf.js +667 -0
- package/dist/wallet-7RELuTkf.js.map +1 -0
- package/dist/wallet-T_JazXRc.cjs +709 -0
- package/dist/wallet-T_JazXRc.cjs.map +1 -0
- package/dist/wallet.cjs +27 -0
- package/dist/wallet.d.cts +3 -0
- package/dist/wallet.d.ts +3 -0
- package/dist/wallet.js +3 -0
- package/package.json +122 -4
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { A as RpcContractDeploymentResult, I as RpcEffectiveContractResult, Ot as TransportRequestOptions, Tt as UnsupportedRpcValue, t as RpcClient } from "./client-JixxskeH.js";
|
|
2
|
+
import { Ot as ContractSpec, k as CoreThruputClient } from "./readViews-DQoaUORa.js";
|
|
3
|
+
import { t as ContractArtifactSpec } from "./artifact-BM_MVzhL.js";
|
|
4
|
+
import { F as WalletAccount, a as SubmissionEvidence, k as PrepareTransactionRequest } from "./execution-Dj6E4B_b.js";
|
|
5
|
+
import { Invocation, NetworkHash, SHA256Hash, SignedTransaction, Transaction } from "@thruputchain/protocol";
|
|
6
|
+
|
|
7
|
+
//#region src/actions/public/getContractSpec.d.ts
|
|
8
|
+
/** Snapshot deployment evidence and its authenticated metadata, if deployed. */
|
|
9
|
+
interface ContractSpecResult extends RpcContractDeploymentResult {
|
|
10
|
+
artifactSpec: ContractArtifactSpec | null;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Resolve a current deployment and verify its embedded spec against its hash.
|
|
14
|
+
* Missing artifacts and invalid responses throw; neither means no deployment.
|
|
15
|
+
* The snapshot does not establish which implementation produced historical events.
|
|
16
|
+
*/
|
|
17
|
+
declare function getContractSpec(client: RpcClient, request: {
|
|
18
|
+
address: Uint8Array;
|
|
19
|
+
}, options?: TransportRequestOptions): Promise<ContractSpecResult>;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/actions/public/getEffectiveContractSpec.d.ts
|
|
22
|
+
interface EffectiveContractSpecResult extends RpcEffectiveContractResult {
|
|
23
|
+
artifactSpec: ContractArtifactSpec | null;
|
|
24
|
+
/** Recognized native interface; not artifact-bound or proof of runtime code. */
|
|
25
|
+
nativeInterface: {
|
|
26
|
+
name: "DefaultWallet";
|
|
27
|
+
spec: ContractSpec;
|
|
28
|
+
} | null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Discover current contract selection without inferring authorization or historical identity.
|
|
32
|
+
* Root context allows the chain-configured fallback; nested excludes that fallback.
|
|
33
|
+
* Transaction-local deployments are outside this committed-state reading.
|
|
34
|
+
*/
|
|
35
|
+
declare function getEffectiveContractSpec(client: RpcClient, request: {
|
|
36
|
+
address: Uint8Array;
|
|
37
|
+
context: "root" | "nested";
|
|
38
|
+
}, options?: TransportRequestOptions): Promise<EffectiveContractSpecResult>;
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/actions/public/decodeWalletRequests.d.ts
|
|
41
|
+
/** Requested child invocations, never proof of execution or child outputs. */
|
|
42
|
+
interface WalletRequests {
|
|
43
|
+
wrapper: "DefaultWallet.execute" | "DefaultWallet.deploy";
|
|
44
|
+
requestedCalls: Invocation[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Interpret a known DefaultWallet root using built-in binding descriptors.
|
|
48
|
+
* Call only after identifying the root as DefaultWallet; matching selectors
|
|
49
|
+
* alone do not establish wallet identity. Malformed recognized inputs throw.
|
|
50
|
+
*/
|
|
51
|
+
declare function decodeDefaultWalletRequests(root: Invocation): WalletRequests | null;
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/actions/public/readTransactionInput.d.ts
|
|
54
|
+
/** Canonical retained input verified against the requested public transaction hash. */
|
|
55
|
+
type VerifiedTransactionInput = {
|
|
56
|
+
status: "available";
|
|
57
|
+
transactionHash: Uint8Array;
|
|
58
|
+
blockHeight: bigint;
|
|
59
|
+
transactionXdr: Uint8Array;
|
|
60
|
+
transaction: Transaction;
|
|
61
|
+
} | {
|
|
62
|
+
status: "unavailable";
|
|
63
|
+
} | UnsupportedRpcValue;
|
|
64
|
+
/**
|
|
65
|
+
* Read and authenticate a retained Transaction, including its root invocation.
|
|
66
|
+
* Unavailable does not prove nonexecution. A matching body hash authenticates
|
|
67
|
+
* neither signatures nor the reported block height, and does not imply success.
|
|
68
|
+
*/
|
|
69
|
+
declare function readTransactionInput(client: RpcClient, request: {
|
|
70
|
+
transactionHash: Uint8Array;
|
|
71
|
+
}, options?: TransportRequestOptions): Promise<VerifiedTransactionInput>;
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/actions/wallet/sendTransaction.d.ts
|
|
74
|
+
/**
|
|
75
|
+
* Serialize and submit once through the native RPC boundary.
|
|
76
|
+
* Unknown admission throws TransactionObservationError with the signed bytes and
|
|
77
|
+
* destination discovery network; that network does not prove the signing network
|
|
78
|
+
* of an already-signed envelope. RPC and transport failures propagate unchanged.
|
|
79
|
+
*/
|
|
80
|
+
declare function sendTransaction(client: Pick<RpcClient, "sendTransaction" | "discovery">, signedTx: SignedTransaction, options?: TransportRequestOptions): Promise<SHA256Hash>;
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/actions/wallet/sendInvocation.d.ts
|
|
83
|
+
/** Prepare, sign, and submit one explicit root invocation. */
|
|
84
|
+
declare function sendInvocation(client: Pick<CoreThruputClient, "getChainTip" | "sendTransaction" | "requireMethods" | "discovery">, account: WalletAccount, networkHash: NetworkHash, request: PrepareTransactionRequest, controls?: {
|
|
85
|
+
signal?: AbortSignal;
|
|
86
|
+
onSigned?: (evidence: SubmissionEvidence) => void | Promise<void>;
|
|
87
|
+
}): Promise<SHA256Hash>;
|
|
88
|
+
//#endregion
|
|
89
|
+
export { WalletRequests as a, getEffectiveContractSpec as c, readTransactionInput as i, ContractSpecResult as l, sendTransaction as n, decodeDefaultWalletRequests as o, VerifiedTransactionInput as r, EffectiveContractSpecResult as s, sendInvocation as t, getContractSpec as u };
|
|
90
|
+
//# sourceMappingURL=index-SV-inhhO.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-SV-inhhO.d.ts","names":[],"sources":["../src/actions/public/getContractSpec.ts","../src/actions/public/getEffectiveContractSpec.ts","../src/actions/public/decodeWalletRequests.ts","../src/actions/public/readTransactionInput.ts","../src/actions/wallet/sendTransaction.ts","../src/actions/wallet/sendInvocation.ts"],"mappings":";;;;;;;;UAoBiB,kBAAA,SAA2B,2BAA2B;EACrE,YAAA,EAAc,oBAAA;AAAA;;;;;;iBAQM,eAAA,CACpB,MAAA,EAAQ,SAAA,EACR,OAAA;EAAW,OAAA,EAAS,UAAA;AAAA,GACpB,OAAA,GAAU,uBAAA,GACT,OAAA,CAAQ,kBAAA;;;UCXM,2BAAA,SAAoC,0BAAA;EACnD,YAAA,EAAc,oBAAA;EDHC;ECKf,eAAA;IAAmB,IAAA;IAAuB,IAAA,EAAM,YAAA;EAAA;AAAA;;;ADJd;AAQpC;;iBCIsB,wBAAA,CACpB,MAAA,EAAQ,SAAA,EACR,OAAA;EAAW,OAAA,EAAS,UAAA;EAAY,OAAA;AAAA,GAChC,OAAA,GAAU,uBAAA,GACT,OAAA,CAAQ,2BAAA;;;;UCzBM,cAAA;EACf,OAAA;EACA,cAAA,EAAgB,UAAU;AAAA;;AFM5B;;;;iBEEgB,2BAAA,CACd,IAAA,EAAM,UAAA,GACL,cAAc;;;;KCVL,wBAAA;EAEN,MAAA;EACA,eAAA,EAAiB,UAAA;EACjB,WAAA;EACA,cAAA,EAAgB,UAAA;EAChB,WAAA,EAAa,WAAA;AAAA;EAEb,MAAA;AAAA,IACF,mBAAA;;AHFgC;AAQpC;;;iBGCsB,oBAAA,CACpB,MAAA,EAAQ,SAAA,EACR,OAAA;EAAW,eAAA,EAAiB,UAAA;AAAA,GAC5B,OAAA,GAAU,uBAAA,GACT,OAAA,CAAQ,wBAAA;;;;;;;AHdX;;iBICsB,eAAA,CACpB,MAAA,EAAQ,IAAA,CAAK,SAAA,oCACb,QAAA,EAAU,iBAAA,EACV,OAAA,GAAU,uBAAA,GACT,OAAA,CAAQ,UAAA;;;AJLX;AAAA,iBKasB,cAAA,CACpB,MAAA,EAAQ,IAAA,CACN,iBAAA,uEAGF,OAAA,EAAS,aAAA,EACT,WAAA,EAAa,WAAA,EACb,OAAA,EAAS,yBAAA,EACT,QAAA;EACE,MAAA,GAAS,WAAA;EACT,QAAA,IAAY,QAAA,EAAU,kBAAA,YAA8B,OAAA;AAAA,IAErD,OAAA,CAAQ,UAAA"}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { Ot as TransportRequestOptions } from "./client-JixxskeH.js";
|
|
2
|
+
import { $t as WaitForTransactionReceiptOptions, E as AirdropActions, Kt as RequestAirdropOptions, a as ContractCall, k as CoreThruputClient, sn as AirdropSucceeded, un as BalanceResponse } from "./readViews-DQoaUORa.js";
|
|
3
|
+
import { F as WalletAccount, N as PubkeyAccount, P as SourceAddressAccount, T as DeploymentOptions, _ as WalletBatchExecutionRequest, a as SubmissionEvidence, k as PrepareTransactionRequest, r as ExecutionResult, t as CallResults, v as WalletExecutionRequest, w as ContractDeployment, y as WalletInvocationAdapter } from "./execution-Dj6E4B_b.js";
|
|
4
|
+
import { A as WalletProvider, D as SubmitTransactionResult, E as SignTransactionResult, O as WalletAccount$1, k as WalletCapabilities } from "./index-CIHK7Ew9.js";
|
|
5
|
+
import { ContractAddress, GasAmount, NetworkHash, SHA256Hash, SignedTransaction, Transaction } from "@thruputchain/protocol";
|
|
6
|
+
|
|
7
|
+
//#region src/wallet/providerClient.d.ts
|
|
8
|
+
/** Root options and ordered calls for atomic provider-wallet execution. */
|
|
9
|
+
type PrepareBatchExecutionRequest = WalletBatchExecutionRequest & Omit<PrepareExecutionRequest, "invocation">;
|
|
10
|
+
/** Exact signed evidence available before broadcasting. Persist on the original network. */
|
|
11
|
+
interface PendingWalletTransaction extends SignTransactionResult {
|
|
12
|
+
readonly account: WalletAccount$1;
|
|
13
|
+
readonly networkHash: string;
|
|
14
|
+
}
|
|
15
|
+
/** Lifecycle controls. Cancellation can prevent dispatch; it never cancels a broadcast already sent. */
|
|
16
|
+
interface ProviderExecutionOptions {
|
|
17
|
+
/** Await durable application persistence before submitting; rejection prevents broadcast. */
|
|
18
|
+
onSigned: (pending: PendingWalletTransaction) => void | Promise<void>;
|
|
19
|
+
/** Shared submission/receipt budget after signing and persistence; network identity is pinned. */
|
|
20
|
+
wait?: WaitForTransactionReceiptOptions;
|
|
21
|
+
}
|
|
22
|
+
/** Typed calls executed atomically through DefaultWallet. */
|
|
23
|
+
interface ExecuteCallsRequest<T extends readonly ContractCall[]> {
|
|
24
|
+
calls: T;
|
|
25
|
+
gasLimit: GasAmount;
|
|
26
|
+
contractsToDeploy?: PrepareExecutionRequest["contractsToDeploy"];
|
|
27
|
+
expiryBlocks?: bigint;
|
|
28
|
+
}
|
|
29
|
+
/** External wallet binding. Network hash uses unprefixed, case-sensitive base58. */
|
|
30
|
+
interface CreateProviderWalletClientOptions {
|
|
31
|
+
/**
|
|
32
|
+
* RPC client connected to and verified against the application's expected network.
|
|
33
|
+
* A validated client identity must match `networkHash`; an unqualified
|
|
34
|
+
* CoreThruputClient requires the caller to verify its RPC network separately.
|
|
35
|
+
*/
|
|
36
|
+
client: CoreThruputClient;
|
|
37
|
+
/** Live external provider with an already authorized session. */
|
|
38
|
+
provider: WalletProvider;
|
|
39
|
+
/** Wire pubkey account from the provider subpath, snapshotted at construction. */
|
|
40
|
+
account: WalletAccount$1;
|
|
41
|
+
/** Trusted application network identity: 32-byte base58; must match the session exactly. */
|
|
42
|
+
networkHash: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Explicit prepare/sign/persist/submit flow without access to a raw signer.
|
|
46
|
+
* Allows one in-flight operation; concurrent calls fail with code -32002. Checks
|
|
47
|
+
* `getSession` before each operation and permanently invalidates on every `change`,
|
|
48
|
+
* a failed session read, or a mismatched session. Dispose and recreate after a
|
|
49
|
+
* change or reconnect; there is no automatic reconnect or retry.
|
|
50
|
+
*
|
|
51
|
+
* @see https://docs.thruput.network/tools/wallet-integration/
|
|
52
|
+
*/
|
|
53
|
+
interface ProviderWalletClient {
|
|
54
|
+
/** Prepare a root deployment, preserving the explicit signing boundary. */
|
|
55
|
+
prepareDeployment(deployment: ContractDeployment, options: DeploymentOptions): Promise<Transaction>;
|
|
56
|
+
/** Persist approved evidence, deploy once, and verify the committed address. */
|
|
57
|
+
deployContractAndWait(deployment: ContractDeployment, options: DeploymentOptions, controls: ProviderExecutionOptions): Promise<ExecutionResult & {
|
|
58
|
+
address: import("@thruputchain/protocol").ContractAddress;
|
|
59
|
+
}>;
|
|
60
|
+
/** Prepare, sign, persist, submit once, then observe a successful receipt. */
|
|
61
|
+
executeAndWait(request: PrepareExecutionRequest, options: ProviderExecutionOptions): Promise<ExecutionResult>;
|
|
62
|
+
/** Execute an ordered atomic batch and decode typed child results. */
|
|
63
|
+
executeCallsAndWait<T extends readonly ContractCall[]>(request: ExecuteCallsRequest<T>, options: ProviderExecutionOptions): Promise<ExecutionResult & {
|
|
64
|
+
values: CallResults<T>;
|
|
65
|
+
}>;
|
|
66
|
+
/** Read fresh account/network capabilities; only 4200 falls back to unsupported. */
|
|
67
|
+
getCapabilities(): Promise<WalletCapabilities>;
|
|
68
|
+
/** Prepare one atomic batch after checking support. Does not sign or submit. */
|
|
69
|
+
prepareBatchExecution(request: PrepareBatchExecutionRequest): Promise<Transaction>;
|
|
70
|
+
/**
|
|
71
|
+
* Prepare a transaction using the default-wallet wrapper and existing nonce and
|
|
72
|
+
* expiry handling. Generates a random transaction nonce when none is supplied;
|
|
73
|
+
* this is separate from the account-derivation nonce. Snapshots input before
|
|
74
|
+
* asynchronous work and enforces the unsigned size bound. Does not sign or submit.
|
|
75
|
+
*/
|
|
76
|
+
prepareExecution(request: PrepareExecutionRequest): Promise<Transaction>;
|
|
77
|
+
/**
|
|
78
|
+
* Request approval and sign without broadcasting. Snapshots the unsigned bytes,
|
|
79
|
+
* checks the account claim, and verifies exact bytes, strict network-bound
|
|
80
|
+
* signature, and canonical hash with {@link verifySignTransactionResult}.
|
|
81
|
+
* Once a new request passes local transaction and account-claim validation, it
|
|
82
|
+
* clears the previous approval before awaiting the session or provider. Failure
|
|
83
|
+
* or user rejection does not restore that approval. Only the latest successfully
|
|
84
|
+
* verified result can be submitted; invalid provider results invalidate the adapter.
|
|
85
|
+
* Await durable persistence of the result,
|
|
86
|
+
* account, and network before calling {@link submitTransaction}.
|
|
87
|
+
*/
|
|
88
|
+
signTransaction(transaction: Transaction): Promise<SignTransactionResult>;
|
|
89
|
+
/**
|
|
90
|
+
* Submit the exact signed bytes and hash of this adapter's latest approval.
|
|
91
|
+
* Consumes approval before requesting broadcast, including when that request
|
|
92
|
+
* fails; the adapter never retries. Returns a broadcast acknowledgement, not an
|
|
93
|
+
* execution receipt, and verifies its hash against the approved result.
|
|
94
|
+
*
|
|
95
|
+
* Treat a submit failure as potentially broadcast. Keep the previously persisted
|
|
96
|
+
* hash and query status/receipt on the original network; do not automatically
|
|
97
|
+
* prepare, sign, or execute a replacement transaction. A timeout, session change,
|
|
98
|
+
* or invalid response can occur after broadcast. See the factory's persistence example.
|
|
99
|
+
*/
|
|
100
|
+
submitTransaction(signed: SignTransactionResult): Promise<SubmitTransactionResult>;
|
|
101
|
+
/**
|
|
102
|
+
* Idempotently unsubscribe and permanently invalidate this adapter, clearing its
|
|
103
|
+
* approval. Does not revoke provider permission or cancel pending requests.
|
|
104
|
+
* A late response cannot reactivate the adapter. Use provider `disconnect` to
|
|
105
|
+
* revoke permission; create a new adapter for a later authorized session.
|
|
106
|
+
*/
|
|
107
|
+
dispose(): void;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Synchronously bind a pubkey provider account without modifying the RPC client.
|
|
111
|
+
* Does not connect or request permission: first await provider `connect` and
|
|
112
|
+
* validate its session. Snapshots account/network configuration, validates account
|
|
113
|
+
* derivation and any validated client network identity, and subscribes to changes.
|
|
114
|
+
* Supply the application's trusted expected network hash, not a value adopted from
|
|
115
|
+
* the wallet. The RPC client must be connected to and verified against that same
|
|
116
|
+
* network. Every native client carries a discovered network identity, checked here.
|
|
117
|
+
* See {@link ProviderWalletClient} for invalidation and concurrency rules.
|
|
118
|
+
* Providers own signing UI deadlines. Execution controls bound submission and
|
|
119
|
+
* observation after signing; they cannot cancel a broadcast already sent.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* Await an application-owned `onSigned` callback to durably save the signed result
|
|
123
|
+
* and its original account/network before broadcasting. If saving fails, submission
|
|
124
|
+
* is never requested.
|
|
125
|
+
* `expectedNetworkHash` comes from trusted application configuration, and `client`
|
|
126
|
+
* must already be connected to and verified against that network.
|
|
127
|
+
*
|
|
128
|
+
* ```ts
|
|
129
|
+
* import type { CoreThruputClient } from "@thruputchain/client";
|
|
130
|
+
* import {
|
|
131
|
+
* parseWalletSession,
|
|
132
|
+
* parseWalletNetworkHash,
|
|
133
|
+
* type SignTransactionResult,
|
|
134
|
+
* type WalletAccount,
|
|
135
|
+
* type WalletProvider,
|
|
136
|
+
* } from "@thruputchain/client/provider";
|
|
137
|
+
* import {
|
|
138
|
+
* createProviderWalletClient,
|
|
139
|
+
* type PrepareExecutionRequest,
|
|
140
|
+
* } from "@thruputchain/client/wallet";
|
|
141
|
+
*
|
|
142
|
+
* async function sendWithWallet(
|
|
143
|
+
* client: CoreThruputClient,
|
|
144
|
+
* provider: WalletProvider,
|
|
145
|
+
* expectedNetworkHash: string,
|
|
146
|
+
* request: PrepareExecutionRequest,
|
|
147
|
+
* onSigned: (pending: SignTransactionResult & {
|
|
148
|
+
* account: WalletAccount;
|
|
149
|
+
* networkHash: string;
|
|
150
|
+
* }) => Promise<void>,
|
|
151
|
+
* ) {
|
|
152
|
+
* const networkHash = parseWalletNetworkHash(expectedNetworkHash);
|
|
153
|
+
* const session = parseWalletSession(await provider.request({ method: "connect" }));
|
|
154
|
+
* if (session.networkHash !== networkHash) {
|
|
155
|
+
* throw new Error("Wallet network does not match the application network");
|
|
156
|
+
* }
|
|
157
|
+
* const account = session.accounts[0];
|
|
158
|
+
* if (!account) throw new Error("No authorized account");
|
|
159
|
+
* const wallet = createProviderWalletClient({
|
|
160
|
+
* client, provider, account, networkHash,
|
|
161
|
+
* });
|
|
162
|
+
* try {
|
|
163
|
+
* const transaction = await wallet.prepareExecution(request);
|
|
164
|
+
* const signed = await wallet.signTransaction(transaction);
|
|
165
|
+
* await onSigned({ ...signed, account, networkHash });
|
|
166
|
+
* // On submit failure, recover using the saved hash and original network.
|
|
167
|
+
* return await wallet.submitTransaction(signed);
|
|
168
|
+
* } finally {
|
|
169
|
+
* wallet.dispose();
|
|
170
|
+
* }
|
|
171
|
+
* }
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* @see https://docs.thruput.network/tools/wallet-integration/
|
|
175
|
+
* @see https://docs.thruput.network/tools/wallet-provider/
|
|
176
|
+
*/
|
|
177
|
+
declare function createProviderWalletClient(options: CreateProviderWalletClientOptions): ProviderWalletClient;
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/wallet/client.d.ts
|
|
180
|
+
/** Wallet airdrop options with the bound account as the default recipient. */
|
|
181
|
+
type WalletRequestAirdropOptions = Omit<RequestAirdropOptions, "recipient"> & {
|
|
182
|
+
readonly recipient?: ContractAddress;
|
|
183
|
+
};
|
|
184
|
+
/** Signer-bound transaction and account actions. */
|
|
185
|
+
interface WalletActions<TAccount extends WalletAccount = WalletAccount> {
|
|
186
|
+
readonly account: TAccount;
|
|
187
|
+
getBalance(request?: {
|
|
188
|
+
address?: Uint8Array;
|
|
189
|
+
}, options?: TransportRequestOptions): Promise<BalanceResponse>;
|
|
190
|
+
prepareTransaction(request: PrepareTransactionRequest): Promise<Transaction>;
|
|
191
|
+
signTransaction(transaction: Transaction): Promise<SignedTransaction>;
|
|
192
|
+
sendInvocation(request: PrepareTransactionRequest): Promise<SHA256Hash>;
|
|
193
|
+
/** Prepare explicit funding, deployment and optional initialization in one root. */
|
|
194
|
+
prepareDeployment(deployment: ContractDeployment, options: DeploymentOptions): Promise<Transaction>;
|
|
195
|
+
/** Submit deployment and return its predicted address before commitment. */
|
|
196
|
+
deployContract(deployment: ContractDeployment, options: DeploymentOptions): Promise<{
|
|
197
|
+
transactionHash: SHA256Hash;
|
|
198
|
+
address: ContractAddress;
|
|
199
|
+
}>;
|
|
200
|
+
/** Deploy, wait for success and verify the returned address. */
|
|
201
|
+
deployContractAndWait(deployment: ContractDeployment, options: DeploymentOptions, wait?: WaitForTransactionReceiptOptions): Promise<ExecutionResult & {
|
|
202
|
+
address: ContractAddress;
|
|
203
|
+
}>;
|
|
204
|
+
}
|
|
205
|
+
/** Transaction options accepted when wrapping an inner wallet invocation. */
|
|
206
|
+
type PrepareExecutionRequest<TRequest extends WalletExecutionRequest = WalletExecutionRequest> = TRequest & Omit<PrepareTransactionRequest, "invocation">;
|
|
207
|
+
/** Wallet-contract wrapping actions available when an adapter is configured. */
|
|
208
|
+
interface WalletExecutionActions<TRequest extends WalletExecutionRequest = WalletExecutionRequest> {
|
|
209
|
+
prepareExecution(request: PrepareExecutionRequest<TRequest>): Promise<Transaction>;
|
|
210
|
+
execute(request: PrepareExecutionRequest<TRequest>): Promise<SHA256Hash>;
|
|
211
|
+
/** Submit and require a successful committed receipt. */
|
|
212
|
+
executeAndWait(request: PrepareExecutionRequest<TRequest>, options?: WaitForTransactionReceiptOptions): Promise<ExecutionResult>;
|
|
213
|
+
/** Execute typed calls atomically and decode their ordered return values. */
|
|
214
|
+
executeCallsAndWait<T extends readonly ContractCall[]>(request: ExecuteCallsRequest<T>, options?: WaitForTransactionReceiptOptions): Promise<ExecutionResult & {
|
|
215
|
+
values: CallResults<T>;
|
|
216
|
+
}>;
|
|
217
|
+
}
|
|
218
|
+
/** Account-defaulted funding available when the underlying client supports it. */
|
|
219
|
+
interface WalletAirdropActions {
|
|
220
|
+
requestAirdrop(options?: WalletRequestAirdropOptions): Promise<AirdropSucceeded>;
|
|
221
|
+
}
|
|
222
|
+
/** Existing client methods plus signer-bound wallet actions. */
|
|
223
|
+
type WalletClient<TClient extends CoreThruputClient, TAccount extends WalletAccount = WalletAccount> = Omit<TClient, "getBalance" | "requestAirdrop" | "account" | "prepareTransaction" | "signTransaction" | "sendInvocation" | "prepareExecution" | "execute"> & WalletActions<TAccount> & (TClient extends AirdropActions ? WalletAirdropActions : object);
|
|
224
|
+
/** Wallet client with adapter-aware inner invocation execution. */
|
|
225
|
+
type ExecutableWalletClient<TClient extends CoreThruputClient, TAccount extends WalletAccount = WalletAccount, TRequest extends WalletExecutionRequest = WalletExecutionRequest> = WalletClient<TClient, TAccount> & WalletExecutionActions<TRequest>;
|
|
226
|
+
/** Signing-network input inferred from whether a client has validated identity. */
|
|
227
|
+
type WalletNetworkOptions<TClient extends CoreThruputClient> = TClient extends {
|
|
228
|
+
readonly network: {
|
|
229
|
+
readonly networkHash: Uint8Array;
|
|
230
|
+
};
|
|
231
|
+
} ? {
|
|
232
|
+
readonly networkHash?: never;
|
|
233
|
+
} : {
|
|
234
|
+
/** Signing network required when the client has no validated identity. */readonly networkHash: NetworkHash;
|
|
235
|
+
};
|
|
236
|
+
/** Decorate an existing client with signer-bound wallet behavior. */
|
|
237
|
+
declare function createWalletClient<TClient extends CoreThruputClient, TAccount extends WalletAccount, TRequest extends WalletExecutionRequest>(options: {
|
|
238
|
+
readonly client: TClient;
|
|
239
|
+
readonly account: TAccount;
|
|
240
|
+
readonly onSigned?: (submission: SubmissionEvidence) => void | Promise<void>;
|
|
241
|
+
readonly invocationAdapter: WalletInvocationAdapter<TRequest>;
|
|
242
|
+
} & WalletNetworkOptions<TClient>): ExecutableWalletClient<TClient, TAccount, TRequest>;
|
|
243
|
+
declare function createWalletClient<TClient extends CoreThruputClient, TAccount extends PubkeyAccount>(options: {
|
|
244
|
+
readonly client: TClient;
|
|
245
|
+
readonly account: TAccount;
|
|
246
|
+
readonly onSigned?: (submission: SubmissionEvidence) => void | Promise<void>;
|
|
247
|
+
readonly invocationAdapter?: undefined;
|
|
248
|
+
} & WalletNetworkOptions<TClient>): ExecutableWalletClient<TClient, TAccount>;
|
|
249
|
+
declare function createWalletClient<TClient extends CoreThruputClient, TAccount extends SourceAddressAccount>(options: {
|
|
250
|
+
readonly client: TClient;
|
|
251
|
+
readonly account: TAccount;
|
|
252
|
+
readonly onSigned?: (submission: SubmissionEvidence) => void | Promise<void>;
|
|
253
|
+
readonly invocationAdapter?: undefined;
|
|
254
|
+
} & WalletNetworkOptions<TClient>): WalletClient<TClient, TAccount>;
|
|
255
|
+
declare function createWalletClient<TClient extends CoreThruputClient, TAccount extends WalletAccount>(options: {
|
|
256
|
+
readonly client: TClient;
|
|
257
|
+
readonly account: TAccount;
|
|
258
|
+
readonly onSigned?: (submission: SubmissionEvidence) => void | Promise<void>;
|
|
259
|
+
readonly invocationAdapter?: undefined;
|
|
260
|
+
} & WalletNetworkOptions<TClient>): WalletClient<TClient, TAccount>;
|
|
261
|
+
//#endregion
|
|
262
|
+
export { WalletClient as a, WalletRequestAirdropOptions as c, ExecuteCallsRequest as d, PendingWalletTransaction as f, createProviderWalletClient as g, ProviderWalletClient as h, WalletAirdropActions as i, createWalletClient as l, ProviderExecutionOptions as m, PrepareExecutionRequest as n, WalletExecutionActions as o, PrepareBatchExecutionRequest as p, WalletActions as r, WalletNetworkOptions as s, ExecutableWalletClient as t, CreateProviderWalletClientOptions as u };
|
|
263
|
+
//# sourceMappingURL=index-dJ65V8se.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-dJ65V8se.d.ts","names":[],"sources":["../src/wallet/providerClient.ts","../src/wallet/client.ts"],"mappings":";;;;;;;;KA+DY,4BAAA,GAA+B,2BAAA,GACzC,IAAA,CAAK,uBAAA;;UAGU,wBAAA,SAAiC,qBAAqB;EAAA,SAC5D,OAAA,EAAS,eAAA;EAAA,SACT,WAAA;AAAA;;UAIM,wBAAA;EATa;EAW5B,QAAA,GAAW,OAAA,EAAS,wBAAA,YAAoC,OAAA;EARzC;EAUf,IAAA,GAAO,gCAAA;AAAA;;UAIQ,mBAAA,oBAAuC,YAAA;EACtD,KAAA,EAAO,CAAA;EACP,QAAA,EAAU,SAAA;EACV,iBAAA,GAAoB,uBAAA;EACpB,YAAA;AAAA;AAZF;AAAA,UAgBiB,iCAAA;;;;;;EAMf,MAAA,EAAQ,iBAAA;EApBR;EAsBA,QAAA,EAAU,cAAA;EAtBC;EAwBX,OAAA,EAAS,eAAA;EAtBT;EAwBA,WAAA;AAAA;AAxBuC;AAIzC;;;;;;;;AAJyC,UAoCxB,oBAAA;EAhCoB;EAkCnC,iBAAA,CACE,UAAA,EAAY,kBAAA,EACZ,OAAA,EAAS,iBAAA,GACR,OAAA,CAAQ,WAAA;EApCX;EAsCA,qBAAA,CACE,UAAA,EAAY,kBAAA,EACZ,OAAA,EAAS,iBAAA,EACT,QAAA,EAAU,wBAAA,GACT,OAAA,CACD,eAAA;IACE,OAAA,mCAA0C,eAAA;EAAA;EA1C9C;EA8CA,cAAA,CACE,OAAA,EAAS,uBAAA,EACT,OAAA,EAAS,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oBAAA,CAAqB,OAAA,IACxB,YAAA,CAAa,OAAA,EAAS,QAAA"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { t as Signer } from "./types-BE40oD_Q.js";
|
|
2
|
+
import { CryptographicScheme, MlDsa65PublicKey, MlDsa65Signature, PublicKey, Signature } from "@thruputchain/protocol";
|
|
3
|
+
|
|
4
|
+
//#region src/signers/ed25519.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Ed25519 signer backed by an in-memory private key.
|
|
7
|
+
*
|
|
8
|
+
* This is convenient for scripts and tests. Browser wallets or production key
|
|
9
|
+
* management systems should usually provide their own {@link Signer}
|
|
10
|
+
* implementation instead of exposing raw private keys to application code.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { Ed25519Signer } from "@thruputchain/client/signers";
|
|
15
|
+
*
|
|
16
|
+
* const signer = Ed25519Signer.fromSeed(seed); // 32 bytes
|
|
17
|
+
* const signature = await signer.sign(message);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
declare class Ed25519Signer implements Signer {
|
|
21
|
+
#private;
|
|
22
|
+
/** Ed25519 public key derived from the constructor's private key. */
|
|
23
|
+
publicKey: Extract<PublicKey, {
|
|
24
|
+
scheme: CryptographicScheme.Ed25519;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Create an Ed25519 signer from a 32-byte private key.
|
|
28
|
+
*
|
|
29
|
+
* Prefer {@link Ed25519Signer.fromSeed}, which validates the key length and
|
|
30
|
+
* matches `MlDsa65Signer.fromSeed`.
|
|
31
|
+
*/
|
|
32
|
+
constructor(secretKey: Uint8Array);
|
|
33
|
+
/** Create an Ed25519 signer from a 32-byte RFC 8032 private key seed. */
|
|
34
|
+
static fromSeed(seed: Uint8Array): Ed25519Signer;
|
|
35
|
+
/** Sign a message with the in-memory Ed25519 private key. */
|
|
36
|
+
sign(message: Uint8Array): Promise<Extract<Signature, {
|
|
37
|
+
scheme: CryptographicScheme.Ed25519;
|
|
38
|
+
}>>;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/signers/mlDsa65.d.ts
|
|
42
|
+
/**
|
|
43
|
+
* ML-DSA-65 (FIPS 204) signer backed by an in-memory key derived from a seed.
|
|
44
|
+
*
|
|
45
|
+
* Signatures are pure ML-DSA (not HashML-DSA) with an empty context string,
|
|
46
|
+
* over the same transaction signature preimage an Ed25519 signer signs. Keys
|
|
47
|
+
* are scheme-tagged `PublicKey` values; there is no StrKey form for them.
|
|
48
|
+
*
|
|
49
|
+
* Signing is hedged by default (fresh randomness mixed into each signature).
|
|
50
|
+
* Pass `{ deterministic: true }` for the FIPS 204 deterministic variant, which
|
|
51
|
+
* reproduces the same signature for the same key and message.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* import { MlDsa65Signer } from "@thruputchain/client/signers";
|
|
56
|
+
*
|
|
57
|
+
* const signer = MlDsa65Signer.fromSeed(seed); // 32 bytes
|
|
58
|
+
* const signature = await signer.sign(message);
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
declare class MlDsa65Signer implements Signer {
|
|
62
|
+
#private;
|
|
63
|
+
/** Scheme-tagged ML-DSA-65 public key derived from the seed. */
|
|
64
|
+
readonly publicKey: Extract<PublicKey, {
|
|
65
|
+
scheme: CryptographicScheme.MlDsa65;
|
|
66
|
+
}>;
|
|
67
|
+
private constructor();
|
|
68
|
+
/** Derive an ML-DSA-65 key pair from a 32-byte FIPS 204 `ξ` seed. */
|
|
69
|
+
static fromSeed(seed: Uint8Array, options?: {
|
|
70
|
+
readonly deterministic?: boolean;
|
|
71
|
+
}): MlDsa65Signer;
|
|
72
|
+
/** Sign a message with pure ML-DSA-65 and an empty context. */
|
|
73
|
+
sign(message: Uint8Array): Promise<Signature>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Verify a pure ML-DSA-65 signature with an empty context string.
|
|
77
|
+
*
|
|
78
|
+
* Returns `false` for a malformed or invalid signature rather than throwing.
|
|
79
|
+
*/
|
|
80
|
+
declare function verifyMlDsa65(publicKey: MlDsa65PublicKey, message: Uint8Array, signature: MlDsa65Signature): boolean;
|
|
81
|
+
//#endregion
|
|
82
|
+
export { verifyMlDsa65 as n, Ed25519Signer as r, MlDsa65Signer as t };
|
|
83
|
+
//# sourceMappingURL=index-fdTURpBk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-fdTURpBk.d.ts","names":[],"sources":["../src/signers/ed25519.ts","../src/signers/mlDsa65.ts"],"mappings":";;;;;AAgCA;;;;;;;;;;;;;;cAAa,aAAA,YAAyB,MAAA;EAAA;EAAM;EAE1C,SAAA,EAAW,OAAA,CAAQ,SAAA;IAAa,MAAA,EAAQ,mBAAA,CAAoB,OAAA;EAAA;EAAjD;;;;;;cASC,SAAA,EAAW,UAAA;EAAX;EAAA,OASL,QAAA,CAAS,IAAA,EAAM,UAAA,GAAa,aAAA;EAAb;EAQhB,IAAA,CACJ,OAAA,EAAS,UAAA,GACR,OAAA,CAAQ,OAAA,CAAQ,SAAA;IAAa,MAAA,EAAQ,mBAAA,CAAoB,OAAA;EAAA;AAAA;;;;AA9B9D;;;;;;;;;;;;;;;;;;cCIa,aAAA,YAAyB,MAAA;EAAA;EDFzB;EAAA,SCIF,SAAA,EAAW,OAAA,CAClB,SAAA;IACE,MAAA,EAAQ,mBAAA,CAAoB,OAAA;EAAA;EAAA,QAKzB,WAAA;;SAcA,QAAA,CACL,IAAA,EAAM,UAAA,EACN,OAAA;IAAA,SAAoB,aAAA;EAAA,IACnB,aAAA;EDVmB;ECuBhB,IAAA,CAAK,OAAA,EAAS,UAAA,GAAa,OAAA,CAAQ,SAAA;AAAA;;;;;;iBAkB3B,aAAA,CACd,SAAA,EAAW,gBAAA,EACX,OAAA,EAAS,UAAA,EACT,SAAA,EAAW,gBAAA"}
|