@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
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { $ as RpcPublicKey, A as RpcContractDeploymentResult, B as RpcEventPage, C as RpcChainConfig, Ct as RpcDecodingError, D as RpcConflictDiagnostic, Dt as Transport, E as RpcConflictCode, Et as RpcParams, F as RpcEffectiveContract, G as RpcIdentifiedEvent, H as RpcFailureCause, I as RpcEffectiveContractResult, J as RpcInvocationOutput, K as RpcInvocation, L as RpcEmittedEvent, M as RpcDecimalTimePoint, N as RpcDecimalU64, O as RpcContractArtifactResult, Ot as TransportRequestOptions, P as RpcDescendingAnchor, Q as RpcPendingTransactionCount, R as RpcErrorData, S as RpcBlockStart, St as RpcVersionInfo, T as RpcConfigLimits, Tt as UnsupportedRpcValue, U as RpcFundingSubmission, V as RpcExecutionConfig, W as RpcHistoryStart, X as RpcIterationOrder, Y as RpcInvocationResult, Z as RpcNetworkInfo, _ as RpcBase58_Ed25519PublicKey, _t as RpcTransactionReceipt, a as RpcMethod, at as RpcSchedulerError, b as RpcBase58_ValidatorID, bt as RpcTransactionStatus, c as RpcAdmission, ct as RpcServerLimits, d as RpcAscendingAnchor, dt as RpcSimulationResults, et as RpcReceiptExecution, f as RpcAssumedAuth, ft as RpcStorageCosts, g as RpcBase58_ContractAddress, gt as RpcTransactionInputResult, h as RpcBalanceResult, ht as RpcTopicFilter, i as RpcDiscovery, it as RpcResults, j as RpcContractRejectCode, k as RpcContractDeployment, l as RpcAirdropAttempt, lt as RpcSimulationBatchLimits, m as RpcAuthSigner, mt as RpcStorageResult, n as RpcClientOptions, nt as RpcRegisteredAuthResult, o as RpcMethods, ot as RpcSchedulerErrorSource, p as RpcAuthConfiguration, pt as RpcStorageItem, q as RpcInvocationContext, r as RpcCompatibilityError, rt as RpcRequests, s as createRpcClient, st as RpcSendTransactionResult, t as RpcClient, tt as RpcRecentAttemptFailure, u as RpcAirdropExecution, ut as RpcSimulationResult, v as RpcBase58_PublicKeyHash, vt as RpcTransactionRef, w as RpcChainTip, wt as RpcRequestValidationError, x as RpcBlockInfo, xt as RpcTxHash, y as RpcBase58_SHA256Hash, yt as RpcTransactionRefPage, z as RpcEventFilter } from "./client-JixxskeH.cjs";
|
|
2
|
+
import { $ as HistoryCompletion, $t as WaitForTransactionReceiptOptions, A as ThruputClient, An as RecentAttemptFailure, At as ContractSpecInterface, B as DEVNET_RPC_URL, Bn as TransactionReceipt, Bt as ContractUnionCaseType, C as MethodArgs, Cn as FundAccountRequest, Ct as ContractEnumDef, D as ClusterThruputClientOptions, Dn as IterationOrder, Dt as ContractMethodEffect, E as AirdropActions, En as IdentifiedEvent, Et as ContractField, F as iterateTransactionsByBlock, Fn as SimulationBatchLimits, Ft as ContractTypeDef, G as assertNetworkMatchesCluster, Gn as ViewBatchRequest, Gt as FundingObservationError, H as LOCALNET_RPC_URL, Hn as TransactionRefPage, Ht as ContractVectorType, I as iterateTransactionsByRootAddress, In as StorageCosts, It as ContractTypeDefKind, J as futurenet, Jn as ViewOutput, Jt as requestAirdropAttempt, K as defineCluster, Kn as ViewBatchResponse, Kt as RequestAirdropOptions, L as Cluster, Ln as StorageItemInfo, Lt as ContractTypeKind, M as createThruputClient, Mn as RootAddressTransactionQuery, Mt as ContractSpecString, N as BlockTransactionWalkQuery, Nn as SchedulerTransactionError, Nt as ContractStructDef, O as ConnectedThruputClient, On as NetworkConfigParams, Ot as ContractSpec, P as RootAddressWalkQuery, Pn as ServerLimits, Pt as ContractType, Q as iterateEventPages, Qt as TransactionReceiptTimeoutError, R as ClusterCapability, Rn as StorageItemRead, Rt as ContractUnionCase, S as ContractViewRequestOptions, Sn as ExecutionConfig, St as ContractArrayType, T as defineContractMethod, Tn as HistoryStart, Tt as ContractExceptionType, U as NetworkMismatchError, Un as TransactionStatus, Ut as formatSpecId, V as FUTURENET_RPC_URL, Vn as TransactionRef, Vt as ContractUnionDef, W as PredefinedClusterOptions, Wn as VersionInfo, Wt as specIdKey, X as mainnet, Xn as ViewResponse, Xt as ReceiptObserver, Y as localnet, Yn as ViewRequest, Yt as KnownCommitment, Z as EventWalkQuery, Zt as TransactionReceiptObservationError, _ as ContractViewError, _n as ContractRejectCode, _t as defineContractEvent, a as ContractCall, an as AirdropPending, at as ContractEvent, b as ContractViewOutcome, bn as EventPage, bt as ContractCodecContext, c as ContractExceptionMetadata, cn as AuthPublicKey, ct as ContractEventFilterInput, d as ContractMethodInputs, dn as BlockInfo, dt as ContractEventTopicMetadata, en as waitForCommitment, et as HistoryWalkError, f as ContractReceipt, fn as BlockTransactionQuery, ft as ContractReceiptEvent, g as ContractView, gn as ConflictDiagnostic, gt as createContractEventDecoder, h as ContractReceiptOutcome, hn as ConflictCode, ht as bytesEqual, i as ContractArgumentMetadata, in as AirdropExecutionStatus, it as getContractEvents, j as ThruputClientOptions, jn as RegisteredAuthResult, jt as ContractSpecMethod, k as CoreThruputClient, kn as NetworkInfo, kt as ContractSpecId, l as ContractMethod, ln as AuthSigner, lt as ContractEventFilterValue, m as ContractReceiptFailure, mn as ChainTip, mt as SpecDecodedEvent, n as ReadViewsResponse, nn as AddressAuthDataInfo, nt as ContractEventQuery, o as ContractCallOptions, on as AirdropResponse, ot as ContractEventDefinition, p as ContractReceiptError, pn as ChainConfig, pt as DecodedContractEvent, q as devnet, qn as ViewCall, qt as requestAirdrop, r as readViews, rn as AirdropAttemptRequest, rt as IdentifiedContractEvent, s as ContractException, sn as AirdropSucceeded, st as ContractEventFieldMetadata, t as ReadViewsRequest, tn as waitForTransactionReceipt, tt as ContractEventPage, u as ContractMethodDefinition, un as BalanceResponse, ut as ContractEventReceiptOptions, v as ContractViewFailure, vn as EmittedEvent, vt as topicRepresentation, w as UnknownContractException, wn as FundAccountResponse, wt as ContractEnumVariant, x as ContractViewRequest, xn as EventQuery, xt as createContractCodecContext, y as ContractViewOptions, yn as EventFilter, yt as ContractCodec, z as ClusterHasCapability, zn as TransactionFailureCause, zt as ContractUnionCaseKind } from "./readViews-DJyqc7im.cjs";
|
|
3
|
+
import { n as readContractArtifactSpec, t as ContractArtifactSpec } from "./artifact-BM_MVzhL.cjs";
|
|
4
|
+
import { a as WalletRequests, c as getEffectiveContractSpec, i as readTransactionInput, l as ContractSpecResult, n as sendTransaction, o as decodeDefaultWalletRequests, r as VerifiedTransactionInput, s as EffectiveContractSpecResult, t as sendInvocation, u as getContractSpec } from "./index-1-rFirYe.cjs";
|
|
5
|
+
import { t as Signer } from "./types-BE40oD_Q.cjs";
|
|
6
|
+
import { n as signTransaction, t as SignerEntry } from "./sign-eUT0iGQG.cjs";
|
|
7
|
+
import { A as prepareTransaction, C as devWalletAdapter, D as prepareContractDeployment, E as decodeDeployment, F as WalletAccount, I as createPubkeyAccount, L as createSourceAddressAccount, M as CreateSourceAddressAccountOptions, N as PubkeyAccount, O as rv32Contract, P as SourceAddressAccount, S as defineWalletInvocationAdapter, T as DeploymentOptions, _ as WalletBatchExecutionRequest, a as SubmissionEvidence, b as createDefaultWalletBatchInvocation, c as UnsupportedTransactionAdmissionError, d as assertTransactionSuccess, f as createSubmissionEvidence, g as walletGasLimit, h as waitForExecution, i as ExecutionReturnUnavailableError, j as CreatePubkeyAccountOptions, k as PrepareTransactionRequest, l as UnsupportedTransactionOutcomeError, m as submitAndObserve, n as ExecutionDecodeError, o as TransactionExecutionError, p as decodeExecution, r as ExecutionResult, s as TransactionObservationError, t as CallResults, u as assertTransactionAdmission, v as WalletExecutionRequest, w as ContractDeployment, x as defaultWalletAdapter, y as WalletInvocationAdapter } from "./execution-DYqPDn4O.cjs";
|
|
8
|
+
import { _ as SpecDecodedCall, a as BoundContractMethod, b as encodeCalldata, c as SignedToken, d as ContractDecodeError, f as ContractVerificationError, g as SpecDeclaredException, h as buildNamedCodecs, i as fixedBytes, l as isSignedToken, m as hashContract, n as FixedBytes, o as ContractInstance, p as deriveContractAddress, r as fixedArray, s as getContract, t as FixedArray, u as signedToken, v as createContractCallDecoder, x as resolveCodec, y as decodeCalldata } from "./index-CG2WRtGa.cjs";
|
|
9
|
+
import { n as spec, r as thruput_signed_op_if, t as SignedOp } from "./signed_op-DX5WuyEh.cjs";
|
|
10
|
+
import { a as serializeSignedTransaction, c as createTransaction, i as deserializeTransaction, n as transactionSignaturePreimage, o as serializeTransaction, r as deserializeSignedTransaction, s as createInvocation, t as pubkeySignatureEnvelopeBytes } from "./index-DzrLv3EA.cjs";
|
|
11
|
+
import { a as WalletClient, c as WalletRequestAirdropOptions, d as ExecuteCallsRequest, f as PendingWalletTransaction, g as createProviderWalletClient, h as ProviderWalletClient, i as WalletAirdropActions, l as createWalletClient, m as ProviderExecutionOptions, n as PrepareExecutionRequest, o as WalletExecutionActions, p as PrepareBatchExecutionRequest, r as WalletActions, s as WalletNetworkOptions, t as ExecutableWalletClient, u as CreateProviderWalletClientOptions } from "./index-CVrhB9Dr.cjs";
|
|
12
|
+
import { a as Operation, c as SignedOperationType, i as DefineSignedOperationOptions, l as defineSignedOperation, n as signedOperationPreimage, o as SignedOperation, r as ContractTypeSelector, s as SignedOperationRequest, t as SignedOperationPreimage, u as randomNonce } from "./index-B5KqSHeL.cjs";
|
|
13
|
+
import { a as TxInvalidDetail, c as classifyReadError, d as HttpRequestError, f as HttpResponseError, h as JsonRpcError, i as NativeRpcErrorCode, l as MockTransport, m as HttpTransportOptions, n as DecodedRpcError, o as txInvalidDetail, p as HttpTransport, r as NativeRpcError, s as ReadErrorKind, t as RpcResponseError, u as HttpBatchOptions } from "./index-BraLWObY.cjs";
|
|
14
|
+
import { n as verifyMlDsa65, r as Ed25519Signer, t as MlDsa65Signer } from "./index-ByNNqY7S.cjs";
|
|
15
|
+
import { BlockHeight, Calldata, ContractAddress, ContractAddress as ContractAddress$1, ContractEntrypointID, ContractEntrypointID as ContractEntrypointID$1, ExecResult, GasAmount, Invocation, InvokeFlag, InvokeFlagSet, NetworkHash, PubkeyAccountPreimage, PublicKey, PublicKeyHash, SHA256Hash, SHA256Hash as SHA256Hash$1, SignedTransaction, SignedTransaction as SignedTransaction$1, TimePoint, Transaction, blockHeight, calldata, contractAddress, contractEntrypointID, gasAmount, invokeFlagSet, networkHash, sha256Hash, timePoint } from "@thruputchain/protocol";
|
|
16
|
+
import { fromBase58, maxBase58Length, toBase58 } from "@thruputchain/protocol/utils";
|
|
17
|
+
|
|
18
|
+
//#region src/actions/hex.d.ts
|
|
19
|
+
/** Convert bytes to a `0x`-prefixed lowercase hex string. */
|
|
20
|
+
declare function toHex0x(bytes: Uint8Array): string;
|
|
21
|
+
/** Decode a `0x`-prefixed hex string into bytes. */
|
|
22
|
+
declare function fromHex0x(hex: string): Uint8Array;
|
|
23
|
+
/** Decode a `0x`-prefixed hex string into a protocol SHA-256 hash. */
|
|
24
|
+
declare function hashFromHex(hex: string): SHA256Hash$1;
|
|
25
|
+
/** Decode a `0x`-prefixed hex string into a contract address. */
|
|
26
|
+
declare function addressFromHex(hex: string): ContractAddress$1;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/derivation/pubkeyAccount.d.ts
|
|
29
|
+
/**
|
|
30
|
+
* Builds the preimage of a pubkey account's address from its key and nonce:
|
|
31
|
+
* `{ pubkey_hash: derivePublicKeyHash(pubkey), nonce }`.
|
|
32
|
+
*
|
|
33
|
+
* The preimage names the key by its scheme-inclusive hash for every scheme,
|
|
34
|
+
* Ed25519 included, so it is the same size whatever the key.
|
|
35
|
+
*/
|
|
36
|
+
declare function pubkeyAccountPreimage(pubkey: PublicKey, nonce?: bigint): PubkeyAccountPreimage;
|
|
37
|
+
/**
|
|
38
|
+
* Derives the on-chain address of a pubkey account from its preimage:
|
|
39
|
+
* `sha256( cxs(DomainSeparator("PubkeyAccount")) || cxs(preimage) )`.
|
|
40
|
+
*
|
|
41
|
+
* Mirrors `pubkey_account_address` in the Rust `thruput-domain-separator`
|
|
42
|
+
* crate; the two are pinned to each other by the golden vectors in
|
|
43
|
+
* `specs/test-vectors/domain-separator.json`.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import {
|
|
48
|
+
* derivePubkeyAccountAddress,
|
|
49
|
+
* pubkeyAccountPreimage,
|
|
50
|
+
* } from "@thruputchain/client";
|
|
51
|
+
*
|
|
52
|
+
* const address = derivePubkeyAccountAddress(
|
|
53
|
+
* pubkeyAccountPreimage(signer.publicKey, 0n),
|
|
54
|
+
* );
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare function derivePubkeyAccountAddress(preimage: PubkeyAccountPreimage): ContractAddress$1;
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/derivation/publicKeyHash.d.ts
|
|
60
|
+
/**
|
|
61
|
+
* Hashes a public key, scheme included:
|
|
62
|
+
* `sha256( cxs(DomainSeparator("PublicKey")) || cxs(pubkey) )`.
|
|
63
|
+
*
|
|
64
|
+
* A pubkey account names its key by this hash, so an Ed25519 key and an
|
|
65
|
+
* ML-DSA-65 key can never share an account even if their bytes overlap. The
|
|
66
|
+
* signed envelope carries the key itself as `pubkey_claim_key`, which the chain
|
|
67
|
+
* checks against this hash.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* import { derivePublicKeyHash } from "@thruputchain/client";
|
|
72
|
+
*
|
|
73
|
+
* const hash = derivePublicKeyHash(signer.publicKey);
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
declare function derivePublicKeyHash(pubkey: PublicKey): PublicKeyHash;
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/derivation/transactionHash.d.ts
|
|
79
|
+
/**
|
|
80
|
+
* The transaction's network-wide identifier: `sha256(txs(stx.tx))`.
|
|
81
|
+
*
|
|
82
|
+
* The hash covers the {@link https://github.com/thruputchain/thruput-protocol | protocol}
|
|
83
|
+
* `Transaction` only — deliberately not the signatures wrapped around it. That
|
|
84
|
+
* keeps the identifier stable under signature malleability, so a third party
|
|
85
|
+
* cannot change the identity of an in-flight transaction by re-encoding its
|
|
86
|
+
* signatures, and it matches what the chain uses to index transactions.
|
|
87
|
+
*
|
|
88
|
+
* Not to be confused with the signature preimage, which is a different message
|
|
89
|
+
* and does carry a domain separator and the network hash — see
|
|
90
|
+
* {@link transactionSignaturePreimage}. This is what you look a transaction up
|
|
91
|
+
* by; that is what you sign.
|
|
92
|
+
*/
|
|
93
|
+
declare function hashSignedTransaction(stx: SignedTransaction$1): SHA256Hash$1;
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/derivation/entrypointId.d.ts
|
|
96
|
+
/**
|
|
97
|
+
* The major-version domain a semver string belongs to.
|
|
98
|
+
*
|
|
99
|
+
* Mirrors the Rust SDK's `major_version_from_string`: a zero major or minor is
|
|
100
|
+
* not a stable domain on its own, so the domain widens until it is.
|
|
101
|
+
*
|
|
102
|
+
* - `1.2.3` → `1`
|
|
103
|
+
* - `0.9.2` → `0.9`
|
|
104
|
+
* - `0.0.2` → `0.0.2`
|
|
105
|
+
*
|
|
106
|
+
* @throws If `versionStr` has fewer than three dot-separated components.
|
|
107
|
+
*/
|
|
108
|
+
declare function majorVersionFromSemver(versionStr: string): string;
|
|
109
|
+
/**
|
|
110
|
+
* The 8-byte entrypoint ID for a contract method:
|
|
111
|
+
* `sha256(interface :: majorVersion :: method)[0..8]`.
|
|
112
|
+
*
|
|
113
|
+
* A null `interfaceName` uses the `_unnamed_interface` domain. The literal `::`
|
|
114
|
+
* separators are what keep field boundaries unambiguous — without them
|
|
115
|
+
* interface `Foo1` with major `2` and interface `Foo` with major `12` would
|
|
116
|
+
* hash identically. Fields are raw UTF-8, not XDR-encoded.
|
|
117
|
+
*
|
|
118
|
+
* Matches the Rust SDK's `contract_entrypoint_id`.
|
|
119
|
+
*/
|
|
120
|
+
declare function deriveEntrypointID(interfaceName: string | null, versionStr: string, methodName: string): ContractEntrypointID$1;
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/units.d.ts
|
|
123
|
+
/** Invalid decimal input to {@link parseUnits}. */
|
|
124
|
+
declare class ParseUnitsError extends Error {
|
|
125
|
+
readonly code: "malformed" | "precision";
|
|
126
|
+
constructor(code: "malformed" | "precision", decimals: number);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Convert a plain decimal string to raw units without rounding.
|
|
130
|
+
*
|
|
131
|
+
* Accepts a leading minus sign. Rejects whitespace, exponent notation, and
|
|
132
|
+
* excess fractional digits, including zeroes. Decimals must be 0–255.
|
|
133
|
+
* Token positivity and ABI bounds are separate validation steps.
|
|
134
|
+
*
|
|
135
|
+
* @example `parseUnits("12.05", 2)` returns `1205n`.
|
|
136
|
+
*/
|
|
137
|
+
declare function parseUnits(text: string, decimals: number): bigint;
|
|
138
|
+
/**
|
|
139
|
+
* Format raw units exactly, omitting redundant fractional zeroes.
|
|
140
|
+
*
|
|
141
|
+
* Decimals must be 0–255. Uses no floating-point conversion or display rounding.
|
|
142
|
+
* @example `formatUnits(-1205n, 2)` returns `"-12.05"`.
|
|
143
|
+
*/
|
|
144
|
+
declare function formatUnits(value: bigint, decimals: number): string;
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/encoding.d.ts
|
|
147
|
+
/** Decode exactly the expected number of bytes, with no format fallback. */
|
|
148
|
+
declare function fixedFromBase58(text: string, byteLength: number): Uint8Array;
|
|
149
|
+
/** Decode a canonical base58 Thruput address, without account derivation. */
|
|
150
|
+
declare function addressFromBase58(text: string): ContractAddress$1;
|
|
151
|
+
/** Decode a canonical base58 SHA-256 hash. */
|
|
152
|
+
declare function hashFromBase58(text: string): SHA256Hash$1;
|
|
153
|
+
/**
|
|
154
|
+
* Parse human address input: base58 or Thruput Z StrKey, without account derivation.
|
|
155
|
+
* Stellar C addresses are rejected. Z does not identify a specific Thruput network.
|
|
156
|
+
*/
|
|
157
|
+
declare function parseAddress(text: string): ContractAddress$1;
|
|
158
|
+
/** Parse human Ed25519 key input: base58 or G StrKey, never a wallet address. */
|
|
159
|
+
declare function parsePublicKey(text: string): Uint8Array;
|
|
160
|
+
/**
|
|
161
|
+
* Explicitly import a 32-byte Ed25519 seed from base58 or S StrKey.
|
|
162
|
+
* Callers must clear returned bytes after use. JavaScript input strings cannot
|
|
163
|
+
* be reliably erased; do not log or persist them in diagnostics.
|
|
164
|
+
*/
|
|
165
|
+
declare function parseSecretSeed(text: string): Uint8Array;
|
|
166
|
+
/** Render address bytes as a Thruput Z StrKey, without a specific network identity. */
|
|
167
|
+
declare function addressToStrkey(bytes: Uint8Array): string;
|
|
168
|
+
/** Render an Ed25519 public key as a G StrKey, without deriving an address. */
|
|
169
|
+
declare function publicKeyToStrkey(bytes: Uint8Array): string;
|
|
170
|
+
/** Explicitly export a seed as an S StrKey. Treat the returned string as secret. */
|
|
171
|
+
declare function secretSeedToStrkey(bytes: Uint8Array): string;
|
|
172
|
+
//#endregion
|
|
173
|
+
export { type AddressAuthDataInfo, type AirdropActions, type AirdropAttemptRequest, type AirdropExecutionStatus, type AirdropPending, type AirdropResponse, type AirdropSucceeded, type AuthPublicKey, type AuthSigner, type BalanceResponse, type BlockHeight, type BlockInfo, type BlockTransactionQuery, type BlockTransactionWalkQuery, type BoundContractMethod, CallResults, type Calldata, type ChainConfig, type ChainTip, type Cluster, type ClusterCapability, type ClusterHasCapability, type ClusterThruputClientOptions, type ConflictCode, type ConflictDiagnostic, type ConnectedThruputClient, type ContractAddress, type ContractArgumentMetadata, type ContractArrayType, type ContractArtifactSpec, type ContractCall, type ContractCallOptions, type ContractCodec, type ContractCodecContext, ContractDecodeError, type ContractDeployment, type ContractEntrypointID, type ContractEnumDef, type ContractEnumVariant, type ContractEvent, type ContractEventDefinition, type ContractEventFieldMetadata, type ContractEventFilterInput, type ContractEventFilterValue, type ContractEventPage, type ContractEventQuery, type ContractEventReceiptOptions, type ContractEventTopicMetadata, type ContractException, type ContractExceptionMetadata, type ContractExceptionType, type ContractField, type ContractInstance, type ContractMethod, type ContractMethodDefinition, ContractMethodEffect, type ContractMethodInputs, type ContractReceipt, ContractReceiptError, type ContractReceiptEvent, type ContractReceiptFailure, type ContractReceiptOutcome, type ContractRejectCode, type ContractSpec, type ContractSpecId, type ContractSpecInterface, type ContractSpecMethod, type ContractSpecResult, type ContractSpecString, type ContractStructDef, type ContractType, type ContractTypeDef, ContractTypeDefKind, ContractTypeKind, type ContractTypeSelector, type ContractUnionCase, ContractUnionCaseKind, type ContractUnionCaseType, type ContractUnionDef, type ContractVectorType, ContractVerificationError, type ContractView, ContractViewError, type ContractViewFailure, type ContractViewOptions, type ContractViewOutcome, type ContractViewRequest, type ContractViewRequestOptions, type CoreThruputClient, type CreateProviderWalletClientOptions, type CreatePubkeyAccountOptions, type CreateSourceAddressAccountOptions, DEVNET_RPC_URL, type DecodedContractEvent, type DecodedRpcError, type DefineSignedOperationOptions, type DeploymentOptions, Ed25519Signer, type EffectiveContractSpecResult, type EmittedEvent, type EventFilter, type EventPage, type EventQuery, type EventWalkQuery, ExecResult, type ExecutableWalletClient, type ExecuteCallsRequest, type ExecutionConfig, ExecutionDecodeError, ExecutionResult, ExecutionReturnUnavailableError, FUTURENET_RPC_URL, type FixedArray, type FixedBytes, type FundAccountRequest, type FundAccountResponse, FundingObservationError, type GasAmount, type HistoryCompletion, type HistoryStart, HistoryWalkError, type HttpBatchOptions, HttpRequestError, HttpResponseError, HttpTransport, type HttpTransportOptions, type IdentifiedContractEvent, type IdentifiedEvent, type Invocation, InvokeFlag, type InvokeFlagSet, type IterationOrder, JsonRpcError, type KnownCommitment, LOCALNET_RPC_URL, type MethodArgs, MlDsa65Signer, MockTransport, NativeRpcError, NativeRpcErrorCode, type NetworkConfigParams, type NetworkHash, type NetworkInfo, NetworkMismatchError, type Operation, ParseUnitsError, type PendingWalletTransaction, type PredefinedClusterOptions, type PrepareBatchExecutionRequest, type PrepareExecutionRequest, type PrepareTransactionRequest, type ProviderExecutionOptions, type ProviderWalletClient, type PubkeyAccount, type ReadErrorKind, type ReadViewsRequest, type ReadViewsResponse, type ReceiptObserver, type RecentAttemptFailure, type RegisteredAuthResult, type RequestAirdropOptions, type RootAddressTransactionQuery, type RootAddressWalkQuery, type RpcAdmission, type RpcAirdropAttempt, type RpcAirdropExecution, type RpcAscendingAnchor, type RpcAssumedAuth, type RpcAuthConfiguration, type RpcAuthSigner, type RpcBalanceResult, type RpcBase58_ContractAddress, type RpcBase58_Ed25519PublicKey, type RpcBase58_PublicKeyHash, type RpcBase58_SHA256Hash, type RpcBase58_ValidatorID, type RpcBlockInfo, type RpcBlockStart, type RpcChainConfig, type RpcChainTip, type RpcClient, type RpcClientOptions, RpcCompatibilityError, type RpcConfigLimits, type RpcConflictCode, type RpcConflictDiagnostic, type RpcContractArtifactResult, type RpcContractDeployment, type RpcContractDeploymentResult, type RpcContractRejectCode, type RpcDecimalTimePoint, type RpcDecimalU64, RpcDecodingError, type RpcDescendingAnchor, type RpcDiscovery, type RpcEffectiveContract, type RpcEffectiveContractResult, type RpcEmittedEvent, type RpcErrorData, type RpcEventFilter, type RpcEventPage, type RpcExecutionConfig, type RpcFailureCause, type RpcFundingSubmission, type RpcHistoryStart, type RpcIdentifiedEvent, type RpcInvocation, type RpcInvocationContext, type RpcInvocationOutput, type RpcInvocationResult, type RpcIterationOrder, type RpcMethod, type RpcMethods, type RpcNetworkInfo, type RpcParams, type RpcPendingTransactionCount, type RpcPublicKey, type RpcReceiptExecution, type RpcRecentAttemptFailure, type RpcRegisteredAuthResult, RpcRequestValidationError, type RpcRequests, RpcResponseError, type RpcResults, type RpcSchedulerError, type RpcSchedulerErrorSource, type RpcSendTransactionResult, type RpcServerLimits, type RpcSimulationBatchLimits, type RpcSimulationResult, type RpcSimulationResults, type RpcStorageCosts, type RpcStorageItem, type RpcStorageResult, type RpcTopicFilter, type RpcTransactionInputResult, type RpcTransactionReceipt, type RpcTransactionRef, type RpcTransactionRefPage, type RpcTransactionStatus, type RpcTxHash, type RpcVersionInfo, type SHA256Hash, type SchedulerTransactionError, type ServerLimits, SignedOp, spec as SignedOpSpec, type SignedOperation, type SignedOperationPreimage, type SignedOperationRequest, type SignedOperationType, type SignedToken, type SignedTransaction, type Signer, type SignerEntry, type SimulationBatchLimits, type SourceAddressAccount, type SpecDeclaredException, type SpecDecodedCall, type SpecDecodedEvent, type StorageCosts, type StorageItemInfo, type StorageItemRead, SubmissionEvidence, type ThruputClient, type ThruputClientOptions, type TimePoint, type Transaction, TransactionExecutionError, type TransactionFailureCause, TransactionObservationError, type TransactionReceipt, TransactionReceiptObservationError, TransactionReceiptTimeoutError, type TransactionRef, type TransactionRefPage, type TransactionStatus, type Transport, type TransportRequestOptions, type TxInvalidDetail, type UnknownContractException, UnsupportedRpcValue, UnsupportedTransactionAdmissionError, UnsupportedTransactionOutcomeError, type VerifiedTransactionInput, type VersionInfo, type ViewBatchRequest, type ViewBatchResponse, type ViewCall, type ViewOutput, type ViewRequest, type ViewResponse, type WaitForTransactionReceiptOptions, type WalletAccount, type WalletActions, type WalletAirdropActions, type WalletBatchExecutionRequest, type WalletClient, type WalletExecutionActions, type WalletExecutionRequest, type WalletInvocationAdapter, type WalletNetworkOptions, type WalletRequestAirdropOptions, type WalletRequests, addressFromBase58, addressFromHex, addressToStrkey, assertNetworkMatchesCluster, assertTransactionAdmission, assertTransactionSuccess, blockHeight, buildNamedCodecs, bytesEqual, calldata, classifyReadError, contractAddress, contractEntrypointID, createContractCallDecoder, createContractCodecContext, createContractEventDecoder, createDefaultWalletBatchInvocation, createInvocation, createProviderWalletClient, createPubkeyAccount, createRpcClient, createSourceAddressAccount, createSubmissionEvidence, createThruputClient, createTransaction, createWalletClient, decodeCalldata, decodeDefaultWalletRequests, decodeDeployment, decodeExecution, defaultWalletAdapter, defineCluster, defineContractEvent, defineContractMethod, defineSignedOperation, defineWalletInvocationAdapter, deriveContractAddress, deriveEntrypointID, derivePubkeyAccountAddress, derivePublicKeyHash, deserializeSignedTransaction, deserializeTransaction, devWalletAdapter, devnet, encodeCalldata, fixedArray, fixedBytes, fixedFromBase58, formatSpecId, formatUnits, fromBase58, fromHex0x, futurenet, gasAmount, getContract, getContractEvents, getContractSpec, getEffectiveContractSpec, hashContract, hashFromBase58, hashFromHex, hashSignedTransaction, invokeFlagSet, isSignedToken, iterateEventPages, iterateTransactionsByBlock, iterateTransactionsByRootAddress, localnet, mainnet, majorVersionFromSemver, maxBase58Length, networkHash, parseAddress, parsePublicKey, parseSecretSeed, parseUnits, prepareContractDeployment, prepareTransaction, pubkeyAccountPreimage, pubkeySignatureEnvelopeBytes, publicKeyToStrkey, randomNonce, readContractArtifactSpec, readTransactionInput, readViews, requestAirdrop, requestAirdropAttempt, resolveCodec, rv32Contract, secretSeedToStrkey, sendInvocation, sendTransaction, serializeSignedTransaction, serializeTransaction, sha256Hash, signTransaction, signedOperationPreimage, signedToken, specIdKey, submitAndObserve, thruput_signed_op_if, timePoint, toBase58, toHex0x, topicRepresentation, transactionSignaturePreimage, txInvalidDetail, verifyMlDsa65, waitForCommitment, waitForExecution, waitForTransactionReceipt, walletGasLimit };
|
|
174
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/actions/hex.ts","../src/derivation/pubkeyAccount.ts","../src/derivation/publicKeyHash.ts","../src/derivation/transactionHash.ts","../src/derivation/entrypointId.ts","../src/units.ts","../src/encoding.ts"],"mappings":";;;;;;;;;;;;;;;;;;;iBAWgB,OAAA,CAAQ,KAAiB,EAAV,UAAU;;iBAKzB,SAAA,CAAU,GAAA,WAAc,UAAU;;iBAOlC,WAAA,CAAY,GAAA,WAAc,YAAU;;iBAKpC,cAAA,CAAe,GAAA,WAAc,iBAAe;;;;;;;;;;iBCZ5C,qBAAA,CACd,MAAA,EAAQ,SAAA,EACR,KAAA,YACC,qBAAqB;;;;;;;;;;ADRxB;;;;AAAyC;AAKzC;;;;AAAkD;AAOlD;iBCoBgB,0BAAA,CACd,QAAA,EAAU,qBAAA,GACT,iBAAe;;;;;;;;;;;;;;;;;;;iBCzBF,mBAAA,CAAoB,MAAA,EAAQ,SAAA,GAAY,aAAa;;;;;;;;;;;;;;;;;iBCFrD,qBAAA,CAAsB,GAAA,EAAK,mBAAA,GAAoB,YAAU;;;;;;;;;;;;;;;iBCFzD,sBAAA,CAAuB,UAAkB;;;;;AJLzD;;;;AAAyC;AAKzC;;iBI6BgB,kBAAA,CACd,aAAA,iBACA,UAAA,UACA,UAAA,WACC,sBAAoB;;;;cChDV,eAAA,SAAwB,KAAK;EAAA,SAE7B,IAAA;cAAA,IAAA,6BACT,QAAA;AAAA;;;;;;;;;;iBAoBY,UAAA,CAAW,IAAA,UAAc,QAAgB;;;;ALbzD;;;iBKoCgB,WAAA,CAAY,KAAA,UAAe,QAAgB;;;;iBCjC3C,eAAA,CAAgB,IAAA,UAAc,UAAA,WAAqB,UAAU;;iBAU7D,iBAAA,CAAkB,IAAA,WAAe,iBAAe;;iBAKhD,cAAA,CAAe,IAAA,WAAe,YAAU;;;;;iBAqExC,YAAA,CAAa,IAAA,WAAe,iBAAe;;iBAK3C,cAAA,CAAe,IAAA,WAAe,UAAU;;;;AN5FxD;;iBMqGgB,eAAA,CAAgB,IAAA,WAAe,UAAU;;iBAKzC,eAAA,CAAgB,KAAiB,EAAV,UAAU;ANrGjD;AAAA,iBM0GgB,iBAAA,CAAkB,KAAiB,EAAV,UAAU;;iBAKnC,kBAAA,CAAmB,KAAiB,EAAV,UAAU"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { $ as RpcPublicKey, A as RpcContractDeploymentResult, B as RpcEventPage, C as RpcChainConfig, Ct as RpcDecodingError, D as RpcConflictDiagnostic, Dt as Transport, E as RpcConflictCode, Et as RpcParams, F as RpcEffectiveContract, G as RpcIdentifiedEvent, H as RpcFailureCause, I as RpcEffectiveContractResult, J as RpcInvocationOutput, K as RpcInvocation, L as RpcEmittedEvent, M as RpcDecimalTimePoint, N as RpcDecimalU64, O as RpcContractArtifactResult, Ot as TransportRequestOptions, P as RpcDescendingAnchor, Q as RpcPendingTransactionCount, R as RpcErrorData, S as RpcBlockStart, St as RpcVersionInfo, T as RpcConfigLimits, Tt as UnsupportedRpcValue, U as RpcFundingSubmission, V as RpcExecutionConfig, W as RpcHistoryStart, X as RpcIterationOrder, Y as RpcInvocationResult, Z as RpcNetworkInfo, _ as RpcBase58_Ed25519PublicKey, _t as RpcTransactionReceipt, a as RpcMethod, at as RpcSchedulerError, b as RpcBase58_ValidatorID, bt as RpcTransactionStatus, c as RpcAdmission, ct as RpcServerLimits, d as RpcAscendingAnchor, dt as RpcSimulationResults, et as RpcReceiptExecution, f as RpcAssumedAuth, ft as RpcStorageCosts, g as RpcBase58_ContractAddress, gt as RpcTransactionInputResult, h as RpcBalanceResult, ht as RpcTopicFilter, i as RpcDiscovery, it as RpcResults, j as RpcContractRejectCode, k as RpcContractDeployment, l as RpcAirdropAttempt, lt as RpcSimulationBatchLimits, m as RpcAuthSigner, mt as RpcStorageResult, n as RpcClientOptions, nt as RpcRegisteredAuthResult, o as RpcMethods, ot as RpcSchedulerErrorSource, p as RpcAuthConfiguration, pt as RpcStorageItem, q as RpcInvocationContext, r as RpcCompatibilityError, rt as RpcRequests, s as createRpcClient, st as RpcSendTransactionResult, t as RpcClient, tt as RpcRecentAttemptFailure, u as RpcAirdropExecution, ut as RpcSimulationResult, v as RpcBase58_PublicKeyHash, vt as RpcTransactionRef, w as RpcChainTip, wt as RpcRequestValidationError, x as RpcBlockInfo, xt as RpcTxHash, y as RpcBase58_SHA256Hash, yt as RpcTransactionRefPage, z as RpcEventFilter } from "./client-JixxskeH.js";
|
|
2
|
+
import { $ as HistoryCompletion, $t as WaitForTransactionReceiptOptions, A as ThruputClient, An as RecentAttemptFailure, At as ContractSpecInterface, B as DEVNET_RPC_URL, Bn as TransactionReceipt, Bt as ContractUnionCaseType, C as MethodArgs, Cn as FundAccountRequest, Ct as ContractEnumDef, D as ClusterThruputClientOptions, Dn as IterationOrder, Dt as ContractMethodEffect, E as AirdropActions, En as IdentifiedEvent, Et as ContractField, F as iterateTransactionsByBlock, Fn as SimulationBatchLimits, Ft as ContractTypeDef, G as assertNetworkMatchesCluster, Gn as ViewBatchRequest, Gt as FundingObservationError, H as LOCALNET_RPC_URL, Hn as TransactionRefPage, Ht as ContractVectorType, I as iterateTransactionsByRootAddress, In as StorageCosts, It as ContractTypeDefKind, J as futurenet, Jn as ViewOutput, Jt as requestAirdropAttempt, K as defineCluster, Kn as ViewBatchResponse, Kt as RequestAirdropOptions, L as Cluster, Ln as StorageItemInfo, Lt as ContractTypeKind, M as createThruputClient, Mn as RootAddressTransactionQuery, Mt as ContractSpecString, N as BlockTransactionWalkQuery, Nn as SchedulerTransactionError, Nt as ContractStructDef, O as ConnectedThruputClient, On as NetworkConfigParams, Ot as ContractSpec, P as RootAddressWalkQuery, Pn as ServerLimits, Pt as ContractType, Q as iterateEventPages, Qt as TransactionReceiptTimeoutError, R as ClusterCapability, Rn as StorageItemRead, Rt as ContractUnionCase, S as ContractViewRequestOptions, Sn as ExecutionConfig, St as ContractArrayType, T as defineContractMethod, Tn as HistoryStart, Tt as ContractExceptionType, U as NetworkMismatchError, Un as TransactionStatus, Ut as formatSpecId, V as FUTURENET_RPC_URL, Vn as TransactionRef, Vt as ContractUnionDef, W as PredefinedClusterOptions, Wn as VersionInfo, Wt as specIdKey, X as mainnet, Xn as ViewResponse, Xt as ReceiptObserver, Y as localnet, Yn as ViewRequest, Yt as KnownCommitment, Z as EventWalkQuery, Zt as TransactionReceiptObservationError, _ as ContractViewError, _n as ContractRejectCode, _t as defineContractEvent, a as ContractCall, an as AirdropPending, at as ContractEvent, b as ContractViewOutcome, bn as EventPage, bt as ContractCodecContext, c as ContractExceptionMetadata, cn as AuthPublicKey, ct as ContractEventFilterInput, d as ContractMethodInputs, dn as BlockInfo, dt as ContractEventTopicMetadata, en as waitForCommitment, et as HistoryWalkError, f as ContractReceipt, fn as BlockTransactionQuery, ft as ContractReceiptEvent, g as ContractView, gn as ConflictDiagnostic, gt as createContractEventDecoder, h as ContractReceiptOutcome, hn as ConflictCode, ht as bytesEqual, i as ContractArgumentMetadata, in as AirdropExecutionStatus, it as getContractEvents, j as ThruputClientOptions, jn as RegisteredAuthResult, jt as ContractSpecMethod, k as CoreThruputClient, kn as NetworkInfo, kt as ContractSpecId, l as ContractMethod, ln as AuthSigner, lt as ContractEventFilterValue, m as ContractReceiptFailure, mn as ChainTip, mt as SpecDecodedEvent, n as ReadViewsResponse, nn as AddressAuthDataInfo, nt as ContractEventQuery, o as ContractCallOptions, on as AirdropResponse, ot as ContractEventDefinition, p as ContractReceiptError, pn as ChainConfig, pt as DecodedContractEvent, q as devnet, qn as ViewCall, qt as requestAirdrop, r as readViews, rn as AirdropAttemptRequest, rt as IdentifiedContractEvent, s as ContractException, sn as AirdropSucceeded, st as ContractEventFieldMetadata, t as ReadViewsRequest, tn as waitForTransactionReceipt, tt as ContractEventPage, u as ContractMethodDefinition, un as BalanceResponse, ut as ContractEventReceiptOptions, v as ContractViewFailure, vn as EmittedEvent, vt as topicRepresentation, w as UnknownContractException, wn as FundAccountResponse, wt as ContractEnumVariant, x as ContractViewRequest, xn as EventQuery, xt as createContractCodecContext, y as ContractViewOptions, yn as EventFilter, yt as ContractCodec, z as ClusterHasCapability, zn as TransactionFailureCause, zt as ContractUnionCaseKind } from "./readViews-DQoaUORa.js";
|
|
3
|
+
import { n as readContractArtifactSpec, t as ContractArtifactSpec } from "./artifact-BM_MVzhL.js";
|
|
4
|
+
import { a as WalletRequests, c as getEffectiveContractSpec, i as readTransactionInput, l as ContractSpecResult, n as sendTransaction, o as decodeDefaultWalletRequests, r as VerifiedTransactionInput, s as EffectiveContractSpecResult, t as sendInvocation, u as getContractSpec } from "./index-SV-inhhO.js";
|
|
5
|
+
import { t as Signer } from "./types-BE40oD_Q.js";
|
|
6
|
+
import { n as signTransaction, t as SignerEntry } from "./sign-Ve0eetRO.js";
|
|
7
|
+
import { A as prepareTransaction, C as devWalletAdapter, D as prepareContractDeployment, E as decodeDeployment, F as WalletAccount, I as createPubkeyAccount, L as createSourceAddressAccount, M as CreateSourceAddressAccountOptions, N as PubkeyAccount, O as rv32Contract, P as SourceAddressAccount, S as defineWalletInvocationAdapter, T as DeploymentOptions, _ as WalletBatchExecutionRequest, a as SubmissionEvidence, b as createDefaultWalletBatchInvocation, c as UnsupportedTransactionAdmissionError, d as assertTransactionSuccess, f as createSubmissionEvidence, g as walletGasLimit, h as waitForExecution, i as ExecutionReturnUnavailableError, j as CreatePubkeyAccountOptions, k as PrepareTransactionRequest, l as UnsupportedTransactionOutcomeError, m as submitAndObserve, n as ExecutionDecodeError, o as TransactionExecutionError, p as decodeExecution, r as ExecutionResult, s as TransactionObservationError, t as CallResults, u as assertTransactionAdmission, v as WalletExecutionRequest, w as ContractDeployment, x as defaultWalletAdapter, y as WalletInvocationAdapter } from "./execution-Dj6E4B_b.js";
|
|
8
|
+
import { _ as SpecDecodedCall, a as BoundContractMethod, b as encodeCalldata, c as SignedToken, d as ContractDecodeError, f as ContractVerificationError, g as SpecDeclaredException, h as buildNamedCodecs, i as fixedBytes, l as isSignedToken, m as hashContract, n as FixedBytes, o as ContractInstance, p as deriveContractAddress, r as fixedArray, s as getContract, t as FixedArray, u as signedToken, v as createContractCallDecoder, x as resolveCodec, y as decodeCalldata } from "./index-D89ur7mO.js";
|
|
9
|
+
import { n as spec, r as thruput_signed_op_if, t as SignedOp } from "./signed_op-C4lY_TCc.js";
|
|
10
|
+
import { a as serializeSignedTransaction, c as createTransaction, i as deserializeTransaction, n as transactionSignaturePreimage, o as serializeTransaction, r as deserializeSignedTransaction, s as createInvocation, t as pubkeySignatureEnvelopeBytes } from "./index-DzrLv3EA.js";
|
|
11
|
+
import { a as WalletClient, c as WalletRequestAirdropOptions, d as ExecuteCallsRequest, f as PendingWalletTransaction, g as createProviderWalletClient, h as ProviderWalletClient, i as WalletAirdropActions, l as createWalletClient, m as ProviderExecutionOptions, n as PrepareExecutionRequest, o as WalletExecutionActions, p as PrepareBatchExecutionRequest, r as WalletActions, s as WalletNetworkOptions, t as ExecutableWalletClient, u as CreateProviderWalletClientOptions } from "./index-dJ65V8se.js";
|
|
12
|
+
import { a as Operation, c as SignedOperationType, i as DefineSignedOperationOptions, l as defineSignedOperation, n as signedOperationPreimage, o as SignedOperation, r as ContractTypeSelector, s as SignedOperationRequest, t as SignedOperationPreimage, u as randomNonce } from "./index--5LsCotr.js";
|
|
13
|
+
import { a as TxInvalidDetail, c as classifyReadError, d as HttpRequestError, f as HttpResponseError, h as JsonRpcError, i as NativeRpcErrorCode, l as MockTransport, m as HttpTransportOptions, n as DecodedRpcError, o as txInvalidDetail, p as HttpTransport, r as NativeRpcError, s as ReadErrorKind, t as RpcResponseError, u as HttpBatchOptions } from "./index-ByvV2UF6.js";
|
|
14
|
+
import { n as verifyMlDsa65, r as Ed25519Signer, t as MlDsa65Signer } from "./index-fdTURpBk.js";
|
|
15
|
+
import { BlockHeight, Calldata, ContractAddress, ContractAddress as ContractAddress$1, ContractEntrypointID, ContractEntrypointID as ContractEntrypointID$1, ExecResult, GasAmount, Invocation, InvokeFlag, InvokeFlagSet, NetworkHash, PubkeyAccountPreimage, PublicKey, PublicKeyHash, SHA256Hash, SHA256Hash as SHA256Hash$1, SignedTransaction, SignedTransaction as SignedTransaction$1, TimePoint, Transaction, blockHeight, calldata, contractAddress, contractEntrypointID, gasAmount, invokeFlagSet, networkHash, sha256Hash, timePoint } from "@thruputchain/protocol";
|
|
16
|
+
import { fromBase58, maxBase58Length, toBase58 } from "@thruputchain/protocol/utils";
|
|
17
|
+
|
|
18
|
+
//#region src/actions/hex.d.ts
|
|
19
|
+
/** Convert bytes to a `0x`-prefixed lowercase hex string. */
|
|
20
|
+
declare function toHex0x(bytes: Uint8Array): string;
|
|
21
|
+
/** Decode a `0x`-prefixed hex string into bytes. */
|
|
22
|
+
declare function fromHex0x(hex: string): Uint8Array;
|
|
23
|
+
/** Decode a `0x`-prefixed hex string into a protocol SHA-256 hash. */
|
|
24
|
+
declare function hashFromHex(hex: string): SHA256Hash$1;
|
|
25
|
+
/** Decode a `0x`-prefixed hex string into a contract address. */
|
|
26
|
+
declare function addressFromHex(hex: string): ContractAddress$1;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/derivation/pubkeyAccount.d.ts
|
|
29
|
+
/**
|
|
30
|
+
* Builds the preimage of a pubkey account's address from its key and nonce:
|
|
31
|
+
* `{ pubkey_hash: derivePublicKeyHash(pubkey), nonce }`.
|
|
32
|
+
*
|
|
33
|
+
* The preimage names the key by its scheme-inclusive hash for every scheme,
|
|
34
|
+
* Ed25519 included, so it is the same size whatever the key.
|
|
35
|
+
*/
|
|
36
|
+
declare function pubkeyAccountPreimage(pubkey: PublicKey, nonce?: bigint): PubkeyAccountPreimage;
|
|
37
|
+
/**
|
|
38
|
+
* Derives the on-chain address of a pubkey account from its preimage:
|
|
39
|
+
* `sha256( cxs(DomainSeparator("PubkeyAccount")) || cxs(preimage) )`.
|
|
40
|
+
*
|
|
41
|
+
* Mirrors `pubkey_account_address` in the Rust `thruput-domain-separator`
|
|
42
|
+
* crate; the two are pinned to each other by the golden vectors in
|
|
43
|
+
* `specs/test-vectors/domain-separator.json`.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import {
|
|
48
|
+
* derivePubkeyAccountAddress,
|
|
49
|
+
* pubkeyAccountPreimage,
|
|
50
|
+
* } from "@thruputchain/client";
|
|
51
|
+
*
|
|
52
|
+
* const address = derivePubkeyAccountAddress(
|
|
53
|
+
* pubkeyAccountPreimage(signer.publicKey, 0n),
|
|
54
|
+
* );
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare function derivePubkeyAccountAddress(preimage: PubkeyAccountPreimage): ContractAddress$1;
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/derivation/publicKeyHash.d.ts
|
|
60
|
+
/**
|
|
61
|
+
* Hashes a public key, scheme included:
|
|
62
|
+
* `sha256( cxs(DomainSeparator("PublicKey")) || cxs(pubkey) )`.
|
|
63
|
+
*
|
|
64
|
+
* A pubkey account names its key by this hash, so an Ed25519 key and an
|
|
65
|
+
* ML-DSA-65 key can never share an account even if their bytes overlap. The
|
|
66
|
+
* signed envelope carries the key itself as `pubkey_claim_key`, which the chain
|
|
67
|
+
* checks against this hash.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* import { derivePublicKeyHash } from "@thruputchain/client";
|
|
72
|
+
*
|
|
73
|
+
* const hash = derivePublicKeyHash(signer.publicKey);
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
declare function derivePublicKeyHash(pubkey: PublicKey): PublicKeyHash;
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/derivation/transactionHash.d.ts
|
|
79
|
+
/**
|
|
80
|
+
* The transaction's network-wide identifier: `sha256(txs(stx.tx))`.
|
|
81
|
+
*
|
|
82
|
+
* The hash covers the {@link https://github.com/thruputchain/thruput-protocol | protocol}
|
|
83
|
+
* `Transaction` only — deliberately not the signatures wrapped around it. That
|
|
84
|
+
* keeps the identifier stable under signature malleability, so a third party
|
|
85
|
+
* cannot change the identity of an in-flight transaction by re-encoding its
|
|
86
|
+
* signatures, and it matches what the chain uses to index transactions.
|
|
87
|
+
*
|
|
88
|
+
* Not to be confused with the signature preimage, which is a different message
|
|
89
|
+
* and does carry a domain separator and the network hash — see
|
|
90
|
+
* {@link transactionSignaturePreimage}. This is what you look a transaction up
|
|
91
|
+
* by; that is what you sign.
|
|
92
|
+
*/
|
|
93
|
+
declare function hashSignedTransaction(stx: SignedTransaction$1): SHA256Hash$1;
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/derivation/entrypointId.d.ts
|
|
96
|
+
/**
|
|
97
|
+
* The major-version domain a semver string belongs to.
|
|
98
|
+
*
|
|
99
|
+
* Mirrors the Rust SDK's `major_version_from_string`: a zero major or minor is
|
|
100
|
+
* not a stable domain on its own, so the domain widens until it is.
|
|
101
|
+
*
|
|
102
|
+
* - `1.2.3` → `1`
|
|
103
|
+
* - `0.9.2` → `0.9`
|
|
104
|
+
* - `0.0.2` → `0.0.2`
|
|
105
|
+
*
|
|
106
|
+
* @throws If `versionStr` has fewer than three dot-separated components.
|
|
107
|
+
*/
|
|
108
|
+
declare function majorVersionFromSemver(versionStr: string): string;
|
|
109
|
+
/**
|
|
110
|
+
* The 8-byte entrypoint ID for a contract method:
|
|
111
|
+
* `sha256(interface :: majorVersion :: method)[0..8]`.
|
|
112
|
+
*
|
|
113
|
+
* A null `interfaceName` uses the `_unnamed_interface` domain. The literal `::`
|
|
114
|
+
* separators are what keep field boundaries unambiguous — without them
|
|
115
|
+
* interface `Foo1` with major `2` and interface `Foo` with major `12` would
|
|
116
|
+
* hash identically. Fields are raw UTF-8, not XDR-encoded.
|
|
117
|
+
*
|
|
118
|
+
* Matches the Rust SDK's `contract_entrypoint_id`.
|
|
119
|
+
*/
|
|
120
|
+
declare function deriveEntrypointID(interfaceName: string | null, versionStr: string, methodName: string): ContractEntrypointID$1;
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/units.d.ts
|
|
123
|
+
/** Invalid decimal input to {@link parseUnits}. */
|
|
124
|
+
declare class ParseUnitsError extends Error {
|
|
125
|
+
readonly code: "malformed" | "precision";
|
|
126
|
+
constructor(code: "malformed" | "precision", decimals: number);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Convert a plain decimal string to raw units without rounding.
|
|
130
|
+
*
|
|
131
|
+
* Accepts a leading minus sign. Rejects whitespace, exponent notation, and
|
|
132
|
+
* excess fractional digits, including zeroes. Decimals must be 0–255.
|
|
133
|
+
* Token positivity and ABI bounds are separate validation steps.
|
|
134
|
+
*
|
|
135
|
+
* @example `parseUnits("12.05", 2)` returns `1205n`.
|
|
136
|
+
*/
|
|
137
|
+
declare function parseUnits(text: string, decimals: number): bigint;
|
|
138
|
+
/**
|
|
139
|
+
* Format raw units exactly, omitting redundant fractional zeroes.
|
|
140
|
+
*
|
|
141
|
+
* Decimals must be 0–255. Uses no floating-point conversion or display rounding.
|
|
142
|
+
* @example `formatUnits(-1205n, 2)` returns `"-12.05"`.
|
|
143
|
+
*/
|
|
144
|
+
declare function formatUnits(value: bigint, decimals: number): string;
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/encoding.d.ts
|
|
147
|
+
/** Decode exactly the expected number of bytes, with no format fallback. */
|
|
148
|
+
declare function fixedFromBase58(text: string, byteLength: number): Uint8Array;
|
|
149
|
+
/** Decode a canonical base58 Thruput address, without account derivation. */
|
|
150
|
+
declare function addressFromBase58(text: string): ContractAddress$1;
|
|
151
|
+
/** Decode a canonical base58 SHA-256 hash. */
|
|
152
|
+
declare function hashFromBase58(text: string): SHA256Hash$1;
|
|
153
|
+
/**
|
|
154
|
+
* Parse human address input: base58 or Thruput Z StrKey, without account derivation.
|
|
155
|
+
* Stellar C addresses are rejected. Z does not identify a specific Thruput network.
|
|
156
|
+
*/
|
|
157
|
+
declare function parseAddress(text: string): ContractAddress$1;
|
|
158
|
+
/** Parse human Ed25519 key input: base58 or G StrKey, never a wallet address. */
|
|
159
|
+
declare function parsePublicKey(text: string): Uint8Array;
|
|
160
|
+
/**
|
|
161
|
+
* Explicitly import a 32-byte Ed25519 seed from base58 or S StrKey.
|
|
162
|
+
* Callers must clear returned bytes after use. JavaScript input strings cannot
|
|
163
|
+
* be reliably erased; do not log or persist them in diagnostics.
|
|
164
|
+
*/
|
|
165
|
+
declare function parseSecretSeed(text: string): Uint8Array;
|
|
166
|
+
/** Render address bytes as a Thruput Z StrKey, without a specific network identity. */
|
|
167
|
+
declare function addressToStrkey(bytes: Uint8Array): string;
|
|
168
|
+
/** Render an Ed25519 public key as a G StrKey, without deriving an address. */
|
|
169
|
+
declare function publicKeyToStrkey(bytes: Uint8Array): string;
|
|
170
|
+
/** Explicitly export a seed as an S StrKey. Treat the returned string as secret. */
|
|
171
|
+
declare function secretSeedToStrkey(bytes: Uint8Array): string;
|
|
172
|
+
//#endregion
|
|
173
|
+
export { type AddressAuthDataInfo, type AirdropActions, type AirdropAttemptRequest, type AirdropExecutionStatus, type AirdropPending, type AirdropResponse, type AirdropSucceeded, type AuthPublicKey, type AuthSigner, type BalanceResponse, type BlockHeight, type BlockInfo, type BlockTransactionQuery, type BlockTransactionWalkQuery, type BoundContractMethod, CallResults, type Calldata, type ChainConfig, type ChainTip, type Cluster, type ClusterCapability, type ClusterHasCapability, type ClusterThruputClientOptions, type ConflictCode, type ConflictDiagnostic, type ConnectedThruputClient, type ContractAddress, type ContractArgumentMetadata, type ContractArrayType, type ContractArtifactSpec, type ContractCall, type ContractCallOptions, type ContractCodec, type ContractCodecContext, ContractDecodeError, type ContractDeployment, type ContractEntrypointID, type ContractEnumDef, type ContractEnumVariant, type ContractEvent, type ContractEventDefinition, type ContractEventFieldMetadata, type ContractEventFilterInput, type ContractEventFilterValue, type ContractEventPage, type ContractEventQuery, type ContractEventReceiptOptions, type ContractEventTopicMetadata, type ContractException, type ContractExceptionMetadata, type ContractExceptionType, type ContractField, type ContractInstance, type ContractMethod, type ContractMethodDefinition, ContractMethodEffect, type ContractMethodInputs, type ContractReceipt, ContractReceiptError, type ContractReceiptEvent, type ContractReceiptFailure, type ContractReceiptOutcome, type ContractRejectCode, type ContractSpec, type ContractSpecId, type ContractSpecInterface, type ContractSpecMethod, type ContractSpecResult, type ContractSpecString, type ContractStructDef, type ContractType, type ContractTypeDef, ContractTypeDefKind, ContractTypeKind, type ContractTypeSelector, type ContractUnionCase, ContractUnionCaseKind, type ContractUnionCaseType, type ContractUnionDef, type ContractVectorType, ContractVerificationError, type ContractView, ContractViewError, type ContractViewFailure, type ContractViewOptions, type ContractViewOutcome, type ContractViewRequest, type ContractViewRequestOptions, type CoreThruputClient, type CreateProviderWalletClientOptions, type CreatePubkeyAccountOptions, type CreateSourceAddressAccountOptions, DEVNET_RPC_URL, type DecodedContractEvent, type DecodedRpcError, type DefineSignedOperationOptions, type DeploymentOptions, Ed25519Signer, type EffectiveContractSpecResult, type EmittedEvent, type EventFilter, type EventPage, type EventQuery, type EventWalkQuery, ExecResult, type ExecutableWalletClient, type ExecuteCallsRequest, type ExecutionConfig, ExecutionDecodeError, ExecutionResult, ExecutionReturnUnavailableError, FUTURENET_RPC_URL, type FixedArray, type FixedBytes, type FundAccountRequest, type FundAccountResponse, FundingObservationError, type GasAmount, type HistoryCompletion, type HistoryStart, HistoryWalkError, type HttpBatchOptions, HttpRequestError, HttpResponseError, HttpTransport, type HttpTransportOptions, type IdentifiedContractEvent, type IdentifiedEvent, type Invocation, InvokeFlag, type InvokeFlagSet, type IterationOrder, JsonRpcError, type KnownCommitment, LOCALNET_RPC_URL, type MethodArgs, MlDsa65Signer, MockTransport, NativeRpcError, NativeRpcErrorCode, type NetworkConfigParams, type NetworkHash, type NetworkInfo, NetworkMismatchError, type Operation, ParseUnitsError, type PendingWalletTransaction, type PredefinedClusterOptions, type PrepareBatchExecutionRequest, type PrepareExecutionRequest, type PrepareTransactionRequest, type ProviderExecutionOptions, type ProviderWalletClient, type PubkeyAccount, type ReadErrorKind, type ReadViewsRequest, type ReadViewsResponse, type ReceiptObserver, type RecentAttemptFailure, type RegisteredAuthResult, type RequestAirdropOptions, type RootAddressTransactionQuery, type RootAddressWalkQuery, type RpcAdmission, type RpcAirdropAttempt, type RpcAirdropExecution, type RpcAscendingAnchor, type RpcAssumedAuth, type RpcAuthConfiguration, type RpcAuthSigner, type RpcBalanceResult, type RpcBase58_ContractAddress, type RpcBase58_Ed25519PublicKey, type RpcBase58_PublicKeyHash, type RpcBase58_SHA256Hash, type RpcBase58_ValidatorID, type RpcBlockInfo, type RpcBlockStart, type RpcChainConfig, type RpcChainTip, type RpcClient, type RpcClientOptions, RpcCompatibilityError, type RpcConfigLimits, type RpcConflictCode, type RpcConflictDiagnostic, type RpcContractArtifactResult, type RpcContractDeployment, type RpcContractDeploymentResult, type RpcContractRejectCode, type RpcDecimalTimePoint, type RpcDecimalU64, RpcDecodingError, type RpcDescendingAnchor, type RpcDiscovery, type RpcEffectiveContract, type RpcEffectiveContractResult, type RpcEmittedEvent, type RpcErrorData, type RpcEventFilter, type RpcEventPage, type RpcExecutionConfig, type RpcFailureCause, type RpcFundingSubmission, type RpcHistoryStart, type RpcIdentifiedEvent, type RpcInvocation, type RpcInvocationContext, type RpcInvocationOutput, type RpcInvocationResult, type RpcIterationOrder, type RpcMethod, type RpcMethods, type RpcNetworkInfo, type RpcParams, type RpcPendingTransactionCount, type RpcPublicKey, type RpcReceiptExecution, type RpcRecentAttemptFailure, type RpcRegisteredAuthResult, RpcRequestValidationError, type RpcRequests, RpcResponseError, type RpcResults, type RpcSchedulerError, type RpcSchedulerErrorSource, type RpcSendTransactionResult, type RpcServerLimits, type RpcSimulationBatchLimits, type RpcSimulationResult, type RpcSimulationResults, type RpcStorageCosts, type RpcStorageItem, type RpcStorageResult, type RpcTopicFilter, type RpcTransactionInputResult, type RpcTransactionReceipt, type RpcTransactionRef, type RpcTransactionRefPage, type RpcTransactionStatus, type RpcTxHash, type RpcVersionInfo, type SHA256Hash, type SchedulerTransactionError, type ServerLimits, SignedOp, spec as SignedOpSpec, type SignedOperation, type SignedOperationPreimage, type SignedOperationRequest, type SignedOperationType, type SignedToken, type SignedTransaction, type Signer, type SignerEntry, type SimulationBatchLimits, type SourceAddressAccount, type SpecDeclaredException, type SpecDecodedCall, type SpecDecodedEvent, type StorageCosts, type StorageItemInfo, type StorageItemRead, SubmissionEvidence, type ThruputClient, type ThruputClientOptions, type TimePoint, type Transaction, TransactionExecutionError, type TransactionFailureCause, TransactionObservationError, type TransactionReceipt, TransactionReceiptObservationError, TransactionReceiptTimeoutError, type TransactionRef, type TransactionRefPage, type TransactionStatus, type Transport, type TransportRequestOptions, type TxInvalidDetail, type UnknownContractException, UnsupportedRpcValue, UnsupportedTransactionAdmissionError, UnsupportedTransactionOutcomeError, type VerifiedTransactionInput, type VersionInfo, type ViewBatchRequest, type ViewBatchResponse, type ViewCall, type ViewOutput, type ViewRequest, type ViewResponse, type WaitForTransactionReceiptOptions, type WalletAccount, type WalletActions, type WalletAirdropActions, type WalletBatchExecutionRequest, type WalletClient, type WalletExecutionActions, type WalletExecutionRequest, type WalletInvocationAdapter, type WalletNetworkOptions, type WalletRequestAirdropOptions, type WalletRequests, addressFromBase58, addressFromHex, addressToStrkey, assertNetworkMatchesCluster, assertTransactionAdmission, assertTransactionSuccess, blockHeight, buildNamedCodecs, bytesEqual, calldata, classifyReadError, contractAddress, contractEntrypointID, createContractCallDecoder, createContractCodecContext, createContractEventDecoder, createDefaultWalletBatchInvocation, createInvocation, createProviderWalletClient, createPubkeyAccount, createRpcClient, createSourceAddressAccount, createSubmissionEvidence, createThruputClient, createTransaction, createWalletClient, decodeCalldata, decodeDefaultWalletRequests, decodeDeployment, decodeExecution, defaultWalletAdapter, defineCluster, defineContractEvent, defineContractMethod, defineSignedOperation, defineWalletInvocationAdapter, deriveContractAddress, deriveEntrypointID, derivePubkeyAccountAddress, derivePublicKeyHash, deserializeSignedTransaction, deserializeTransaction, devWalletAdapter, devnet, encodeCalldata, fixedArray, fixedBytes, fixedFromBase58, formatSpecId, formatUnits, fromBase58, fromHex0x, futurenet, gasAmount, getContract, getContractEvents, getContractSpec, getEffectiveContractSpec, hashContract, hashFromBase58, hashFromHex, hashSignedTransaction, invokeFlagSet, isSignedToken, iterateEventPages, iterateTransactionsByBlock, iterateTransactionsByRootAddress, localnet, mainnet, majorVersionFromSemver, maxBase58Length, networkHash, parseAddress, parsePublicKey, parseSecretSeed, parseUnits, prepareContractDeployment, prepareTransaction, pubkeyAccountPreimage, pubkeySignatureEnvelopeBytes, publicKeyToStrkey, randomNonce, readContractArtifactSpec, readTransactionInput, readViews, requestAirdrop, requestAirdropAttempt, resolveCodec, rv32Contract, secretSeedToStrkey, sendInvocation, sendTransaction, serializeSignedTransaction, serializeTransaction, sha256Hash, signTransaction, signedOperationPreimage, signedToken, specIdKey, submitAndObserve, thruput_signed_op_if, timePoint, toBase58, toHex0x, topicRepresentation, transactionSignaturePreimage, txInvalidDetail, verifyMlDsa65, waitForCommitment, waitForExecution, waitForTransactionReceipt, walletGasLimit };
|
|
174
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/actions/hex.ts","../src/derivation/pubkeyAccount.ts","../src/derivation/publicKeyHash.ts","../src/derivation/transactionHash.ts","../src/derivation/entrypointId.ts","../src/units.ts","../src/encoding.ts"],"mappings":";;;;;;;;;;;;;;;;;;;iBAWgB,OAAA,CAAQ,KAAiB,EAAV,UAAU;;iBAKzB,SAAA,CAAU,GAAA,WAAc,UAAU;;iBAOlC,WAAA,CAAY,GAAA,WAAc,YAAU;;iBAKpC,cAAA,CAAe,GAAA,WAAc,iBAAe;;;;;;;;;;iBCZ5C,qBAAA,CACd,MAAA,EAAQ,SAAA,EACR,KAAA,YACC,qBAAqB;;;;;;;;;;ADRxB;;;;AAAyC;AAKzC;;;;AAAkD;AAOlD;iBCoBgB,0BAAA,CACd,QAAA,EAAU,qBAAA,GACT,iBAAe;;;;;;;;;;;;;;;;;;;iBCzBF,mBAAA,CAAoB,MAAA,EAAQ,SAAA,GAAY,aAAa;;;;;;;;;;;;;;;;;iBCFrD,qBAAA,CAAsB,GAAA,EAAK,mBAAA,GAAoB,YAAU;;;;;;;;;;;;;;;iBCFzD,sBAAA,CAAuB,UAAkB;;;;;AJLzD;;;;AAAyC;AAKzC;;iBI6BgB,kBAAA,CACd,aAAA,iBACA,UAAA,UACA,UAAA,WACC,sBAAoB;;;;cChDV,eAAA,SAAwB,KAAK;EAAA,SAE7B,IAAA;cAAA,IAAA,6BACT,QAAA;AAAA;;;;;;;;;;iBAoBY,UAAA,CAAW,IAAA,UAAc,QAAgB;;;;ALbzD;;;iBKoCgB,WAAA,CAAY,KAAA,UAAe,QAAgB;;;;iBCjC3C,eAAA,CAAgB,IAAA,UAAc,UAAA,WAAqB,UAAU;;iBAU7D,iBAAA,CAAkB,IAAA,WAAe,iBAAe;;iBAKhD,cAAA,CAAe,IAAA,WAAe,YAAU;;;;;iBAqExC,YAAA,CAAa,IAAA,WAAe,iBAAe;;iBAK3C,cAAA,CAAe,IAAA,WAAe,UAAU;;;;AN5FxD;;iBMqGgB,eAAA,CAAgB,IAAA,WAAe,UAAU;;iBAKzC,eAAA,CAAgB,KAAiB,EAAV,UAAU;ANrGjD;AAAA,iBM0GgB,iBAAA,CAAkB,KAAiB,EAAV,UAAU;;iBAKnC,kBAAA,CAAmB,KAAiB,EAAV,UAAU"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { n as createInvocation, r as createTransaction, t as signTransaction } from "./sign-DVIRyW8Y.js";
|
|
2
|
+
import { i as serializeTransaction, n as deserializeTransaction, r as serializeSignedTransaction, t as deserializeSignedTransaction } from "./transaction-CwkQxQOx.js";
|
|
3
|
+
import { n as transactionSignaturePreimage, r as derivePublicKeyHash, t as pubkeySignatureEnvelopeBytes } from "./size-506oTE28.js";
|
|
4
|
+
import { A as ContractUnionCaseKind, C as isSignedToken, D as ContractMethodEffect, E as ContractVerificationError, M as specIdKey, O as ContractTypeDefKind, S as resolveCodec, T as ContractDecodeError, _ as buildNamedCodecs, a as readContractArtifactSpec, b as decodeCalldata, c as defineContractEvent, d as createContractCallDecoder, f as ContractReceiptError, g as createContractCodecContext, i as deriveContractAddress, j as formatSpecId, k as ContractTypeKind, l as topicRepresentation, m as defineContractMethod, n as fixedBytes, o as bytesEqual, p as ContractViewError, r as getContract, s as createContractEventDecoder, t as fixedArray, u as hashContract, v as deriveEntrypointID, w as signedToken, x as encodeCalldata, y as majorVersionFromSemver } from "./contract-DzvyyFCI.js";
|
|
5
|
+
import { n as RpcRequestValidationError, r as UnsupportedRpcValue, t as RpcDecodingError } from "./codec-BHKoSaOP.js";
|
|
6
|
+
import { a as addressFromBase58, c as fromBase58, d as parseAddress, f as parsePublicKey, g as toBase58, h as secretSeedToStrkey, i as toHex0x, l as hashFromBase58, m as publicKeyToStrkey, n as fromHex0x, o as addressToStrkey, p as parseSecretSeed, r as hashFromHex, s as fixedFromBase58, t as addressFromHex, u as maxBase58Length } from "./hex-DIcaALXL.js";
|
|
7
|
+
import { t as hashSignedTransaction } from "./transactionHash-CO9ajbvU.js";
|
|
8
|
+
import { a as HttpRequestError, c as JsonRpcError, i as NativeRpcError, l as RpcResponseError, n as RpcCompatibilityError, o as HttpResponseError, r as createRpcClient, s as HttpTransport, t as classifyReadError } from "./readError-CZPYcW__.js";
|
|
9
|
+
import { C as waitForCommitment, S as TransactionReceiptTimeoutError, _ as createDefaultWalletBatchInvocation, a as ExecutionReturnUnavailableError, b as devWalletAdapter, c as UnsupportedTransactionAdmissionError, d as assertTransactionSuccess, f as createSubmissionEvidence, g as walletGasLimit, h as waitForExecution, i as ExecutionDecodeError, l as UnsupportedTransactionOutcomeError, m as submitAndObserve, o as TransactionExecutionError, p as decodeExecution, r as prepareTransaction, s as TransactionObservationError, t as sendInvocation, u as assertTransactionAdmission, v as defaultWalletAdapter, w as waitForTransactionReceipt, x as TransactionReceiptObservationError, y as defineWalletInvocationAdapter } from "./sendInvocation-BwabRa2N.js";
|
|
10
|
+
import { S as pubkeyAccountPreimage, x as derivePubkeyAccountAddress } from "./validation-eXATmgO0.js";
|
|
11
|
+
import { a as getContractSpec, c as readViews, d as getContractEvents, f as FundingObservationError, i as getEffectiveContractSpec, l as iterateEventPages, m as requestAirdropAttempt, n as readTransactionInput, o as iterateTransactionsByBlock, p as requestAirdrop, r as decodeDefaultWalletRequests, s as iterateTransactionsByRootAddress, t as sendTransaction, u as HistoryWalkError } from "./actions-QHgiCqT6.js";
|
|
12
|
+
import { a as rv32Contract, i as prepareContractDeployment, n as createWalletClient, o as createPubkeyAccount, r as decodeDeployment, s as createSourceAddressAccount, t as createProviderWalletClient } from "./wallet-7RELuTkf.js";
|
|
13
|
+
import { n as randomNonce, r as signedOperationPreimage, t as defineSignedOperation } from "./signedOp-C52gOgpR.js";
|
|
14
|
+
import { n as spec, r as thruput_signed_op_if, t as SignedOp } from "./signed_op-BokEDWr-.js";
|
|
15
|
+
import { n as txInvalidDetail, r as MockTransport, t as NativeRpcErrorCode } from "./transport-CBFwAIIv.js";
|
|
16
|
+
import { n as verifyMlDsa65, r as Ed25519Signer, t as MlDsa65Signer } from "./signers-CzOSedwJ.js";
|
|
17
|
+
import { ExecResult, InvokeFlag, blockHeight, calldata, contractAddress, contractEntrypointID, gasAmount, invokeFlagSet, networkHash, networkHash as networkHash$1, sha256Hash, sha256Hash as sha256Hash$1, timePoint } from "@thruputchain/protocol";
|
|
18
|
+
//#region src/cluster.ts
|
|
19
|
+
/** Public Thruput Futurenet JSON-RPC endpoint. */
|
|
20
|
+
const FUTURENET_RPC_URL = "https://rpc.thruput.network";
|
|
21
|
+
/** @deprecated Use {@link FUTURENET_RPC_URL}. */
|
|
22
|
+
const DEVNET_RPC_URL = FUTURENET_RPC_URL;
|
|
23
|
+
/** Default JSON-RPC endpoint for `thruput node`. */
|
|
24
|
+
const LOCALNET_RPC_URL = "http://127.0.0.1:9545";
|
|
25
|
+
/** Define a reusable cluster while preserving its literal capability types. */
|
|
26
|
+
function defineCluster(cluster) {
|
|
27
|
+
if (cluster.rpcUrl !== void 0) validateRpcUrl(cluster.rpcUrl);
|
|
28
|
+
return Object.freeze({
|
|
29
|
+
...cluster,
|
|
30
|
+
...cluster.networkHash === void 0 ? {} : { networkHash: networkHash$1(sha256Hash$1(new Uint8Array(cluster.networkHash))) },
|
|
31
|
+
capabilities: Object.freeze([...cluster.capabilities])
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/** Define the canonical Thruput mainnet cluster. */
|
|
35
|
+
function mainnet(options = {}) {
|
|
36
|
+
return defineCluster({
|
|
37
|
+
name: "mainnet",
|
|
38
|
+
capabilities: [],
|
|
39
|
+
...withOptionalRpcUrl(options),
|
|
40
|
+
...withNetworkHash(options)
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** Define Futurenet, the resettable public development network, unpinned unless `networkHash` is supplied. */
|
|
44
|
+
function futurenet(options = {}) {
|
|
45
|
+
return defineCluster({
|
|
46
|
+
name: "futurenet",
|
|
47
|
+
rpcUrl: options.rpcUrl ?? "https://rpc.thruput.network",
|
|
48
|
+
capabilities: ["airdrop"],
|
|
49
|
+
...withNetworkHash(options)
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Compatibility alias for {@link futurenet}, retaining the legacy cluster name.
|
|
54
|
+
* @deprecated Use {@link futurenet}.
|
|
55
|
+
*/
|
|
56
|
+
function devnet(options = {}) {
|
|
57
|
+
return defineCluster({
|
|
58
|
+
...futurenet(options),
|
|
59
|
+
name: "devnet"
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/** Define a local `thruput node` development network. */
|
|
63
|
+
function localnet(options = {}) {
|
|
64
|
+
return defineCluster({
|
|
65
|
+
name: "localnet",
|
|
66
|
+
networkHash: options.networkHash ?? networkHash$1(sha256Hash$1(new Uint8Array(32))),
|
|
67
|
+
rpcUrl: options.rpcUrl ?? "http://127.0.0.1:9545",
|
|
68
|
+
capabilities: ["airdrop"]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/** Error thrown when an RPC endpoint does not match its declared cluster. */
|
|
72
|
+
var NetworkMismatchError = class extends Error {
|
|
73
|
+
cluster;
|
|
74
|
+
actual;
|
|
75
|
+
constructor(cluster, actual) {
|
|
76
|
+
const expected = cluster.networkHash === void 0 ? "an unpinned network" : `network ${toBase58(cluster.networkHash)}`;
|
|
77
|
+
super(`Network mismatch${cluster.name ? ` for ${cluster.name}` : ""}: expected ${expected}, received network ${toBase58(actual.networkHash)}`);
|
|
78
|
+
this.name = "NetworkMismatchError";
|
|
79
|
+
this.cluster = cluster;
|
|
80
|
+
this.actual = actual;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
/** Assert that runtime network information matches a cluster descriptor. */
|
|
84
|
+
function assertNetworkMatchesCluster(cluster, actual) {
|
|
85
|
+
if (cluster.networkHash !== void 0 && !bytesEqual$1(actual.networkHash, cluster.networkHash)) throw new NetworkMismatchError(cluster, actual);
|
|
86
|
+
}
|
|
87
|
+
function withNetworkHash(options) {
|
|
88
|
+
return options.networkHash === void 0 ? {} : { networkHash: options.networkHash };
|
|
89
|
+
}
|
|
90
|
+
function withOptionalRpcUrl(options) {
|
|
91
|
+
return options.rpcUrl === void 0 ? {} : { rpcUrl: options.rpcUrl };
|
|
92
|
+
}
|
|
93
|
+
function validateRpcUrl(rpcUrl) {
|
|
94
|
+
let url;
|
|
95
|
+
try {
|
|
96
|
+
url = new URL(rpcUrl);
|
|
97
|
+
} catch {
|
|
98
|
+
throw new Error(`Cluster rpcUrl must be an absolute HTTP URL: ${rpcUrl}`);
|
|
99
|
+
}
|
|
100
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") throw new Error(`Cluster rpcUrl must use HTTP or HTTPS: ${rpcUrl}`);
|
|
101
|
+
}
|
|
102
|
+
function bytesEqual$1(left, right) {
|
|
103
|
+
if (left.length !== right.length) return false;
|
|
104
|
+
return left.every((byte, index) => byte === right[index]);
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/client.ts
|
|
108
|
+
async function createThruputClient(options) {
|
|
109
|
+
const cluster = options.cluster === void 0 ? void 0 : defineCluster(options.cluster);
|
|
110
|
+
const transport = options.transport ?? (cluster?.rpcUrl ? new HttpTransport(cluster.rpcUrl) : void 0);
|
|
111
|
+
if (!transport) throw new Error("Cluster has no default RPC URL; provide a transport or rpcUrl");
|
|
112
|
+
const requiredMethods = [...options.requiredMethods ?? []];
|
|
113
|
+
if (cluster?.capabilities.includes("airdrop")) requiredMethods.push("faucet_requestAirdrop");
|
|
114
|
+
const rpc = await createRpcClient({
|
|
115
|
+
transport,
|
|
116
|
+
expectedNetworkHash: cluster?.networkHash,
|
|
117
|
+
requiredMethods,
|
|
118
|
+
signal: options.signal
|
|
119
|
+
});
|
|
120
|
+
const client = Object.assign(rpc, {
|
|
121
|
+
waitForTransactionReceipt: (hash, wait) => waitForTransactionReceipt(rpc, hash, wait),
|
|
122
|
+
waitForCommitment: (hash, wait) => waitForCommitment(rpc, hash, wait),
|
|
123
|
+
readViews: (request, control) => readViews(rpc, request, control),
|
|
124
|
+
getContractEvents: (query, control) => getContractEvents(rpc, query, control),
|
|
125
|
+
iterateTransactionsByRootAddress: (query, options) => iterateTransactionsByRootAddress(rpc, query, options),
|
|
126
|
+
iterateTransactionsByBlock: (query, options) => iterateTransactionsByBlock(rpc, query, options),
|
|
127
|
+
iterateEventPages: (query, control) => iterateEventPages(rpc, query, control)
|
|
128
|
+
});
|
|
129
|
+
if (!cluster || cluster.capabilities.includes("airdrop")) Object.assign(client, {
|
|
130
|
+
requestAirdrop: (request) => requestAirdrop(rpc, request),
|
|
131
|
+
requestAirdropAttempt: (request, control) => requestAirdropAttempt(rpc, request, control)
|
|
132
|
+
});
|
|
133
|
+
return cluster ? Object.assign(client, {
|
|
134
|
+
cluster,
|
|
135
|
+
network: rpc.discovery.network
|
|
136
|
+
}) : client;
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region src/units.ts
|
|
140
|
+
/** Invalid decimal input to {@link parseUnits}. */
|
|
141
|
+
var ParseUnitsError = class extends Error {
|
|
142
|
+
code;
|
|
143
|
+
constructor(code, decimals) {
|
|
144
|
+
super(code === "malformed" ? "Use a plain decimal amount" : `Use at most ${decimals} decimal places`);
|
|
145
|
+
this.code = code;
|
|
146
|
+
this.name = "ParseUnitsError";
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Convert a plain decimal string to raw units without rounding.
|
|
151
|
+
*
|
|
152
|
+
* Accepts a leading minus sign. Rejects whitespace, exponent notation, and
|
|
153
|
+
* excess fractional digits, including zeroes. Decimals must be 0–255.
|
|
154
|
+
* Token positivity and ABI bounds are separate validation steps.
|
|
155
|
+
*
|
|
156
|
+
* @example `parseUnits("12.05", 2)` returns `1205n`.
|
|
157
|
+
*/
|
|
158
|
+
function parseUnits(text, decimals) {
|
|
159
|
+
assertDecimals(decimals);
|
|
160
|
+
if (typeof text !== "string" || text.trim() !== text || !/^-?[0-9]+(?:\.[0-9]+)?$/.test(text)) throw new ParseUnitsError("malformed", decimals);
|
|
161
|
+
const negative = text.startsWith("-");
|
|
162
|
+
const [whole, fraction = ""] = (negative ? text.slice(1) : text).split(".");
|
|
163
|
+
if (fraction.length > decimals) throw new ParseUnitsError("precision", decimals);
|
|
164
|
+
const units = BigInt(whole + fraction.padEnd(decimals, "0"));
|
|
165
|
+
return negative ? -units : units;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Format raw units exactly, omitting redundant fractional zeroes.
|
|
169
|
+
*
|
|
170
|
+
* Decimals must be 0–255. Uses no floating-point conversion or display rounding.
|
|
171
|
+
* @example `formatUnits(-1205n, 2)` returns `"-12.05"`.
|
|
172
|
+
*/
|
|
173
|
+
function formatUnits(value, decimals) {
|
|
174
|
+
assertDecimals(decimals);
|
|
175
|
+
if (typeof value !== "bigint") throw new TypeError("value must be a bigint");
|
|
176
|
+
if (decimals === 0) return value.toString();
|
|
177
|
+
const negative = value < 0n;
|
|
178
|
+
const digits = (negative ? -value : value).toString().padStart(decimals + 1, "0");
|
|
179
|
+
const whole = digits.slice(0, -decimals);
|
|
180
|
+
const fraction = digits.slice(-decimals).replace(/0+$/, "");
|
|
181
|
+
return `${negative ? "-" : ""}${whole}${fraction ? `.${fraction}` : ""}`;
|
|
182
|
+
}
|
|
183
|
+
function assertDecimals(decimals) {
|
|
184
|
+
if (!Number.isInteger(decimals) || decimals < 0 || decimals > 255) throw new RangeError("decimals must be an integer between 0 and 255");
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
export { ContractDecodeError, ContractMethodEffect, ContractReceiptError, ContractTypeDefKind, ContractTypeKind, ContractUnionCaseKind, ContractVerificationError, ContractViewError, DEVNET_RPC_URL, Ed25519Signer, ExecResult, ExecutionDecodeError, ExecutionReturnUnavailableError, FUTURENET_RPC_URL, FundingObservationError, HistoryWalkError, HttpRequestError, HttpResponseError, HttpTransport, InvokeFlag, JsonRpcError, LOCALNET_RPC_URL, MlDsa65Signer, MockTransport, NativeRpcError, NativeRpcErrorCode, NetworkMismatchError, ParseUnitsError, RpcCompatibilityError, RpcDecodingError, RpcRequestValidationError, RpcResponseError, SignedOp, spec as SignedOpSpec, TransactionExecutionError, TransactionObservationError, TransactionReceiptObservationError, TransactionReceiptTimeoutError, UnsupportedRpcValue, UnsupportedTransactionAdmissionError, UnsupportedTransactionOutcomeError, addressFromBase58, addressFromHex, addressToStrkey, assertNetworkMatchesCluster, assertTransactionAdmission, assertTransactionSuccess, blockHeight, buildNamedCodecs, bytesEqual, calldata, classifyReadError, contractAddress, contractEntrypointID, createContractCallDecoder, createContractCodecContext, createContractEventDecoder, createDefaultWalletBatchInvocation, createInvocation, createProviderWalletClient, createPubkeyAccount, createRpcClient, createSourceAddressAccount, createSubmissionEvidence, createThruputClient, createTransaction, createWalletClient, decodeCalldata, decodeDefaultWalletRequests, decodeDeployment, decodeExecution, defaultWalletAdapter, defineCluster, defineContractEvent, defineContractMethod, defineSignedOperation, defineWalletInvocationAdapter, deriveContractAddress, deriveEntrypointID, derivePubkeyAccountAddress, derivePublicKeyHash, deserializeSignedTransaction, deserializeTransaction, devWalletAdapter, devnet, encodeCalldata, fixedArray, fixedBytes, fixedFromBase58, formatSpecId, formatUnits, fromBase58, fromHex0x, futurenet, gasAmount, getContract, getContractEvents, getContractSpec, getEffectiveContractSpec, hashContract, hashFromBase58, hashFromHex, hashSignedTransaction, invokeFlagSet, isSignedToken, iterateEventPages, iterateTransactionsByBlock, iterateTransactionsByRootAddress, localnet, mainnet, majorVersionFromSemver, maxBase58Length, networkHash, parseAddress, parsePublicKey, parseSecretSeed, parseUnits, prepareContractDeployment, prepareTransaction, pubkeyAccountPreimage, pubkeySignatureEnvelopeBytes, publicKeyToStrkey, randomNonce, readContractArtifactSpec, readTransactionInput, readViews, requestAirdrop, requestAirdropAttempt, resolveCodec, rv32Contract, secretSeedToStrkey, sendInvocation, sendTransaction, serializeSignedTransaction, serializeTransaction, sha256Hash, signTransaction, signedOperationPreimage, signedToken, specIdKey, submitAndObserve, thruput_signed_op_if, timePoint, toBase58, toHex0x, topicRepresentation, transactionSignaturePreimage, txInvalidDetail, verifyMlDsa65, waitForCommitment, waitForExecution, waitForTransactionReceipt, walletGasLimit };
|
|
188
|
+
|
|
189
|
+
//# sourceMappingURL=index.js.map
|