@piprail/sdk 1.21.1 → 1.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +6 -0
- package/dist/{algorand-F3OYB534.js → algorand-677ILBQS.js} +1 -1
- package/dist/{algorand-EJ3S2V7E.cjs → algorand-ZJ53VCTN.cjs} +17 -17
- package/dist/{aptos-SUXOVP7B.js → aptos-3TSKTI4D.js} +1 -1
- package/dist/{aptos-GJGIZHNI.cjs → aptos-XIIHPAOO.cjs} +16 -16
- package/dist/{chunk-ILPABTI2.js → chunk-L6WQRHEZ.js} +4 -0
- package/dist/{chunk-PA6YD3HL.cjs → chunk-U35MG4TF.cjs} +14 -10
- package/dist/index.cjs +102 -89
- package/dist/index.d.cts +16 -3
- package/dist/index.d.ts +16 -3
- package/dist/index.js +24 -11
- package/dist/{near-ZJLZE26R.cjs → near-MG256A3E.cjs} +19 -19
- package/dist/{near-LM7S3WUD.js → near-TWA4PYOD.js} +1 -1
- package/dist/{solana-IBVUZS54.js → solana-KWNRY5NR.js} +1 -1
- package/dist/{solana-WG7RGDSI.cjs → solana-UEMHFQH5.cjs} +28 -28
- package/dist/{stellar-XHLLNHQP.cjs → stellar-SCRRPCEA.cjs} +21 -21
- package/dist/{stellar-FIJPQZVW.js → stellar-YB7JXKK4.js} +1 -1
- package/dist/{sui-B7AVN7NK.js → sui-IODKU2MA.js} +1 -1
- package/dist/{sui-6CVLEXLA.cjs → sui-LFT65OGU.cjs} +17 -17
- package/dist/{ton-CHJ26BVA.js → ton-QN5GTOCS.js} +1 -1
- package/dist/{ton-RNEFN25G.cjs → ton-RAYJFKJC.cjs} +14 -14
- package/dist/{tron-TKJHNFGM.cjs → tron-KX4VWS7V.cjs} +24 -24
- package/dist/{tron-DD3JDROV.js → tron-QSNCDYRB.js} +1 -1
- package/dist/{xrpl-GTUPP6SK.js → xrpl-ECHK3GIX.js} +1 -1
- package/dist/{xrpl-XN2NBNGI.cjs → xrpl-GXUFDXHU.cjs} +21 -21
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -5079,8 +5079,13 @@ interface SpendRemaining {
|
|
|
5079
5079
|
remainingFormatted?: string;
|
|
5080
5080
|
}
|
|
5081
5081
|
interface PipRailClientOptions {
|
|
5082
|
-
/**
|
|
5083
|
-
|
|
5082
|
+
/**
|
|
5083
|
+
* Wallet for the chosen chain family. **Optional** — omit it for a READ-ONLY
|
|
5084
|
+
* client that can `quote`, `discover`, `estimateCost`, and `register` (402 Index)
|
|
5085
|
+
* with no key. Paying, planning, or signing then throws {@link WalletRequiredError}
|
|
5086
|
+
* until a wallet is provided. Supplying a wallet is byte-identical to before.
|
|
5087
|
+
*/
|
|
5088
|
+
wallet?: WalletInput;
|
|
5084
5089
|
/** Which chain to pay on. EVM ('bnb'|'base'|…), 'solana', 'ton', 'stellar',
|
|
5085
5090
|
* 'xrpl', 'tron', 'sui', 'near', 'aptos', or 'algorand'. */
|
|
5086
5091
|
chain: ChainSelector;
|
|
@@ -6392,6 +6397,14 @@ declare class UnsupportedSchemeError extends PipRailError {
|
|
|
6392
6397
|
declare class NonReplayableBodyError extends PipRailError {
|
|
6393
6398
|
readonly code = "NON_REPLAYABLE_BODY";
|
|
6394
6399
|
}
|
|
6400
|
+
/**
|
|
6401
|
+
* A wallet-bound operation was called on a READ-ONLY client — one built with no
|
|
6402
|
+
* `wallet`. Read-only clients still `quote`, `discover`, and `register` (402 Index);
|
|
6403
|
+
* paying, planning, or signing needs a wallet. Pass `wallet` to enable them.
|
|
6404
|
+
*/
|
|
6405
|
+
declare class WalletRequiredError extends PipRailError {
|
|
6406
|
+
readonly code = "WALLET_REQUIRED";
|
|
6407
|
+
}
|
|
6395
6408
|
/**
|
|
6396
6409
|
* The chosen chain belongs to one family (EVM, Solana, TON, Stellar, XRPL, Tron,
|
|
6397
6410
|
* Sui, NEAR, Aptos, Algorand) but the wallet, payTo, or token was given in another family's form
|
|
@@ -6780,4 +6793,4 @@ declare const PERMIT2_WITNESS_TYPES: {
|
|
|
6780
6793
|
}];
|
|
6781
6794
|
};
|
|
6782
6795
|
|
|
6783
|
-
export { type AcceptOption, type AddressId, type AgentTool, type AlgorandToken, type AptosToken, type AssetId, type BazaarExtension, type BuildExactParams, CHAINS, type Caip2, type ChainFamily, type ChainInput, type ChainName, type ChainPreset, type ChainSelector, type ChallengeTriage, type ChallengeVerdict, type ConfirmInfo, ConfirmationTimeoutError, type CostEstimate, DIRECTORY_INFO, type DeclineReasonCode, type DeliverAttempt, type DeliverReceiptOptions, type DeliverResult, type DirectoryInfo, type DiscoverOptions, type DiscoveredRail, type DiscoveredResource, type DiscoveryDescriptor, type DiscoverySigner, type DiscoverySource, type DomainClaim, type DomainVerification, EIP3009_TYPES, EXACT_NETWORK_SLUGS, type EvmToken, type ExactAccept, type ExactAuthorization, type ExactAuthorizationWire, type ExactPaymentPayload, type ExactPaymentPayloadAny, type ExactRailOption, type ExpressLikeMiddleware, type ExpressLikeNext, type ExpressLikeRequest, type ExpressLikeResponse, type FacilitatorConfig, type FacilitatorPaymentRequirements, GENERATOR, HEADER_REQUIRED, HEADER_RESPONSE, HEADER_RESPONSE_V1, HEADER_SIGNATURE, HEADER_SIGNATURE_V1, InsufficientFundsError, InvalidEnvelopeError, type ListingVisibility, type ManifestInput, MaxRetriesExceededError, MissingDriverError, type NearToken, NoCompatibleAcceptError, NonReplayableBodyError, type OpenApiDocument, type OpenApiOperation, PERMIT2_ADDRESS, PERMIT2_PROXY_CHAIN_IDS, PERMIT2_WITNESS_TYPES, PIPRAIL_AGENT_GUIDE, type PaidReceipt, type ParsedExactPayment, type PayBlocker, type PayOption, type PayWarning, PaymentDeclinedError, type PaymentDriver, type PaymentGate, type PaymentIntent, type PaymentPlan, type PaymentPolicy, type PaymentRail, type PaymentScheme, PaymentTimeoutError, type Permit2Authorization, type Permit2PaymentPayload, PipRailClient, type PipRailClientOptions, type PipRailCostQuote, PipRailError, type PipRailEvent, type PipRailQuote, type PolicyDecision, type PolicyDenyCode, REGISTER_ATTRIBUTION, RecipientNotReadyError, type RecipientReason, type RegisterInput, type RegisterOptions, type RegisterOutcome, type RequirePaymentOptions, type ResolveOptions, type ResolvedChain, type ResolvedNetwork, type ResolvedToken, type ResourceDescription, type SearchOpenIndexesOptions, type SessionBudget, type SettleOutcome, type SettleViaFacilitatorInput, SettlementError, type SolanaToken, type SpendAssetTotal, type SpendRecord, type SpendRemaining, type SpendSummary, type StellarToken, type SuiToken, type TokenInfo, type TokenInput, type TonToken, type ToolAnnotations, type TronToken, UnknownTokenError, UnsupportedNetworkError, UnsupportedSchemeError, type VerifyErrorCode, type VerifyPaymentResult, type VerifyResult, type WalletBalance, type WalletHandle, type WalletInput, type WellKnownX402, WrongChainError, WrongFamilyError, type X402AcceptEntry, type X402AnyAccept, type X402Challenge, type X402DnsRecord, type X402ExactAcceptEntry, type X402InvalidBody, type X402PaymentSignature, type X402Receipt, type X402ResourceObject, X402_EXACT_PERMIT2_PROXY, type XrplToken, agentGuide, appendAttribution, buildBazaarExtension, buildChallengeHeader, buildExactAuthorization, buildExactSignatureHeader, buildOpenApi, buildReceiptHeader, buildSignatureHeader, buildWellKnownX402, buildX402DnsTxt, chainIdForExactNetwork, claim402IndexDomain, classifyChallenge, createPaymentGate, decorateOutcome, deliverReceipt, eip3009Abi, encodeXPaymentHeader, evaluatePolicy, explainDecline, formatSpendReport, getDirectoryInfo, isPermit2ProxyChain, normalizeNetwork, parseChallenge, parseExactPaymentHeader, parseExactRequirements, parseReceipt, parseSettleResponse, parseSignatureHeader, paymentTools, pickAccept, planAcross, readExactDomain, register402Index, registerDriver, registerX402Scan, requirePayment, resolveChain, searchOpenIndexes, settleViaFacilitator, summarizePlan, toInsufficientFundsError, toInvalidBody, verify402IndexDomain };
|
|
6796
|
+
export { type AcceptOption, type AddressId, type AgentTool, type AlgorandToken, type AptosToken, type AssetId, type BazaarExtension, type BuildExactParams, CHAINS, type Caip2, type ChainFamily, type ChainInput, type ChainName, type ChainPreset, type ChainSelector, type ChallengeTriage, type ChallengeVerdict, type ConfirmInfo, ConfirmationTimeoutError, type CostEstimate, DIRECTORY_INFO, type DeclineReasonCode, type DeliverAttempt, type DeliverReceiptOptions, type DeliverResult, type DirectoryInfo, type DiscoverOptions, type DiscoveredRail, type DiscoveredResource, type DiscoveryDescriptor, type DiscoverySigner, type DiscoverySource, type DomainClaim, type DomainVerification, EIP3009_TYPES, EXACT_NETWORK_SLUGS, type EvmToken, type ExactAccept, type ExactAuthorization, type ExactAuthorizationWire, type ExactPaymentPayload, type ExactPaymentPayloadAny, type ExactRailOption, type ExpressLikeMiddleware, type ExpressLikeNext, type ExpressLikeRequest, type ExpressLikeResponse, type FacilitatorConfig, type FacilitatorPaymentRequirements, GENERATOR, HEADER_REQUIRED, HEADER_RESPONSE, HEADER_RESPONSE_V1, HEADER_SIGNATURE, HEADER_SIGNATURE_V1, InsufficientFundsError, InvalidEnvelopeError, type ListingVisibility, type ManifestInput, MaxRetriesExceededError, MissingDriverError, type NearToken, NoCompatibleAcceptError, NonReplayableBodyError, type OpenApiDocument, type OpenApiOperation, PERMIT2_ADDRESS, PERMIT2_PROXY_CHAIN_IDS, PERMIT2_WITNESS_TYPES, PIPRAIL_AGENT_GUIDE, type PaidReceipt, type ParsedExactPayment, type PayBlocker, type PayOption, type PayWarning, PaymentDeclinedError, type PaymentDriver, type PaymentGate, type PaymentIntent, type PaymentPlan, type PaymentPolicy, type PaymentRail, type PaymentScheme, PaymentTimeoutError, type Permit2Authorization, type Permit2PaymentPayload, PipRailClient, type PipRailClientOptions, type PipRailCostQuote, PipRailError, type PipRailEvent, type PipRailQuote, type PolicyDecision, type PolicyDenyCode, REGISTER_ATTRIBUTION, RecipientNotReadyError, type RecipientReason, type RegisterInput, type RegisterOptions, type RegisterOutcome, type RequirePaymentOptions, type ResolveOptions, type ResolvedChain, type ResolvedNetwork, type ResolvedToken, type ResourceDescription, type SearchOpenIndexesOptions, type SessionBudget, type SettleOutcome, type SettleViaFacilitatorInput, SettlementError, type SolanaToken, type SpendAssetTotal, type SpendRecord, type SpendRemaining, type SpendSummary, type StellarToken, type SuiToken, type TokenInfo, type TokenInput, type TonToken, type ToolAnnotations, type TronToken, UnknownTokenError, UnsupportedNetworkError, UnsupportedSchemeError, type VerifyErrorCode, type VerifyPaymentResult, type VerifyResult, type WalletBalance, type WalletHandle, type WalletInput, WalletRequiredError, type WellKnownX402, WrongChainError, WrongFamilyError, type X402AcceptEntry, type X402AnyAccept, type X402Challenge, type X402DnsRecord, type X402ExactAcceptEntry, type X402InvalidBody, type X402PaymentSignature, type X402Receipt, type X402ResourceObject, X402_EXACT_PERMIT2_PROXY, type XrplToken, agentGuide, appendAttribution, buildBazaarExtension, buildChallengeHeader, buildExactAuthorization, buildExactSignatureHeader, buildOpenApi, buildReceiptHeader, buildSignatureHeader, buildWellKnownX402, buildX402DnsTxt, chainIdForExactNetwork, claim402IndexDomain, classifyChallenge, createPaymentGate, decorateOutcome, deliverReceipt, eip3009Abi, encodeXPaymentHeader, evaluatePolicy, explainDecline, formatSpendReport, getDirectoryInfo, isPermit2ProxyChain, normalizeNetwork, parseChallenge, parseExactPaymentHeader, parseExactRequirements, parseReceipt, parseSettleResponse, parseSignatureHeader, paymentTools, pickAccept, planAcross, readExactDomain, register402Index, registerDriver, registerX402Scan, requirePayment, resolveChain, searchOpenIndexes, settleViaFacilitator, summarizePlan, toInsufficientFundsError, toInvalidBody, verify402IndexDomain };
|
package/dist/index.d.ts
CHANGED
|
@@ -5079,8 +5079,13 @@ interface SpendRemaining {
|
|
|
5079
5079
|
remainingFormatted?: string;
|
|
5080
5080
|
}
|
|
5081
5081
|
interface PipRailClientOptions {
|
|
5082
|
-
/**
|
|
5083
|
-
|
|
5082
|
+
/**
|
|
5083
|
+
* Wallet for the chosen chain family. **Optional** — omit it for a READ-ONLY
|
|
5084
|
+
* client that can `quote`, `discover`, `estimateCost`, and `register` (402 Index)
|
|
5085
|
+
* with no key. Paying, planning, or signing then throws {@link WalletRequiredError}
|
|
5086
|
+
* until a wallet is provided. Supplying a wallet is byte-identical to before.
|
|
5087
|
+
*/
|
|
5088
|
+
wallet?: WalletInput;
|
|
5084
5089
|
/** Which chain to pay on. EVM ('bnb'|'base'|…), 'solana', 'ton', 'stellar',
|
|
5085
5090
|
* 'xrpl', 'tron', 'sui', 'near', 'aptos', or 'algorand'. */
|
|
5086
5091
|
chain: ChainSelector;
|
|
@@ -6392,6 +6397,14 @@ declare class UnsupportedSchemeError extends PipRailError {
|
|
|
6392
6397
|
declare class NonReplayableBodyError extends PipRailError {
|
|
6393
6398
|
readonly code = "NON_REPLAYABLE_BODY";
|
|
6394
6399
|
}
|
|
6400
|
+
/**
|
|
6401
|
+
* A wallet-bound operation was called on a READ-ONLY client — one built with no
|
|
6402
|
+
* `wallet`. Read-only clients still `quote`, `discover`, and `register` (402 Index);
|
|
6403
|
+
* paying, planning, or signing needs a wallet. Pass `wallet` to enable them.
|
|
6404
|
+
*/
|
|
6405
|
+
declare class WalletRequiredError extends PipRailError {
|
|
6406
|
+
readonly code = "WALLET_REQUIRED";
|
|
6407
|
+
}
|
|
6395
6408
|
/**
|
|
6396
6409
|
* The chosen chain belongs to one family (EVM, Solana, TON, Stellar, XRPL, Tron,
|
|
6397
6410
|
* Sui, NEAR, Aptos, Algorand) but the wallet, payTo, or token was given in another family's form
|
|
@@ -6780,4 +6793,4 @@ declare const PERMIT2_WITNESS_TYPES: {
|
|
|
6780
6793
|
}];
|
|
6781
6794
|
};
|
|
6782
6795
|
|
|
6783
|
-
export { type AcceptOption, type AddressId, type AgentTool, type AlgorandToken, type AptosToken, type AssetId, type BazaarExtension, type BuildExactParams, CHAINS, type Caip2, type ChainFamily, type ChainInput, type ChainName, type ChainPreset, type ChainSelector, type ChallengeTriage, type ChallengeVerdict, type ConfirmInfo, ConfirmationTimeoutError, type CostEstimate, DIRECTORY_INFO, type DeclineReasonCode, type DeliverAttempt, type DeliverReceiptOptions, type DeliverResult, type DirectoryInfo, type DiscoverOptions, type DiscoveredRail, type DiscoveredResource, type DiscoveryDescriptor, type DiscoverySigner, type DiscoverySource, type DomainClaim, type DomainVerification, EIP3009_TYPES, EXACT_NETWORK_SLUGS, type EvmToken, type ExactAccept, type ExactAuthorization, type ExactAuthorizationWire, type ExactPaymentPayload, type ExactPaymentPayloadAny, type ExactRailOption, type ExpressLikeMiddleware, type ExpressLikeNext, type ExpressLikeRequest, type ExpressLikeResponse, type FacilitatorConfig, type FacilitatorPaymentRequirements, GENERATOR, HEADER_REQUIRED, HEADER_RESPONSE, HEADER_RESPONSE_V1, HEADER_SIGNATURE, HEADER_SIGNATURE_V1, InsufficientFundsError, InvalidEnvelopeError, type ListingVisibility, type ManifestInput, MaxRetriesExceededError, MissingDriverError, type NearToken, NoCompatibleAcceptError, NonReplayableBodyError, type OpenApiDocument, type OpenApiOperation, PERMIT2_ADDRESS, PERMIT2_PROXY_CHAIN_IDS, PERMIT2_WITNESS_TYPES, PIPRAIL_AGENT_GUIDE, type PaidReceipt, type ParsedExactPayment, type PayBlocker, type PayOption, type PayWarning, PaymentDeclinedError, type PaymentDriver, type PaymentGate, type PaymentIntent, type PaymentPlan, type PaymentPolicy, type PaymentRail, type PaymentScheme, PaymentTimeoutError, type Permit2Authorization, type Permit2PaymentPayload, PipRailClient, type PipRailClientOptions, type PipRailCostQuote, PipRailError, type PipRailEvent, type PipRailQuote, type PolicyDecision, type PolicyDenyCode, REGISTER_ATTRIBUTION, RecipientNotReadyError, type RecipientReason, type RegisterInput, type RegisterOptions, type RegisterOutcome, type RequirePaymentOptions, type ResolveOptions, type ResolvedChain, type ResolvedNetwork, type ResolvedToken, type ResourceDescription, type SearchOpenIndexesOptions, type SessionBudget, type SettleOutcome, type SettleViaFacilitatorInput, SettlementError, type SolanaToken, type SpendAssetTotal, type SpendRecord, type SpendRemaining, type SpendSummary, type StellarToken, type SuiToken, type TokenInfo, type TokenInput, type TonToken, type ToolAnnotations, type TronToken, UnknownTokenError, UnsupportedNetworkError, UnsupportedSchemeError, type VerifyErrorCode, type VerifyPaymentResult, type VerifyResult, type WalletBalance, type WalletHandle, type WalletInput, type WellKnownX402, WrongChainError, WrongFamilyError, type X402AcceptEntry, type X402AnyAccept, type X402Challenge, type X402DnsRecord, type X402ExactAcceptEntry, type X402InvalidBody, type X402PaymentSignature, type X402Receipt, type X402ResourceObject, X402_EXACT_PERMIT2_PROXY, type XrplToken, agentGuide, appendAttribution, buildBazaarExtension, buildChallengeHeader, buildExactAuthorization, buildExactSignatureHeader, buildOpenApi, buildReceiptHeader, buildSignatureHeader, buildWellKnownX402, buildX402DnsTxt, chainIdForExactNetwork, claim402IndexDomain, classifyChallenge, createPaymentGate, decorateOutcome, deliverReceipt, eip3009Abi, encodeXPaymentHeader, evaluatePolicy, explainDecline, formatSpendReport, getDirectoryInfo, isPermit2ProxyChain, normalizeNetwork, parseChallenge, parseExactPaymentHeader, parseExactRequirements, parseReceipt, parseSettleResponse, parseSignatureHeader, paymentTools, pickAccept, planAcross, readExactDomain, register402Index, registerDriver, registerX402Scan, requirePayment, resolveChain, searchOpenIndexes, settleViaFacilitator, summarizePlan, toInsufficientFundsError, toInvalidBody, verify402IndexDomain };
|
|
6796
|
+
export { type AcceptOption, type AddressId, type AgentTool, type AlgorandToken, type AptosToken, type AssetId, type BazaarExtension, type BuildExactParams, CHAINS, type Caip2, type ChainFamily, type ChainInput, type ChainName, type ChainPreset, type ChainSelector, type ChallengeTriage, type ChallengeVerdict, type ConfirmInfo, ConfirmationTimeoutError, type CostEstimate, DIRECTORY_INFO, type DeclineReasonCode, type DeliverAttempt, type DeliverReceiptOptions, type DeliverResult, type DirectoryInfo, type DiscoverOptions, type DiscoveredRail, type DiscoveredResource, type DiscoveryDescriptor, type DiscoverySigner, type DiscoverySource, type DomainClaim, type DomainVerification, EIP3009_TYPES, EXACT_NETWORK_SLUGS, type EvmToken, type ExactAccept, type ExactAuthorization, type ExactAuthorizationWire, type ExactPaymentPayload, type ExactPaymentPayloadAny, type ExactRailOption, type ExpressLikeMiddleware, type ExpressLikeNext, type ExpressLikeRequest, type ExpressLikeResponse, type FacilitatorConfig, type FacilitatorPaymentRequirements, GENERATOR, HEADER_REQUIRED, HEADER_RESPONSE, HEADER_RESPONSE_V1, HEADER_SIGNATURE, HEADER_SIGNATURE_V1, InsufficientFundsError, InvalidEnvelopeError, type ListingVisibility, type ManifestInput, MaxRetriesExceededError, MissingDriverError, type NearToken, NoCompatibleAcceptError, NonReplayableBodyError, type OpenApiDocument, type OpenApiOperation, PERMIT2_ADDRESS, PERMIT2_PROXY_CHAIN_IDS, PERMIT2_WITNESS_TYPES, PIPRAIL_AGENT_GUIDE, type PaidReceipt, type ParsedExactPayment, type PayBlocker, type PayOption, type PayWarning, PaymentDeclinedError, type PaymentDriver, type PaymentGate, type PaymentIntent, type PaymentPlan, type PaymentPolicy, type PaymentRail, type PaymentScheme, PaymentTimeoutError, type Permit2Authorization, type Permit2PaymentPayload, PipRailClient, type PipRailClientOptions, type PipRailCostQuote, PipRailError, type PipRailEvent, type PipRailQuote, type PolicyDecision, type PolicyDenyCode, REGISTER_ATTRIBUTION, RecipientNotReadyError, type RecipientReason, type RegisterInput, type RegisterOptions, type RegisterOutcome, type RequirePaymentOptions, type ResolveOptions, type ResolvedChain, type ResolvedNetwork, type ResolvedToken, type ResourceDescription, type SearchOpenIndexesOptions, type SessionBudget, type SettleOutcome, type SettleViaFacilitatorInput, SettlementError, type SolanaToken, type SpendAssetTotal, type SpendRecord, type SpendRemaining, type SpendSummary, type StellarToken, type SuiToken, type TokenInfo, type TokenInput, type TonToken, type ToolAnnotations, type TronToken, UnknownTokenError, UnsupportedNetworkError, UnsupportedSchemeError, type VerifyErrorCode, type VerifyPaymentResult, type VerifyResult, type WalletBalance, type WalletHandle, type WalletInput, WalletRequiredError, type WellKnownX402, WrongChainError, WrongFamilyError, type X402AcceptEntry, type X402AnyAccept, type X402Challenge, type X402DnsRecord, type X402ExactAcceptEntry, type X402InvalidBody, type X402PaymentSignature, type X402Receipt, type X402ResourceObject, X402_EXACT_PERMIT2_PROXY, type XrplToken, agentGuide, appendAttribution, buildBazaarExtension, buildChallengeHeader, buildExactAuthorization, buildExactSignatureHeader, buildOpenApi, buildReceiptHeader, buildSignatureHeader, buildWellKnownX402, buildX402DnsTxt, chainIdForExactNetwork, claim402IndexDomain, classifyChallenge, createPaymentGate, decorateOutcome, deliverReceipt, eip3009Abi, encodeXPaymentHeader, evaluatePolicy, explainDecline, formatSpendReport, getDirectoryInfo, isPermit2ProxyChain, normalizeNetwork, parseChallenge, parseExactPaymentHeader, parseExactRequirements, parseReceipt, parseSettleResponse, parseSignatureHeader, paymentTools, pickAccept, planAcross, readExactDomain, register402Index, registerDriver, registerX402Scan, requirePayment, resolveChain, searchOpenIndexes, settleViaFacilitator, summarizePlan, toInsufficientFundsError, toInvalidBody, verify402IndexDomain };
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
UnknownTokenError,
|
|
15
15
|
UnsupportedNetworkError,
|
|
16
16
|
UnsupportedSchemeError,
|
|
17
|
+
WalletRequiredError,
|
|
17
18
|
WrongChainError,
|
|
18
19
|
WrongFamilyError,
|
|
19
20
|
floorUnits,
|
|
@@ -22,7 +23,7 @@ import {
|
|
|
22
23
|
parseUnits,
|
|
23
24
|
rejectForeignToken,
|
|
24
25
|
toInsufficientFundsError
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-L6WQRHEZ.js";
|
|
26
27
|
|
|
27
28
|
// src/drivers/registry.ts
|
|
28
29
|
var byFamily = /* @__PURE__ */ new Map();
|
|
@@ -1795,7 +1796,7 @@ var loaders = {
|
|
|
1795
1796
|
solana: async () => {
|
|
1796
1797
|
let mod;
|
|
1797
1798
|
try {
|
|
1798
|
-
mod = await import("./solana-
|
|
1799
|
+
mod = await import("./solana-KWNRY5NR.js");
|
|
1799
1800
|
} catch (cause) {
|
|
1800
1801
|
throw new MissingDriverError(
|
|
1801
1802
|
`Solana selected, but its packages aren't installed. Run: npm install @solana/web3.js @solana/spl-token bs58`,
|
|
@@ -1807,7 +1808,7 @@ var loaders = {
|
|
|
1807
1808
|
ton: async () => {
|
|
1808
1809
|
let mod;
|
|
1809
1810
|
try {
|
|
1810
|
-
mod = await import("./ton-
|
|
1811
|
+
mod = await import("./ton-QN5GTOCS.js");
|
|
1811
1812
|
} catch (cause) {
|
|
1812
1813
|
throw new MissingDriverError(
|
|
1813
1814
|
`TON selected, but its packages aren't installed. Run: npm install @ton/ton @ton/core @ton/crypto`,
|
|
@@ -1819,7 +1820,7 @@ var loaders = {
|
|
|
1819
1820
|
stellar: async () => {
|
|
1820
1821
|
let mod;
|
|
1821
1822
|
try {
|
|
1822
|
-
mod = await import("./stellar-
|
|
1823
|
+
mod = await import("./stellar-YB7JXKK4.js");
|
|
1823
1824
|
} catch (cause) {
|
|
1824
1825
|
throw new MissingDriverError(
|
|
1825
1826
|
`Stellar selected, but its package isn't installed. Run: npm install @stellar/stellar-sdk`,
|
|
@@ -1831,7 +1832,7 @@ var loaders = {
|
|
|
1831
1832
|
xrpl: async () => {
|
|
1832
1833
|
let mod;
|
|
1833
1834
|
try {
|
|
1834
|
-
mod = await import("./xrpl-
|
|
1835
|
+
mod = await import("./xrpl-ECHK3GIX.js");
|
|
1835
1836
|
} catch (cause) {
|
|
1836
1837
|
throw new MissingDriverError(
|
|
1837
1838
|
`XRPL selected, but its package isn't installed. Run: npm install xrpl`,
|
|
@@ -1843,7 +1844,7 @@ var loaders = {
|
|
|
1843
1844
|
tron: async () => {
|
|
1844
1845
|
let mod;
|
|
1845
1846
|
try {
|
|
1846
|
-
mod = await import("./tron-
|
|
1847
|
+
mod = await import("./tron-QSNCDYRB.js");
|
|
1847
1848
|
} catch (cause) {
|
|
1848
1849
|
throw new MissingDriverError(
|
|
1849
1850
|
`Tron selected, but its package isn't installed. Run: npm install tronweb`,
|
|
@@ -1855,7 +1856,7 @@ var loaders = {
|
|
|
1855
1856
|
sui: async () => {
|
|
1856
1857
|
let mod;
|
|
1857
1858
|
try {
|
|
1858
|
-
mod = await import("./sui-
|
|
1859
|
+
mod = await import("./sui-IODKU2MA.js");
|
|
1859
1860
|
} catch (cause) {
|
|
1860
1861
|
throw new MissingDriverError(
|
|
1861
1862
|
`Sui selected, but its package isn't installed. Run: npm install @mysten/sui`,
|
|
@@ -1867,7 +1868,7 @@ var loaders = {
|
|
|
1867
1868
|
near: async () => {
|
|
1868
1869
|
let mod;
|
|
1869
1870
|
try {
|
|
1870
|
-
mod = await import("./near-
|
|
1871
|
+
mod = await import("./near-TWA4PYOD.js");
|
|
1871
1872
|
} catch (cause) {
|
|
1872
1873
|
throw new MissingDriverError(
|
|
1873
1874
|
`NEAR selected, but its package isn't installed. Run: npm install near-api-js`,
|
|
@@ -1879,7 +1880,7 @@ var loaders = {
|
|
|
1879
1880
|
aptos: async () => {
|
|
1880
1881
|
let mod;
|
|
1881
1882
|
try {
|
|
1882
|
-
mod = await import("./aptos-
|
|
1883
|
+
mod = await import("./aptos-3TSKTI4D.js");
|
|
1883
1884
|
} catch (cause) {
|
|
1884
1885
|
throw new MissingDriverError(
|
|
1885
1886
|
`Aptos selected, but its package isn't installed. Run: npm install @aptos-labs/ts-sdk`,
|
|
@@ -1891,7 +1892,7 @@ var loaders = {
|
|
|
1891
1892
|
algorand: async () => {
|
|
1892
1893
|
let mod;
|
|
1893
1894
|
try {
|
|
1894
|
-
mod = await import("./algorand-
|
|
1895
|
+
mod = await import("./algorand-677ILBQS.js");
|
|
1895
1896
|
} catch (cause) {
|
|
1896
1897
|
throw new MissingDriverError(
|
|
1897
1898
|
`Algorand selected, but its package isn't installed. Run: npm install algosdk`,
|
|
@@ -2626,7 +2627,7 @@ var PipRailClient = class {
|
|
|
2626
2627
|
chain: this.opts.chain,
|
|
2627
2628
|
rpcUrl: this.opts.rpcUrl
|
|
2628
2629
|
});
|
|
2629
|
-
const wallet = net.bindWallet(this.opts.wallet);
|
|
2630
|
+
const wallet = this.opts.wallet !== void 0 ? net.bindWallet(this.opts.wallet) : void 0;
|
|
2630
2631
|
return { net, wallet };
|
|
2631
2632
|
})();
|
|
2632
2633
|
}
|
|
@@ -2792,6 +2793,11 @@ var PipRailClient = class {
|
|
|
2792
2793
|
throw new InvalidEnvelopeError("402 response did not include a parseable x402 challenge.");
|
|
2793
2794
|
}
|
|
2794
2795
|
const { net, wallet } = await this.ensure();
|
|
2796
|
+
if (!wallet) {
|
|
2797
|
+
throw new WalletRequiredError(
|
|
2798
|
+
"planPayment needs a wallet (it checks YOUR balance, gas, and recipient-readiness). This client is read-only \u2014 construct it with a `wallet` to plan or pay."
|
|
2799
|
+
);
|
|
2800
|
+
}
|
|
2795
2801
|
return this.planFromChallenge(net, wallet, challenge, url, this.resolveSchemes());
|
|
2796
2802
|
}
|
|
2797
2803
|
/**
|
|
@@ -2943,6 +2949,7 @@ var PipRailClient = class {
|
|
|
2943
2949
|
*/
|
|
2944
2950
|
async discoverySigner() {
|
|
2945
2951
|
const { net, wallet } = await this.ensure();
|
|
2952
|
+
if (!wallet) return null;
|
|
2946
2953
|
return net.discoverySigner ? net.discoverySigner(wallet) : null;
|
|
2947
2954
|
}
|
|
2948
2955
|
/**
|
|
@@ -2964,6 +2971,11 @@ var PipRailClient = class {
|
|
|
2964
2971
|
const schemes = this.resolveSchemes(init?.schemes);
|
|
2965
2972
|
const resolved = await this.resolveChallenge(url, firstResponse, schemes);
|
|
2966
2973
|
const { net, wallet, challenge } = resolved;
|
|
2974
|
+
if (!wallet) {
|
|
2975
|
+
throw new WalletRequiredError(
|
|
2976
|
+
"Paying a 402 needs a wallet to sign + settle. This client is read-only \u2014 construct it with a `wallet` to pay (quote/discover/register still work without one)."
|
|
2977
|
+
);
|
|
2978
|
+
}
|
|
2967
2979
|
let accept = resolved.accept;
|
|
2968
2980
|
let quote = resolved.quote;
|
|
2969
2981
|
const autoRoute = init?.autoRoute ?? this.opts.autoRoute ?? false;
|
|
@@ -4760,6 +4772,7 @@ export {
|
|
|
4760
4772
|
UnknownTokenError,
|
|
4761
4773
|
UnsupportedNetworkError,
|
|
4762
4774
|
UnsupportedSchemeError,
|
|
4775
|
+
WalletRequiredError,
|
|
4763
4776
|
WrongChainError,
|
|
4764
4777
|
WrongFamilyError,
|
|
4765
4778
|
X402_EXACT_PERMIT2_PROXY,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkU35MG4TFcjs = require('./chunk-U35MG4TF.cjs');
|
|
11
11
|
|
|
12
12
|
// src/drivers/near/index.ts
|
|
13
13
|
var _nearapijs = require('near-api-js');
|
|
@@ -53,18 +53,18 @@ async function payNear(params) {
|
|
|
53
53
|
return res.hash;
|
|
54
54
|
} catch (err) {
|
|
55
55
|
if (isNearRegistrationError(err)) {
|
|
56
|
-
throw new (0,
|
|
56
|
+
throw new (0, _chunkU35MG4TFcjs.RecipientNotReadyError)(
|
|
57
57
|
`NEAR recipient ${accept.payTo} isn't registered on token ${accept.asset} (NEP-145 storage_deposit) \u2014 register it once (\u22480.00125 NEAR) before it can receive. (NEAR: not registered)`,
|
|
58
58
|
{ cause: err }
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
if (isNearAffordability(err)) {
|
|
62
|
-
throw new (0,
|
|
62
|
+
throw new (0, _chunkU35MG4TFcjs.InsufficientFundsError)(
|
|
63
63
|
err instanceof Error ? err.message : "Insufficient NEAR balance for the payment.",
|
|
64
64
|
{ cause: err }
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
|
-
throw _nullishCoalesce(
|
|
67
|
+
throw _nullishCoalesce(_chunkU35MG4TFcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
async function payNearNative(params) {
|
|
@@ -74,12 +74,12 @@ async function payNearNative(params) {
|
|
|
74
74
|
return res.hash;
|
|
75
75
|
} catch (err) {
|
|
76
76
|
if (isNearAffordability(err)) {
|
|
77
|
-
throw new (0,
|
|
77
|
+
throw new (0, _chunkU35MG4TFcjs.InsufficientFundsError)(
|
|
78
78
|
err instanceof Error ? err.message : "Insufficient NEAR balance for the payment.",
|
|
79
79
|
{ cause: err }
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
|
-
throw _nullishCoalesce(
|
|
82
|
+
throw _nullishCoalesce(_chunkU35MG4TFcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
function isNearRegistrationError(err) {
|
|
@@ -216,22 +216,22 @@ function txNotFound(hash) {
|
|
|
216
216
|
|
|
217
217
|
function assertNearWallet(wallet, network) {
|
|
218
218
|
if (typeof wallet !== "object" || wallet === null) {
|
|
219
|
-
throw new (0,
|
|
219
|
+
throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
|
|
220
220
|
`chain ${network} is NEAR; wallet must be { accountId, privateKey } (privateKey = ed25519:\u2026).`
|
|
221
221
|
);
|
|
222
222
|
}
|
|
223
223
|
if ("walletClient" in wallet) {
|
|
224
|
-
throw new (0,
|
|
224
|
+
throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
|
|
225
225
|
`chain ${network} is NEAR; a viem { walletClient } can't be used \u2014 pass { accountId, privateKey }.`
|
|
226
226
|
);
|
|
227
227
|
}
|
|
228
228
|
if ("secretKey" in wallet || "signer" in wallet || "mnemonic" in wallet || "keyPair" in wallet || "secret" in wallet || "seed" in wallet || "keypair" in wallet) {
|
|
229
|
-
throw new (0,
|
|
229
|
+
throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
|
|
230
230
|
`chain ${network} is NEAR; that looks like another family's wallet \u2014 pass { accountId, privateKey }.`
|
|
231
231
|
);
|
|
232
232
|
}
|
|
233
233
|
if (!("accountId" in wallet) || !("privateKey" in wallet)) {
|
|
234
|
-
throw new (0,
|
|
234
|
+
throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
|
|
235
235
|
`chain ${network} is NEAR; wallet must be { accountId, privateKey } (privateKey = ed25519:\u2026).`
|
|
236
236
|
);
|
|
237
237
|
}
|
|
@@ -239,13 +239,13 @@ function assertNearWallet(wallet, network) {
|
|
|
239
239
|
}
|
|
240
240
|
function resolveNearWallet(config) {
|
|
241
241
|
if (!config.accountId || !config.privateKey) {
|
|
242
|
-
throw new (0,
|
|
242
|
+
throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)("NEAR wallet needs { accountId, privateKey } (privateKey = ed25519:\u2026).");
|
|
243
243
|
}
|
|
244
244
|
let signer;
|
|
245
245
|
try {
|
|
246
246
|
signer = _nearapijs.KeyPairSigner.fromSecretKey(config.privateKey);
|
|
247
247
|
} catch (cause) {
|
|
248
|
-
throw new (0,
|
|
248
|
+
throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)("NEAR wallet { privateKey } is not a valid ed25519:\u2026 secret key.", {
|
|
249
249
|
cause
|
|
250
250
|
});
|
|
251
251
|
}
|
|
@@ -312,16 +312,16 @@ function makeNearNetwork(preset, rpcUrl) {
|
|
|
312
312
|
const info = preset.tokens[token.toUpperCase()];
|
|
313
313
|
if (!info) {
|
|
314
314
|
const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
|
|
315
|
-
throw new (0,
|
|
315
|
+
throw new (0, _chunkU35MG4TFcjs.UnknownTokenError)(
|
|
316
316
|
`token "${token}" isn't built in for NEAR (known: ${known}). Pass { contractId, decimals } for a custom NEP-141.`
|
|
317
317
|
);
|
|
318
318
|
}
|
|
319
319
|
return { asset: info.contractId, decimals: info.decimals, symbol: info.symbol };
|
|
320
320
|
}
|
|
321
|
-
|
|
321
|
+
_chunkU35MG4TFcjs.rejectForeignToken.call(void 0, token, "near", network);
|
|
322
322
|
const t = token;
|
|
323
323
|
if (!t.contractId || typeof t.decimals !== "number") {
|
|
324
|
-
throw new (0,
|
|
324
|
+
throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
|
|
325
325
|
`chain ${network} is NEAR; a custom token must be { contractId, decimals }.`
|
|
326
326
|
);
|
|
327
327
|
}
|
|
@@ -340,12 +340,12 @@ function makeNearNetwork(preset, rpcUrl) {
|
|
|
340
340
|
},
|
|
341
341
|
assertValidPayTo(payTo) {
|
|
342
342
|
if (payTo.startsWith("0x")) {
|
|
343
|
-
throw new (0,
|
|
343
|
+
throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
|
|
344
344
|
`chain ${network} is NEAR, but payTo "${payTo}" looks like an EVM/Sui 0x address.`
|
|
345
345
|
);
|
|
346
346
|
}
|
|
347
347
|
if (!isValidNearAccountId(payTo)) {
|
|
348
|
-
throw new (0,
|
|
348
|
+
throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
|
|
349
349
|
`chain ${network} is NEAR, but payTo "${payTo}" is not a valid NEAR account id.`
|
|
350
350
|
);
|
|
351
351
|
}
|
|
@@ -389,10 +389,10 @@ function makeNearNetwork(preset, rpcUrl) {
|
|
|
389
389
|
if (tx && tx.success) return { height: "0" };
|
|
390
390
|
} catch (e7) {
|
|
391
391
|
}
|
|
392
|
-
throw new (0,
|
|
392
|
+
throw new (0, _chunkU35MG4TFcjs.ConfirmationTimeoutError)(`NEAR tx ${hash} not confirmed in time.`);
|
|
393
393
|
},
|
|
394
394
|
async estimateCost() {
|
|
395
|
-
return
|
|
395
|
+
return _chunkU35MG4TFcjs.nativeCost.call(void 0, {
|
|
396
396
|
symbol: "NEAR",
|
|
397
397
|
decimals: NEAR_DECIMALS,
|
|
398
398
|
fee: 1500000000000000000000n,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkU35MG4TFcjs = require('./chunk-U35MG4TF.cjs');
|
|
11
11
|
|
|
12
12
|
// src/drivers/solana/index.ts
|
|
13
13
|
var _web3js = require('@solana/web3.js');
|
|
@@ -229,15 +229,15 @@ function isEmptySig(sig) {
|
|
|
229
229
|
async function payExactSolana(input) {
|
|
230
230
|
const { connection, keypair, accept } = input;
|
|
231
231
|
if (accept.asset === "native") {
|
|
232
|
-
throw new (0,
|
|
232
|
+
throw new (0, _chunkU35MG4TFcjs.UnsupportedSchemeError)(
|
|
233
233
|
"SVM exact is SPL-token only (TransferChecked); native SOL is not exact-payable. Pay via onchain-proof."
|
|
234
234
|
);
|
|
235
235
|
}
|
|
236
236
|
if (!accept.extra.feePayer) {
|
|
237
|
-
throw new (0,
|
|
237
|
+
throw new (0, _chunkU35MG4TFcjs.UnsupportedSchemeError)("SVM exact rail must advertise extra.feePayer (the merchant sponsor key).");
|
|
238
238
|
}
|
|
239
239
|
if (accept.extra.decimals === void 0) {
|
|
240
|
-
throw new (0,
|
|
240
|
+
throw new (0, _chunkU35MG4TFcjs.UnsupportedSchemeError)("SVM exact rail must advertise extra.decimals for the TransferChecked.");
|
|
241
241
|
}
|
|
242
242
|
let feePayer;
|
|
243
243
|
let mint;
|
|
@@ -247,12 +247,12 @@ async function payExactSolana(input) {
|
|
|
247
247
|
mint = new (0, _web3js.PublicKey)(accept.asset);
|
|
248
248
|
payTo = new (0, _web3js.PublicKey)(accept.payTo);
|
|
249
249
|
} catch (err) {
|
|
250
|
-
throw new (0,
|
|
250
|
+
throw new (0, _chunkU35MG4TFcjs.UnsupportedSchemeError)(
|
|
251
251
|
`SVM exact: bad feePayer/asset/payTo (${err instanceof Error ? err.message : String(err)}).`
|
|
252
252
|
);
|
|
253
253
|
}
|
|
254
254
|
if (feePayer.equals(payTo)) {
|
|
255
|
-
throw new (0,
|
|
255
|
+
throw new (0, _chunkU35MG4TFcjs.UnsupportedSchemeError)(
|
|
256
256
|
"SVM exact: the fee payer must differ from payTo \u2014 payTo appears in the transfer instruction, which the fee payer must not (a scheme MUST-rule). Use a separate relayer key for the gate."
|
|
257
257
|
);
|
|
258
258
|
}
|
|
@@ -266,7 +266,7 @@ async function payExactSolana(input) {
|
|
|
266
266
|
destInfo = "unknown";
|
|
267
267
|
}
|
|
268
268
|
if (destInfo === null) {
|
|
269
|
-
throw new (0,
|
|
269
|
+
throw new (0, _chunkU35MG4TFcjs.UnsupportedSchemeError)(
|
|
270
270
|
`SVM exact: the recipient's token account for ${mint.toBase58()} doesn't exist yet \u2014 the exact rail can't create it. Pay via onchain-proof (which creates it), or have ${payTo.toBase58()} create its associated token account first.`
|
|
271
271
|
);
|
|
272
272
|
}
|
|
@@ -294,11 +294,11 @@ async function payExactSolana(input) {
|
|
|
294
294
|
tx.sign([keypair]);
|
|
295
295
|
const buyerIndex = message.staticAccountKeys.findIndex((k) => k.equals(keypair.publicKey));
|
|
296
296
|
if (buyerIndex < 1 || buyerIndex >= message.header.numRequiredSignatures) {
|
|
297
|
-
throw new (0,
|
|
297
|
+
throw new (0, _chunkU35MG4TFcjs.UnsupportedSchemeError)("SVM exact: could not locate the buyer signer slot.");
|
|
298
298
|
}
|
|
299
299
|
const buyerSig = tx.signatures[buyerIndex];
|
|
300
300
|
if (!buyerSig || isEmptySig(buyerSig)) {
|
|
301
|
-
throw new (0,
|
|
301
|
+
throw new (0, _chunkU35MG4TFcjs.UnsupportedSchemeError)("SVM exact: the wallet did not produce a buyer signature.");
|
|
302
302
|
}
|
|
303
303
|
const transaction = Buffer.from(tx.serialize()).toString("base64");
|
|
304
304
|
return {
|
|
@@ -325,15 +325,15 @@ async function verifyAndSettleExactSolana(input) {
|
|
|
325
325
|
if (!accept.extra.feePayer) throw new Error("rail is missing extra.feePayer");
|
|
326
326
|
railFeePayer = new (0, _web3js.PublicKey)(accept.extra.feePayer);
|
|
327
327
|
} catch (err) {
|
|
328
|
-
throw new (0,
|
|
328
|
+
throw new (0, _chunkU35MG4TFcjs.SettlementError)(`SVM exact: rail has a bad payTo/asset/feePayer (${err instanceof Error ? err.message : String(err)}).`);
|
|
329
329
|
}
|
|
330
330
|
if (!railFeePayer.equals(feePayerKeypair.publicKey)) {
|
|
331
|
-
throw new (0,
|
|
331
|
+
throw new (0, _chunkU35MG4TFcjs.SettlementError)(
|
|
332
332
|
"SVM exact: the gate relayer key does not match the rail extra.feePayer \u2014 misconfigured rail."
|
|
333
333
|
);
|
|
334
334
|
}
|
|
335
335
|
if (feePayerKeypair.publicKey.equals(payTo)) {
|
|
336
|
-
throw new (0,
|
|
336
|
+
throw new (0, _chunkU35MG4TFcjs.SettlementError)("SVM exact: the fee payer must differ from payTo \u2014 misconfigured rail.");
|
|
337
337
|
}
|
|
338
338
|
const program = tokenProgramFor(accept);
|
|
339
339
|
let tx;
|
|
@@ -457,7 +457,7 @@ async function verifyAndSettleExactSolana(input) {
|
|
|
457
457
|
} catch (err) {
|
|
458
458
|
const msg = err instanceof Error ? err.message : String(err);
|
|
459
459
|
if (/blockhash|block height|expired/i.test(msg)) return fail("payment_expired", `Settle broadcast rejected \u2014 blockhash expired: ${shorten(msg)}.`);
|
|
460
|
-
throw new (0,
|
|
460
|
+
throw new (0, _chunkU35MG4TFcjs.SettlementError)(
|
|
461
461
|
`SVM exact settle: the merchant fee payer failed to broadcast (${shorten(msg)}). The buyer's signed transaction is still valid \u2014 fund/fix the fee payer and the buyer can re-present it.`,
|
|
462
462
|
{ cause: err }
|
|
463
463
|
);
|
|
@@ -467,7 +467,7 @@ async function verifyAndSettleExactSolana(input) {
|
|
|
467
467
|
return fail("tx_reverted", `Settle tx ${txid} reverted on-chain (a post-simulate race).`);
|
|
468
468
|
}
|
|
469
469
|
if (confirmed === "timeout") {
|
|
470
|
-
throw new (0,
|
|
470
|
+
throw new (0, _chunkU35MG4TFcjs.SettlementError)(
|
|
471
471
|
`SVM exact settle: broadcast ${txid} but it did not confirm in time. It likely landed \u2014 re-verify by signature before re-presenting; do NOT re-pay.`
|
|
472
472
|
);
|
|
473
473
|
}
|
|
@@ -510,12 +510,12 @@ async function pollConfirmed(connection, signature) {
|
|
|
510
510
|
|
|
511
511
|
function toKeypair(wallet, network) {
|
|
512
512
|
if (typeof wallet !== "object" || wallet === null) {
|
|
513
|
-
throw new (0,
|
|
513
|
+
throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
|
|
514
514
|
`chain ${network} is Solana; wallet must be { secretKey } or { signer }.`
|
|
515
515
|
);
|
|
516
516
|
}
|
|
517
517
|
if ("privateKey" in wallet || "walletClient" in wallet) {
|
|
518
|
-
throw new (0,
|
|
518
|
+
throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
|
|
519
519
|
`chain ${network} is Solana; an EVM wallet can't be used \u2014 pass { secretKey } or { signer }.`
|
|
520
520
|
);
|
|
521
521
|
}
|
|
@@ -527,7 +527,7 @@ function toKeypair(wallet, network) {
|
|
|
527
527
|
const bytes = typeof sk === "string" ? _bs582.default.decode(sk) : sk;
|
|
528
528
|
return _web3js.Keypair.fromSecretKey(bytes);
|
|
529
529
|
}
|
|
530
|
-
throw new (0,
|
|
530
|
+
throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
|
|
531
531
|
`chain ${network} is Solana; wallet must be { secretKey } or { signer }.`
|
|
532
532
|
);
|
|
533
533
|
}
|
|
@@ -556,15 +556,15 @@ function makeSolanaNetwork(preset, rpcUrl) {
|
|
|
556
556
|
const info = preset.tokens[token.toUpperCase()];
|
|
557
557
|
if (!info) {
|
|
558
558
|
const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
|
|
559
|
-
throw new (0,
|
|
559
|
+
throw new (0, _chunkU35MG4TFcjs.UnknownTokenError)(
|
|
560
560
|
`token "${token}" isn't built in for Solana (known: ${known}). Pass { mint, decimals } instead, or use 'native'.`
|
|
561
561
|
);
|
|
562
562
|
}
|
|
563
563
|
return { asset: info.mint, decimals: info.decimals, symbol: info.symbol };
|
|
564
564
|
}
|
|
565
|
-
|
|
565
|
+
_chunkU35MG4TFcjs.rejectForeignToken.call(void 0, token, "solana", network);
|
|
566
566
|
if (!("mint" in token)) {
|
|
567
|
-
throw new (0,
|
|
567
|
+
throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
|
|
568
568
|
`chain ${network} is Solana; a custom token must be { mint, decimals }.`
|
|
569
569
|
);
|
|
570
570
|
}
|
|
@@ -583,14 +583,14 @@ function makeSolanaNetwork(preset, rpcUrl) {
|
|
|
583
583
|
},
|
|
584
584
|
assertValidPayTo(payTo) {
|
|
585
585
|
if (payTo.startsWith("0x")) {
|
|
586
|
-
throw new (0,
|
|
586
|
+
throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
|
|
587
587
|
`chain ${network} is Solana, but payTo "${payTo}" looks like an EVM address.`
|
|
588
588
|
);
|
|
589
589
|
}
|
|
590
590
|
try {
|
|
591
591
|
new (0, _web3js.PublicKey)(payTo);
|
|
592
592
|
} catch (e7) {
|
|
593
|
-
throw new (0,
|
|
593
|
+
throw new (0, _chunkU35MG4TFcjs.WrongFamilyError)(
|
|
594
594
|
`chain ${network} is Solana, but payTo "${payTo}" is not a base58 address.`
|
|
595
595
|
);
|
|
596
596
|
}
|
|
@@ -602,7 +602,7 @@ function makeSolanaNetwork(preset, rpcUrl) {
|
|
|
602
602
|
try {
|
|
603
603
|
return await paySolana({ connection, keypair: wallet._native, accept });
|
|
604
604
|
} catch (err) {
|
|
605
|
-
throw _nullishCoalesce(
|
|
605
|
+
throw _nullishCoalesce(_chunkU35MG4TFcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
|
|
606
606
|
}
|
|
607
607
|
},
|
|
608
608
|
async confirm(ref) {
|
|
@@ -613,19 +613,19 @@ function makeSolanaNetwork(preset, rpcUrl) {
|
|
|
613
613
|
});
|
|
614
614
|
info = value[0];
|
|
615
615
|
} catch (err) {
|
|
616
|
-
throw new (0,
|
|
616
|
+
throw new (0, _chunkU35MG4TFcjs.ConfirmationTimeoutError)(
|
|
617
617
|
`Solana payment ${ref} could not be confirmed (RPC read failed).`,
|
|
618
618
|
{ cause: err }
|
|
619
619
|
);
|
|
620
620
|
}
|
|
621
621
|
if (!info || info.err || info.confirmationStatus !== "confirmed" && info.confirmationStatus !== "finalized") {
|
|
622
|
-
throw new (0,
|
|
622
|
+
throw new (0, _chunkU35MG4TFcjs.ConfirmationTimeoutError)(`Solana payment ${ref} did not confirm in time.`);
|
|
623
623
|
}
|
|
624
624
|
return { height: String(info.slot) };
|
|
625
625
|
},
|
|
626
626
|
async estimateCost(accept) {
|
|
627
627
|
if (accept.scheme === "exact") {
|
|
628
|
-
return
|
|
628
|
+
return _chunkU35MG4TFcjs.nativeCost.call(void 0, {
|
|
629
629
|
symbol: "SOL",
|
|
630
630
|
decimals: SOL_DECIMALS,
|
|
631
631
|
fee: 0n,
|
|
@@ -635,7 +635,7 @@ function makeSolanaNetwork(preset, rpcUrl) {
|
|
|
635
635
|
}
|
|
636
636
|
const base = 5000n;
|
|
637
637
|
if (accept.asset === "native") {
|
|
638
|
-
return
|
|
638
|
+
return _chunkU35MG4TFcjs.nativeCost.call(void 0, {
|
|
639
639
|
symbol: "SOL",
|
|
640
640
|
decimals: SOL_DECIMALS,
|
|
641
641
|
fee: base,
|
|
@@ -644,7 +644,7 @@ function makeSolanaNetwork(preset, rpcUrl) {
|
|
|
644
644
|
});
|
|
645
645
|
}
|
|
646
646
|
const ataRent = 2039280n;
|
|
647
|
-
return
|
|
647
|
+
return _chunkU35MG4TFcjs.nativeCost.call(void 0, {
|
|
648
648
|
symbol: "SOL",
|
|
649
649
|
decimals: SOL_DECIMALS,
|
|
650
650
|
fee: base + ataRent,
|