@resvary/sdk 0.5.0-alpha.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/LICENSE +13 -0
- package/README.md +17 -0
- package/dist/billing/index.d.ts +3 -0
- package/dist/billing/index.d.ts.map +1 -0
- package/dist/billing/index.js +3 -0
- package/dist/billing/index.js.map +1 -0
- package/dist/billing/meter.d.ts +97 -0
- package/dist/billing/meter.d.ts.map +1 -0
- package/dist/billing/meter.js +109 -0
- package/dist/billing/meter.js.map +1 -0
- package/dist/billing/plans.d.ts +77 -0
- package/dist/billing/plans.d.ts.map +1 -0
- package/dist/billing/plans.js +65 -0
- package/dist/billing/plans.js.map +1 -0
- package/dist/client/buyer.d.ts +82 -0
- package/dist/client/buyer.d.ts.map +1 -0
- package/dist/client/buyer.js +168 -0
- package/dist/client/buyer.js.map +1 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +2 -0
- package/dist/client/index.js.map +1 -0
- package/dist/constants.d.ts +36 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +42 -0
- package/dist/constants.js.map +1 -0
- package/dist/credits/amount.d.ts +7 -0
- package/dist/credits/amount.d.ts.map +1 -0
- package/dist/credits/amount.js +36 -0
- package/dist/credits/amount.js.map +1 -0
- package/dist/credits/errors.d.ts +20 -0
- package/dist/credits/errors.d.ts.map +1 -0
- package/dist/credits/errors.js +35 -0
- package/dist/credits/errors.js.map +1 -0
- package/dist/credits/index.d.ts +7 -0
- package/dist/credits/index.d.ts.map +1 -0
- package/dist/credits/index.js +6 -0
- package/dist/credits/index.js.map +1 -0
- package/dist/credits/ledger.d.ts +175 -0
- package/dist/credits/ledger.d.ts.map +1 -0
- package/dist/credits/ledger.js +705 -0
- package/dist/credits/ledger.js.map +1 -0
- package/dist/credits/store.d.ts +104 -0
- package/dist/credits/store.d.ts.map +1 -0
- package/dist/credits/store.js +420 -0
- package/dist/credits/store.js.map +1 -0
- package/dist/credits/types.d.ts +234 -0
- package/dist/credits/types.d.ts.map +1 -0
- package/dist/credits/types.js +2 -0
- package/dist/credits/types.js.map +1 -0
- package/dist/credits/webhooks.d.ts +5 -0
- package/dist/credits/webhooks.d.ts.map +1 -0
- package/dist/credits/webhooks.js +13 -0
- package/dist/credits/webhooks.js.map +1 -0
- package/dist/funding/arc-worker.d.ts +55 -0
- package/dist/funding/arc-worker.d.ts.map +1 -0
- package/dist/funding/arc-worker.js +133 -0
- package/dist/funding/arc-worker.js.map +1 -0
- package/dist/funding/arc.d.ts +38 -0
- package/dist/funding/arc.d.ts.map +1 -0
- package/dist/funding/arc.js +83 -0
- package/dist/funding/arc.js.map +1 -0
- package/dist/funding/index.d.ts +3 -0
- package/dist/funding/index.d.ts.map +1 -0
- package/dist/funding/index.js +3 -0
- package/dist/funding/index.js.map +1 -0
- package/dist/gateway/client.d.ts +51 -0
- package/dist/gateway/client.d.ts.map +1 -0
- package/dist/gateway/client.js +59 -0
- package/dist/gateway/client.js.map +1 -0
- package/dist/gateway/index.d.ts +2 -0
- package/dist/gateway/index.d.ts.map +1 -0
- package/dist/gateway/index.js +2 -0
- package/dist/gateway/index.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/middleware/express.d.ts +25 -0
- package/dist/middleware/express.d.ts.map +1 -0
- package/dist/middleware/express.js +61 -0
- package/dist/middleware/express.js.map +1 -0
- package/dist/middleware/index.d.ts +4 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +4 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/next.d.ts +27 -0
- package/dist/middleware/next.d.ts.map +1 -0
- package/dist/middleware/next.js +67 -0
- package/dist/middleware/next.js.map +1 -0
- package/dist/middleware/paywall.d.ts +54 -0
- package/dist/middleware/paywall.d.ts.map +1 -0
- package/dist/middleware/paywall.js +102 -0
- package/dist/middleware/paywall.js.map +1 -0
- package/dist/pricing/index.d.ts +3 -0
- package/dist/pricing/index.d.ts.map +1 -0
- package/dist/pricing/index.js +2 -0
- package/dist/pricing/index.js.map +1 -0
- package/dist/pricing/rating.d.ts +21 -0
- package/dist/pricing/rating.d.ts.map +1 -0
- package/dist/pricing/rating.js +109 -0
- package/dist/pricing/rating.js.map +1 -0
- package/dist/receipts/amount.d.ts +8 -0
- package/dist/receipts/amount.d.ts.map +1 -0
- package/dist/receipts/amount.js +27 -0
- package/dist/receipts/amount.js.map +1 -0
- package/dist/receipts/index.d.ts +16 -0
- package/dist/receipts/index.d.ts.map +1 -0
- package/dist/receipts/index.js +15 -0
- package/dist/receipts/index.js.map +1 -0
- package/dist/receipts/invoice.d.ts +18 -0
- package/dist/receipts/invoice.d.ts.map +1 -0
- package/dist/receipts/invoice.js +112 -0
- package/dist/receipts/invoice.js.map +1 -0
- package/dist/receipts/ledger.d.ts +30 -0
- package/dist/receipts/ledger.d.ts.map +1 -0
- package/dist/receipts/ledger.js +109 -0
- package/dist/receipts/ledger.js.map +1 -0
- package/dist/receipts/memo-payment.d.ts +100 -0
- package/dist/receipts/memo-payment.d.ts.map +1 -0
- package/dist/receipts/memo-payment.js +91 -0
- package/dist/receipts/memo-payment.js.map +1 -0
- package/dist/receipts/memo.d.ts +14 -0
- package/dist/receipts/memo.d.ts.map +1 -0
- package/dist/receipts/memo.js +39 -0
- package/dist/receipts/memo.js.map +1 -0
- package/dist/receipts/persistent-ledger.d.ts +27 -0
- package/dist/receipts/persistent-ledger.d.ts.map +1 -0
- package/dist/receipts/persistent-ledger.js +111 -0
- package/dist/receipts/persistent-ledger.js.map +1 -0
- package/dist/receipts/persistent-webhook-inbox.d.ts +32 -0
- package/dist/receipts/persistent-webhook-inbox.d.ts.map +1 -0
- package/dist/receipts/persistent-webhook-inbox.js +93 -0
- package/dist/receipts/persistent-webhook-inbox.js.map +1 -0
- package/dist/receipts/proof.d.ts +80 -0
- package/dist/receipts/proof.d.ts.map +1 -0
- package/dist/receipts/proof.js +223 -0
- package/dist/receipts/proof.js.map +1 -0
- package/dist/receipts/serialization.d.ts +3 -0
- package/dist/receipts/serialization.d.ts.map +1 -0
- package/dist/receipts/serialization.js +24 -0
- package/dist/receipts/serialization.js.map +1 -0
- package/dist/receipts/store.d.ts +69 -0
- package/dist/receipts/store.d.ts.map +1 -0
- package/dist/receipts/store.js +85 -0
- package/dist/receipts/store.js.map +1 -0
- package/dist/receipts/types.d.ts +134 -0
- package/dist/receipts/types.d.ts.map +1 -0
- package/dist/receipts/types.js +5 -0
- package/dist/receipts/types.js.map +1 -0
- package/dist/receipts/watcher.d.ts +92 -0
- package/dist/receipts/watcher.d.ts.map +1 -0
- package/dist/receipts/watcher.js +323 -0
- package/dist/receipts/watcher.js.map +1 -0
- package/dist/receipts/webhook-inbox.d.ts +34 -0
- package/dist/receipts/webhook-inbox.d.ts.map +1 -0
- package/dist/receipts/webhook-inbox.js +101 -0
- package/dist/receipts/webhook-inbox.js.map +1 -0
- package/dist/receipts/webhook-route.d.ts +22 -0
- package/dist/receipts/webhook-route.d.ts.map +1 -0
- package/dist/receipts/webhook-route.js +37 -0
- package/dist/receipts/webhook-route.js.map +1 -0
- package/dist/receipts/webhooks.d.ts +20 -0
- package/dist/receipts/webhooks.d.ts.map +1 -0
- package/dist/receipts/webhooks.js +72 -0
- package/dist/receipts/webhooks.js.map +1 -0
- package/dist/types.d.ts +101 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +116 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arc wallet balance reader.
|
|
3
|
+
*
|
|
4
|
+
* This client reads the native USDC balance exposed by Arc RPC. It does not
|
|
5
|
+
* query Circle Gateway unified balances or pending Gateway settlements.
|
|
6
|
+
*/
|
|
7
|
+
import type { NetworkConfig } from '../types.js';
|
|
8
|
+
/** Arc exposes native USDC with 18 RPC balance decimals. */
|
|
9
|
+
export declare const ARC_NATIVE_USDC_DECIMALS = 18;
|
|
10
|
+
export interface ArcWalletBalanceClientConfig {
|
|
11
|
+
walletAddress: `0x${string}`;
|
|
12
|
+
rpcUrl?: string;
|
|
13
|
+
network?: NetworkConfig;
|
|
14
|
+
}
|
|
15
|
+
/** @deprecated Use ArcWalletBalanceClientConfig. */
|
|
16
|
+
export type GatewayClientConfig = ArcWalletBalanceClientConfig;
|
|
17
|
+
export interface BalanceInfo {
|
|
18
|
+
/** Native Arc USDC balance, formatted with 18 RPC decimals. */
|
|
19
|
+
available: string;
|
|
20
|
+
/** Always zero: this client does not query Gateway pending settlements. */
|
|
21
|
+
pending: '0';
|
|
22
|
+
/** Equal to available for this Arc wallet reader. */
|
|
23
|
+
total: string;
|
|
24
|
+
lastUpdated: number;
|
|
25
|
+
}
|
|
26
|
+
export interface SettlementRecord {
|
|
27
|
+
txHash: `0x${string}`;
|
|
28
|
+
amount: string;
|
|
29
|
+
batchSize: number;
|
|
30
|
+
timestamp: number;
|
|
31
|
+
blockNumber: bigint;
|
|
32
|
+
}
|
|
33
|
+
export declare class ArcWalletBalanceClient {
|
|
34
|
+
private readonly walletAddress;
|
|
35
|
+
private readonly client;
|
|
36
|
+
private readonly network;
|
|
37
|
+
constructor(config: ArcWalletBalanceClientConfig);
|
|
38
|
+
getBalance(): Promise<BalanceInfo>;
|
|
39
|
+
getAddress(): `0x${string}`;
|
|
40
|
+
getNetwork(): NetworkConfig;
|
|
41
|
+
getExplorerUrl(txHash: `0x${string}`): string;
|
|
42
|
+
getAddressExplorerUrl(): string;
|
|
43
|
+
hasSufficientBalance(amount: string): Promise<boolean>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated This name implied a Circle Gateway client. Use
|
|
47
|
+
* ArcWalletBalanceClient for Arc RPC balances or @resvary/circle for Gateway.
|
|
48
|
+
*/
|
|
49
|
+
export declare class GatewayClient extends ArcWalletBalanceClient {
|
|
50
|
+
}
|
|
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,MAAM;IAIzB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAM7D;AAED;;;GAGG;AACH,qBAAa,aAAc,SAAQ,sBAAsB;CAAG"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arc wallet balance reader.
|
|
3
|
+
*
|
|
4
|
+
* This client reads the native USDC balance exposed by Arc RPC. It does not
|
|
5
|
+
* query Circle Gateway unified balances or pending Gateway settlements.
|
|
6
|
+
*/
|
|
7
|
+
import { createPublicClient, formatUnits, http, parseUnits } from 'viem';
|
|
8
|
+
import { ARC_TESTNET } from '../constants.js';
|
|
9
|
+
/** Arc exposes native USDC with 18 RPC balance decimals. */
|
|
10
|
+
export const ARC_NATIVE_USDC_DECIMALS = 18;
|
|
11
|
+
export class ArcWalletBalanceClient {
|
|
12
|
+
walletAddress;
|
|
13
|
+
client;
|
|
14
|
+
network;
|
|
15
|
+
constructor(config) {
|
|
16
|
+
this.walletAddress = config.walletAddress;
|
|
17
|
+
this.network = config.network ?? ARC_TESTNET;
|
|
18
|
+
this.client = createPublicClient({
|
|
19
|
+
transport: http(config.rpcUrl ?? this.network.rpcUrl),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
async getBalance() {
|
|
23
|
+
const balance = await this.client.getBalance({
|
|
24
|
+
address: this.walletAddress,
|
|
25
|
+
});
|
|
26
|
+
const available = formatUnits(balance, ARC_NATIVE_USDC_DECIMALS);
|
|
27
|
+
return {
|
|
28
|
+
available,
|
|
29
|
+
pending: '0',
|
|
30
|
+
total: available,
|
|
31
|
+
lastUpdated: Date.now(),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
getAddress() {
|
|
35
|
+
return this.walletAddress;
|
|
36
|
+
}
|
|
37
|
+
getNetwork() {
|
|
38
|
+
return this.network;
|
|
39
|
+
}
|
|
40
|
+
getExplorerUrl(txHash) {
|
|
41
|
+
return `${this.network.explorerUrl}/tx/${txHash}`;
|
|
42
|
+
}
|
|
43
|
+
getAddressExplorerUrl() {
|
|
44
|
+
return `${this.network.explorerUrl}/address/${this.walletAddress}`;
|
|
45
|
+
}
|
|
46
|
+
async hasSufficientBalance(amount) {
|
|
47
|
+
const rawBalance = await this.client.getBalance({
|
|
48
|
+
address: this.walletAddress,
|
|
49
|
+
});
|
|
50
|
+
return rawBalance >= parseUnits(amount, ARC_NATIVE_USDC_DECIMALS);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated This name implied a Circle Gateway client. Use
|
|
55
|
+
* ArcWalletBalanceClient for Arc RPC balances or @resvary/circle for Gateway.
|
|
56
|
+
*/
|
|
57
|
+
export class GatewayClient extends ArcWalletBalanceClient {
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/gateway/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAqB,MAAM,MAAM,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,4DAA4D;AAC5D,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AA6B3C,MAAM,OAAO,sBAAsB;IAChB,aAAa,CAAgB;IAC7B,MAAM,CAAe;IACrB,OAAO,CAAgB;IAExC,YAAY,MAAoC;QAC9C,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;QAC1C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,WAAW,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,kBAAkB,CAAC;YAC/B,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;SACtD,CAAC,CAAC;IACL,CAAC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aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gateway/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,aAAa,GAKd,MAAM,aAAa,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @resvary/sdk
|
|
3
|
+
*
|
|
4
|
+
* Open-source prepaid credits and usage billing for AI products.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
export { createPaywallMiddleware, type PaywallConfig, type PaywallMiddleware, } from './middleware/paywall.js';
|
|
9
|
+
export { expressPaywall } from './middleware/express.js';
|
|
10
|
+
export { nextPaywall, type NextRouteHandler } from './middleware/next.js';
|
|
11
|
+
export { BuyerClient, type BuyerClientConfig } from './client/buyer.js';
|
|
12
|
+
export { UsageMeter, type UsageRecord, type MeterConfig } from './billing/meter.js';
|
|
13
|
+
export { createBillingPlan, type BillingPlan, type PricingModel, type PerRequestPricing, type PerSecondPricing, type PerJobPricing, } from './billing/plans.js';
|
|
14
|
+
export * from './credits/index.js';
|
|
15
|
+
export { createMeterDefinition, createPriceVersion, rateUsage } from './pricing/index.js';
|
|
16
|
+
export { ArcCreditFunding, type ArcCreditFundingConfig, type ArcFundingRequest, } from './funding/index.js';
|
|
17
|
+
export { ArcWalletBalanceClient, GatewayClient, ARC_NATIVE_USDC_DECIMALS, type ArcWalletBalanceClientConfig, type GatewayClientConfig, } from './gateway/client.js';
|
|
18
|
+
export { ReceiptWatcher, InMemoryReceiptStore, PersistentReceiptLedger, PersistentWebhookInbox, ReceiptLedger, WebhookInbox, createInvoice, createInvoiceMemo, createMemoPaymentRequest, createReceipt, createWebhookRouteHandler, createWatcherCursorKey, findMemoPaymentProof, parseReceiptStoreValue, serializeReceiptStoreValue, signWebhookEvent, verifyMemoPaymentProof, verifyWebhookSignature, type PaymentInvoice, type PaymentReceipt, type ReceiptOnchainProof, type ReceiptWatcherConfig, type CreateInvoiceInput, type FindMemoPaymentProofInput, type FindMemoPaymentProofResult, type PersistentReceiptLedgerConfig, type PersistentWebhookInboxConfig, type MemoPaymentRequest, type ObservedPayment, type ProofClient, type ProofMemoLog, type ProofPollingClient, type ReceiptStore, type ReceiptStoreDeliveryFilter, type ReceiptStoreEventFilter, type ReceiptStoreInvoiceFilter, type ProofTransactionReceipt, type ReceiptWatcherClient, type VerifyMemoPaymentProofInput, type VerifyMemoPaymentProofResult, type WatcherCursor, type WatcherCursorKeyInput, type WebhookDeliveryAttempt, type WebhookDeliveryStatus, type WebhookEvent, type WebhookRouteHandlerConfig, type WebhookRouteResult, } from './receipts/index.js';
|
|
19
|
+
export { ARC_TESTNET, ARC_TESTNET_CONTRACTS, USDC_DECIMALS } from './constants.js';
|
|
20
|
+
export type { PaymentRequirements, PaymentPayload, PaymentResult, X402Version, NetworkConfig, } from './types.js';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,uBAAuB,EACvB,KAAK,aAAa,EAClB,KAAK,iBAAiB,GACvB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,EACL,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK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AAqB,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEnF,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,WAAW,EACX,aAAa,GACd,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @resvary/sdk
|
|
3
|
+
*
|
|
4
|
+
* Open-source prepaid credits and usage billing for AI products.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
export { createPaywallMiddleware, } from './middleware/paywall.js';
|
|
9
|
+
export { expressPaywall } from './middleware/express.js';
|
|
10
|
+
export { nextPaywall } from './middleware/next.js';
|
|
11
|
+
export { BuyerClient } from './client/buyer.js';
|
|
12
|
+
export { UsageMeter } from './billing/meter.js';
|
|
13
|
+
export { createBillingPlan, } from './billing/plans.js';
|
|
14
|
+
export * from './credits/index.js';
|
|
15
|
+
export { createMeterDefinition, createPriceVersion, rateUsage } from './pricing/index.js';
|
|
16
|
+
export { ArcCreditFunding, } from './funding/index.js';
|
|
17
|
+
export { ArcWalletBalanceClient, GatewayClient, ARC_NATIVE_USDC_DECIMALS, } from './gateway/client.js';
|
|
18
|
+
export { ReceiptWatcher, InMemoryReceiptStore, PersistentReceiptLedger, PersistentWebhookInbox, ReceiptLedger, WebhookInbox, createInvoice, createInvoiceMemo, createMemoPaymentRequest, createReceipt, createWebhookRouteHandler, createWatcherCursorKey, findMemoPaymentProof, parseReceiptStoreValue, serializeReceiptStoreValue, signWebhookEvent, verifyMemoPaymentProof, verifyWebhookSignature, } from './receipts/index.js';
|
|
19
|
+
export { ARC_TESTNET, ARC_TESTNET_CONTRACTS, USDC_DECIMALS } from './constants.js';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,uBAAuB,GAGxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAyB,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EAAE,WAAW,EAA0B,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAE,UAAU,EAAsC,MAAM,oBAAoB,CAAC;AACpF,OAAO,EACL,iBAAiB,GAMlB,MAAM,oBAAoB,CAAC;AAE5B,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EACL,gBAAgB,GAGjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,sBAAsB,EACtB,aAAa,EACb,wBAAwB,GAGzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,wBAAwB,EACxB,aAAa,EACb,yBAAyB,EACzB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,GA8BvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Express.js middleware for x402 paywalled endpoints.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import express from 'express';
|
|
7
|
+
* import { expressPaywall } from '@resvary/sdk/middleware';
|
|
8
|
+
*
|
|
9
|
+
* const app = express();
|
|
10
|
+
*
|
|
11
|
+
* app.get('/api/data', expressPaywall({ price: '0.001' }), (req, res) => {
|
|
12
|
+
* res.json({ data: 'premium content' });
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import type { Request, Response, NextFunction } from 'express';
|
|
17
|
+
import { type PaywallConfig } from './paywall.js';
|
|
18
|
+
/**
|
|
19
|
+
* Create Express middleware that gates an endpoint behind an x402 paywall.
|
|
20
|
+
*
|
|
21
|
+
* @param config - Paywall configuration
|
|
22
|
+
* @returns Express middleware function
|
|
23
|
+
*/
|
|
24
|
+
export declare function expressPaywall(config: PaywallConfig): (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
25
|
+
//# sourceMappingURL=express.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../src/middleware/express.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAG3E;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,IAGpC,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,KAAG,OAAO,CAAC,IAAI,CAAC,CAwC9E"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Express.js middleware for x402 paywalled endpoints.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import express from 'express';
|
|
7
|
+
* import { expressPaywall } from '@resvary/sdk/middleware';
|
|
8
|
+
*
|
|
9
|
+
* const app = express();
|
|
10
|
+
*
|
|
11
|
+
* app.get('/api/data', expressPaywall({ price: '0.001' }), (req, res) => {
|
|
12
|
+
* res.json({ data: 'premium content' });
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import { createPaywallMiddleware } from './paywall.js';
|
|
17
|
+
import { HTTP_402, PAYMENT_REQUIRED_HEADER } from '../constants.js';
|
|
18
|
+
/**
|
|
19
|
+
* Create Express middleware that gates an endpoint behind an x402 paywall.
|
|
20
|
+
*
|
|
21
|
+
* @param config - Paywall configuration
|
|
22
|
+
* @returns Express middleware function
|
|
23
|
+
*/
|
|
24
|
+
export function expressPaywall(config) {
|
|
25
|
+
const paywall = createPaywallMiddleware(config);
|
|
26
|
+
return async (req, res, next) => {
|
|
27
|
+
// Extract headers as a simple record
|
|
28
|
+
const headers = {};
|
|
29
|
+
for (const [key, value] of Object.entries(req.headers)) {
|
|
30
|
+
headers[key.toLowerCase()] = Array.isArray(value) ? value[0] : value;
|
|
31
|
+
}
|
|
32
|
+
// Try to parse payment from headers
|
|
33
|
+
const payment = paywall.parsePayment(headers);
|
|
34
|
+
if (!payment) {
|
|
35
|
+
// No payment provided — return 402 with requirements
|
|
36
|
+
const requirements = paywall.getPaymentRequirements();
|
|
37
|
+
const encoded = Buffer.from(JSON.stringify(requirements)).toString('base64');
|
|
38
|
+
res
|
|
39
|
+
.status(HTTP_402)
|
|
40
|
+
.set(PAYMENT_REQUIRED_HEADER, encoded)
|
|
41
|
+
.json({
|
|
42
|
+
error: 'Payment Required',
|
|
43
|
+
message: `This endpoint requires a payment of ${config.price} USDC`,
|
|
44
|
+
requirements,
|
|
45
|
+
});
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
// Verify the payment
|
|
49
|
+
const isValid = await paywall.verifyPayment(payment);
|
|
50
|
+
if (!isValid) {
|
|
51
|
+
res.status(403).json({
|
|
52
|
+
error: 'Payment Invalid',
|
|
53
|
+
message: 'The provided payment could not be verified',
|
|
54
|
+
});
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
// Payment verified — proceed to handler
|
|
58
|
+
next();
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=express.js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AAO,EAAE,uCAAuC,MAAM,CAAC,KAAK,OAAO;gBACnE,YAAY;aACb,CAAC,CAAC;YACL,OAAO;QACT,CAAC;QAED,qBAAqB;QACrB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAErD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,KAAK,EAAE,iBAAiB;gBACxB,OAAO,EAAE,4CAA4C;aACtD,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,wCAAwC;QACxC,IAAI,EAAE,CAAC;IACT,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAA8C,MAAM,cAAc,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAyB,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Next.js App Router middleware for x402 paywalled endpoints.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* // app/api/data/route.ts
|
|
7
|
+
* import { nextPaywall } from '@resvary/sdk/middleware';
|
|
8
|
+
*
|
|
9
|
+
* export const GET = nextPaywall(
|
|
10
|
+
* { price: '0.001' },
|
|
11
|
+
* async (request) => {
|
|
12
|
+
* return Response.json({ data: 'premium content' });
|
|
13
|
+
* }
|
|
14
|
+
* );
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import { type PaywallConfig } from './paywall.js';
|
|
18
|
+
export type NextRouteHandler = (request: Request) => Promise<Response> | Response;
|
|
19
|
+
/**
|
|
20
|
+
* Wrap a Next.js route handler with x402 paywall protection.
|
|
21
|
+
*
|
|
22
|
+
* @param config - Paywall configuration
|
|
23
|
+
* @param handler - The route handler to protect
|
|
24
|
+
* @returns A new route handler that enforces payment
|
|
25
|
+
*/
|
|
26
|
+
export declare function nextPaywall(config: PaywallConfig, handler: NextRouteHandler): NextRouteHandler;
|
|
27
|
+
//# sourceMappingURL=next.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/middleware/next.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAI3E,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;AAElF;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,gBAAgB,GACxB,gBAAgB,CAqDlB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Next.js App Router middleware for x402 paywalled endpoints.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* // app/api/data/route.ts
|
|
7
|
+
* import { nextPaywall } from '@resvary/sdk/middleware';
|
|
8
|
+
*
|
|
9
|
+
* export const GET = nextPaywall(
|
|
10
|
+
* { price: '0.001' },
|
|
11
|
+
* async (request) => {
|
|
12
|
+
* return Response.json({ data: 'premium content' });
|
|
13
|
+
* }
|
|
14
|
+
* );
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import { createPaywallMiddleware } from './paywall.js';
|
|
18
|
+
import { HTTP_402, PAYMENT_REQUIRED_HEADER } from '../constants.js';
|
|
19
|
+
/**
|
|
20
|
+
* Wrap a Next.js route handler with x402 paywall protection.
|
|
21
|
+
*
|
|
22
|
+
* @param config - Paywall configuration
|
|
23
|
+
* @param handler - The route handler to protect
|
|
24
|
+
* @returns A new route handler that enforces payment
|
|
25
|
+
*/
|
|
26
|
+
export function nextPaywall(config, handler) {
|
|
27
|
+
const paywall = createPaywallMiddleware(config);
|
|
28
|
+
return async (request) => {
|
|
29
|
+
// Extract headers
|
|
30
|
+
const headers = {};
|
|
31
|
+
request.headers.forEach((value, key) => {
|
|
32
|
+
headers[key.toLowerCase()] = value;
|
|
33
|
+
});
|
|
34
|
+
// Try to parse payment
|
|
35
|
+
const payment = paywall.parsePayment(headers);
|
|
36
|
+
if (!payment) {
|
|
37
|
+
// Return 402 with payment requirements
|
|
38
|
+
const requirements = paywall.getPaymentRequirements();
|
|
39
|
+
const encoded = Buffer.from(JSON.stringify(requirements)).toString('base64');
|
|
40
|
+
return new Response(JSON.stringify({
|
|
41
|
+
error: 'Payment Required',
|
|
42
|
+
message: `This endpoint requires a payment of ${config.price} USDC`,
|
|
43
|
+
requirements,
|
|
44
|
+
}), {
|
|
45
|
+
status: HTTP_402,
|
|
46
|
+
headers: {
|
|
47
|
+
'Content-Type': 'application/json',
|
|
48
|
+
[PAYMENT_REQUIRED_HEADER]: encoded,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// Verify payment
|
|
53
|
+
const isValid = await paywall.verifyPayment(payment);
|
|
54
|
+
if (!isValid) {
|
|
55
|
+
return new Response(JSON.stringify({
|
|
56
|
+
error: 'Payment Invalid',
|
|
57
|
+
message: 'The provided payment could not be verified',
|
|
58
|
+
}), {
|
|
59
|
+
status: 403,
|
|
60
|
+
headers: { 'Content-Type': 'application/json' },
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
// Payment verified — call the handler
|
|
64
|
+
return handler(request);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=next.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.js","sourceRoot":"","sources":["../../src/middleware/next.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,uBAAuB,EAAsB,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAKpE;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACzB,MAAqB,EACrB,OAAyB;IAEzB,MAAM,OAAO,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAEhD,OAAO,KAAK,EAAE,OAAoB,EAAqB,EAAE;QACvD,kBAAkB;QAClB,MAAM,OAAO,GAAuC,EAAE,CAAC;QACvD,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YACrC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,uBAAuB;QACvB,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAE9C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,uCAAuC;YACvC,MAAM,YAAY,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;YACtD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAE7E,OAAO,IAAI,QAAQ,CACjB,IAAI,CAAC,SAAS,CAAC;gBACb,KAAK,EAAE,kBAAkB;gBACzB,OAAO,EAAE,uCAAuC,MAAM,CAAC,KAAK,OAAO;gBACnE,YAAY;aACb,CAAC,EACF;gBACE,MAAM,EAAE,QAAQ;gBAChB,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,CAAC,uBAAuB,CAAC,EAAE,OAAO;iBACnC;aACF,CACF,CAAC;QACJ,CAAC;QAED,iBAAiB;QACjB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAErD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,IAAI,QAAQ,CACjB,IAAI,CAAC,SAAS,CAAC;gBACb,KAAK,EAAE,iBAAiB;gBACxB,OAAO,EAAE,4CAA4C;aACtD,CAAC,EACF;gBACE,MAAM,EAAE,GAAG;gBACX,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;aAChD,CACF,CAAC;QACJ,CAAC;QAED,sCAAsC;QACtC,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-agnostic paywall configuration.
|
|
3
|
+
*/
|
|
4
|
+
import type { EndpointConfig, PaymentPayload, PaymentRequirements } from '../types.js';
|
|
5
|
+
/** Configuration for the paywall middleware */
|
|
6
|
+
export interface PaywallConfig extends EndpointConfig {
|
|
7
|
+
/** Seller's wallet address to receive payments */
|
|
8
|
+
payTo?: `0x${string}`;
|
|
9
|
+
/** Custom logger */
|
|
10
|
+
logger?: {
|
|
11
|
+
info: (msg: string, data?: unknown) => void;
|
|
12
|
+
error: (msg: string, data?: unknown) => void;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** Generic middleware function type */
|
|
16
|
+
export type PaywallMiddleware = (config: PaywallConfig) => {
|
|
17
|
+
/** Generate payment requirements for a 402 response */
|
|
18
|
+
getPaymentRequirements: () => PaymentRequirements;
|
|
19
|
+
/** Parse payment payload from request headers */
|
|
20
|
+
parsePayment: (headers: Record<string, string | undefined>) => PaymentPayload | null;
|
|
21
|
+
/** Verify a payment payload */
|
|
22
|
+
verifyPayment: (payload: PaymentPayload) => Promise<boolean>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Create a framework-agnostic paywall handler.
|
|
26
|
+
*
|
|
27
|
+
* @param config - Paywall configuration including price and network
|
|
28
|
+
* @returns Paywall handler with methods for 402 flow
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const paywall = createPaywallMiddleware({
|
|
33
|
+
* price: '0.001',
|
|
34
|
+
* network: 'arc-testnet',
|
|
35
|
+
* description: 'Premium data endpoint',
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function createPaywallMiddleware(config: PaywallConfig): {
|
|
40
|
+
/**
|
|
41
|
+
* Generate payment requirements for a 402 response.
|
|
42
|
+
*/
|
|
43
|
+
getPaymentRequirements(): PaymentRequirements;
|
|
44
|
+
/**
|
|
45
|
+
* Parse payment payload from request headers.
|
|
46
|
+
*/
|
|
47
|
+
parsePayment(headers: Record<string, string | undefined>): PaymentPayload | null;
|
|
48
|
+
/**
|
|
49
|
+
* Verify a payment payload.
|
|
50
|
+
* In production, this delegates to Circle Gateway for verification.
|
|
51
|
+
*/
|
|
52
|
+
verifyPayment(payload: PaymentPayload): Promise<boolean>;
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=paywall.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paywall.d.ts","sourceRoot":"","sources":["../../src/middleware/paywall.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvF,+CAA+C;AAC/C,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,kDAAkD;IAClD,KAAK,CAAC,EAAE,KAAK,MAAM,EAAE,CAAC;IACtB,oBAAoB;IACpB,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;QAC5C,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;KAC9C,CAAC;CACH;AAED,uCAAuC;AACvC,MAAM,MAAM,iBAAiB,GAAG,CAC9B,MAAM,EAAE,aAAa,KAClB;IACH,uDAAuD;IACvD,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;IAClD,iDAAiD;IACjD,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,KAAK,cAAc,GAAG,IAAI,CAAC;IACrF,+BAA+B;IAC/B,aAAa,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9D,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,aAAa;IAmBzD;;OAEG;8BACuB,mBAAmB;IAY7C;;OAEG;0BACmB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,cAAc,GAAG,IAAI;IAgBhF;;;OAGG;2BAC0B,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;EAiDjE"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-agnostic paywall configuration.
|
|
3
|
+
*/
|
|
4
|
+
import { DEFAULTS, USDC_DECIMALS, X402_HEADER } from '../constants.js';
|
|
5
|
+
/**
|
|
6
|
+
* Create a framework-agnostic paywall handler.
|
|
7
|
+
*
|
|
8
|
+
* @param config - Paywall configuration including price and network
|
|
9
|
+
* @returns Paywall handler with methods for 402 flow
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const paywall = createPaywallMiddleware({
|
|
14
|
+
* price: '0.001',
|
|
15
|
+
* network: 'arc-testnet',
|
|
16
|
+
* description: 'Premium data endpoint',
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export function createPaywallMiddleware(config) {
|
|
21
|
+
const { price, network = DEFAULTS.network, scheme = DEFAULTS.scheme, description, payTo, logger = { info: () => { }, error: () => { } }, } = config;
|
|
22
|
+
const sellerAddress = payTo ?? process.env.SELLER_ADDRESS;
|
|
23
|
+
if (!sellerAddress) {
|
|
24
|
+
throw new Error('resvary: Seller address is required. Set SELLER_ADDRESS env var or pass payTo in config.');
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
/**
|
|
28
|
+
* Generate payment requirements for a 402 response.
|
|
29
|
+
*/
|
|
30
|
+
getPaymentRequirements() {
|
|
31
|
+
return {
|
|
32
|
+
x402Version: DEFAULTS.x402Version,
|
|
33
|
+
scheme: scheme,
|
|
34
|
+
network,
|
|
35
|
+
maxAmountRequired: price,
|
|
36
|
+
payTo: sellerAddress,
|
|
37
|
+
description,
|
|
38
|
+
expiry: Math.floor(Date.now() / 1000) + DEFAULTS.paymentValiditySeconds,
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* Parse payment payload from request headers.
|
|
43
|
+
*/
|
|
44
|
+
parsePayment(headers) {
|
|
45
|
+
const paymentHeader = headers[X402_HEADER] ?? headers[X402_HEADER.toUpperCase()];
|
|
46
|
+
if (!paymentHeader) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
const decoded = Buffer.from(paymentHeader, 'base64').toString('utf-8');
|
|
51
|
+
return JSON.parse(decoded);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
logger.error('Failed to parse payment header', error);
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* Verify a payment payload.
|
|
60
|
+
* In production, this delegates to Circle Gateway for verification.
|
|
61
|
+
*/
|
|
62
|
+
async verifyPayment(payload) {
|
|
63
|
+
if (config.verifyPayment) {
|
|
64
|
+
const result = await config.verifyPayment(payload);
|
|
65
|
+
return result.success;
|
|
66
|
+
}
|
|
67
|
+
// Verify basic payment structure
|
|
68
|
+
if (!payload.payload?.signature || !payload.payload?.authorization) {
|
|
69
|
+
logger.error('Invalid payment payload structure');
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
// Verify payment amount meets minimum
|
|
73
|
+
const paymentAmount = BigInt(payload.payload.authorization.value);
|
|
74
|
+
const requiredAmount = BigInt(Math.floor(parseFloat(price) * 10 ** USDC_DECIMALS));
|
|
75
|
+
if (paymentAmount < requiredAmount) {
|
|
76
|
+
logger.error('Payment amount insufficient', {
|
|
77
|
+
received: paymentAmount.toString(),
|
|
78
|
+
required: requiredAmount.toString(),
|
|
79
|
+
});
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
// Verify payment is addressed to seller
|
|
83
|
+
if (payload.payload.authorization.to.toLowerCase() !== sellerAddress.toLowerCase()) {
|
|
84
|
+
logger.error('Payment not addressed to seller');
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
// Verify payment hasn't expired
|
|
88
|
+
const now = Math.floor(Date.now() / 1000);
|
|
89
|
+
const validBefore = parseInt(payload.payload.authorization.validBefore, 10);
|
|
90
|
+
if (now > validBefore) {
|
|
91
|
+
logger.error('Payment authorization has expired');
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
logger.info('Payment verified successfully', {
|
|
95
|
+
from: payload.payload.authorization.from,
|
|
96
|
+
amount: payload.payload.authorization.value,
|
|
97
|
+
});
|
|
98
|
+
return true;
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=paywall.js.map
|
|
@@ -0,0 +1 @@
|
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O,CAAC,aAAa,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC,WAAW,EAAE,EAC9E,CAAC;gBACD,MAAM,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;gBAChD,OAAO,KAAK,CAAC;YACf,CAAC;YAED,gCAAgC;YAChC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;YAC1C,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YAE5E,IAAI,GAAG,GAAG,WAAW,EAAE,CAAC;gBACtB,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;gBAClD,OAAO,KAAK,CAAC;YACf,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,+BAA+B,EAAE;gBAC3C,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI;gBACxC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK;aAC5C,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pricing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACnF,YAAY,EACV,eAAe,EACf,SAAS,EACT,cAAc,EACd,YAAY,EACZ,aAAa,EACb,UAAU,EACV,eAAe,GAChB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pricing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { MeterDefinition, PriceRateInput, PriceVersion, RatedUsage, UsageQuantities } from '../credits/types.js';
|
|
2
|
+
export declare function createMeterDefinition(input: {
|
|
3
|
+
id: string;
|
|
4
|
+
projectId: string;
|
|
5
|
+
key: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
dimensions: string[];
|
|
8
|
+
createdAt?: number;
|
|
9
|
+
metadata?: Record<string, unknown>;
|
|
10
|
+
}): MeterDefinition;
|
|
11
|
+
export declare function createPriceVersion(input: {
|
|
12
|
+
id: string;
|
|
13
|
+
projectId: string;
|
|
14
|
+
meter: MeterDefinition;
|
|
15
|
+
version: number;
|
|
16
|
+
rates: PriceRateInput[];
|
|
17
|
+
createdAt?: number;
|
|
18
|
+
metadata?: Record<string, unknown>;
|
|
19
|
+
}): PriceVersion;
|
|
20
|
+
export declare function rateUsage(price: PriceVersion, quantities: UsageQuantities): RatedUsage;
|
|
21
|
+
//# sourceMappingURL=rating.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rating.d.ts","sourceRoot":"","sources":["../../src/pricing/rating.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,YAAY,EAEZ,UAAU,EACV,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAE7B,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,GAAG,eAAe,CAelB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,eAAe,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,GAAG,YAAY,CAiDf;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,GAAG,UAAU,CAkCtF"}
|