@agent-score/commerce 1.3.0 → 1.3.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/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/identity/express.js +1 -1
- package/dist/identity/express.mjs +1 -1
- package/dist/identity/fastify.js +1 -1
- package/dist/identity/fastify.mjs +1 -1
- package/dist/identity/hono.js +1 -1
- package/dist/identity/hono.mjs +1 -1
- package/dist/identity/nextjs.js +1 -1
- package/dist/identity/nextjs.mjs +1 -1
- package/dist/identity/web.js +1 -1
- package/dist/identity/web.mjs +1 -1
- package/dist/payment/index.d.mts +23 -1
- package/dist/payment/index.d.ts +23 -1
- package/dist/payment/index.js +44 -11
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/index.mjs +43 -11
- package/dist/payment/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -220,7 +220,7 @@ function createAgentScoreCore(options) {
|
|
|
220
220
|
} = options;
|
|
221
221
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
222
222
|
const agentMemoryHint = buildAgentMemoryHint();
|
|
223
|
-
const defaultUa = `@agent-score/commerce@${"1.3.
|
|
223
|
+
const defaultUa = `@agent-score/commerce@${"1.3.1"}`;
|
|
224
224
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
225
225
|
const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
226
226
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/core.mjs
CHANGED
|
@@ -202,7 +202,7 @@ function createAgentScoreCore(options) {
|
|
|
202
202
|
} = options;
|
|
203
203
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
204
204
|
const agentMemoryHint = buildAgentMemoryHint();
|
|
205
|
-
const defaultUa = `@agent-score/commerce@${"1.3.
|
|
205
|
+
const defaultUa = `@agent-score/commerce@${"1.3.1"}`;
|
|
206
206
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
207
207
|
const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
208
208
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/identity/express.js
CHANGED
|
@@ -365,7 +365,7 @@ function createAgentScoreCore(options) {
|
|
|
365
365
|
} = options;
|
|
366
366
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
367
367
|
const agentMemoryHint = buildAgentMemoryHint();
|
|
368
|
-
const defaultUa = `@agent-score/commerce@${"1.3.
|
|
368
|
+
const defaultUa = `@agent-score/commerce@${"1.3.1"}`;
|
|
369
369
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
370
370
|
const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
371
371
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
|
@@ -332,7 +332,7 @@ function createAgentScoreCore(options) {
|
|
|
332
332
|
} = options;
|
|
333
333
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
334
334
|
const agentMemoryHint = buildAgentMemoryHint();
|
|
335
|
-
const defaultUa = `@agent-score/commerce@${"1.3.
|
|
335
|
+
const defaultUa = `@agent-score/commerce@${"1.3.1"}`;
|
|
336
336
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
337
337
|
const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
338
338
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/identity/fastify.js
CHANGED
|
@@ -366,7 +366,7 @@ function createAgentScoreCore(options) {
|
|
|
366
366
|
} = options;
|
|
367
367
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
368
368
|
const agentMemoryHint = buildAgentMemoryHint();
|
|
369
|
-
const defaultUa = `@agent-score/commerce@${"1.3.
|
|
369
|
+
const defaultUa = `@agent-score/commerce@${"1.3.1"}`;
|
|
370
370
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
371
371
|
const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
372
372
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
|
@@ -332,7 +332,7 @@ function createAgentScoreCore(options) {
|
|
|
332
332
|
} = options;
|
|
333
333
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
334
334
|
const agentMemoryHint = buildAgentMemoryHint();
|
|
335
|
-
const defaultUa = `@agent-score/commerce@${"1.3.
|
|
335
|
+
const defaultUa = `@agent-score/commerce@${"1.3.1"}`;
|
|
336
336
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
337
337
|
const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
338
338
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/identity/hono.js
CHANGED
|
@@ -365,7 +365,7 @@ function createAgentScoreCore(options) {
|
|
|
365
365
|
} = options;
|
|
366
366
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
367
367
|
const agentMemoryHint = buildAgentMemoryHint();
|
|
368
|
-
const defaultUa = `@agent-score/commerce@${"1.3.
|
|
368
|
+
const defaultUa = `@agent-score/commerce@${"1.3.1"}`;
|
|
369
369
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
370
370
|
const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
371
371
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/identity/hono.mjs
CHANGED
|
@@ -332,7 +332,7 @@ function createAgentScoreCore(options) {
|
|
|
332
332
|
} = options;
|
|
333
333
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
334
334
|
const agentMemoryHint = buildAgentMemoryHint();
|
|
335
|
-
const defaultUa = `@agent-score/commerce@${"1.3.
|
|
335
|
+
const defaultUa = `@agent-score/commerce@${"1.3.1"}`;
|
|
336
336
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
337
337
|
const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
338
338
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/identity/nextjs.js
CHANGED
|
@@ -361,7 +361,7 @@ function createAgentScoreCore(options) {
|
|
|
361
361
|
} = options;
|
|
362
362
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
363
363
|
const agentMemoryHint = buildAgentMemoryHint();
|
|
364
|
-
const defaultUa = `@agent-score/commerce@${"1.3.
|
|
364
|
+
const defaultUa = `@agent-score/commerce@${"1.3.1"}`;
|
|
365
365
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
366
366
|
const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
367
367
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/identity/nextjs.mjs
CHANGED
|
@@ -332,7 +332,7 @@ function createAgentScoreCore(options) {
|
|
|
332
332
|
} = options;
|
|
333
333
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
334
334
|
const agentMemoryHint = buildAgentMemoryHint();
|
|
335
|
-
const defaultUa = `@agent-score/commerce@${"1.3.
|
|
335
|
+
const defaultUa = `@agent-score/commerce@${"1.3.1"}`;
|
|
336
336
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
337
337
|
const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
338
338
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/identity/web.js
CHANGED
|
@@ -361,7 +361,7 @@ function createAgentScoreCore(options) {
|
|
|
361
361
|
} = options;
|
|
362
362
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
363
363
|
const agentMemoryHint = buildAgentMemoryHint();
|
|
364
|
-
const defaultUa = `@agent-score/commerce@${"1.3.
|
|
364
|
+
const defaultUa = `@agent-score/commerce@${"1.3.1"}`;
|
|
365
365
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
366
366
|
const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
367
367
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/identity/web.mjs
CHANGED
|
@@ -332,7 +332,7 @@ function createAgentScoreCore(options) {
|
|
|
332
332
|
} = options;
|
|
333
333
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
334
334
|
const agentMemoryHint = buildAgentMemoryHint();
|
|
335
|
-
const defaultUa = `@agent-score/commerce@${"1.3.
|
|
335
|
+
const defaultUa = `@agent-score/commerce@${"1.3.1"}`;
|
|
336
336
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
337
337
|
const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
338
338
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/payment/index.d.mts
CHANGED
|
@@ -626,6 +626,28 @@ interface CreateMppxServerOptions {
|
|
|
626
626
|
* `mppx` is an OPTIONAL peer dependency — install it only if you accept MPP rails.
|
|
627
627
|
*/
|
|
628
628
|
declare function createMppxServer(opts: CreateMppxServerOptions): Promise<unknown>;
|
|
629
|
+
type SolanaChargeRequestArgs = {
|
|
630
|
+
credential?: unknown;
|
|
631
|
+
request?: unknown;
|
|
632
|
+
};
|
|
633
|
+
type SolanaChargeMethod = {
|
|
634
|
+
request?: (args: SolanaChargeRequestArgs) => Promise<unknown>;
|
|
635
|
+
} & Record<string, unknown>;
|
|
636
|
+
/**
|
|
637
|
+
* Wraps `@solana/mpp.charge()`'s Method so the issued challenge carries a
|
|
638
|
+
* `finalized` blockhash instead of `confirmed`.
|
|
639
|
+
*
|
|
640
|
+
* `@solana/mpp` <= 0.5.2 fetches `getLatestBlockhash` with `commitment: 'confirmed'`
|
|
641
|
+
* but its broadcast `sendTransaction` sets `skipPreflight: false` without an
|
|
642
|
+
* overridden `preflightCommitment`. The RPC server's default preflight commitment
|
|
643
|
+
* is `finalized`, which rejects any blockhash that hasn't yet finalized with a
|
|
644
|
+
* "Blockhash not found" error. Handing the client a `finalized` blockhash up
|
|
645
|
+
* front sidesteps the mismatch.
|
|
646
|
+
*
|
|
647
|
+
* Trade-off: the signing window shrinks from ~58s (confirmed) to ~46s (finalized).
|
|
648
|
+
* Fine for agent-driven flows; manual signing flows still have plenty of margin.
|
|
649
|
+
*/
|
|
650
|
+
declare function wrapSolanaChargeWithFinalizedBlockhash(baseMethod: SolanaChargeMethod, rpcUrl: string): SolanaChargeMethod;
|
|
629
651
|
|
|
630
652
|
interface SettlementHandlers<TPayload, TResult> {
|
|
631
653
|
evm?: (payload: TPayload) => TResult | Promise<TResult>;
|
|
@@ -800,4 +822,4 @@ declare function settlementOverrideHeader(overrides: SettlementOverrides): {
|
|
|
800
822
|
value: string;
|
|
801
823
|
};
|
|
802
824
|
|
|
803
|
-
export { type BuildIdempotencyKeyInput, type BuildPaymentDirectiveInput, type BuildPaymentHeadersInput, type ClassifiedX402Error, type CreateMppxServerOptions, type CreateX402ServerOptions, type NetworkFamily, type PaymentDirectiveInput, type PaymentHeadersRail, type PaymentHeadersResult, type PaymentRequestInput, type ProcessX402SettleInput, type ProcessX402SettleResult, type RailDefinition, type RailName, SETTLEMENT_OVERRIDES_HEADER, type SettlementHandlers, type SettlementOverrides, type SettlementPayloadLike, type SolanaMppNetwork, USDC, type ValidateX402NetworkConfigInput, type VerifyX402RequestInput, type VerifyX402RequestResult, type X402FacilitatorChoice, type X402Server, type X402ServerLike, type X402SymbolicRail, X402_SUPPORTED_BASE_NETWORKS, buildIdempotencyKey, buildPaymentDirective, buildPaymentHeaders, buildPaymentRequestBlob, classifyX402SettleResult, createMppxServer, createX402Server, dispatchSettlementByNetwork, lookupRail, networkFamily, networks, paymentDirective, processX402Settle, rails, registerX402SchemesV1V2, settlementOverrideHeader, validateX402NetworkConfig, verifyX402Request };
|
|
825
|
+
export { type BuildIdempotencyKeyInput, type BuildPaymentDirectiveInput, type BuildPaymentHeadersInput, type ClassifiedX402Error, type CreateMppxServerOptions, type CreateX402ServerOptions, type NetworkFamily, type PaymentDirectiveInput, type PaymentHeadersRail, type PaymentHeadersResult, type PaymentRequestInput, type ProcessX402SettleInput, type ProcessX402SettleResult, type RailDefinition, type RailName, SETTLEMENT_OVERRIDES_HEADER, type SettlementHandlers, type SettlementOverrides, type SettlementPayloadLike, type SolanaMppNetwork, USDC, type ValidateX402NetworkConfigInput, type VerifyX402RequestInput, type VerifyX402RequestResult, type X402FacilitatorChoice, type X402Server, type X402ServerLike, type X402SymbolicRail, X402_SUPPORTED_BASE_NETWORKS, buildIdempotencyKey, buildPaymentDirective, buildPaymentHeaders, buildPaymentRequestBlob, classifyX402SettleResult, createMppxServer, createX402Server, dispatchSettlementByNetwork, lookupRail, networkFamily, networks, paymentDirective, processX402Settle, rails, registerX402SchemesV1V2, settlementOverrideHeader, validateX402NetworkConfig, verifyX402Request, wrapSolanaChargeWithFinalizedBlockhash };
|
package/dist/payment/index.d.ts
CHANGED
|
@@ -626,6 +626,28 @@ interface CreateMppxServerOptions {
|
|
|
626
626
|
* `mppx` is an OPTIONAL peer dependency — install it only if you accept MPP rails.
|
|
627
627
|
*/
|
|
628
628
|
declare function createMppxServer(opts: CreateMppxServerOptions): Promise<unknown>;
|
|
629
|
+
type SolanaChargeRequestArgs = {
|
|
630
|
+
credential?: unknown;
|
|
631
|
+
request?: unknown;
|
|
632
|
+
};
|
|
633
|
+
type SolanaChargeMethod = {
|
|
634
|
+
request?: (args: SolanaChargeRequestArgs) => Promise<unknown>;
|
|
635
|
+
} & Record<string, unknown>;
|
|
636
|
+
/**
|
|
637
|
+
* Wraps `@solana/mpp.charge()`'s Method so the issued challenge carries a
|
|
638
|
+
* `finalized` blockhash instead of `confirmed`.
|
|
639
|
+
*
|
|
640
|
+
* `@solana/mpp` <= 0.5.2 fetches `getLatestBlockhash` with `commitment: 'confirmed'`
|
|
641
|
+
* but its broadcast `sendTransaction` sets `skipPreflight: false` without an
|
|
642
|
+
* overridden `preflightCommitment`. The RPC server's default preflight commitment
|
|
643
|
+
* is `finalized`, which rejects any blockhash that hasn't yet finalized with a
|
|
644
|
+
* "Blockhash not found" error. Handing the client a `finalized` blockhash up
|
|
645
|
+
* front sidesteps the mismatch.
|
|
646
|
+
*
|
|
647
|
+
* Trade-off: the signing window shrinks from ~58s (confirmed) to ~46s (finalized).
|
|
648
|
+
* Fine for agent-driven flows; manual signing flows still have plenty of margin.
|
|
649
|
+
*/
|
|
650
|
+
declare function wrapSolanaChargeWithFinalizedBlockhash(baseMethod: SolanaChargeMethod, rpcUrl: string): SolanaChargeMethod;
|
|
629
651
|
|
|
630
652
|
interface SettlementHandlers<TPayload, TResult> {
|
|
631
653
|
evm?: (payload: TPayload) => TResult | Promise<TResult>;
|
|
@@ -800,4 +822,4 @@ declare function settlementOverrideHeader(overrides: SettlementOverrides): {
|
|
|
800
822
|
value: string;
|
|
801
823
|
};
|
|
802
824
|
|
|
803
|
-
export { type BuildIdempotencyKeyInput, type BuildPaymentDirectiveInput, type BuildPaymentHeadersInput, type ClassifiedX402Error, type CreateMppxServerOptions, type CreateX402ServerOptions, type NetworkFamily, type PaymentDirectiveInput, type PaymentHeadersRail, type PaymentHeadersResult, type PaymentRequestInput, type ProcessX402SettleInput, type ProcessX402SettleResult, type RailDefinition, type RailName, SETTLEMENT_OVERRIDES_HEADER, type SettlementHandlers, type SettlementOverrides, type SettlementPayloadLike, type SolanaMppNetwork, USDC, type ValidateX402NetworkConfigInput, type VerifyX402RequestInput, type VerifyX402RequestResult, type X402FacilitatorChoice, type X402Server, type X402ServerLike, type X402SymbolicRail, X402_SUPPORTED_BASE_NETWORKS, buildIdempotencyKey, buildPaymentDirective, buildPaymentHeaders, buildPaymentRequestBlob, classifyX402SettleResult, createMppxServer, createX402Server, dispatchSettlementByNetwork, lookupRail, networkFamily, networks, paymentDirective, processX402Settle, rails, registerX402SchemesV1V2, settlementOverrideHeader, validateX402NetworkConfig, verifyX402Request };
|
|
825
|
+
export { type BuildIdempotencyKeyInput, type BuildPaymentDirectiveInput, type BuildPaymentHeadersInput, type ClassifiedX402Error, type CreateMppxServerOptions, type CreateX402ServerOptions, type NetworkFamily, type PaymentDirectiveInput, type PaymentHeadersRail, type PaymentHeadersResult, type PaymentRequestInput, type ProcessX402SettleInput, type ProcessX402SettleResult, type RailDefinition, type RailName, SETTLEMENT_OVERRIDES_HEADER, type SettlementHandlers, type SettlementOverrides, type SettlementPayloadLike, type SolanaMppNetwork, USDC, type ValidateX402NetworkConfigInput, type VerifyX402RequestInput, type VerifyX402RequestResult, type X402FacilitatorChoice, type X402Server, type X402ServerLike, type X402SymbolicRail, X402_SUPPORTED_BASE_NETWORKS, buildIdempotencyKey, buildPaymentDirective, buildPaymentHeaders, buildPaymentRequestBlob, classifyX402SettleResult, createMppxServer, createX402Server, dispatchSettlementByNetwork, lookupRail, networkFamily, networks, paymentDirective, processX402Settle, rails, registerX402SchemesV1V2, settlementOverrideHeader, validateX402NetworkConfig, verifyX402Request, wrapSolanaChargeWithFinalizedBlockhash };
|
package/dist/payment/index.js
CHANGED
|
@@ -45,6 +45,7 @@ __export(payment_exports, {
|
|
|
45
45
|
settlementOverrideHeader: () => settlementOverrideHeader,
|
|
46
46
|
validateX402NetworkConfig: () => validateX402NetworkConfig,
|
|
47
47
|
verifyX402Request: () => verifyX402Request,
|
|
48
|
+
wrapSolanaChargeWithFinalizedBlockhash: () => wrapSolanaChargeWithFinalizedBlockhash,
|
|
48
49
|
wwwAuthenticateHeader: () => wwwAuthenticateHeader
|
|
49
50
|
});
|
|
50
51
|
module.exports = __toCommonJS(payment_exports);
|
|
@@ -547,17 +548,17 @@ async function createMppxServer(opts) {
|
|
|
547
548
|
const network = s.network ?? "mainnet-beta";
|
|
548
549
|
const defaultMint = network === "mainnet-beta" ? USDC.solana.mainnet.mint : USDC.solana.devnet.mint;
|
|
549
550
|
const defaultDecimals = network === "mainnet-beta" ? USDC.solana.mainnet.decimals : USDC.solana.devnet.decimals;
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
);
|
|
551
|
+
const baseMethod = solanaMpp.charge({
|
|
552
|
+
recipient: s.recipient,
|
|
553
|
+
currency: s.currency ?? defaultMint,
|
|
554
|
+
decimals: s.decimals ?? defaultDecimals,
|
|
555
|
+
network,
|
|
556
|
+
...s.rpcUrl ? { rpcUrl: s.rpcUrl } : {},
|
|
557
|
+
...s.signer ? { signer: s.signer } : {},
|
|
558
|
+
...s.tokenProgram ? { tokenProgram: s.tokenProgram } : {}
|
|
559
|
+
});
|
|
560
|
+
const rpcUrl = s.rpcUrl ?? (network === "mainnet-beta" ? "https://api.mainnet-beta.solana.com" : network === "devnet" ? "https://api.devnet.solana.com" : "http://localhost:8899");
|
|
561
|
+
methods.push(wrapSolanaChargeWithFinalizedBlockhash(baseMethod, rpcUrl));
|
|
561
562
|
}
|
|
562
563
|
if (opts.rails?.stripe) {
|
|
563
564
|
const stripeMethod = await createMppxStripe(opts.rails.stripe);
|
|
@@ -572,6 +573,37 @@ async function dynamicImport2(moduleName) {
|
|
|
572
573
|
return null;
|
|
573
574
|
}
|
|
574
575
|
}
|
|
576
|
+
function wrapSolanaChargeWithFinalizedBlockhash(baseMethod, rpcUrl) {
|
|
577
|
+
return {
|
|
578
|
+
...baseMethod,
|
|
579
|
+
async request(args) {
|
|
580
|
+
const orig = await baseMethod.request(args);
|
|
581
|
+
if (args.credential || !orig || typeof orig !== "object") return orig;
|
|
582
|
+
try {
|
|
583
|
+
const res = await fetch(rpcUrl, {
|
|
584
|
+
method: "POST",
|
|
585
|
+
headers: { "Content-Type": "application/json" },
|
|
586
|
+
body: JSON.stringify({
|
|
587
|
+
id: 1,
|
|
588
|
+
jsonrpc: "2.0",
|
|
589
|
+
method: "getLatestBlockhash",
|
|
590
|
+
params: [{ commitment: "finalized" }]
|
|
591
|
+
})
|
|
592
|
+
});
|
|
593
|
+
const data = await res.json();
|
|
594
|
+
const finalized = data?.result?.value?.blockhash;
|
|
595
|
+
if (finalized) {
|
|
596
|
+
return {
|
|
597
|
+
...orig,
|
|
598
|
+
methodDetails: { ...orig.methodDetails ?? {}, recentBlockhash: finalized }
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
} catch {
|
|
602
|
+
}
|
|
603
|
+
return orig;
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
}
|
|
575
607
|
|
|
576
608
|
// src/payment/dispatch.ts
|
|
577
609
|
async function dispatchSettlementByNetwork(payload, handlers) {
|
|
@@ -774,6 +806,7 @@ function settlementOverrideHeader(overrides) {
|
|
|
774
806
|
settlementOverrideHeader,
|
|
775
807
|
validateX402NetworkConfig,
|
|
776
808
|
verifyX402Request,
|
|
809
|
+
wrapSolanaChargeWithFinalizedBlockhash,
|
|
777
810
|
wwwAuthenticateHeader
|
|
778
811
|
});
|
|
779
812
|
//# sourceMappingURL=index.js.map
|