@dvmkit/sdk 0.7.0-rc.1 → 0.7.0-rc.3
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 +4 -0
- package/dist/{chunk-S3OY533W.js → chunk-26W6GPCD.js} +48 -6
- package/dist/{chunk-FWGWLPXF.js → chunk-2OM2QPBE.js} +2 -2
- package/dist/{chunk-GY66THYI.js → chunk-3UK3CDOT.js} +186 -90
- package/dist/{chunk-CXCQLOOK.js → chunk-62FI3NJF.js} +42 -107
- package/dist/{chunk-VHNPVGSA.js → chunk-6STC5TCP.js} +3 -3
- package/dist/{chunk-N5RZ5HVB.js → chunk-72V5DTEC.js} +2 -2
- package/dist/chunk-A262WVYX.js +6 -0
- package/dist/{chunk-QR2EF2NI.js → chunk-AQ7OX5NX.js} +2 -2
- package/dist/{chunk-BYCEKO65.js → chunk-CLIAFTUR.js} +102 -13
- package/dist/{chunk-GAOAYHZA.js → chunk-DNG4KGSC.js} +3 -3
- package/dist/{chunk-Z4ZT5LNT.js → chunk-GSLS4464.js} +3 -3
- package/dist/{chunk-RA2WIX7G.js → chunk-H5FVVEEN.js} +18 -7
- package/dist/{chunk-IXR5RFK7.js → chunk-HCE4MPZ5.js} +1 -1
- package/dist/{chunk-OML32F6I.js → chunk-I555L2WK.js} +1 -1
- package/dist/{chunk-EQLA4FFY.js → chunk-IIZQNDQU.js} +3 -3
- package/dist/{chunk-FUJ36YDV.js → chunk-KXWROQGK.js} +24 -1
- package/dist/{chunk-ETXDTUJO.js → chunk-LAKP6FUI.js} +55 -0
- package/dist/{chunk-X7EZ5CLI.js → chunk-MON76YBJ.js} +3 -3
- package/dist/chunk-OFSOLHRX.js +120 -0
- package/dist/{chunk-IV6Q7NRW.js → chunk-RAGX6VG7.js} +2 -2
- package/dist/{chunk-KA6VN5FK.js → chunk-RXPHMS4C.js} +3 -3
- package/dist/{chunk-6XF3RVVX.js → chunk-SPYEJXI7.js} +5 -5
- package/dist/{chunk-P6QON7ER.js → chunk-TRNMTTPX.js} +1 -1
- package/dist/{chunk-RCM3P2HE.js → chunk-UKD3R2KU.js} +55 -4
- package/dist/chunk-USL7ZEXN.js +17 -0
- package/dist/{chunk-KMED3H3A.js → chunk-VB5OLOZH.js} +395 -231
- package/dist/{content-retention-DHyLdA6b.d.ts → content-retention-ChFSSVO0.d.ts} +1 -1
- package/dist/{credit-ledger-MCUXYKSJ.js → credit-ledger-7Z7LOCTN.js} +4 -4
- package/dist/{credit-menu-DjnkeEUU.d.ts → credit-menu-fy0DDigm.d.ts} +6 -6
- package/dist/{fx-zMWFzfrU.d.ts → fx-DM0_NYiE.d.ts} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +236 -16
- package/dist/internal/caller.d.ts +4968 -8286
- package/dist/internal/caller.js +4291 -8084
- package/dist/internal/index.js +1 -1
- package/dist/internal/server.d.ts +7 -7
- package/dist/internal/server.js +27 -30
- package/dist/{job-store-DdLXBpol.d.ts → job-store-DkfNE9sv.d.ts} +1 -1
- package/dist/{lightning-backend-Bw-qtAbt.d.ts → lightning-backend-C3Gf1XpP.d.ts} +2 -2
- package/dist/{memory-credit-ledger-SBSMGMDX.js → memory-credit-ledger-3WOS74UH.js} +5 -5
- package/dist/{mpp-setup-RF5FXGGV.js → mpp-setup-XB4KATMU.js} +2 -2
- package/dist/{payout-reporter-3Y2U55ZX.js → payout-reporter-WT7XYW42.js} +2 -2
- package/dist/{postgres-consumed-credential-store-BUVCAPLS.js → postgres-consumed-credential-store-W7UP33AH.js} +3 -3
- package/dist/{postgres-job-store-VHLQBJZC.js → postgres-job-store-3KGUGFRD.js} +2 -2
- package/dist/{postgres-replay-store-ARZSQ45X.js → postgres-replay-store-CVNJJOQG.js} +2 -2
- package/dist/{pricing-XT2IAPNE.js → pricing-QAVZUTZR.js} +12 -12
- package/dist/{revenue-reporter-MAERPYGK.js → revenue-reporter-7UR3W2SD.js} +2 -2
- package/dist/server/index.d.ts +10 -10
- package/dist/server/index.js +44 -48
- package/dist/{step-cache-2MkvenJn.d.ts → step-cache-DDTwd4SK.d.ts} +6 -2
- package/dist/{tempo-charge-store-Q3D7KYMH.js → tempo-charge-store-GA6CED6O.js} +2 -2
- package/dist/{tempo-session-store-ZRNCOX7P.js → tempo-session-store-WZWQRITB.js} +3 -3
- package/dist/testing/index.d.ts +3 -3
- package/dist/testing/index.js +6 -7
- package/dist/{usd-DI3d3gTK.d.ts → usd-DkRy9nfU.d.ts} +1 -1
- package/dist/{x402-FT4S4JS4.js → x402-ZU4GML7Z.js} +8 -27
- package/package.json +1 -1
- package/dist/chunk-66HGCPBU.js +0 -25
- package/dist/chunk-AT6V3SY7.js +0 -102
- package/dist/chunk-EZXAJ6EI.js +0 -1082
- package/dist/chunk-HCLVYZUZ.js +0 -244
- package/dist/chunk-JEVLNAO3.js +0 -1668
- package/dist/chunk-NFMOPYBA.js +0 -357
- package/dist/chunk-O2OTZ5GP.js +0 -1869
- package/dist/chunk-OFVV37XC.js +0 -57
- package/dist/chunk-SZVXOQ75.js +0 -211
- package/dist/chunk-WBOKPC37.js +0 -795
- package/dist/tempo-lifecycle-GJ77YKVY.js +0 -15
- package/dist/tempo-wallet-X2GGAZ6X.js +0 -40
|
@@ -81,7 +81,11 @@ type X402SettlementReconciliationReason = "settlement_not_on_chain" | "chain_unr
|
|
|
81
81
|
interface X402BatchSettlementConfig {
|
|
82
82
|
/** Receiver-authorizer signer used when the facilitator advertises none. */
|
|
83
83
|
receiverAuthorizerSigner?: AuthorizerSigner;
|
|
84
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Immutable payer withdrawal grace in integer seconds; defaults to 86400 (24 hours).
|
|
86
|
+
* Base Sepolia (`eip155:84532`) permits an explicit value >=900 (15 minutes).
|
|
87
|
+
* All other networks retain the 86400 minimum, including in dev/test mode.
|
|
88
|
+
*/
|
|
85
89
|
withdrawDelay?: number;
|
|
86
90
|
/** Freshness window for local voucher verification. */
|
|
87
91
|
onchainStateTtlMs?: number;
|
|
@@ -5761,4 +5765,4 @@ declare class StepCache {
|
|
|
5761
5765
|
static deserialize(records: StepRecord[]): StepCache;
|
|
5762
5766
|
}
|
|
5763
5767
|
|
|
5764
|
-
export { type JobReceipt as $, type ApprovalContent as A, SignedRequestError as B, type Currency as C, type DVMConfig as D, type SignedRequestFailure as E, type SignedRequestReplayStore as F, type SignedRequestSignOpts as G, type SignedRequestStatementHeader as H, type IncomingMessage as I, type JobCost as J, type KVStore as K, type Logger as L, type SignedRequestVerifier as M, createSignedRequestVerifier as N, isZodSchema as O, type PaymentContent as P, type QuoteConfig as Q, type ResolvedCreditConfig as R, type SDKJobContext as S, signedRequestStatementHeader as T, UnsupportedCurrencyError as U, validateCurrency as V, type JsonValue as W, X402_BATCH_SETTLEMENT_SCHEME as X, X402_EXACT_SCHEME as Y, type ZodLike as Z, type FundingReceipt as _, type DVMDescriptor as a, isDrainReceipt as a$, type
|
|
5768
|
+
export { type JobReceipt as $, type ApprovalContent as A, SignedRequestError as B, type Currency as C, type DVMConfig as D, type SignedRequestFailure as E, type SignedRequestReplayStore as F, type SignedRequestSignOpts as G, type SignedRequestStatementHeader as H, type IncomingMessage as I, type JobCost as J, type KVStore as K, type Logger as L, type SignedRequestVerifier as M, createSignedRequestVerifier as N, isZodSchema as O, type PaymentContent as P, type QuoteConfig as Q, type ResolvedCreditConfig as R, type SDKJobContext as S, signedRequestStatementHeader as T, UnsupportedCurrencyError as U, validateCurrency as V, type JsonValue as W, X402_BATCH_SETTLEMENT_SCHEME as X, X402_EXACT_SCHEME as Y, type ZodLike as Z, type FundingReceipt as _, type DVMDescriptor as a, isDrainReceipt as a$, type MessageType as a0, type X402Version as a1, type MppxCredential as a2, type PaymentRequired as a3, type Message as a4, type MppxChallenge as a5, type ReceiptCredit as a6, type DrainReceipt as a7, type X402Wallet as a8, type PaymentRequirementsV1 as a9, type UnsignedFundingReceipt as aA, type UnsignedJobReceipt as aB, type VerifyResponse as aC, type WorkingContent as aD, type X402Config$1 as aE, type X402ResponseBody as aF, type X402SelfRelayRpcFailureReason as aG, X402_DEFAULT_NETWORK as aH, X402_V1_VERSION as aI, X402_VERSION as aJ, buildPaymentRequiredV2 as aK, buildPaymentRequirements as aL, caip2ToX402Network as aM, canonicalRequestPath as aN, canonicaliseForSigning as aO, canonicalize as aP, chainIdFromCaip2 as aQ, computeResultHash as aR, decodePayment as aS, decodePaymentRequiredHeader as aT, encodePayment as aU, encodePaymentRequiredHeader as aV, encodeSettleResponseHeader as aW, exactEvmAuthorization as aX, isArtifactMessage as aY, isCancelMessage as aZ, isCompleteMessage as a_, type PaymentRequirementsV2 as aa, type BuildPaymentRequirementsOpts as ab, type CapabilityDescriptor as ac, type CashuMode as ad, type CompleteContent as ae, type DrainReceiptEvent as af, type ExactEvmPayload as ag, type ExactEvmPayloadAuthorization as ah, type FundingMethod as ai, type MessageFrom as aj, type PaymentPayload as ak, type PaymentPayloadV1 as al, type PaymentPayloadV2 as am, type PaymentRequestContent as an, type PaymentRequiredV2 as ao, type PaymentRequirements as ap, type PromptContent as aq, RAIL_REFUNDABLE as ar, type ReceiptOutcome as as, type ReceiptPayment as at, type ResourceInfo as au, type SettleResponse as av, StepCache as aw, type StepRecord as ax, type TextContent as ay, type UnsignedDrainReceipt as az, type ArtifactContent as b, type DrawRecord as b$, isFundingReceipt as b0, isPaymentRequestMessage as b1, isPromptMessage as b2, isSignedJobReceipt as b3, isTextMessage as b4, isWorkingMessage as b5, paymentRequiredV2FromV1 as b6, signDrainReceipt as b7, signFundingReceipt as b8, signReceipt as b9, _testing as bA, createDefaultReplayStore as bB, depleteLots as bC, fifoOrder as bD, inKindDrawMsats as bE, isInKindDepletion as bF, isNonChannelBitcoinRail as bG, lotOwedSats as bH, netOwedSats as bI, wrapMppx as bJ, type CreditDrainEnqueue as bK, HostedSettlementReportObligations as bL, type DVMAuthScheme as bM, type CreditLedgerLike as bN, type X402RefundSettlementGate as bO, type CreditSnapshot as bP, type DrawResult as bQ, type X402SettlementStatus as bR, type X402UnresolvedRefund as bS, type GrownDrawResult as bT, type DrawResolution as bU, type FundingRecord as bV, type CreditInvoiceRecord as bW, type InvoiceSettlement as bX, type BlockedInvoiceCursor as bY, type InvoiceReconciliation as bZ, type InvoiceWriteOff as b_, usdcContractByCaip2 as ba, usdcContractFor as bb, usdcDomainNameFor as bc, usdcDomainVersionFor as bd, verifyDrainReceipt as be, verifyFundingReceipt as bf, verifyReceipt as bg, x402NetworkToCaip2 as bh, type X402ExactVersionSupport as bi, type X402Receipt as bj, type TransactionalPayoutHook as bk, type CashuMeltCompleted as bl, type CreditDepositPayload as bm, type CreditDrainPayload as bn, type FundingLot as bo, type LotDebit as bp, type LotDepletion as bq, type MppxServer as br, NON_CHANNEL_BITCOIN_RAILS as bs, type NonChannelBitcoinRail as bt, PayoutReporter as bu, PostgresTempoSessionStore as bv, RevenueReporter as bw, SIGNED_ENVELOPE_FIELDS as bx, SIGNED_ENVELOPE_TYPES as by, type X402TrackedChannel as bz, type CancelContent as c, type X402BatchSettlementConfig as c$, type StalePendingDrawCursor as c0, type TempoCreditLossEvidence as c1, type CreditLedgerQuerier as c2, type TempoCreditLoss as c3, type X402CreditLossEvidence as c4, type X402CreditLoss as c5, type DrainMethod as c6, type DrainRequestResult as c7, type BitcoinDepositLiability as c8, type CreditDrainRecord as c9, type JobTerminalReportPayload as cA, PostgresX402ChannelStorage as cB, type ReplayStoreBackend as cC, type RevenueSkippedNoRailPayload as cD, type RevenueSkippedNoRailReason as cE, type Secp256k1AuthOpts as cF, type X402ChannelStorageOpts as cG, type X402RelayLockHolder as cH, type X402RelaySubmissionLock as cI, X402RelaySubmissionLockError as cJ, allocateDrawValue as cK, clientCompatibilityAttributes as cL, clientCompatibilityMiddleware as cM, clientUpgradeRequired as cN, parseClientCapabilities as cO, parseClientCompatibility as cP, parseDvmClient as cQ, parseProtocolVersion as cR, requireClientCompatibility as cS, secp256k1Auth as cT, signedRequestInput as cU, type HostedIntent as cV, type X402SettlementIntent as cW, type HostedFundingReservation as cX, type X402SettlementCursor as cY, type X402SettlementWriteOff as cZ, type X402FacilitatorAuth as c_, type ChannelDrainCursor as ca, type DrainWriteOff as cb, type DrainReleaseResult as cc, type DrainFulfilment as cd, type DrainTransitionResult as ce, HostingCleanupFence as cf, CLIENT_COMPATIBILITY_HEADERS as cg, type ClientCompatibility as ch, type ClientCompatibilityEnv as ci, type ClientCompatibilityGate as cj, type ClientCompatibilityRequirement as ck, type ClientSemVer as cl, type CreditFundingBasis as cm, type CreditInvoiceStatus as cn, CreditLedger as co, CreditLedgerError as cp, type CreditLedgerErrorCode as cq, type CreditLedgerErrorDetails as cr, type CreditLedgerPool as cs, type CreditStatus as ct, DRAIN_DELIVERY_RESERVE_SATS as cu, DVM_PROTOCOL_VERSION as cv, type DrainConflictReason as cw, type DrawRailValue as cx, type DrawStatus as cy, type JobCostReportPayload as cz, type CanonicalEnvelope as d, type X402PayoutObserver as d0, type CreditDepositEnqueue as d1, type X402SettlementReconciliationReason as d2, type CreditDrawReleaseEnqueue as d3, type CreateSignedRequestVerifierOpts as e, type CreditConfig as f, type CreditView as g, DEFAULT_CREDIT_MAX as h, DEFAULT_CREDIT_MIN as i, DEFAULT_CREDIT_TTL_SECONDS as j, DEFAULT_JOB_RETENTION_DAYS as k, type DVMRouteContext as l, type InputType as m, InvalidCurrencyError as n, type PaymentMethod as o, type PriceValue as p, type ProgressContent as q, type PromptOpts as r, type QuoteContext as s, type QuoteResult as t, type ResponseContent as u, type SDKPaymentRequestOpts as v, SIGNED_REQUEST_AUTH_ID as w, SIGNED_REQUEST_STATEMENT_VERSION as x, type SignedRequestAudience as y, type SignedRequestDomain as z };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PostgresTempoChargeStore
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RXPHMS4C.js";
|
|
4
4
|
import "./chunk-YG7G4DPZ.js";
|
|
5
|
+
import "./chunk-LAKP6FUI.js";
|
|
5
6
|
import "./chunk-COYKJRMM.js";
|
|
6
|
-
import "./chunk-ETXDTUJO.js";
|
|
7
7
|
export {
|
|
8
8
|
PostgresTempoChargeStore
|
|
9
9
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PostgresTempoSessionStore,
|
|
3
3
|
assertMonotonicTransition
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MON76YBJ.js";
|
|
5
5
|
import "./chunk-YG7G4DPZ.js";
|
|
6
|
+
import "./chunk-TRNMTTPX.js";
|
|
7
|
+
import "./chunk-LAKP6FUI.js";
|
|
6
8
|
import "./chunk-COYKJRMM.js";
|
|
7
|
-
import "./chunk-P6QON7ER.js";
|
|
8
|
-
import "./chunk-ETXDTUJO.js";
|
|
9
9
|
export {
|
|
10
10
|
PostgresTempoSessionStore,
|
|
11
11
|
assertMonotonicTransition
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as ContentHoldHistory, a as ContentHoldMutation } from '../content-retention-
|
|
2
|
-
import { $ as JobReceipt,
|
|
3
|
-
import { c as StreamableJobStore, R as ReceiptIssuingStore, J as JobRecord, d as RequestIdClaim, e as RequestIdClaimResult, f as JobRetentionCursor, O as OutgoingMessage, A as AppendOutgoingOptions, P as PaymentCreditDelta, V as VerifyAndCreditResult, g as JobCounters } from '../job-store-
|
|
1
|
+
import { C as ContentHoldHistory, a as ContentHoldMutation } from '../content-retention-ChFSSVO0.js';
|
|
2
|
+
import { $ as JobReceipt, a4 as Message, a0 as MessageType, K as KVStore, L as Logger, u as ResponseContent, P as PaymentContent, S as SDKJobContext } from '../step-cache-DDTwd4SK.js';
|
|
3
|
+
import { c as StreamableJobStore, R as ReceiptIssuingStore, J as JobRecord, d as RequestIdClaim, e as RequestIdClaimResult, f as JobRetentionCursor, O as OutgoingMessage, A as AppendOutgoingOptions, P as PaymentCreditDelta, V as VerifyAndCreditResult, g as JobCounters } from '../job-store-DkfNE9sv.js';
|
|
4
4
|
import 'hono';
|
|
5
5
|
import 'mppx';
|
|
6
6
|
import '@x402/core/server';
|
package/dist/testing/index.js
CHANGED
|
@@ -4,21 +4,20 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
MemoryJobStore,
|
|
6
6
|
createInstrumentedFetch
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-RAGX6VG7.js";
|
|
8
8
|
import {
|
|
9
9
|
JobCancelledError
|
|
10
10
|
} from "../chunk-AFV77S4C.js";
|
|
11
11
|
import {
|
|
12
12
|
createNoopLogger
|
|
13
|
-
} from "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-FUJ36YDV.js";
|
|
13
|
+
} from "../chunk-AQ7OX5NX.js";
|
|
14
|
+
import "../chunk-KXWROQGK.js";
|
|
16
15
|
import "../chunk-BQJIFRAZ.js";
|
|
16
|
+
import "../chunk-USL7ZEXN.js";
|
|
17
17
|
import {
|
|
18
18
|
validateCurrency
|
|
19
|
-
} from "../chunk-
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-ETXDTUJO.js";
|
|
19
|
+
} from "../chunk-CLIAFTUR.js";
|
|
20
|
+
import "../chunk-LAKP6FUI.js";
|
|
22
21
|
|
|
23
22
|
// src/sdk/testing/test-context.ts
|
|
24
23
|
function createTestContext(opts) {
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
connectedX402Payer,
|
|
3
2
|
ensureAddress,
|
|
4
3
|
generateX402PrivateKey,
|
|
5
4
|
getX402Balance,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
repinX402WalletNetwork,
|
|
9
|
-
resolveX402Asset,
|
|
10
|
-
saveX402Wallet,
|
|
11
|
-
tryX402Payment,
|
|
12
|
-
x402WrongAssetHint
|
|
13
|
-
} from "./chunk-EZXAJ6EI.js";
|
|
14
|
-
import "./chunk-O2OTZ5GP.js";
|
|
15
|
-
import "./chunk-WBOKPC37.js";
|
|
5
|
+
resolveX402Asset
|
|
6
|
+
} from "./chunk-OFSOLHRX.js";
|
|
16
7
|
import {
|
|
17
8
|
verifyX402Payment
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-NFMOPYBA.js";
|
|
9
|
+
} from "./chunk-H5FVVEEN.js";
|
|
10
|
+
import "./chunk-26W6GPCD.js";
|
|
21
11
|
import {
|
|
22
12
|
X402_DEFAULT_FACILITATOR,
|
|
23
13
|
X402_DEFAULT_NETWORK,
|
|
@@ -36,11 +26,8 @@ import {
|
|
|
36
26
|
paymentRequiredV2FromV1,
|
|
37
27
|
usdcContractByCaip2,
|
|
38
28
|
x402NetworkToCaip2
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import "./chunk-66HGCPBU.js";
|
|
42
|
-
import "./chunk-FUJ36YDV.js";
|
|
43
|
-
import "./chunk-AT6V3SY7.js";
|
|
29
|
+
} from "./chunk-62FI3NJF.js";
|
|
30
|
+
import "./chunk-KXWROQGK.js";
|
|
44
31
|
import {
|
|
45
32
|
X402_NETWORKS,
|
|
46
33
|
assertSupportedX402Network,
|
|
@@ -49,6 +36,7 @@ import {
|
|
|
49
36
|
x402NetworkListForCopy,
|
|
50
37
|
x402SupportedNetworksHint
|
|
51
38
|
} from "./chunk-BPYMEMQX.js";
|
|
39
|
+
import "./chunk-LAKP6FUI.js";
|
|
52
40
|
export {
|
|
53
41
|
X402_DEFAULT_FACILITATOR,
|
|
54
42
|
X402_DEFAULT_NETWORK,
|
|
@@ -60,7 +48,6 @@ export {
|
|
|
60
48
|
buildPaymentRequirements,
|
|
61
49
|
caip2ToX402Network,
|
|
62
50
|
chainIdFromCaip2,
|
|
63
|
-
connectedX402Payer,
|
|
64
51
|
decodePayment,
|
|
65
52
|
decodePaymentRequiredHeader,
|
|
66
53
|
encodePayment,
|
|
@@ -70,19 +57,13 @@ export {
|
|
|
70
57
|
exactEvmAuthorization,
|
|
71
58
|
generateX402PrivateKey,
|
|
72
59
|
getX402Balance,
|
|
73
|
-
loadX402Wallet,
|
|
74
60
|
paymentRequiredV2FromV1,
|
|
75
|
-
removeX402Wallet,
|
|
76
|
-
repinX402WalletNetwork,
|
|
77
61
|
resolveX402Asset,
|
|
78
|
-
saveX402Wallet,
|
|
79
|
-
tryX402Payment,
|
|
80
62
|
usdcContractByCaip2,
|
|
81
63
|
verifyX402Payment,
|
|
82
64
|
x402NetworkByCaip2,
|
|
83
65
|
x402NetworkLabel,
|
|
84
66
|
x402NetworkListForCopy,
|
|
85
67
|
x402NetworkToCaip2,
|
|
86
|
-
x402SupportedNetworksHint
|
|
87
|
-
x402WrongAssetHint
|
|
68
|
+
x402SupportedNetworksHint
|
|
88
69
|
};
|
package/package.json
CHANGED
package/dist/chunk-66HGCPBU.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// src/lib/caller-loggers.ts
|
|
2
|
-
var callerLoggers = buildNoopLoggers();
|
|
3
|
-
function initCallerLoggers(nextLoggers) {
|
|
4
|
-
callerLoggers = nextLoggers;
|
|
5
|
-
}
|
|
6
|
-
function buildNoopLoggers() {
|
|
7
|
-
const noopLogger = {
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function -- standalone caller has no exporter
|
|
9
|
-
info() {
|
|
10
|
-
},
|
|
11
|
-
async span(_name, _attrs, fn) {
|
|
12
|
-
return fn();
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
return {
|
|
16
|
-
cashu: noopLogger,
|
|
17
|
-
lightning: noopLogger,
|
|
18
|
-
x402: noopLogger
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
callerLoggers,
|
|
24
|
-
initCallerLoggers
|
|
25
|
-
};
|
package/dist/chunk-AT6V3SY7.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
// src/sdk/pricing/usd.ts
|
|
2
|
-
var InvalidFxRateError = class extends Error {
|
|
3
|
-
code = "invalid_fx_rate";
|
|
4
|
-
ratePerBtc;
|
|
5
|
-
constructor(ratePerBtc) {
|
|
6
|
-
super(
|
|
7
|
-
`invalid fx rate ${String(ratePerBtc)} \u2014 expected a finite positive number of fiat per BTC`
|
|
8
|
-
);
|
|
9
|
-
this.ratePerBtc = ratePerBtc;
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
function fiatToSatsCeil(amount, ratePerBtc) {
|
|
13
|
-
if (!Number.isFinite(ratePerBtc) || ratePerBtc <= 0) {
|
|
14
|
-
throw new InvalidFxRateError(ratePerBtc);
|
|
15
|
-
}
|
|
16
|
-
if (!Number.isFinite(amount) || amount < 0) return 0;
|
|
17
|
-
return Math.ceil(amount * 1e8 / ratePerBtc);
|
|
18
|
-
}
|
|
19
|
-
function satsToFiat(sats, ratePerBtc) {
|
|
20
|
-
if (!Number.isFinite(ratePerBtc) || ratePerBtc <= 0) {
|
|
21
|
-
throw new InvalidFxRateError(ratePerBtc);
|
|
22
|
-
}
|
|
23
|
-
return sats / 1e8 * ratePerBtc;
|
|
24
|
-
}
|
|
25
|
-
var InvalidUsdPriceError = class extends Error {
|
|
26
|
-
constructor(field, value, detail) {
|
|
27
|
-
super(`${field}: ${detail}`);
|
|
28
|
-
this.field = field;
|
|
29
|
-
this.value = value;
|
|
30
|
-
this.name = "InvalidUsdPriceError";
|
|
31
|
-
}
|
|
32
|
-
field;
|
|
33
|
-
value;
|
|
34
|
-
code = "invalid_usd_price";
|
|
35
|
-
};
|
|
36
|
-
function parseUsdPrice(value, field) {
|
|
37
|
-
if (!USD_PRICE_RE.test(value)) {
|
|
38
|
-
throw new InvalidUsdPriceError(
|
|
39
|
-
field,
|
|
40
|
-
value,
|
|
41
|
-
`${JSON.stringify(value)} is not a USD price literal. Use a "$X.XX" string, e.g. "$0.05".`
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
const usd = parseFloat(value.slice(1));
|
|
45
|
-
if (!Number.isFinite(usd) || usd < MIN_USD_PRICE) {
|
|
46
|
-
throw new InvalidUsdPriceError(
|
|
47
|
-
field,
|
|
48
|
-
value,
|
|
49
|
-
`${JSON.stringify(value)} is below ${MIN_USD_PRICE_LITERAL}, the smallest price the wire can carry \u2014 every price surface rounds to four decimals, so this would advertise as $0 and then charge anyway. Charge at least ${MIN_USD_PRICE_LITERAL}, or omit the price for a free capability.`
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
if (roundUsd(usd) !== usd) {
|
|
53
|
-
throw new InvalidUsdPriceError(
|
|
54
|
-
field,
|
|
55
|
-
value,
|
|
56
|
-
`${JSON.stringify(value)} carries more than four decimal places. Every price surface rounds to four, so this would advertise ${formatUsd(roundUsd(usd))} and charge something else. Use at most four decimals.`
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
if (!Number.isSafeInteger(Math.round(usd * 1e6))) {
|
|
60
|
-
throw new InvalidUsdPriceError(
|
|
61
|
-
field,
|
|
62
|
-
value,
|
|
63
|
-
`${JSON.stringify(value)} is too large to denominate. Use an amount under $9,007,199,254.`
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
return usd;
|
|
67
|
-
}
|
|
68
|
-
function roundUsd(usd) {
|
|
69
|
-
return Math.round(usd * 1e4) / 1e4;
|
|
70
|
-
}
|
|
71
|
-
function formatUsd(usd) {
|
|
72
|
-
if (usd === 0) return "$0.00";
|
|
73
|
-
if (usd >= 0.01) return `$${usd.toFixed(2)}`;
|
|
74
|
-
return `$${usd.toFixed(4)}`;
|
|
75
|
-
}
|
|
76
|
-
function formatFiat(amount, currency) {
|
|
77
|
-
const code = currency.toUpperCase();
|
|
78
|
-
const symbol = FIAT_SYMBOLS[currency] ?? "";
|
|
79
|
-
const digits = currency === "jpy" ? 0 : amount >= 0.01 || amount === 0 ? 2 : 4;
|
|
80
|
-
const body = `${amount.toFixed(digits)} ${code}`;
|
|
81
|
-
return symbol ? `${symbol}${body}` : body;
|
|
82
|
-
}
|
|
83
|
-
var USD_PRICE_RE = /^\$\d+(\.\d+)?$/;
|
|
84
|
-
var MIN_USD_PRICE = 1e-4;
|
|
85
|
-
var MIN_USD_PRICE_LITERAL = '"$0.0001"';
|
|
86
|
-
var FIAT_SYMBOLS = {
|
|
87
|
-
usd: "$",
|
|
88
|
-
eur: "\u20AC",
|
|
89
|
-
gbp: "\xA3",
|
|
90
|
-
jpy: "\xA5"
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export {
|
|
94
|
-
InvalidFxRateError,
|
|
95
|
-
fiatToSatsCeil,
|
|
96
|
-
satsToFiat,
|
|
97
|
-
InvalidUsdPriceError,
|
|
98
|
-
parseUsdPrice,
|
|
99
|
-
roundUsd,
|
|
100
|
-
formatUsd,
|
|
101
|
-
formatFiat
|
|
102
|
-
};
|