@secondlayer/stacks 2.11.0 → 2.13.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/README.md +47 -0
- package/dist/shared/{stacks-v150hffx.js → stacks-01pbr7gf.js} +13 -12
- package/dist/shared/stacks-01pbr7gf.js.map +11 -0
- package/dist/shared/stacks-0cdm20eh.js +225 -0
- package/dist/shared/stacks-0cdm20eh.js.map +11 -0
- package/dist/shared/{stacks-hxm7r5ay.cjs → stacks-44y18a8e.cjs} +3 -10
- package/dist/shared/stacks-44y18a8e.cjs.map +10 -0
- package/dist/shared/{stacks-7nvbv61d.js → stacks-59xy6t1p.js} +27 -25
- package/dist/shared/{stacks-7nvbv61d.js.map → stacks-59xy6t1p.js.map} +6 -6
- package/dist/shared/{stacks-63xbc6cj.js → stacks-6n2m9hyk.js} +3 -3
- package/dist/shared/stacks-bnbdqznq.cjs +211 -0
- package/dist/shared/stacks-bnbdqznq.cjs.map +11 -0
- package/dist/shared/stacks-esn3wcw5.cjs +416 -0
- package/dist/shared/stacks-esn3wcw5.cjs.map +18 -0
- package/dist/shared/{stacks-3kmj5yre.js → stacks-g67f4w1d.js} +5 -12
- package/dist/shared/stacks-g67f4w1d.js.map +10 -0
- package/dist/shared/stacks-kjg7fw4y.js +434 -0
- package/dist/shared/stacks-kjg7fw4y.js.map +18 -0
- package/dist/shared/{stacks-maamjqma.cjs → stacks-tbv5p6pn.cjs} +7 -9
- package/dist/shared/stacks-tbv5p6pn.cjs.map +11 -0
- package/dist/shared/{stacks-k5an9zcw.cjs → stacks-y5epf0sb.cjs} +19 -22
- package/dist/shared/{stacks-k5an9zcw.cjs.map → stacks-y5epf0sb.cjs.map} +6 -6
- package/dist/src/accounts/index.cjs +28 -1
- package/dist/src/accounts/index.cjs.map +4 -3
- package/dist/src/accounts/index.d.cts +23 -1
- package/dist/src/accounts/index.d.ts +23 -1
- package/dist/src/accounts/index.js +33 -1
- package/dist/src/accounts/index.js.map +4 -3
- package/dist/src/actions/index.cjs +8 -1
- package/dist/src/actions/index.cjs.map +1 -1
- package/dist/src/actions/index.d.cts +140 -6
- package/dist/src/actions/index.d.ts +140 -6
- package/dist/src/actions/index.js +22 -8
- package/dist/src/actions/index.js.map +1 -1
- package/dist/src/bitcoin/index.cjs +4 -175
- package/dist/src/bitcoin/index.cjs.map +4 -6
- package/dist/src/bitcoin/index.d.cts +18 -2
- package/dist/src/bitcoin/index.d.ts +18 -2
- package/dist/src/bitcoin/index.js +18 -181
- package/dist/src/bitcoin/index.js.map +4 -6
- package/dist/src/bns/index.js +3 -3
- package/dist/src/index.cjs +10 -1
- package/dist/src/index.cjs.map +3 -3
- package/dist/src/index.d.cts +167 -9
- package/dist/src/index.d.ts +167 -9
- package/dist/src/index.js +23 -7
- package/dist/src/index.js.map +3 -3
- package/dist/src/pox/index.js +3 -3
- package/dist/src/sbtc/index.cjs +49 -7
- package/dist/src/sbtc/index.cjs.map +6 -6
- package/dist/src/sbtc/index.d.cts +8 -2
- package/dist/src/sbtc/index.d.ts +8 -2
- package/dist/src/sbtc/index.js +56 -10
- package/dist/src/sbtc/index.js.map +6 -6
- package/dist/src/stackingdao/index.js +3 -3
- package/dist/src/tools/index.cjs +194 -13
- package/dist/src/tools/index.cjs.map +12 -9
- package/dist/src/tools/index.js +194 -13
- package/dist/src/tools/index.js.map +12 -9
- package/dist/src/x402/index.cjs +5 -2
- package/dist/src/x402/index.cjs.map +3 -3
- package/dist/src/x402/index.d.cts +36 -0
- package/dist/src/x402/index.d.ts +36 -0
- package/dist/src/x402/index.js +7 -4
- package/dist/src/x402/index.js.map +3 -3
- package/package.json +2 -4
- package/dist/shared/stacks-3kmj5yre.js.map +0 -10
- package/dist/shared/stacks-502j0efj.js +0 -210
- package/dist/shared/stacks-502j0efj.js.map +0 -15
- package/dist/shared/stacks-hxm7r5ay.cjs.map +0 -10
- package/dist/shared/stacks-maamjqma.cjs.map +0 -11
- package/dist/shared/stacks-v150hffx.js.map +0 -11
- package/dist/shared/stacks-xmsms921.cjs +0 -196
- package/dist/shared/stacks-xmsms921.cjs.map +0 -15
- /package/dist/shared/{stacks-63xbc6cj.js.map → stacks-6n2m9hyk.js.map} +0 -0
|
@@ -522,6 +522,109 @@ type SimulateDeployResult = {
|
|
|
522
522
|
};
|
|
523
523
|
type SimulateTransactionResult = SimulateContractCallResult | SimulateTransferResult | SimulateDeployResult;
|
|
524
524
|
declare function simulateTransaction(client: Client, params: SimulateTransactionParams): Promise<SimulateTransactionResult>;
|
|
525
|
+
/**
|
|
526
|
+
* Pluggable transaction-status sources for {@link getTransaction} /
|
|
527
|
+
* `waitForTransactionReceipt`.
|
|
528
|
+
*
|
|
529
|
+
* A bare stacks-node has no confirmed-transaction endpoint, so status reads
|
|
530
|
+
* need a host that indexes transactions. Where that data comes from is
|
|
531
|
+
* pluggable, mirroring the nonce sources:
|
|
532
|
+
*
|
|
533
|
+
* - {@link extendedApiSource} — default; `/extended/v1/tx/{txid}` on the
|
|
534
|
+
* client's transport host (Hiro API or any extended-API-compatible host).
|
|
535
|
+
* - {@link indexTxSource} — Secondlayer's `/v1/index/transactions/{txid}`;
|
|
536
|
+
* returns the chain tip in the same response, so N-confirmation waits
|
|
537
|
+
* need no second request.
|
|
538
|
+
*/
|
|
539
|
+
type TransactionStatus = "pending" | "success" | "abort_by_response" | "abort_by_post_condition" | "dropped";
|
|
540
|
+
type TransactionReceipt = {
|
|
541
|
+
txid: string
|
|
542
|
+
status: TransactionStatus
|
|
543
|
+
/** Anchor block height; absent while pending. */
|
|
544
|
+
blockHeight?: number
|
|
545
|
+
blockHash?: string
|
|
546
|
+
/** Decoded Clarity result; absent while pending or when the source omits it. */
|
|
547
|
+
result?: ClarityValue
|
|
548
|
+
resultHex?: string
|
|
549
|
+
events: unknown[]
|
|
550
|
+
/** The source's unnormalized response, for fields the receipt doesn't model. */
|
|
551
|
+
raw: unknown
|
|
552
|
+
};
|
|
553
|
+
type TransactionSnapshot = {
|
|
554
|
+
/** `null` when the source has no record of the tx (mempool + chain). */
|
|
555
|
+
receipt: TransactionReceipt | null
|
|
556
|
+
/** Chain tip height, when the source knows it (saves a round-trip). */
|
|
557
|
+
tip?: number
|
|
558
|
+
};
|
|
559
|
+
type TransactionStatusSource = {
|
|
560
|
+
get(args: {
|
|
561
|
+
client: Client
|
|
562
|
+
txid: string
|
|
563
|
+
}): Promise<TransactionSnapshot>
|
|
564
|
+
};
|
|
565
|
+
type FetchImpl = typeof globalThis.fetch;
|
|
566
|
+
/**
|
|
567
|
+
* Default source: `GET /extended/v1/tx/{txid}` via the client's transport.
|
|
568
|
+
* Requires a host that serves Hiro's extended API (a bare stacks-node does
|
|
569
|
+
* not). Does not report the chain tip — the wait action fetches it separately
|
|
570
|
+
* when `confirmations > 1`.
|
|
571
|
+
*/
|
|
572
|
+
declare function extendedApiSource(): TransactionStatusSource;
|
|
573
|
+
type IndexTxSourceParams = {
|
|
574
|
+
/** Base URL of a Secondlayer-shaped index API. */
|
|
575
|
+
baseUrl?: string
|
|
576
|
+
apiKey?: string
|
|
577
|
+
fetchImpl?: FetchImpl
|
|
578
|
+
};
|
|
579
|
+
/**
|
|
580
|
+
* Source backed by Secondlayer's `/v1/index/transactions/{txid}`. The response
|
|
581
|
+
* embeds the chain tip, so N-confirmation math needs no extra request. The
|
|
582
|
+
* index only returns canonical (mined) transactions — while a tx is in the
|
|
583
|
+
* mempool this source reports `receipt: null`, and the wait action's grace
|
|
584
|
+
* window carries it until inclusion.
|
|
585
|
+
*/
|
|
586
|
+
declare function indexTxSource(params?: IndexTxSourceParams): TransactionStatusSource;
|
|
587
|
+
type GetTransactionParams = {
|
|
588
|
+
txid: string
|
|
589
|
+
/** Where to read status from. Defaults to {@link extendedApiSource}. */
|
|
590
|
+
source?: TransactionStatusSource
|
|
591
|
+
};
|
|
592
|
+
/**
|
|
593
|
+
* Fetch a transaction's receipt (status, block info, decoded result).
|
|
594
|
+
* Returns `null` when the source has no record of the transaction.
|
|
595
|
+
*/
|
|
596
|
+
declare function getTransaction(client: Client, params: GetTransactionParams): Promise<TransactionReceipt | null>;
|
|
597
|
+
type WaitForTransactionReceiptParams = {
|
|
598
|
+
txid: string
|
|
599
|
+
/** Anchor-block confirmations to wait for. Default 1 (mined). */
|
|
600
|
+
confirmations?: number
|
|
601
|
+
/** Give up after this many ms. Default 180_000 (3 min). */
|
|
602
|
+
timeout?: number
|
|
603
|
+
/** Delay between status polls, ms. Default 3_000. */
|
|
604
|
+
pollingInterval?: number
|
|
605
|
+
/**
|
|
606
|
+
* How long a tx may be unknown to the source before it counts as dropped,
|
|
607
|
+
* ms. Covers broadcast propagation lag and canonical-only sources that
|
|
608
|
+
* can't see the mempool. Default 30_000.
|
|
609
|
+
*/
|
|
610
|
+
droppedGracePeriod?: number
|
|
611
|
+
/** Where to read status from. Defaults to {@link extendedApiSource}. */
|
|
612
|
+
source?: TransactionStatusSource
|
|
613
|
+
};
|
|
614
|
+
/**
|
|
615
|
+
* Poll until a transaction is mined with N confirmations, then return its
|
|
616
|
+
* receipt.
|
|
617
|
+
*
|
|
618
|
+
* Rejects with {@link TransactionAbortedError} when the tx mines but aborts
|
|
619
|
+
* (`abort_by_response` / `abort_by_post_condition`) — the receipt is attached.
|
|
620
|
+
* Rejects with {@link TransactionDroppedError} when the tx leaves the mempool
|
|
621
|
+
* unmined or stays unknown past `droppedGracePeriod`, and
|
|
622
|
+
* {@link WaitForTransactionTimeoutError} at `timeout`.
|
|
623
|
+
*
|
|
624
|
+
* Reorg-tolerant: every cycle re-reads the receipt (block height may change)
|
|
625
|
+
* and recomputes confirmations from the current tip.
|
|
626
|
+
*/
|
|
627
|
+
declare function waitForTransactionReceipt(client: Client, params: WaitForTransactionReceiptParams): Promise<TransactionReceipt>;
|
|
525
628
|
/** Handle returned by WebSocket subscription methods; call `unsubscribe()` to stop. */
|
|
526
629
|
type Subscription = {
|
|
527
630
|
unsubscribe: () => void
|
|
@@ -658,9 +761,17 @@ declare function watchNftEvent(client: Client, params: WatchNftEventParams): Pro
|
|
|
658
761
|
type SendTransactionParams = {
|
|
659
762
|
transaction: StacksTransaction
|
|
660
763
|
attachment?: Uint8Array | string
|
|
764
|
+
/**
|
|
765
|
+
* Wait for the transaction to be mined before returning. `true` waits for
|
|
766
|
+
* 1 confirmation; a number waits for that many. The receipt lands on the
|
|
767
|
+
* result. Rejects if the tx aborts, is dropped, or the wait times out.
|
|
768
|
+
*/
|
|
769
|
+
wait?: boolean | number
|
|
661
770
|
};
|
|
662
771
|
type SendTransactionResult = {
|
|
663
772
|
txid: string
|
|
773
|
+
/** Present when `wait` was requested. */
|
|
774
|
+
receipt?: TransactionReceipt
|
|
664
775
|
};
|
|
665
776
|
/** Broadcast a signed transaction to the network */
|
|
666
777
|
declare function sendTransaction(client: Client, params: SendTransactionParams): Promise<SendTransactionResult>;
|
|
@@ -707,11 +818,35 @@ type PoxPostCondition = {
|
|
|
707
818
|
};
|
|
708
819
|
type PostCondition = StxPostCondition | FtPostCondition | NftPostCondition | StakingPostCondition | PoxPostCondition;
|
|
709
820
|
type IntegerType = number | string | bigint | Uint8Array;
|
|
821
|
+
declare function isProviderAccount(account: Account): account is ProviderAccount;
|
|
822
|
+
/**
|
|
823
|
+
* Named fee tiers. `'low' | 'mid' | 'high'` map to the node's three fee
|
|
824
|
+
* estimations; `'min'` is the node's minimum relay fee — 1 uSTX per byte of
|
|
825
|
+
* the serialized transaction, computable offline.
|
|
826
|
+
*/
|
|
827
|
+
type FeeTier = "min" | "low" | "mid" | "high";
|
|
828
|
+
/** Fee input accepted by wallet actions: an explicit amount or a named tier. */
|
|
829
|
+
type FeeParam = IntegerType | FeeTier;
|
|
830
|
+
declare function isFeeTier(fee: FeeParam | undefined): fee is FeeTier;
|
|
831
|
+
/**
|
|
832
|
+
* Minimum relay fee: 1 uSTX per byte of the serialized transaction. The fee
|
|
833
|
+
* field is fixed-width (8 bytes), so the size — and therefore this floor — is
|
|
834
|
+
* stable regardless of the fee value later set on the spending condition.
|
|
835
|
+
*/
|
|
836
|
+
declare function minimumFee(transaction: StacksTransaction): bigint;
|
|
837
|
+
/**
|
|
838
|
+
* Resolve a fee param to a concrete amount. Numeric input passes through.
|
|
839
|
+
* Tiers `'low' | 'mid' | 'high'` index the node's estimations (nearest
|
|
840
|
+
* available when fewer than three are returned); `'min'` — and any estimation
|
|
841
|
+
* failure (e.g. NoEstimateAvailable) — resolves to {@link minimumFee}, which
|
|
842
|
+
* needs no network round-trip.
|
|
843
|
+
*/
|
|
844
|
+
declare function resolveFee(client: Client, transaction: StacksTransaction, fee: FeeParam | undefined): Promise<bigint>;
|
|
710
845
|
type TransferStxParams = {
|
|
711
846
|
to: string
|
|
712
847
|
amount: IntegerType
|
|
713
848
|
memo?: string
|
|
714
|
-
fee?:
|
|
849
|
+
fee?: FeeParam
|
|
715
850
|
nonce?: IntegerType
|
|
716
851
|
postConditionMode?: "allow" | "deny"
|
|
717
852
|
postConditions?: PostCondition[]
|
|
@@ -722,7 +857,7 @@ type CallContractParams = {
|
|
|
722
857
|
contract: string
|
|
723
858
|
functionName: string
|
|
724
859
|
functionArgs?: ClarityValue[]
|
|
725
|
-
fee?:
|
|
860
|
+
fee?: FeeParam
|
|
726
861
|
nonce?: IntegerType
|
|
727
862
|
postConditionMode?: "allow" | "deny"
|
|
728
863
|
postConditions?: PostCondition[]
|
|
@@ -733,7 +868,7 @@ type DeployContractParams = {
|
|
|
733
868
|
contractName: string
|
|
734
869
|
codeBody: string
|
|
735
870
|
clarityVersion?: ClarityVersion
|
|
736
|
-
fee?:
|
|
871
|
+
fee?: FeeParam
|
|
737
872
|
nonce?: IntegerType
|
|
738
873
|
postConditionMode?: "allow" | "deny"
|
|
739
874
|
postConditions?: PostCondition[]
|
|
@@ -752,12 +887,11 @@ type SignMessageParams = {
|
|
|
752
887
|
declare function signMessage2(client: Client, params: SignMessageParams): Promise<string>;
|
|
753
888
|
type SponsorTransactionParams = {
|
|
754
889
|
transaction: StacksTransaction
|
|
755
|
-
fee?:
|
|
890
|
+
fee?: FeeParam
|
|
756
891
|
nonce?: IntegerType
|
|
757
892
|
};
|
|
758
893
|
/** Sponsor a transaction: set sponsor spending condition, sign as sponsor */
|
|
759
894
|
declare function sponsorTransaction(client: Client, params: SponsorTransactionParams): Promise<StacksTransaction>;
|
|
760
|
-
declare function isProviderAccount(account: Account): account is ProviderAccount;
|
|
761
895
|
type AbiUInt128 = "uint128";
|
|
762
896
|
type AbiInt128 = "int128";
|
|
763
897
|
type AbiBool = "bool";
|
|
@@ -1028,4 +1162,4 @@ declare class ContractResponseError extends Error {
|
|
|
1028
1162
|
name: string;
|
|
1029
1163
|
constructor(message: string, errorValue: unknown);
|
|
1030
1164
|
}
|
|
1031
|
-
export { watchTransaction, watchNftEvent, watchMempool, watchBlocks, watchAddressBalance, watchAddress, transferStx, sponsorTransaction, simulateTransaction, simulateCall, signTransactionAction, signMessage2 as signMessage, sendTransaction, readContract, multicall, isProviderAccount, getNonce, getMapEntry, getContractAbi, getContract, getBlockHeight, getBlock, getBalance, getAccountInfo, estimateFee, deployContract, callContract, WatchTransactionParams, WatchNftEventParams, WatchMempoolParams, WatchBlocksParams, WatchAddressParams, WatchAddressBalanceParams, TransferStxParams, SponsorTransactionParams, SimulateTransferResult, SimulateTransactionResult, SimulateTransactionParams, SimulateDeployResult, SimulateContractCallResult, SimulateCallSuccess, SimulateCallResult, SimulateCallParams, SimulateCallFailure, SignTransactionParams, SignMessageParams, SendTransactionResult, SendTransactionParams, ReadContractParams, MulticallSuccessResult, MulticallResult, MulticallParams, MulticallFailureResult, MulticallCall, GetNonceParams, GetMapEntryParams, GetContractParams, GetContractAbiParams, GetBlockParams, GetBalanceParams, GetAccountInfoParams, FeeEstimation, EstimateFeeParams, DeployContractParams, ContractResponseError, ContractInstance, ContractCallOptions, ContractBuildCallOptions, CallContractParams, AccountInfo };
|
|
1165
|
+
export { watchTransaction, watchNftEvent, watchMempool, watchBlocks, watchAddressBalance, watchAddress, waitForTransactionReceipt, transferStx, sponsorTransaction, simulateTransaction, simulateCall, signTransactionAction, signMessage2 as signMessage, sendTransaction, resolveFee, readContract, multicall, minimumFee, isProviderAccount, isFeeTier, indexTxSource, getTransaction, getNonce, getMapEntry, getContractAbi, getContract, getBlockHeight, getBlock, getBalance, getAccountInfo, extendedApiSource, estimateFee, deployContract, callContract, WatchTransactionParams, WatchNftEventParams, WatchMempoolParams, WatchBlocksParams, WatchAddressParams, WatchAddressBalanceParams, WaitForTransactionReceiptParams, TransferStxParams, TransactionStatusSource, TransactionStatus, TransactionSnapshot, TransactionReceipt, SponsorTransactionParams, SimulateTransferResult, SimulateTransactionResult, SimulateTransactionParams, SimulateDeployResult, SimulateContractCallResult, SimulateCallSuccess, SimulateCallResult, SimulateCallParams, SimulateCallFailure, SignTransactionParams, SignMessageParams, SendTransactionResult, SendTransactionParams, ReadContractParams, MulticallSuccessResult, MulticallResult, MulticallParams, MulticallFailureResult, MulticallCall, IndexTxSourceParams, GetTransactionParams, GetNonceParams, GetMapEntryParams, GetContractParams, GetContractAbiParams, GetBlockParams, GetBalanceParams, GetAccountInfoParams, FeeTier, FeeParam, FeeEstimation, EstimateFeeParams, DeployContractParams, ContractResponseError, ContractInstance, ContractCallOptions, ContractBuildCallOptions, CallContractParams, AccountInfo };
|
|
@@ -522,6 +522,109 @@ type SimulateDeployResult = {
|
|
|
522
522
|
};
|
|
523
523
|
type SimulateTransactionResult = SimulateContractCallResult | SimulateTransferResult | SimulateDeployResult;
|
|
524
524
|
declare function simulateTransaction(client: Client, params: SimulateTransactionParams): Promise<SimulateTransactionResult>;
|
|
525
|
+
/**
|
|
526
|
+
* Pluggable transaction-status sources for {@link getTransaction} /
|
|
527
|
+
* `waitForTransactionReceipt`.
|
|
528
|
+
*
|
|
529
|
+
* A bare stacks-node has no confirmed-transaction endpoint, so status reads
|
|
530
|
+
* need a host that indexes transactions. Where that data comes from is
|
|
531
|
+
* pluggable, mirroring the nonce sources:
|
|
532
|
+
*
|
|
533
|
+
* - {@link extendedApiSource} — default; `/extended/v1/tx/{txid}` on the
|
|
534
|
+
* client's transport host (Hiro API or any extended-API-compatible host).
|
|
535
|
+
* - {@link indexTxSource} — Secondlayer's `/v1/index/transactions/{txid}`;
|
|
536
|
+
* returns the chain tip in the same response, so N-confirmation waits
|
|
537
|
+
* need no second request.
|
|
538
|
+
*/
|
|
539
|
+
type TransactionStatus = "pending" | "success" | "abort_by_response" | "abort_by_post_condition" | "dropped";
|
|
540
|
+
type TransactionReceipt = {
|
|
541
|
+
txid: string
|
|
542
|
+
status: TransactionStatus
|
|
543
|
+
/** Anchor block height; absent while pending. */
|
|
544
|
+
blockHeight?: number
|
|
545
|
+
blockHash?: string
|
|
546
|
+
/** Decoded Clarity result; absent while pending or when the source omits it. */
|
|
547
|
+
result?: ClarityValue
|
|
548
|
+
resultHex?: string
|
|
549
|
+
events: unknown[]
|
|
550
|
+
/** The source's unnormalized response, for fields the receipt doesn't model. */
|
|
551
|
+
raw: unknown
|
|
552
|
+
};
|
|
553
|
+
type TransactionSnapshot = {
|
|
554
|
+
/** `null` when the source has no record of the tx (mempool + chain). */
|
|
555
|
+
receipt: TransactionReceipt | null
|
|
556
|
+
/** Chain tip height, when the source knows it (saves a round-trip). */
|
|
557
|
+
tip?: number
|
|
558
|
+
};
|
|
559
|
+
type TransactionStatusSource = {
|
|
560
|
+
get(args: {
|
|
561
|
+
client: Client
|
|
562
|
+
txid: string
|
|
563
|
+
}): Promise<TransactionSnapshot>
|
|
564
|
+
};
|
|
565
|
+
type FetchImpl = typeof globalThis.fetch;
|
|
566
|
+
/**
|
|
567
|
+
* Default source: `GET /extended/v1/tx/{txid}` via the client's transport.
|
|
568
|
+
* Requires a host that serves Hiro's extended API (a bare stacks-node does
|
|
569
|
+
* not). Does not report the chain tip — the wait action fetches it separately
|
|
570
|
+
* when `confirmations > 1`.
|
|
571
|
+
*/
|
|
572
|
+
declare function extendedApiSource(): TransactionStatusSource;
|
|
573
|
+
type IndexTxSourceParams = {
|
|
574
|
+
/** Base URL of a Secondlayer-shaped index API. */
|
|
575
|
+
baseUrl?: string
|
|
576
|
+
apiKey?: string
|
|
577
|
+
fetchImpl?: FetchImpl
|
|
578
|
+
};
|
|
579
|
+
/**
|
|
580
|
+
* Source backed by Secondlayer's `/v1/index/transactions/{txid}`. The response
|
|
581
|
+
* embeds the chain tip, so N-confirmation math needs no extra request. The
|
|
582
|
+
* index only returns canonical (mined) transactions — while a tx is in the
|
|
583
|
+
* mempool this source reports `receipt: null`, and the wait action's grace
|
|
584
|
+
* window carries it until inclusion.
|
|
585
|
+
*/
|
|
586
|
+
declare function indexTxSource(params?: IndexTxSourceParams): TransactionStatusSource;
|
|
587
|
+
type GetTransactionParams = {
|
|
588
|
+
txid: string
|
|
589
|
+
/** Where to read status from. Defaults to {@link extendedApiSource}. */
|
|
590
|
+
source?: TransactionStatusSource
|
|
591
|
+
};
|
|
592
|
+
/**
|
|
593
|
+
* Fetch a transaction's receipt (status, block info, decoded result).
|
|
594
|
+
* Returns `null` when the source has no record of the transaction.
|
|
595
|
+
*/
|
|
596
|
+
declare function getTransaction(client: Client, params: GetTransactionParams): Promise<TransactionReceipt | null>;
|
|
597
|
+
type WaitForTransactionReceiptParams = {
|
|
598
|
+
txid: string
|
|
599
|
+
/** Anchor-block confirmations to wait for. Default 1 (mined). */
|
|
600
|
+
confirmations?: number
|
|
601
|
+
/** Give up after this many ms. Default 180_000 (3 min). */
|
|
602
|
+
timeout?: number
|
|
603
|
+
/** Delay between status polls, ms. Default 3_000. */
|
|
604
|
+
pollingInterval?: number
|
|
605
|
+
/**
|
|
606
|
+
* How long a tx may be unknown to the source before it counts as dropped,
|
|
607
|
+
* ms. Covers broadcast propagation lag and canonical-only sources that
|
|
608
|
+
* can't see the mempool. Default 30_000.
|
|
609
|
+
*/
|
|
610
|
+
droppedGracePeriod?: number
|
|
611
|
+
/** Where to read status from. Defaults to {@link extendedApiSource}. */
|
|
612
|
+
source?: TransactionStatusSource
|
|
613
|
+
};
|
|
614
|
+
/**
|
|
615
|
+
* Poll until a transaction is mined with N confirmations, then return its
|
|
616
|
+
* receipt.
|
|
617
|
+
*
|
|
618
|
+
* Rejects with {@link TransactionAbortedError} when the tx mines but aborts
|
|
619
|
+
* (`abort_by_response` / `abort_by_post_condition`) — the receipt is attached.
|
|
620
|
+
* Rejects with {@link TransactionDroppedError} when the tx leaves the mempool
|
|
621
|
+
* unmined or stays unknown past `droppedGracePeriod`, and
|
|
622
|
+
* {@link WaitForTransactionTimeoutError} at `timeout`.
|
|
623
|
+
*
|
|
624
|
+
* Reorg-tolerant: every cycle re-reads the receipt (block height may change)
|
|
625
|
+
* and recomputes confirmations from the current tip.
|
|
626
|
+
*/
|
|
627
|
+
declare function waitForTransactionReceipt(client: Client, params: WaitForTransactionReceiptParams): Promise<TransactionReceipt>;
|
|
525
628
|
/** Handle returned by WebSocket subscription methods; call `unsubscribe()` to stop. */
|
|
526
629
|
type Subscription = {
|
|
527
630
|
unsubscribe: () => void
|
|
@@ -658,9 +761,17 @@ declare function watchNftEvent(client: Client, params: WatchNftEventParams): Pro
|
|
|
658
761
|
type SendTransactionParams = {
|
|
659
762
|
transaction: StacksTransaction
|
|
660
763
|
attachment?: Uint8Array | string
|
|
764
|
+
/**
|
|
765
|
+
* Wait for the transaction to be mined before returning. `true` waits for
|
|
766
|
+
* 1 confirmation; a number waits for that many. The receipt lands on the
|
|
767
|
+
* result. Rejects if the tx aborts, is dropped, or the wait times out.
|
|
768
|
+
*/
|
|
769
|
+
wait?: boolean | number
|
|
661
770
|
};
|
|
662
771
|
type SendTransactionResult = {
|
|
663
772
|
txid: string
|
|
773
|
+
/** Present when `wait` was requested. */
|
|
774
|
+
receipt?: TransactionReceipt
|
|
664
775
|
};
|
|
665
776
|
/** Broadcast a signed transaction to the network */
|
|
666
777
|
declare function sendTransaction(client: Client, params: SendTransactionParams): Promise<SendTransactionResult>;
|
|
@@ -707,11 +818,35 @@ type PoxPostCondition = {
|
|
|
707
818
|
};
|
|
708
819
|
type PostCondition = StxPostCondition | FtPostCondition | NftPostCondition | StakingPostCondition | PoxPostCondition;
|
|
709
820
|
type IntegerType = number | string | bigint | Uint8Array;
|
|
821
|
+
declare function isProviderAccount(account: Account): account is ProviderAccount;
|
|
822
|
+
/**
|
|
823
|
+
* Named fee tiers. `'low' | 'mid' | 'high'` map to the node's three fee
|
|
824
|
+
* estimations; `'min'` is the node's minimum relay fee — 1 uSTX per byte of
|
|
825
|
+
* the serialized transaction, computable offline.
|
|
826
|
+
*/
|
|
827
|
+
type FeeTier = "min" | "low" | "mid" | "high";
|
|
828
|
+
/** Fee input accepted by wallet actions: an explicit amount or a named tier. */
|
|
829
|
+
type FeeParam = IntegerType | FeeTier;
|
|
830
|
+
declare function isFeeTier(fee: FeeParam | undefined): fee is FeeTier;
|
|
831
|
+
/**
|
|
832
|
+
* Minimum relay fee: 1 uSTX per byte of the serialized transaction. The fee
|
|
833
|
+
* field is fixed-width (8 bytes), so the size — and therefore this floor — is
|
|
834
|
+
* stable regardless of the fee value later set on the spending condition.
|
|
835
|
+
*/
|
|
836
|
+
declare function minimumFee(transaction: StacksTransaction): bigint;
|
|
837
|
+
/**
|
|
838
|
+
* Resolve a fee param to a concrete amount. Numeric input passes through.
|
|
839
|
+
* Tiers `'low' | 'mid' | 'high'` index the node's estimations (nearest
|
|
840
|
+
* available when fewer than three are returned); `'min'` — and any estimation
|
|
841
|
+
* failure (e.g. NoEstimateAvailable) — resolves to {@link minimumFee}, which
|
|
842
|
+
* needs no network round-trip.
|
|
843
|
+
*/
|
|
844
|
+
declare function resolveFee(client: Client, transaction: StacksTransaction, fee: FeeParam | undefined): Promise<bigint>;
|
|
710
845
|
type TransferStxParams = {
|
|
711
846
|
to: string
|
|
712
847
|
amount: IntegerType
|
|
713
848
|
memo?: string
|
|
714
|
-
fee?:
|
|
849
|
+
fee?: FeeParam
|
|
715
850
|
nonce?: IntegerType
|
|
716
851
|
postConditionMode?: "allow" | "deny"
|
|
717
852
|
postConditions?: PostCondition[]
|
|
@@ -722,7 +857,7 @@ type CallContractParams = {
|
|
|
722
857
|
contract: string
|
|
723
858
|
functionName: string
|
|
724
859
|
functionArgs?: ClarityValue[]
|
|
725
|
-
fee?:
|
|
860
|
+
fee?: FeeParam
|
|
726
861
|
nonce?: IntegerType
|
|
727
862
|
postConditionMode?: "allow" | "deny"
|
|
728
863
|
postConditions?: PostCondition[]
|
|
@@ -733,7 +868,7 @@ type DeployContractParams = {
|
|
|
733
868
|
contractName: string
|
|
734
869
|
codeBody: string
|
|
735
870
|
clarityVersion?: ClarityVersion
|
|
736
|
-
fee?:
|
|
871
|
+
fee?: FeeParam
|
|
737
872
|
nonce?: IntegerType
|
|
738
873
|
postConditionMode?: "allow" | "deny"
|
|
739
874
|
postConditions?: PostCondition[]
|
|
@@ -752,12 +887,11 @@ type SignMessageParams = {
|
|
|
752
887
|
declare function signMessage2(client: Client, params: SignMessageParams): Promise<string>;
|
|
753
888
|
type SponsorTransactionParams = {
|
|
754
889
|
transaction: StacksTransaction
|
|
755
|
-
fee?:
|
|
890
|
+
fee?: FeeParam
|
|
756
891
|
nonce?: IntegerType
|
|
757
892
|
};
|
|
758
893
|
/** Sponsor a transaction: set sponsor spending condition, sign as sponsor */
|
|
759
894
|
declare function sponsorTransaction(client: Client, params: SponsorTransactionParams): Promise<StacksTransaction>;
|
|
760
|
-
declare function isProviderAccount(account: Account): account is ProviderAccount;
|
|
761
895
|
type AbiUInt128 = "uint128";
|
|
762
896
|
type AbiInt128 = "int128";
|
|
763
897
|
type AbiBool = "bool";
|
|
@@ -1028,4 +1162,4 @@ declare class ContractResponseError extends Error {
|
|
|
1028
1162
|
name: string;
|
|
1029
1163
|
constructor(message: string, errorValue: unknown);
|
|
1030
1164
|
}
|
|
1031
|
-
export { watchTransaction, watchNftEvent, watchMempool, watchBlocks, watchAddressBalance, watchAddress, transferStx, sponsorTransaction, simulateTransaction, simulateCall, signTransactionAction, signMessage2 as signMessage, sendTransaction, readContract, multicall, isProviderAccount, getNonce, getMapEntry, getContractAbi, getContract, getBlockHeight, getBlock, getBalance, getAccountInfo, estimateFee, deployContract, callContract, WatchTransactionParams, WatchNftEventParams, WatchMempoolParams, WatchBlocksParams, WatchAddressParams, WatchAddressBalanceParams, TransferStxParams, SponsorTransactionParams, SimulateTransferResult, SimulateTransactionResult, SimulateTransactionParams, SimulateDeployResult, SimulateContractCallResult, SimulateCallSuccess, SimulateCallResult, SimulateCallParams, SimulateCallFailure, SignTransactionParams, SignMessageParams, SendTransactionResult, SendTransactionParams, ReadContractParams, MulticallSuccessResult, MulticallResult, MulticallParams, MulticallFailureResult, MulticallCall, GetNonceParams, GetMapEntryParams, GetContractParams, GetContractAbiParams, GetBlockParams, GetBalanceParams, GetAccountInfoParams, FeeEstimation, EstimateFeeParams, DeployContractParams, ContractResponseError, ContractInstance, ContractCallOptions, ContractBuildCallOptions, CallContractParams, AccountInfo };
|
|
1165
|
+
export { watchTransaction, watchNftEvent, watchMempool, watchBlocks, watchAddressBalance, watchAddress, waitForTransactionReceipt, transferStx, sponsorTransaction, simulateTransaction, simulateCall, signTransactionAction, signMessage2 as signMessage, sendTransaction, resolveFee, readContract, multicall, minimumFee, isProviderAccount, isFeeTier, indexTxSource, getTransaction, getNonce, getMapEntry, getContractAbi, getContract, getBlockHeight, getBlock, getBalance, getAccountInfo, extendedApiSource, estimateFee, deployContract, callContract, WatchTransactionParams, WatchNftEventParams, WatchMempoolParams, WatchBlocksParams, WatchAddressParams, WatchAddressBalanceParams, WaitForTransactionReceiptParams, TransferStxParams, TransactionStatusSource, TransactionStatus, TransactionSnapshot, TransactionReceipt, SponsorTransactionParams, SimulateTransferResult, SimulateTransactionResult, SimulateTransactionParams, SimulateDeployResult, SimulateContractCallResult, SimulateCallSuccess, SimulateCallResult, SimulateCallParams, SimulateCallFailure, SignTransactionParams, SignMessageParams, SendTransactionResult, SendTransactionParams, ReadContractParams, MulticallSuccessResult, MulticallResult, MulticallParams, MulticallFailureResult, MulticallCall, IndexTxSourceParams, GetTransactionParams, GetNonceParams, GetMapEntryParams, GetContractParams, GetContractAbiParams, GetBlockParams, GetBalanceParams, GetAccountInfoParams, FeeTier, FeeParam, FeeEstimation, EstimateFeeParams, DeployContractParams, ContractResponseError, ContractInstance, ContractCallOptions, ContractBuildCallOptions, CallContractParams, AccountInfo };
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ContractResponseError,
|
|
3
3
|
getContract
|
|
4
|
-
} from "../../shared/stacks-
|
|
4
|
+
} from "../../shared/stacks-6n2m9hyk.js";
|
|
5
5
|
import {
|
|
6
6
|
deployContract,
|
|
7
7
|
getAccountInfo,
|
|
8
8
|
getBalance,
|
|
9
9
|
getBlock,
|
|
10
|
-
getBlockHeight,
|
|
11
10
|
getContractAbi,
|
|
11
|
+
getTransaction,
|
|
12
12
|
multicall,
|
|
13
13
|
signMessage,
|
|
14
14
|
signTransactionAction,
|
|
15
15
|
simulateCall,
|
|
16
16
|
simulateTransaction,
|
|
17
17
|
transferStx
|
|
18
|
-
} from "../../shared/stacks-
|
|
18
|
+
} from "../../shared/stacks-59xy6t1p.js";
|
|
19
19
|
import {
|
|
20
20
|
callContract,
|
|
21
21
|
getMapEntry
|
|
22
|
-
} from "../../shared/stacks-
|
|
22
|
+
} from "../../shared/stacks-01pbr7gf.js";
|
|
23
23
|
import {
|
|
24
24
|
readContract
|
|
25
25
|
} from "../../shared/stacks-msmgyerb.js";
|
|
@@ -33,13 +33,20 @@ import {
|
|
|
33
33
|
} from "../../shared/stacks-tjjnkt3r.js";
|
|
34
34
|
import {
|
|
35
35
|
sponsorTransaction
|
|
36
|
-
} from "../../shared/stacks-
|
|
36
|
+
} from "../../shared/stacks-g67f4w1d.js";
|
|
37
37
|
import {
|
|
38
38
|
estimateFee,
|
|
39
|
+
extendedApiSource,
|
|
40
|
+
getBlockHeight,
|
|
39
41
|
getNonce,
|
|
42
|
+
indexTxSource,
|
|
43
|
+
isFeeTier,
|
|
40
44
|
isProviderAccount,
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
minimumFee,
|
|
46
|
+
resolveFee,
|
|
47
|
+
sendTransaction,
|
|
48
|
+
waitForTransactionReceipt
|
|
49
|
+
} from "../../shared/stacks-kjg7fw4y.js";
|
|
43
50
|
import"../../shared/stacks-709tra19.js";
|
|
44
51
|
import"../../shared/stacks-18jv9aen.js";
|
|
45
52
|
import"../../shared/stacks-g11v9a35.js";
|
|
@@ -55,6 +62,7 @@ export {
|
|
|
55
62
|
watchBlocks,
|
|
56
63
|
watchAddressBalance,
|
|
57
64
|
watchAddress,
|
|
65
|
+
waitForTransactionReceipt,
|
|
58
66
|
transferStx,
|
|
59
67
|
sponsorTransaction,
|
|
60
68
|
simulateTransaction,
|
|
@@ -62,9 +70,14 @@ export {
|
|
|
62
70
|
signTransactionAction,
|
|
63
71
|
signMessage,
|
|
64
72
|
sendTransaction,
|
|
73
|
+
resolveFee,
|
|
65
74
|
readContract,
|
|
66
75
|
multicall,
|
|
76
|
+
minimumFee,
|
|
67
77
|
isProviderAccount,
|
|
78
|
+
isFeeTier,
|
|
79
|
+
indexTxSource,
|
|
80
|
+
getTransaction,
|
|
68
81
|
getNonce,
|
|
69
82
|
getMapEntry,
|
|
70
83
|
getContractAbi,
|
|
@@ -73,11 +86,12 @@ export {
|
|
|
73
86
|
getBlock,
|
|
74
87
|
getBalance,
|
|
75
88
|
getAccountInfo,
|
|
89
|
+
extendedApiSource,
|
|
76
90
|
estimateFee,
|
|
77
91
|
deployContract,
|
|
78
92
|
callContract,
|
|
79
93
|
ContractResponseError
|
|
80
94
|
};
|
|
81
95
|
|
|
82
|
-
//# debugId=
|
|
96
|
+
//# debugId=853E584683991ADA64756E2164756E21
|
|
83
97
|
//# sourceMappingURL=index.js.map
|