@piprail/sdk 2.14.0 → 2.14.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 +39 -0
- package/dist/{algorand-QU6G2DQZ.cjs → algorand-ICJNXO5V.cjs} +32 -32
- package/dist/{algorand-6J3IABVF.js → algorand-RM7MP4PK.js} +1 -1
- package/dist/{aptos-DHOMTBLZ.js → aptos-2FIRTMQX.js} +1 -1
- package/dist/{aptos-LFTQGBBK.cjs → aptos-MVEG5ZPS.cjs} +31 -31
- package/dist/{chunk-GYM46G5L.cjs → chunk-57V5DNJT.cjs} +30 -20
- package/dist/{chunk-PAMKCWVW.js → chunk-NUPCFNC5.js} +12 -2
- package/dist/index.cjs +178 -167
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +30 -19
- package/dist/{near-YNNK7RW7.cjs → near-C2IS4RCH.cjs} +27 -27
- package/dist/{near-5PXTVQ47.js → near-L2OWD7M6.js} +1 -1
- package/dist/{solana-N3UCNCYE.cjs → solana-B424IQ5I.cjs} +32 -32
- package/dist/{solana-HITVI3HF.js → solana-V2TGLHJ4.js} +1 -1
- package/dist/{stellar-Y3SQN7S5.cjs → stellar-4YR4UZQX.cjs} +20 -20
- package/dist/{stellar-2QT6YYKN.js → stellar-J7VE7QP7.js} +1 -1
- package/dist/{sui-4AL4E6XU.cjs → sui-F7UW6JXJ.cjs} +16 -16
- package/dist/{sui-FV5L6WF5.js → sui-GMRQAAJH.js} +1 -1
- package/dist/{ton-5HDVOTMR.cjs → ton-3SHFVDLP.cjs} +16 -16
- package/dist/{ton-5FWDQ4QR.js → ton-PEBYBNWJ.js} +1 -1
- package/dist/{tron-TX2B4N2A.cjs → tron-BS5EID2U.cjs} +25 -25
- package/dist/{tron-AZDY7BMQ.js → tron-ZYJHHROT.js} +1 -1
- package/dist/{xrpl-UJL5J7CY.js → xrpl-P2D6TS6I.js} +1 -1
- package/dist/{xrpl-5TYDLQFS.cjs → xrpl-SUEFOOKW.cjs} +20 -20
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -4700,6 +4700,15 @@ declare class SettlementError extends PipRailError {
|
|
|
4700
4700
|
declare class InvalidEnvelopeError extends PipRailError {
|
|
4701
4701
|
readonly code = "INVALID_ENVELOPE";
|
|
4702
4702
|
}
|
|
4703
|
+
/**
|
|
4704
|
+
* A merchant-supplied gate config value is invalid — a non-decimal / scientific-notation /
|
|
4705
|
+
* non-string `amount` (e.g. `'1e3'`, which must NOT be silently read as 1000 tokens), a missing
|
|
4706
|
+
* `payTo`, or a malformed discovery input. A typed boundary error (ERRORS.md §5) so a merchant
|
|
4707
|
+
* gets a clear, catchable failure instead of a raw `viem`/`TypeError`.
|
|
4708
|
+
*/
|
|
4709
|
+
declare class InvalidConfigError extends PipRailError {
|
|
4710
|
+
readonly code = "INVALID_CONFIG";
|
|
4711
|
+
}
|
|
4703
4712
|
/**
|
|
4704
4713
|
* The envelope didn't include any accepts[] entry compatible with the
|
|
4705
4714
|
* client's chain id (or all entries used unsupported schemes).
|
|
@@ -8396,4 +8405,4 @@ interface McpPaymentTool {
|
|
|
8396
8405
|
*/
|
|
8397
8406
|
declare function createMcpPaymentTool(options: McpPaymentToolOptions): McpPaymentTool;
|
|
8398
8407
|
|
|
8399
|
-
export { type A2AArtifact, type A2AExtensionDeclaration, type A2AMessage, type A2AMetadata, type A2APart, type A2APaymentHandler, type A2APaymentHandlerOptions, type A2APaymentStatus, type A2ATask, type A2ATaskRecord, type A2ATaskState, type A2ATaskStore, A2A_ERROR_KEY, A2A_EXTENSIONS_HEADER, A2A_PAYLOAD_KEY, A2A_RECEIPTS_KEY, A2A_REQUIRED_KEY, A2A_STATUS_KEY, A2A_X402_EXTENSION_URI_V01, A2A_X402_EXTENSION_URI_V02, type AcceptOption, AddressId, type AgentTool, type AlgorandToken, type AptosToken, AssetId, BRAND, BUILTIN_DENOMS, type BazaarExtension, type BuildExactParams, CHAINS, Caip2, type ChainFamily, type ChainInput, type ChainName, type ChainPreset, type ChainSelector, type ChallengeTriage, type ChallengeVerdict, type ConfirmInfo, ConfirmationTimeoutError, type CostEstimate, type CountStatus, DENOM_PRECISION, DIRECTORY_INFO, type DeclineReasonCode, type DeliverAttempt, type DeliverReceiptOptions, type DeliverResult, type DenomRemaining, type DirectoryInfo, type DiscoverOptions, type DiscoveredRail, type DiscoveredResource, type DiscoveryDescriptor, type DiscoverySigner, type DiscoverySort, type DiscoverySource, type DomainClaim, type DomainVerification, EIP3009_TYPES, EXACT_NETWORK_SLUGS, type EvmToken, type ExactAccept, type ExactAuthorization, ExactPaymentPayloadAny, type ExactRailOption, type ExpressLikeMiddleware, type ExpressLikeNext, type ExpressLikeRequest, type ExpressLikeResponse, type FacilitatorConfig, type FacilitatorPaymentRequirements, type FacilitatorSupportedKind, type FailedPayment, GENERATOR, InsufficientFundsError, InvalidEnvelopeError, KNOWN_FACILITATORS, type KnownFacilitator, type ListingVisibility, MCP_PAYMENT_META_KEY, MCP_PAYMENT_RESPONSE_META_KEY, type ManifestInput, MaxRetriesExceededError, type McpContentBlock, type McpPaymentMeta, type McpPaymentTool, type McpPaymentToolOptions, type McpToolCallParams, type McpToolResult, MissingDriverError, MultiChainPayer, type MultiChainPayerOptions, type NearToken, NoCompatibleAcceptError, NonReplayableBodyError, type OpenApiDocument, type OpenApiOperation, PERMIT2_ADDRESS, PERMIT2_PROXY_CHAIN_IDS, PERMIT2_UPTO_WITNESS_TYPES, PERMIT2_WITNESS_TYPES, PIPRAIL_AGENT_GUIDE, POWERED_BY, PaidReceipt, type PayBlocker, type PayOption, type PayWarning, type PayingClient, PaymentDeclinedError, type PaymentDriver, type PaymentGate, type PaymentIntent, type PaymentPlan, type PaymentPolicy, type PaymentRail, type PaymentScheme, PaymentTimeoutError, Permit2UptoPaymentPayload, PipRailClient, type PipRailClientOptions, type PipRailCostQuote, PipRailError, type PipRailEvent, type PipRailQuote, PipRailReceipt, type PolicyDecision, type PolicyDenyCode, REGISTER_ATTRIBUTION, type ReceiptInput, type ReceiptOption, type ReceiptVerification, RecipientNotReadyError, type RecipientReason, type RegisterInput, type RegisterOptions, type RegisterOutcome, type RequirePaymentOptions, type ResolveOptions, type ResolvedChain, type ResolvedNetwork, type ResolvedToken, type ResourceDescription, type SearchOpenIndexesOptions, type SelfDescribeEndpoint, type SelfDescribeRail, type SelfDescription, type SessionBudget, SettleOutcome, type SettleViaFacilitatorInput, SettlementError, SignedReceipt, type SolanaToken, SpendLedger, SpendRecord, type SpendRemaining, SpendStore, SpendSummary, type StellarToken, type SuiToken, type TokenInfo, type TokenInput, type TonToken, type ToolAnnotations, type TronToken, UPTO_PROXY_CHAIN_IDS, UnknownTokenError, UnsupportedNetworkError, UnsupportedSchemeError, type UptoRailOption, VERIFY_CODE_TO_A2A_ERROR, VerifyErrorCode, type VerifyPaymentResult, VerifyResult, type WalletBalance, type WalletHandle, type WalletInput, WalletRequiredError, type WellKnownX402, type WellKnownX402Item, type WellKnownX402Manifest, WrongChainError, WrongFamilyError, X402AcceptEntry, X402AnyAccept, X402Challenge, type X402DnsRecord, X402ExactAcceptEntry, type X402InvalidBody, X402Receipt, X402UptoAcceptEntry, X402_EXACT_PERMIT2_PROXY, X402_UPTO_PERMIT2_PROXY, type XrplToken, agentGuide, appendAttribution, appendKeywords, buildBazaarExtension, buildEndpointInfo, buildExactAuthorization, buildMcpPaymentMeta, buildOpenApi, buildSelfDescription, buildWellKnownX402, buildWellKnownX402Manifest, buildX402DnsTxt, chainIdForExactNetwork, claim402IndexDomain, classifyChallenge, createA2APaymentHandler, createMcpPaymentTool, createPaymentGate, decorateOutcome, deliverReceipt, denomOf, describeChallenge, discoveryHeaders, eip3009Abi, encodeXPaymentHeader, evaluatePolicy, explainDecline, facilitatorCoverage, fetchAcross, firstKeylessFacilitator, formatSpendReport, fromA2APaymentPayload, fromA2APaymentRequired, fromMcpPayment, fromMcpPaymentRequired, fromMcpPaymentResponse, getDirectoryInfo, isMcpPaymentRequired, isPermit2ProxyChain, isUptoProxyChain, knownFacilitatorsFor, normalizeNetwork, parseExactRequirements, parseFacilitatorSupported, paymentTools, planAcross, rankResources, readExactDomain, register402Index, registerDriver, registerX402Scan, renderLandingPage, requirePayment, resolveChain, scoreResource, searchOpenIndexes, settleViaFacilitator, summarizePlan, toA2AErrorCode, toA2APaymentFailed, toA2APaymentReceipts, toA2APaymentRequired, toInsufficientFundsError, toInvalidBody, toMcpPaymentRequired, toMcpPaymentResponse, verify402IndexDomain };
|
|
8408
|
+
export { type A2AArtifact, type A2AExtensionDeclaration, type A2AMessage, type A2AMetadata, type A2APart, type A2APaymentHandler, type A2APaymentHandlerOptions, type A2APaymentStatus, type A2ATask, type A2ATaskRecord, type A2ATaskState, type A2ATaskStore, A2A_ERROR_KEY, A2A_EXTENSIONS_HEADER, A2A_PAYLOAD_KEY, A2A_RECEIPTS_KEY, A2A_REQUIRED_KEY, A2A_STATUS_KEY, A2A_X402_EXTENSION_URI_V01, A2A_X402_EXTENSION_URI_V02, type AcceptOption, AddressId, type AgentTool, type AlgorandToken, type AptosToken, AssetId, BRAND, BUILTIN_DENOMS, type BazaarExtension, type BuildExactParams, CHAINS, Caip2, type ChainFamily, type ChainInput, type ChainName, type ChainPreset, type ChainSelector, type ChallengeTriage, type ChallengeVerdict, type ConfirmInfo, ConfirmationTimeoutError, type CostEstimate, type CountStatus, DENOM_PRECISION, DIRECTORY_INFO, type DeclineReasonCode, type DeliverAttempt, type DeliverReceiptOptions, type DeliverResult, type DenomRemaining, type DirectoryInfo, type DiscoverOptions, type DiscoveredRail, type DiscoveredResource, type DiscoveryDescriptor, type DiscoverySigner, type DiscoverySort, type DiscoverySource, type DomainClaim, type DomainVerification, EIP3009_TYPES, EXACT_NETWORK_SLUGS, type EvmToken, type ExactAccept, type ExactAuthorization, ExactPaymentPayloadAny, type ExactRailOption, type ExpressLikeMiddleware, type ExpressLikeNext, type ExpressLikeRequest, type ExpressLikeResponse, type FacilitatorConfig, type FacilitatorPaymentRequirements, type FacilitatorSupportedKind, type FailedPayment, GENERATOR, InsufficientFundsError, InvalidConfigError, InvalidEnvelopeError, KNOWN_FACILITATORS, type KnownFacilitator, type ListingVisibility, MCP_PAYMENT_META_KEY, MCP_PAYMENT_RESPONSE_META_KEY, type ManifestInput, MaxRetriesExceededError, type McpContentBlock, type McpPaymentMeta, type McpPaymentTool, type McpPaymentToolOptions, type McpToolCallParams, type McpToolResult, MissingDriverError, MultiChainPayer, type MultiChainPayerOptions, type NearToken, NoCompatibleAcceptError, NonReplayableBodyError, type OpenApiDocument, type OpenApiOperation, PERMIT2_ADDRESS, PERMIT2_PROXY_CHAIN_IDS, PERMIT2_UPTO_WITNESS_TYPES, PERMIT2_WITNESS_TYPES, PIPRAIL_AGENT_GUIDE, POWERED_BY, PaidReceipt, type PayBlocker, type PayOption, type PayWarning, type PayingClient, PaymentDeclinedError, type PaymentDriver, type PaymentGate, type PaymentIntent, type PaymentPlan, type PaymentPolicy, type PaymentRail, type PaymentScheme, PaymentTimeoutError, Permit2UptoPaymentPayload, PipRailClient, type PipRailClientOptions, type PipRailCostQuote, PipRailError, type PipRailEvent, type PipRailQuote, PipRailReceipt, type PolicyDecision, type PolicyDenyCode, REGISTER_ATTRIBUTION, type ReceiptInput, type ReceiptOption, type ReceiptVerification, RecipientNotReadyError, type RecipientReason, type RegisterInput, type RegisterOptions, type RegisterOutcome, type RequirePaymentOptions, type ResolveOptions, type ResolvedChain, type ResolvedNetwork, type ResolvedToken, type ResourceDescription, type SearchOpenIndexesOptions, type SelfDescribeEndpoint, type SelfDescribeRail, type SelfDescription, type SessionBudget, SettleOutcome, type SettleViaFacilitatorInput, SettlementError, SignedReceipt, type SolanaToken, SpendLedger, SpendRecord, type SpendRemaining, SpendStore, SpendSummary, type StellarToken, type SuiToken, type TokenInfo, type TokenInput, type TonToken, type ToolAnnotations, type TronToken, UPTO_PROXY_CHAIN_IDS, UnknownTokenError, UnsupportedNetworkError, UnsupportedSchemeError, type UptoRailOption, VERIFY_CODE_TO_A2A_ERROR, VerifyErrorCode, type VerifyPaymentResult, VerifyResult, type WalletBalance, type WalletHandle, type WalletInput, WalletRequiredError, type WellKnownX402, type WellKnownX402Item, type WellKnownX402Manifest, WrongChainError, WrongFamilyError, X402AcceptEntry, X402AnyAccept, X402Challenge, type X402DnsRecord, X402ExactAcceptEntry, type X402InvalidBody, X402Receipt, X402UptoAcceptEntry, X402_EXACT_PERMIT2_PROXY, X402_UPTO_PERMIT2_PROXY, type XrplToken, agentGuide, appendAttribution, appendKeywords, buildBazaarExtension, buildEndpointInfo, buildExactAuthorization, buildMcpPaymentMeta, buildOpenApi, buildSelfDescription, buildWellKnownX402, buildWellKnownX402Manifest, buildX402DnsTxt, chainIdForExactNetwork, claim402IndexDomain, classifyChallenge, createA2APaymentHandler, createMcpPaymentTool, createPaymentGate, decorateOutcome, deliverReceipt, denomOf, describeChallenge, discoveryHeaders, eip3009Abi, encodeXPaymentHeader, evaluatePolicy, explainDecline, facilitatorCoverage, fetchAcross, firstKeylessFacilitator, formatSpendReport, fromA2APaymentPayload, fromA2APaymentRequired, fromMcpPayment, fromMcpPaymentRequired, fromMcpPaymentResponse, getDirectoryInfo, isMcpPaymentRequired, isPermit2ProxyChain, isUptoProxyChain, knownFacilitatorsFor, normalizeNetwork, parseExactRequirements, parseFacilitatorSupported, paymentTools, planAcross, rankResources, readExactDomain, register402Index, registerDriver, registerX402Scan, renderLandingPage, requirePayment, resolveChain, scoreResource, searchOpenIndexes, settleViaFacilitator, summarizePlan, toA2AErrorCode, toA2APaymentFailed, toA2APaymentReceipts, toA2APaymentRequired, toInsufficientFundsError, toInvalidBody, toMcpPaymentRequired, toMcpPaymentResponse, verify402IndexDomain };
|
package/dist/index.d.ts
CHANGED
|
@@ -4700,6 +4700,15 @@ declare class SettlementError extends PipRailError {
|
|
|
4700
4700
|
declare class InvalidEnvelopeError extends PipRailError {
|
|
4701
4701
|
readonly code = "INVALID_ENVELOPE";
|
|
4702
4702
|
}
|
|
4703
|
+
/**
|
|
4704
|
+
* A merchant-supplied gate config value is invalid — a non-decimal / scientific-notation /
|
|
4705
|
+
* non-string `amount` (e.g. `'1e3'`, which must NOT be silently read as 1000 tokens), a missing
|
|
4706
|
+
* `payTo`, or a malformed discovery input. A typed boundary error (ERRORS.md §5) so a merchant
|
|
4707
|
+
* gets a clear, catchable failure instead of a raw `viem`/`TypeError`.
|
|
4708
|
+
*/
|
|
4709
|
+
declare class InvalidConfigError extends PipRailError {
|
|
4710
|
+
readonly code = "INVALID_CONFIG";
|
|
4711
|
+
}
|
|
4703
4712
|
/**
|
|
4704
4713
|
* The envelope didn't include any accepts[] entry compatible with the
|
|
4705
4714
|
* client's chain id (or all entries used unsupported schemes).
|
|
@@ -8396,4 +8405,4 @@ interface McpPaymentTool {
|
|
|
8396
8405
|
*/
|
|
8397
8406
|
declare function createMcpPaymentTool(options: McpPaymentToolOptions): McpPaymentTool;
|
|
8398
8407
|
|
|
8399
|
-
export { type A2AArtifact, type A2AExtensionDeclaration, type A2AMessage, type A2AMetadata, type A2APart, type A2APaymentHandler, type A2APaymentHandlerOptions, type A2APaymentStatus, type A2ATask, type A2ATaskRecord, type A2ATaskState, type A2ATaskStore, A2A_ERROR_KEY, A2A_EXTENSIONS_HEADER, A2A_PAYLOAD_KEY, A2A_RECEIPTS_KEY, A2A_REQUIRED_KEY, A2A_STATUS_KEY, A2A_X402_EXTENSION_URI_V01, A2A_X402_EXTENSION_URI_V02, type AcceptOption, AddressId, type AgentTool, type AlgorandToken, type AptosToken, AssetId, BRAND, BUILTIN_DENOMS, type BazaarExtension, type BuildExactParams, CHAINS, Caip2, type ChainFamily, type ChainInput, type ChainName, type ChainPreset, type ChainSelector, type ChallengeTriage, type ChallengeVerdict, type ConfirmInfo, ConfirmationTimeoutError, type CostEstimate, type CountStatus, DENOM_PRECISION, DIRECTORY_INFO, type DeclineReasonCode, type DeliverAttempt, type DeliverReceiptOptions, type DeliverResult, type DenomRemaining, type DirectoryInfo, type DiscoverOptions, type DiscoveredRail, type DiscoveredResource, type DiscoveryDescriptor, type DiscoverySigner, type DiscoverySort, type DiscoverySource, type DomainClaim, type DomainVerification, EIP3009_TYPES, EXACT_NETWORK_SLUGS, type EvmToken, type ExactAccept, type ExactAuthorization, ExactPaymentPayloadAny, type ExactRailOption, type ExpressLikeMiddleware, type ExpressLikeNext, type ExpressLikeRequest, type ExpressLikeResponse, type FacilitatorConfig, type FacilitatorPaymentRequirements, type FacilitatorSupportedKind, type FailedPayment, GENERATOR, InsufficientFundsError, InvalidEnvelopeError, KNOWN_FACILITATORS, type KnownFacilitator, type ListingVisibility, MCP_PAYMENT_META_KEY, MCP_PAYMENT_RESPONSE_META_KEY, type ManifestInput, MaxRetriesExceededError, type McpContentBlock, type McpPaymentMeta, type McpPaymentTool, type McpPaymentToolOptions, type McpToolCallParams, type McpToolResult, MissingDriverError, MultiChainPayer, type MultiChainPayerOptions, type NearToken, NoCompatibleAcceptError, NonReplayableBodyError, type OpenApiDocument, type OpenApiOperation, PERMIT2_ADDRESS, PERMIT2_PROXY_CHAIN_IDS, PERMIT2_UPTO_WITNESS_TYPES, PERMIT2_WITNESS_TYPES, PIPRAIL_AGENT_GUIDE, POWERED_BY, PaidReceipt, type PayBlocker, type PayOption, type PayWarning, type PayingClient, PaymentDeclinedError, type PaymentDriver, type PaymentGate, type PaymentIntent, type PaymentPlan, type PaymentPolicy, type PaymentRail, type PaymentScheme, PaymentTimeoutError, Permit2UptoPaymentPayload, PipRailClient, type PipRailClientOptions, type PipRailCostQuote, PipRailError, type PipRailEvent, type PipRailQuote, PipRailReceipt, type PolicyDecision, type PolicyDenyCode, REGISTER_ATTRIBUTION, type ReceiptInput, type ReceiptOption, type ReceiptVerification, RecipientNotReadyError, type RecipientReason, type RegisterInput, type RegisterOptions, type RegisterOutcome, type RequirePaymentOptions, type ResolveOptions, type ResolvedChain, type ResolvedNetwork, type ResolvedToken, type ResourceDescription, type SearchOpenIndexesOptions, type SelfDescribeEndpoint, type SelfDescribeRail, type SelfDescription, type SessionBudget, SettleOutcome, type SettleViaFacilitatorInput, SettlementError, SignedReceipt, type SolanaToken, SpendLedger, SpendRecord, type SpendRemaining, SpendStore, SpendSummary, type StellarToken, type SuiToken, type TokenInfo, type TokenInput, type TonToken, type ToolAnnotations, type TronToken, UPTO_PROXY_CHAIN_IDS, UnknownTokenError, UnsupportedNetworkError, UnsupportedSchemeError, type UptoRailOption, VERIFY_CODE_TO_A2A_ERROR, VerifyErrorCode, type VerifyPaymentResult, VerifyResult, type WalletBalance, type WalletHandle, type WalletInput, WalletRequiredError, type WellKnownX402, type WellKnownX402Item, type WellKnownX402Manifest, WrongChainError, WrongFamilyError, X402AcceptEntry, X402AnyAccept, X402Challenge, type X402DnsRecord, X402ExactAcceptEntry, type X402InvalidBody, X402Receipt, X402UptoAcceptEntry, X402_EXACT_PERMIT2_PROXY, X402_UPTO_PERMIT2_PROXY, type XrplToken, agentGuide, appendAttribution, appendKeywords, buildBazaarExtension, buildEndpointInfo, buildExactAuthorization, buildMcpPaymentMeta, buildOpenApi, buildSelfDescription, buildWellKnownX402, buildWellKnownX402Manifest, buildX402DnsTxt, chainIdForExactNetwork, claim402IndexDomain, classifyChallenge, createA2APaymentHandler, createMcpPaymentTool, createPaymentGate, decorateOutcome, deliverReceipt, denomOf, describeChallenge, discoveryHeaders, eip3009Abi, encodeXPaymentHeader, evaluatePolicy, explainDecline, facilitatorCoverage, fetchAcross, firstKeylessFacilitator, formatSpendReport, fromA2APaymentPayload, fromA2APaymentRequired, fromMcpPayment, fromMcpPaymentRequired, fromMcpPaymentResponse, getDirectoryInfo, isMcpPaymentRequired, isPermit2ProxyChain, isUptoProxyChain, knownFacilitatorsFor, normalizeNetwork, parseExactRequirements, parseFacilitatorSupported, paymentTools, planAcross, rankResources, readExactDomain, register402Index, registerDriver, registerX402Scan, renderLandingPage, requirePayment, resolveChain, scoreResource, searchOpenIndexes, settleViaFacilitator, summarizePlan, toA2AErrorCode, toA2APaymentFailed, toA2APaymentReceipts, toA2APaymentRequired, toInsufficientFundsError, toInvalidBody, toMcpPaymentRequired, toMcpPaymentResponse, verify402IndexDomain };
|
|
8408
|
+
export { type A2AArtifact, type A2AExtensionDeclaration, type A2AMessage, type A2AMetadata, type A2APart, type A2APaymentHandler, type A2APaymentHandlerOptions, type A2APaymentStatus, type A2ATask, type A2ATaskRecord, type A2ATaskState, type A2ATaskStore, A2A_ERROR_KEY, A2A_EXTENSIONS_HEADER, A2A_PAYLOAD_KEY, A2A_RECEIPTS_KEY, A2A_REQUIRED_KEY, A2A_STATUS_KEY, A2A_X402_EXTENSION_URI_V01, A2A_X402_EXTENSION_URI_V02, type AcceptOption, AddressId, type AgentTool, type AlgorandToken, type AptosToken, AssetId, BRAND, BUILTIN_DENOMS, type BazaarExtension, type BuildExactParams, CHAINS, Caip2, type ChainFamily, type ChainInput, type ChainName, type ChainPreset, type ChainSelector, type ChallengeTriage, type ChallengeVerdict, type ConfirmInfo, ConfirmationTimeoutError, type CostEstimate, type CountStatus, DENOM_PRECISION, DIRECTORY_INFO, type DeclineReasonCode, type DeliverAttempt, type DeliverReceiptOptions, type DeliverResult, type DenomRemaining, type DirectoryInfo, type DiscoverOptions, type DiscoveredRail, type DiscoveredResource, type DiscoveryDescriptor, type DiscoverySigner, type DiscoverySort, type DiscoverySource, type DomainClaim, type DomainVerification, EIP3009_TYPES, EXACT_NETWORK_SLUGS, type EvmToken, type ExactAccept, type ExactAuthorization, ExactPaymentPayloadAny, type ExactRailOption, type ExpressLikeMiddleware, type ExpressLikeNext, type ExpressLikeRequest, type ExpressLikeResponse, type FacilitatorConfig, type FacilitatorPaymentRequirements, type FacilitatorSupportedKind, type FailedPayment, GENERATOR, InsufficientFundsError, InvalidConfigError, InvalidEnvelopeError, KNOWN_FACILITATORS, type KnownFacilitator, type ListingVisibility, MCP_PAYMENT_META_KEY, MCP_PAYMENT_RESPONSE_META_KEY, type ManifestInput, MaxRetriesExceededError, type McpContentBlock, type McpPaymentMeta, type McpPaymentTool, type McpPaymentToolOptions, type McpToolCallParams, type McpToolResult, MissingDriverError, MultiChainPayer, type MultiChainPayerOptions, type NearToken, NoCompatibleAcceptError, NonReplayableBodyError, type OpenApiDocument, type OpenApiOperation, PERMIT2_ADDRESS, PERMIT2_PROXY_CHAIN_IDS, PERMIT2_UPTO_WITNESS_TYPES, PERMIT2_WITNESS_TYPES, PIPRAIL_AGENT_GUIDE, POWERED_BY, PaidReceipt, type PayBlocker, type PayOption, type PayWarning, type PayingClient, PaymentDeclinedError, type PaymentDriver, type PaymentGate, type PaymentIntent, type PaymentPlan, type PaymentPolicy, type PaymentRail, type PaymentScheme, PaymentTimeoutError, Permit2UptoPaymentPayload, PipRailClient, type PipRailClientOptions, type PipRailCostQuote, PipRailError, type PipRailEvent, type PipRailQuote, PipRailReceipt, type PolicyDecision, type PolicyDenyCode, REGISTER_ATTRIBUTION, type ReceiptInput, type ReceiptOption, type ReceiptVerification, RecipientNotReadyError, type RecipientReason, type RegisterInput, type RegisterOptions, type RegisterOutcome, type RequirePaymentOptions, type ResolveOptions, type ResolvedChain, type ResolvedNetwork, type ResolvedToken, type ResourceDescription, type SearchOpenIndexesOptions, type SelfDescribeEndpoint, type SelfDescribeRail, type SelfDescription, type SessionBudget, SettleOutcome, type SettleViaFacilitatorInput, SettlementError, SignedReceipt, type SolanaToken, SpendLedger, SpendRecord, type SpendRemaining, SpendStore, SpendSummary, type StellarToken, type SuiToken, type TokenInfo, type TokenInput, type TonToken, type ToolAnnotations, type TronToken, UPTO_PROXY_CHAIN_IDS, UnknownTokenError, UnsupportedNetworkError, UnsupportedSchemeError, type UptoRailOption, VERIFY_CODE_TO_A2A_ERROR, VerifyErrorCode, type VerifyPaymentResult, VerifyResult, type WalletBalance, type WalletHandle, type WalletInput, WalletRequiredError, type WellKnownX402, type WellKnownX402Item, type WellKnownX402Manifest, WrongChainError, WrongFamilyError, X402AcceptEntry, X402AnyAccept, X402Challenge, type X402DnsRecord, X402ExactAcceptEntry, type X402InvalidBody, X402Receipt, X402UptoAcceptEntry, X402_EXACT_PERMIT2_PROXY, X402_UPTO_PERMIT2_PROXY, type XrplToken, agentGuide, appendAttribution, appendKeywords, buildBazaarExtension, buildEndpointInfo, buildExactAuthorization, buildMcpPaymentMeta, buildOpenApi, buildSelfDescription, buildWellKnownX402, buildWellKnownX402Manifest, buildX402DnsTxt, chainIdForExactNetwork, claim402IndexDomain, classifyChallenge, createA2APaymentHandler, createMcpPaymentTool, createPaymentGate, decorateOutcome, deliverReceipt, denomOf, describeChallenge, discoveryHeaders, eip3009Abi, encodeXPaymentHeader, evaluatePolicy, explainDecline, facilitatorCoverage, fetchAcross, firstKeylessFacilitator, formatSpendReport, fromA2APaymentPayload, fromA2APaymentRequired, fromMcpPayment, fromMcpPaymentRequired, fromMcpPaymentResponse, getDirectoryInfo, isMcpPaymentRequired, isPermit2ProxyChain, isUptoProxyChain, knownFacilitatorsFor, normalizeNetwork, parseExactRequirements, parseFacilitatorSupported, paymentTools, planAcross, rankResources, readExactDomain, register402Index, registerDriver, registerX402Scan, renderLandingPage, requirePayment, resolveChain, scoreResource, searchOpenIndexes, settleViaFacilitator, summarizePlan, toA2AErrorCode, toA2APaymentFailed, toA2APaymentReceipts, toA2APaymentRequired, toInsufficientFundsError, toInvalidBody, toMcpPaymentRequired, toMcpPaymentResponse, verify402IndexDomain };
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
ConfirmationTimeoutError,
|
|
9
9
|
InsufficientFundsError,
|
|
10
|
+
InvalidConfigError,
|
|
10
11
|
InvalidEnvelopeError,
|
|
11
12
|
MAX_DECIMALS,
|
|
12
13
|
MaxRetriesExceededError,
|
|
@@ -31,7 +32,7 @@ import {
|
|
|
31
32
|
parseUnits,
|
|
32
33
|
rejectForeignToken,
|
|
33
34
|
toInsufficientFundsError
|
|
34
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-NUPCFNC5.js";
|
|
35
36
|
|
|
36
37
|
// src/drivers/registry.ts
|
|
37
38
|
var byFamily = /* @__PURE__ */ new Map();
|
|
@@ -2381,7 +2382,7 @@ var loaders = {
|
|
|
2381
2382
|
solana: async () => {
|
|
2382
2383
|
let mod;
|
|
2383
2384
|
try {
|
|
2384
|
-
mod = await import("./solana-
|
|
2385
|
+
mod = await import("./solana-V2TGLHJ4.js");
|
|
2385
2386
|
} catch (cause) {
|
|
2386
2387
|
throw new MissingDriverError(
|
|
2387
2388
|
`Solana selected, but its packages aren't installed. Run: npm install @solana/web3.js @solana/spl-token bs58`,
|
|
@@ -2393,7 +2394,7 @@ var loaders = {
|
|
|
2393
2394
|
ton: async () => {
|
|
2394
2395
|
let mod;
|
|
2395
2396
|
try {
|
|
2396
|
-
mod = await import("./ton-
|
|
2397
|
+
mod = await import("./ton-PEBYBNWJ.js");
|
|
2397
2398
|
} catch (cause) {
|
|
2398
2399
|
throw new MissingDriverError(
|
|
2399
2400
|
`TON selected, but its packages aren't installed. Run: npm install @ton/ton @ton/core @ton/crypto`,
|
|
@@ -2405,7 +2406,7 @@ var loaders = {
|
|
|
2405
2406
|
stellar: async () => {
|
|
2406
2407
|
let mod;
|
|
2407
2408
|
try {
|
|
2408
|
-
mod = await import("./stellar-
|
|
2409
|
+
mod = await import("./stellar-J7VE7QP7.js");
|
|
2409
2410
|
} catch (cause) {
|
|
2410
2411
|
throw new MissingDriverError(
|
|
2411
2412
|
`Stellar selected, but its package isn't installed. Run: npm install @stellar/stellar-sdk`,
|
|
@@ -2417,7 +2418,7 @@ var loaders = {
|
|
|
2417
2418
|
xrpl: async () => {
|
|
2418
2419
|
let mod;
|
|
2419
2420
|
try {
|
|
2420
|
-
mod = await import("./xrpl-
|
|
2421
|
+
mod = await import("./xrpl-P2D6TS6I.js");
|
|
2421
2422
|
} catch (cause) {
|
|
2422
2423
|
throw new MissingDriverError(
|
|
2423
2424
|
`XRPL selected, but its package isn't installed. Run: npm install xrpl`,
|
|
@@ -2429,7 +2430,7 @@ var loaders = {
|
|
|
2429
2430
|
tron: async () => {
|
|
2430
2431
|
let mod;
|
|
2431
2432
|
try {
|
|
2432
|
-
mod = await import("./tron-
|
|
2433
|
+
mod = await import("./tron-ZYJHHROT.js");
|
|
2433
2434
|
} catch (cause) {
|
|
2434
2435
|
throw new MissingDriverError(
|
|
2435
2436
|
`Tron selected, but its package isn't installed. Run: npm install tronweb`,
|
|
@@ -2441,7 +2442,7 @@ var loaders = {
|
|
|
2441
2442
|
sui: async () => {
|
|
2442
2443
|
let mod;
|
|
2443
2444
|
try {
|
|
2444
|
-
mod = await import("./sui-
|
|
2445
|
+
mod = await import("./sui-GMRQAAJH.js");
|
|
2445
2446
|
} catch (cause) {
|
|
2446
2447
|
throw new MissingDriverError(
|
|
2447
2448
|
`Sui selected, but its package isn't installed. Run: npm install @mysten/sui`,
|
|
@@ -2453,7 +2454,7 @@ var loaders = {
|
|
|
2453
2454
|
near: async () => {
|
|
2454
2455
|
let mod;
|
|
2455
2456
|
try {
|
|
2456
|
-
mod = await import("./near-
|
|
2457
|
+
mod = await import("./near-L2OWD7M6.js");
|
|
2457
2458
|
} catch (cause) {
|
|
2458
2459
|
throw new MissingDriverError(
|
|
2459
2460
|
`NEAR selected, but its package isn't installed. Run: npm install near-api-js`,
|
|
@@ -2465,7 +2466,7 @@ var loaders = {
|
|
|
2465
2466
|
aptos: async () => {
|
|
2466
2467
|
let mod;
|
|
2467
2468
|
try {
|
|
2468
|
-
mod = await import("./aptos-
|
|
2469
|
+
mod = await import("./aptos-2FIRTMQX.js");
|
|
2469
2470
|
} catch (cause) {
|
|
2470
2471
|
throw new MissingDriverError(
|
|
2471
2472
|
`Aptos selected, but its package isn't installed. Run: npm install @aptos-labs/ts-sdk`,
|
|
@@ -2477,7 +2478,7 @@ var loaders = {
|
|
|
2477
2478
|
algorand: async () => {
|
|
2478
2479
|
let mod;
|
|
2479
2480
|
try {
|
|
2480
|
-
mod = await import("./algorand-
|
|
2481
|
+
mod = await import("./algorand-RM7MP4PK.js");
|
|
2481
2482
|
} catch (cause) {
|
|
2482
2483
|
throw new MissingDriverError(
|
|
2483
2484
|
`Algorand selected, but its package isn't installed. Run: npm install algosdk`,
|
|
@@ -2510,7 +2511,7 @@ async function resolveNetwork2(opts) {
|
|
|
2510
2511
|
}
|
|
2511
2512
|
|
|
2512
2513
|
// src/indexes.ts
|
|
2513
|
-
var DIRECTORY_INFO = {
|
|
2514
|
+
var DIRECTORY_INFO = Object.freeze({
|
|
2514
2515
|
"402index": {
|
|
2515
2516
|
source: "402index",
|
|
2516
2517
|
review: "probe-sync",
|
|
@@ -2538,7 +2539,7 @@ var DIRECTORY_INFO = {
|
|
|
2538
2539
|
readByDiscover: true,
|
|
2539
2540
|
caveat: "CDP Bazaar has no register endpoint \u2014 it catalogs a resource only when its own facilitator settles a payment. PipRail verifies locally with no facilitator, so a PipRail resource cannot be listed here (you can still READ Bazaar to find others). List on 402 Index or x402scan instead."
|
|
2540
2541
|
}
|
|
2541
|
-
};
|
|
2542
|
+
});
|
|
2542
2543
|
function getDirectoryInfo(source) {
|
|
2543
2544
|
return DIRECTORY_INFO[source];
|
|
2544
2545
|
}
|
|
@@ -5536,14 +5537,15 @@ function formatSpendReport(summary) {
|
|
|
5536
5537
|
return `${perAsset} \u2014 grand total: ${grand}`;
|
|
5537
5538
|
}
|
|
5538
5539
|
function describeChallenge(challenge) {
|
|
5539
|
-
const
|
|
5540
|
+
const accepts = Array.isArray(challenge?.accepts) ? challenge.accepts : [];
|
|
5541
|
+
const first = accepts[0];
|
|
5540
5542
|
if (!first) {
|
|
5541
5543
|
return `${BRAND.name} x402 payment endpoint. Pay with @piprail/sdk (${BRAND.sdkInstall}). Docs: ${BRAND.home}.`;
|
|
5542
5544
|
}
|
|
5543
5545
|
const extra = first.extra ?? {};
|
|
5544
5546
|
const amount = extra.amountFormatted ?? first.amount;
|
|
5545
5547
|
const token = extra.symbol ?? first.asset;
|
|
5546
|
-
const hasExact =
|
|
5548
|
+
const hasExact = accepts.some((a) => a.scheme === "exact");
|
|
5547
5549
|
const standard = hasExact ? "; or any standard x402 client (an exact rail is offered)" : "";
|
|
5548
5550
|
return `${BRAND.name} x402 payment endpoint \u2014 pay ${amount} ${token} on ${first.network} to ${first.payTo}. Programmatic: ${BRAND.sdkInstall} then client.fetch(url)${standard}. Docs: ${BRAND.home}.`;
|
|
5549
5551
|
}
|
|
@@ -6035,12 +6037,14 @@ function paymentTools(client) {
|
|
|
6035
6037
|
|
|
6036
6038
|
// src/classify.ts
|
|
6037
6039
|
function classifyChallenge(challenge, opts) {
|
|
6038
|
-
const accepts = challenge.accepts
|
|
6040
|
+
const accepts = Array.isArray(challenge?.accepts) ? challenge.accepts : [];
|
|
6041
|
+
const network = opts?.network;
|
|
6042
|
+
const schemes = opts?.schemes ?? [];
|
|
6039
6043
|
const offeredSchemes = [...new Set(accepts.map((a) => a.scheme))];
|
|
6040
6044
|
const offeredNetworks = [...new Set(accepts.map((a) => a.network))];
|
|
6041
|
-
const onClientChain = accepts.some((a) => a.network ===
|
|
6045
|
+
const onClientChain = accepts.some((a) => a.network === network);
|
|
6042
6046
|
const payableScheme = accepts.some(
|
|
6043
|
-
(a) => a.network ===
|
|
6047
|
+
(a) => a.network === network && schemes.includes(a.scheme)
|
|
6044
6048
|
);
|
|
6045
6049
|
const verdict = accepts.length === 0 ? "NO_RAIL" : payableScheme ? "PAYABLE_RAIL" : onClientChain ? "UNPAYABLE_SCHEME" : "WRONG_CHAIN";
|
|
6046
6050
|
return { onClientChain, payableScheme, offeredSchemes, offeredNetworks, verdict };
|
|
@@ -6126,9 +6130,15 @@ function buildWellKnownX402(input) {
|
|
|
6126
6130
|
};
|
|
6127
6131
|
}
|
|
6128
6132
|
function buildWellKnownX402Manifest(input) {
|
|
6133
|
+
if (!Array.isArray(input?.resources)) {
|
|
6134
|
+
throw new InvalidConfigError(
|
|
6135
|
+
"buildWellKnownX402Manifest: `resources` must be an array of ResourceDescription."
|
|
6136
|
+
);
|
|
6137
|
+
}
|
|
6138
|
+
const lastUpdated = typeof input.lastUpdated === "number" && Number.isFinite(input.lastUpdated) ? input.lastUpdated : Math.floor(Date.now() / 1e3);
|
|
6129
6139
|
return {
|
|
6130
6140
|
x402Version: 2,
|
|
6131
|
-
lastUpdated
|
|
6141
|
+
lastUpdated,
|
|
6132
6142
|
items: input.resources.map((r) => ({
|
|
6133
6143
|
resource: {
|
|
6134
6144
|
url: r.url,
|
|
@@ -6734,7 +6744,7 @@ function createPaymentGate(options) {
|
|
|
6734
6744
|
const net = await resolveNetwork2({ chain: a.chain, rpcUrl: a.rpcUrl ?? options.rpcUrl });
|
|
6735
6745
|
const payTo = a.payTo ?? options.payTo;
|
|
6736
6746
|
if (!payTo) {
|
|
6737
|
-
throw new
|
|
6747
|
+
throw new InvalidConfigError(
|
|
6738
6748
|
`requirePayment: no payTo for chain ${net.network}. Set it on the accept entry or pass a top-level payTo.`
|
|
6739
6749
|
);
|
|
6740
6750
|
}
|
|
@@ -7991,6 +8001,7 @@ export {
|
|
|
7991
8001
|
HEADER_SIGNATURE,
|
|
7992
8002
|
HEADER_SIGNATURE_V1,
|
|
7993
8003
|
InsufficientFundsError,
|
|
8004
|
+
InvalidConfigError,
|
|
7994
8005
|
InvalidEnvelopeError,
|
|
7995
8006
|
KNOWN_FACILITATORS,
|
|
7996
8007
|
MCP_PAYMENT_META_KEY,
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunk57V5DNJTcjs = require('./chunk-57V5DNJT.cjs');
|
|
14
14
|
|
|
15
15
|
// src/drivers/near/index.ts
|
|
16
16
|
var _nearapijs = require('near-api-js');
|
|
@@ -61,18 +61,18 @@ async function payNear(params) {
|
|
|
61
61
|
return res.hash;
|
|
62
62
|
} catch (err) {
|
|
63
63
|
if (isNearRegistrationError(err)) {
|
|
64
|
-
throw new (0,
|
|
64
|
+
throw new (0, _chunk57V5DNJTcjs.RecipientNotReadyError)(
|
|
65
65
|
`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)`,
|
|
66
66
|
{ cause: err }
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
if (isNearAffordability(err)) {
|
|
70
|
-
throw new (0,
|
|
70
|
+
throw new (0, _chunk57V5DNJTcjs.InsufficientFundsError)(
|
|
71
71
|
err instanceof Error ? err.message : "Insufficient NEAR balance for the payment.",
|
|
72
72
|
{ cause: err }
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
|
-
throw _nullishCoalesce(
|
|
75
|
+
throw _nullishCoalesce(_chunk57V5DNJTcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
async function payNearNative(params) {
|
|
@@ -82,12 +82,12 @@ async function payNearNative(params) {
|
|
|
82
82
|
return res.hash;
|
|
83
83
|
} catch (err) {
|
|
84
84
|
if (isNearAffordability(err)) {
|
|
85
|
-
throw new (0,
|
|
85
|
+
throw new (0, _chunk57V5DNJTcjs.InsufficientFundsError)(
|
|
86
86
|
err instanceof Error ? err.message : "Insufficient NEAR balance for the payment.",
|
|
87
87
|
{ cause: err }
|
|
88
88
|
);
|
|
89
89
|
}
|
|
90
|
-
throw _nullishCoalesce(
|
|
90
|
+
throw _nullishCoalesce(_chunk57V5DNJTcjs.toInsufficientFundsError.call(void 0, err), () => ( err));
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
function isNearRegistrationError(err) {
|
|
@@ -109,28 +109,28 @@ var NONCE_BLOCK_MULTIPLIER = 1000000n;
|
|
|
109
109
|
async function payExactNear(input) {
|
|
110
110
|
const { signer, senderId, blockHeight, accessKeyNonce, accept } = input;
|
|
111
111
|
if (accept.asset === "native") {
|
|
112
|
-
throw new (0,
|
|
112
|
+
throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
|
|
113
113
|
"NEAR exact is NEP-141-only (an ft_transfer); native NEAR is not exact-payable. Pay via onchain-proof."
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
116
|
if (!isValidNearAccountId(accept.asset)) {
|
|
117
|
-
throw new (0,
|
|
117
|
+
throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(`NEAR exact: asset "${accept.asset}" must be a NEP-141 contract account id.`);
|
|
118
118
|
}
|
|
119
119
|
if (!isValidNearAccountId(accept.payTo)) {
|
|
120
|
-
throw new (0,
|
|
120
|
+
throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(`NEAR exact: payTo "${accept.payTo}" is not a valid NEAR account id.`);
|
|
121
121
|
}
|
|
122
122
|
if (!isValidNearAccountId(senderId)) {
|
|
123
|
-
throw new (0,
|
|
123
|
+
throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(`NEAR exact: sender "${senderId}" is not a valid NEAR account id.`);
|
|
124
124
|
}
|
|
125
125
|
const t = accept.maxTimeoutSeconds;
|
|
126
126
|
if (!Number.isInteger(t) || t <= 0) {
|
|
127
|
-
throw new (0,
|
|
127
|
+
throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)("NEAR exact: maxTimeoutSeconds must be a positive integer.");
|
|
128
128
|
}
|
|
129
129
|
const timeoutBlocks = BigInt(Math.max(1, Math.ceil(t / ESTIMATED_BLOCK_SECONDS)));
|
|
130
130
|
const maxBlockHeight = blockHeight + timeoutBlocks;
|
|
131
131
|
const nonce = accessKeyNonce + 1n;
|
|
132
132
|
if (nonce >= blockHeight * NONCE_BLOCK_MULTIPLIER) {
|
|
133
|
-
throw new (0,
|
|
133
|
+
throw new (0, _chunk57V5DNJTcjs.UnsupportedSchemeError)(
|
|
134
134
|
"NEAR exact: the access-key nonce is at the protocol ceiling for this block height; cannot build a delegate action."
|
|
135
135
|
);
|
|
136
136
|
}
|
|
@@ -259,7 +259,7 @@ async function verifyAndSettleExactNear(input) {
|
|
|
259
259
|
if (/not enough|insufficient|exceeded the prepaid gas|NotEnoughBalance|doesn't have enough|is not registered/i.test(m)) {
|
|
260
260
|
return fail("tx_reverted", `the ft_transfer would fail on chain: ${shorten(m)}.`);
|
|
261
261
|
}
|
|
262
|
-
throw new (0,
|
|
262
|
+
throw new (0, _chunk57V5DNJTcjs.SettlementError)(
|
|
263
263
|
`NEAR exact settle: the relayer could not submit the delegate (${shorten(m)}). The buyer's signed delegate is still valid \u2014 fund/fix the relayer and the buyer can re-present it.`,
|
|
264
264
|
{ cause: err }
|
|
265
265
|
);
|
|
@@ -408,13 +408,13 @@ function txNotFound(hash) {
|
|
|
408
408
|
|
|
409
409
|
function assertNearWallet(wallet, network) {
|
|
410
410
|
if (typeof wallet !== "object" || wallet === null) {
|
|
411
|
-
throw new (0,
|
|
411
|
+
throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
|
|
412
412
|
`chain ${network} is NEAR; wallet must be { accountId, key } (key = ed25519:\u2026).`
|
|
413
413
|
);
|
|
414
414
|
}
|
|
415
|
-
|
|
415
|
+
_chunk57V5DNJTcjs.assertNoLegacyWalletKey.call(void 0, wallet, "NEAR");
|
|
416
416
|
if (!("accountId" in wallet) || !("key" in wallet)) {
|
|
417
|
-
throw new (0,
|
|
417
|
+
throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
|
|
418
418
|
`chain ${network} is NEAR; wallet must be { accountId, key } (key = ed25519:\u2026).`
|
|
419
419
|
);
|
|
420
420
|
}
|
|
@@ -422,13 +422,13 @@ function assertNearWallet(wallet, network) {
|
|
|
422
422
|
}
|
|
423
423
|
function resolveNearWallet(config) {
|
|
424
424
|
if (!config.accountId || !config.key) {
|
|
425
|
-
throw new (0,
|
|
425
|
+
throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)("NEAR wallet needs { accountId, key } (key = ed25519:\u2026).");
|
|
426
426
|
}
|
|
427
427
|
let signer;
|
|
428
428
|
try {
|
|
429
429
|
signer = _nearapijs.KeyPairSigner.fromSecretKey(config.key);
|
|
430
430
|
} catch (cause) {
|
|
431
|
-
throw new (0,
|
|
431
|
+
throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)("NEAR wallet { key } is not a valid ed25519:\u2026 secret key.", {
|
|
432
432
|
cause
|
|
433
433
|
});
|
|
434
434
|
}
|
|
@@ -490,16 +490,16 @@ function makeNearNetwork(preset, rpcUrl) {
|
|
|
490
490
|
const info = preset.tokens[token.toUpperCase()];
|
|
491
491
|
if (!info) {
|
|
492
492
|
const known = Object.keys(preset.tokens).join(", ") || "(none built in)";
|
|
493
|
-
throw new (0,
|
|
493
|
+
throw new (0, _chunk57V5DNJTcjs.UnknownTokenError)(
|
|
494
494
|
`token "${token}" isn't built in for NEAR (known: ${known}). Pass { contractId, decimals } for a custom NEP-141.`
|
|
495
495
|
);
|
|
496
496
|
}
|
|
497
497
|
return { asset: info.contractId, decimals: info.decimals, symbol: info.symbol };
|
|
498
498
|
}
|
|
499
|
-
|
|
499
|
+
_chunk57V5DNJTcjs.rejectForeignToken.call(void 0, token, "near", network);
|
|
500
500
|
const t = token;
|
|
501
501
|
if (!t.contractId || typeof t.decimals !== "number") {
|
|
502
|
-
throw new (0,
|
|
502
|
+
throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
|
|
503
503
|
`chain ${network} is NEAR; a custom token must be { contractId, decimals }.`
|
|
504
504
|
);
|
|
505
505
|
}
|
|
@@ -518,12 +518,12 @@ function makeNearNetwork(preset, rpcUrl) {
|
|
|
518
518
|
},
|
|
519
519
|
assertValidPayTo(payTo) {
|
|
520
520
|
if (payTo.startsWith("0x")) {
|
|
521
|
-
throw new (0,
|
|
521
|
+
throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
|
|
522
522
|
`chain ${network} is NEAR, but payTo "${payTo}" looks like an EVM/Sui 0x address.`
|
|
523
523
|
);
|
|
524
524
|
}
|
|
525
525
|
if (!isValidNearAccountId(payTo)) {
|
|
526
|
-
throw new (0,
|
|
526
|
+
throw new (0, _chunk57V5DNJTcjs.WrongFamilyError)(
|
|
527
527
|
`chain ${network} is NEAR, but payTo "${payTo}" is not a valid NEAR account id.`
|
|
528
528
|
);
|
|
529
529
|
}
|
|
@@ -567,11 +567,11 @@ function makeNearNetwork(preset, rpcUrl) {
|
|
|
567
567
|
if (tx && tx.success) return { height: "0" };
|
|
568
568
|
} catch (e11) {
|
|
569
569
|
}
|
|
570
|
-
throw new (0,
|
|
570
|
+
throw new (0, _chunk57V5DNJTcjs.ConfirmationTimeoutError)(`NEAR tx ${hash} not confirmed in time.`);
|
|
571
571
|
},
|
|
572
572
|
async estimateCost(accept) {
|
|
573
573
|
if (accept.scheme === "exact") {
|
|
574
|
-
return
|
|
574
|
+
return _chunk57V5DNJTcjs.nativeCost.call(void 0, {
|
|
575
575
|
symbol: "NEAR",
|
|
576
576
|
decimals: NEAR_DECIMALS,
|
|
577
577
|
fee: 0n,
|
|
@@ -579,7 +579,7 @@ function makeNearNetwork(preset, rpcUrl) {
|
|
|
579
579
|
detail: "gasless \u2014 the relayer prepays gas + the 1 yocto; the buyer pays 0 NEAR"
|
|
580
580
|
});
|
|
581
581
|
}
|
|
582
|
-
return
|
|
582
|
+
return _chunk57V5DNJTcjs.nativeCost.call(void 0, {
|
|
583
583
|
symbol: "NEAR",
|
|
584
584
|
decimals: NEAR_DECIMALS,
|
|
585
585
|
fee: 1500000000000000000000n,
|
|
@@ -701,7 +701,7 @@ function makeNearNetwork(preset, rpcUrl) {
|
|
|
701
701
|
try {
|
|
702
702
|
relayerWallet = resolveNearWallet(relayer._native);
|
|
703
703
|
} catch (err) {
|
|
704
|
-
throw new (0,
|
|
704
|
+
throw new (0, _chunk57V5DNJTcjs.SettlementError)(
|
|
705
705
|
`NEAR exact settle: the relayer wallet is invalid (${err instanceof Error ? err.message : String(err)}).`,
|
|
706
706
|
{ cause: err }
|
|
707
707
|
);
|