@402flow/sdk-third-party-executors 0.1.0-alpha.26
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 +63 -0
- package/dist/dexter-executor.d.ts +14 -0
- package/dist/dexter-executor.js +172 -0
- package/dist/dexter-executor.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/pay-sh-executor.d.ts +21 -0
- package/dist/pay-sh-executor.js +309 -0
- package/dist/pay-sh-executor.js.map +1 -0
- package/dist/request-utils.d.ts +4 -0
- package/dist/request-utils.js +33 -0
- package/dist/request-utils.js.map +1 -0
- package/package.json +84 -0
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# @402flow/sdk-third-party-executors
|
|
2
|
+
|
|
3
|
+
Official supported delegated-execution adapters for `@402flow/sdk`.
|
|
4
|
+
|
|
5
|
+
This package is intentionally separate from the main `@402flow/sdk` package so the core SDK stays provider-neutral while officially supported provider adapters can evolve on their own dependency surface.
|
|
6
|
+
|
|
7
|
+
Current scope:
|
|
8
|
+
|
|
9
|
+
1. Dexter delegated-execution adapter
|
|
10
|
+
2. pay.sh x402 Solana exact delegated-execution adapter
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
Install this package alongside the matching `@402flow/sdk` version.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @402flow/sdk @402flow/sdk-third-party-executors
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If you pin versions explicitly, pin both packages to the same version:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @402flow/sdk@<version> @402flow/sdk-third-party-executors@<version>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
This adapter package is versioned and supported in lockstep with `@402flow/sdk`, so keep the two package versions aligned.
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { AgentPayClient } from '@402flow/sdk';
|
|
32
|
+
import {
|
|
33
|
+
createDexterExecutor,
|
|
34
|
+
createPayShExecutor,
|
|
35
|
+
} from '@402flow/sdk-third-party-executors';
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The main SDK package owns:
|
|
39
|
+
|
|
40
|
+
1. the public executor contract
|
|
41
|
+
2. delegated authorization and finalization
|
|
42
|
+
3. outward result normalization to `PaidResponse` or `FetchPaidError`
|
|
43
|
+
|
|
44
|
+
This package owns:
|
|
45
|
+
|
|
46
|
+
1. provider-specific adapter implementations
|
|
47
|
+
2. provider-specific proof tests
|
|
48
|
+
3. source-level examples in this repo under `third-party-executors/examples/`
|
|
49
|
+
|
|
50
|
+
## In-Repo Verification
|
|
51
|
+
|
|
52
|
+
If you are working in this repo, useful commands are:
|
|
53
|
+
|
|
54
|
+
1. `npm run check`
|
|
55
|
+
2. `npm run pack:check`
|
|
56
|
+
3. `npm run example:dexter-delegated-executor -- --help`
|
|
57
|
+
4. `npm run example:pay-sh-delegated-executor -- --help`
|
|
58
|
+
|
|
59
|
+
From the SDK root, you can also run `npm run check:all` to validate both the main SDK package and this package in one pass.
|
|
60
|
+
|
|
61
|
+
## Release Order
|
|
62
|
+
|
|
63
|
+
When publishing from this repo, publish the main `@402flow/sdk` package first, then publish `@402flow/sdk-third-party-executors` after the matching SDK version is available.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dexter delegated-execution adapter for the repo-local third-party executors
|
|
3
|
+
* package.
|
|
4
|
+
*
|
|
5
|
+
* This module stays outside the main @402flow/sdk package so provider-specific
|
|
6
|
+
* SDK dependencies can evolve independently from the provider-neutral SDK core.
|
|
7
|
+
*/
|
|
8
|
+
import { type PayAndFetchOptions, type WalletSet } from '@dexterai/x402/client';
|
|
9
|
+
import type { PreparedRequestExecutor } from '@402flow/sdk';
|
|
10
|
+
export type DexterExecutorOptions = {
|
|
11
|
+
wallets: WalletSet;
|
|
12
|
+
payAndFetchOptions?: PayAndFetchOptions;
|
|
13
|
+
};
|
|
14
|
+
export declare function createDexterExecutor(options: DexterExecutorOptions): PreparedRequestExecutor;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dexter delegated-execution adapter for the repo-local third-party executors
|
|
3
|
+
* package.
|
|
4
|
+
*
|
|
5
|
+
* This module stays outside the main @402flow/sdk package so provider-specific
|
|
6
|
+
* SDK dependencies can evolve independently from the provider-neutral SDK core.
|
|
7
|
+
*/
|
|
8
|
+
import { getPaymentReceipt, payAndFetch, } from '@dexterai/x402/client';
|
|
9
|
+
import { buildPreparedRequestInit, toSdkMerchantResponse } from './request-utils.js';
|
|
10
|
+
export function createDexterExecutor(options) {
|
|
11
|
+
return {
|
|
12
|
+
provider: 'dexter',
|
|
13
|
+
async execute(input) {
|
|
14
|
+
const result = await payAndFetch(input.prepared.request.url, buildPreparedRequestInit(input.prepared), options.wallets, options.payAndFetchOptions ?? {});
|
|
15
|
+
return mapDexterPayResult(input, result);
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
async function mapDexterPayResult(input, result) {
|
|
20
|
+
const protocol = input.prepared.protocol;
|
|
21
|
+
if (result.ok && result.paid) {
|
|
22
|
+
const merchantResponse = result.response
|
|
23
|
+
? await toSdkMerchantResponse(result.response)
|
|
24
|
+
: undefined;
|
|
25
|
+
const paymentReceipt = result.response
|
|
26
|
+
? getPaymentReceipt(result.response)
|
|
27
|
+
: undefined;
|
|
28
|
+
const settlementReference = result.txSignature ?? paymentReceipt?.transaction;
|
|
29
|
+
const signerSubmissionEvidence = settlementReference
|
|
30
|
+
? {
|
|
31
|
+
txHash: settlementReference,
|
|
32
|
+
paymentReference: settlementReference,
|
|
33
|
+
}
|
|
34
|
+
: undefined;
|
|
35
|
+
if (merchantResponse) {
|
|
36
|
+
return {
|
|
37
|
+
protocol,
|
|
38
|
+
executionStatus: 'succeeded',
|
|
39
|
+
settlementEvidenceClass: 'merchant_verifiable_success',
|
|
40
|
+
merchantOutcome: 'success_response',
|
|
41
|
+
...(settlementReference
|
|
42
|
+
? {
|
|
43
|
+
settlementReference,
|
|
44
|
+
paymentReference: settlementReference,
|
|
45
|
+
}
|
|
46
|
+
: {}),
|
|
47
|
+
evidenceSource: settlementReference ? 'merchant' : undefined,
|
|
48
|
+
...(signerSubmissionEvidence ? { signerSubmissionEvidence } : {}),
|
|
49
|
+
merchantResponse,
|
|
50
|
+
protocolArtifacts: buildDexterProtocolArtifacts(result, paymentReceipt),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
protocol,
|
|
55
|
+
executionStatus: 'inconclusive',
|
|
56
|
+
settlementEvidenceClass: 'settled',
|
|
57
|
+
merchantOutcome: 'no_response',
|
|
58
|
+
...(settlementReference
|
|
59
|
+
? {
|
|
60
|
+
settlementReference,
|
|
61
|
+
paymentReference: settlementReference,
|
|
62
|
+
}
|
|
63
|
+
: {}),
|
|
64
|
+
...(signerSubmissionEvidence ? { signerSubmissionEvidence } : {}),
|
|
65
|
+
protocolArtifacts: buildDexterProtocolArtifacts(result),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (result.ok) {
|
|
69
|
+
const merchantResponse = await toSdkMerchantResponse(result.response);
|
|
70
|
+
return {
|
|
71
|
+
protocol,
|
|
72
|
+
executionStatus: 'preflight_failed',
|
|
73
|
+
settlementEvidenceClass: 'none',
|
|
74
|
+
merchantOutcome: merchantResponse.status >= 400 ? 'failure_response' : 'success_response',
|
|
75
|
+
merchantResponse,
|
|
76
|
+
diagnostic: {
|
|
77
|
+
code: 'preflight_incompatible',
|
|
78
|
+
message: 'Dexter executor retried the request but the merchant did not demand payment.',
|
|
79
|
+
},
|
|
80
|
+
protocolArtifacts: buildDexterProtocolArtifacts(result),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const failureMapping = mapDexterFailure(result.reason);
|
|
84
|
+
return {
|
|
85
|
+
protocol,
|
|
86
|
+
executionStatus: failureMapping.executionStatus,
|
|
87
|
+
settlementEvidenceClass: failureMapping.settlementEvidenceClass,
|
|
88
|
+
merchantOutcome: failureMapping.merchantOutcome,
|
|
89
|
+
diagnostic: {
|
|
90
|
+
code: failureMapping.diagnosticCode,
|
|
91
|
+
...(result.detail ? { message: result.detail } : {}),
|
|
92
|
+
},
|
|
93
|
+
protocolArtifacts: buildDexterProtocolArtifacts(result),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function mapDexterFailure(reason) {
|
|
97
|
+
switch (reason) {
|
|
98
|
+
case 'unsupported_network':
|
|
99
|
+
case 'insufficient_funds':
|
|
100
|
+
case 'budget_exceeded':
|
|
101
|
+
case 'no_payment_options':
|
|
102
|
+
return {
|
|
103
|
+
executionStatus: 'preflight_failed',
|
|
104
|
+
settlementEvidenceClass: 'none',
|
|
105
|
+
merchantOutcome: 'unknown',
|
|
106
|
+
diagnosticCode: 'preflight_incompatible',
|
|
107
|
+
};
|
|
108
|
+
case 'merchant_rejected':
|
|
109
|
+
return {
|
|
110
|
+
executionStatus: 'failed',
|
|
111
|
+
settlementEvidenceClass: 'none',
|
|
112
|
+
merchantOutcome: 'failure_response',
|
|
113
|
+
diagnosticCode: 'merchant_rejected',
|
|
114
|
+
};
|
|
115
|
+
case 'settlement_failed':
|
|
116
|
+
return {
|
|
117
|
+
executionStatus: 'failed',
|
|
118
|
+
settlementEvidenceClass: 'inconclusive',
|
|
119
|
+
merchantOutcome: 'unknown',
|
|
120
|
+
diagnosticCode: 'merchant_execution_failed',
|
|
121
|
+
};
|
|
122
|
+
case 'error':
|
|
123
|
+
return {
|
|
124
|
+
executionStatus: 'inconclusive',
|
|
125
|
+
settlementEvidenceClass: 'inconclusive',
|
|
126
|
+
merchantOutcome: 'no_response',
|
|
127
|
+
diagnosticCode: 'merchant_transport_lost',
|
|
128
|
+
};
|
|
129
|
+
case 'payment_unconfirmed':
|
|
130
|
+
return {
|
|
131
|
+
executionStatus: 'inconclusive',
|
|
132
|
+
settlementEvidenceClass: 'inconclusive',
|
|
133
|
+
merchantOutcome: 'no_response',
|
|
134
|
+
diagnosticCode: 'merchant_transport_lost',
|
|
135
|
+
};
|
|
136
|
+
case 'timeout':
|
|
137
|
+
return {
|
|
138
|
+
executionStatus: 'preflight_failed',
|
|
139
|
+
settlementEvidenceClass: 'none',
|
|
140
|
+
merchantOutcome: 'no_response',
|
|
141
|
+
diagnosticCode: 'merchant_transport_lost',
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function buildDexterProtocolArtifacts(result, paymentReceipt) {
|
|
146
|
+
if (result.ok && result.paid) {
|
|
147
|
+
return {
|
|
148
|
+
dexter: {
|
|
149
|
+
paid: true,
|
|
150
|
+
amountPaid: result.amountPaid,
|
|
151
|
+
network: result.network.caip2,
|
|
152
|
+
...(result.txSignature ? { txSignature: result.txSignature } : {}),
|
|
153
|
+
...(paymentReceipt ? { paymentReceipt } : {}),
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
if (result.ok) {
|
|
158
|
+
return {
|
|
159
|
+
dexter: {
|
|
160
|
+
paid: false,
|
|
161
|
+
status: result.response.status,
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
dexter: {
|
|
167
|
+
reason: result.reason,
|
|
168
|
+
...(result.detail ? { detail: result.detail } : {}),
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=dexter-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dexter-executor.js","sourceRoot":"","sources":["../src/dexter-executor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,iBAAiB,EACjB,WAAW,GAIZ,MAAM,uBAAuB,CAAC;AAY/B,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,C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C"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAG5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repo-local host-owned pay.sh adapter for x402 Solana exact delegated execution.
|
|
3
|
+
* The SDK still owns authorize/finalize; this module only performs the paid retry
|
|
4
|
+
* and normalizes the provider result into the delegated execution contract.
|
|
5
|
+
*/
|
|
6
|
+
import { x402HTTPClient, type PaymentPolicy, type SelectPaymentRequirements } from '@x402/core/client';
|
|
7
|
+
import type { Network } from '@x402/core/types';
|
|
8
|
+
import { type SvmClientConfig } from '@x402/svm/exact/client';
|
|
9
|
+
import type { PreparedRequestExecutor } from '@402flow/sdk';
|
|
10
|
+
type PayShX402HttpClient = Pick<x402HTTPClient, 'createPaymentPayload' | 'encodePaymentSignatureHeader' | 'getPaymentRequiredResponse' | 'processResponse'>;
|
|
11
|
+
export type PayShExecutorOptions = {
|
|
12
|
+
signer: SvmClientConfig['signer'];
|
|
13
|
+
fetch?: typeof fetch;
|
|
14
|
+
networks?: Network[];
|
|
15
|
+
paymentRequirementsSelector?: SelectPaymentRequirements;
|
|
16
|
+
policies?: PaymentPolicy[];
|
|
17
|
+
rpcUrl?: string;
|
|
18
|
+
x402HttpClient?: PayShX402HttpClient;
|
|
19
|
+
};
|
|
20
|
+
export declare function createPayShExecutor(options: PayShExecutorOptions): PreparedRequestExecutor;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repo-local host-owned pay.sh adapter for x402 Solana exact delegated execution.
|
|
3
|
+
* The SDK still owns authorize/finalize; this module only performs the paid retry
|
|
4
|
+
* and normalizes the provider result into the delegated execution contract.
|
|
5
|
+
*/
|
|
6
|
+
import { x402Client, x402HTTPClient, } from '@x402/core/client';
|
|
7
|
+
import { ExactSvmScheme } from '@x402/svm/exact/client';
|
|
8
|
+
import { buildPreparedRequestInit, toSdkMerchantResponse } from './request-utils.js';
|
|
9
|
+
export function createPayShExecutor(options) {
|
|
10
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
11
|
+
const x402HttpClient = options.x402HttpClient ?? createDefaultX402HttpClient(options);
|
|
12
|
+
return {
|
|
13
|
+
provider: 'pay_sh',
|
|
14
|
+
async execute(input) {
|
|
15
|
+
if (input.prepared.protocol !== 'x402') {
|
|
16
|
+
return buildPreflightFailureResult(input.prepared.protocol, 'pay.sh x402 executor only supports x402 prepared requests.');
|
|
17
|
+
}
|
|
18
|
+
let paymentRequired;
|
|
19
|
+
try {
|
|
20
|
+
paymentRequired = readPreparedPaymentRequired(input.prepared, x402HttpClient);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
return buildPreflightFailureResult(input.prepared.protocol, error instanceof Error
|
|
24
|
+
? error.message
|
|
25
|
+
: 'Unable to decode the x402 payment-required challenge.');
|
|
26
|
+
}
|
|
27
|
+
const supportedPaymentRequired = filterSupportedPaymentRequired(paymentRequired);
|
|
28
|
+
if (!supportedPaymentRequired) {
|
|
29
|
+
return buildPreflightFailureResult(input.prepared.protocol, 'pay.sh x402 executor requires an exact Solana payment candidate with a facilitator fee payer.');
|
|
30
|
+
}
|
|
31
|
+
let paymentPayload;
|
|
32
|
+
try {
|
|
33
|
+
paymentPayload = await x402HttpClient.createPaymentPayload(supportedPaymentRequired);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
return buildPreflightFailureResult(input.prepared.protocol, error instanceof Error
|
|
37
|
+
? error.message
|
|
38
|
+
: 'pay.sh x402 payload creation failed before retry.');
|
|
39
|
+
}
|
|
40
|
+
if (!isSupportedSvmExactRequirement(paymentPayload.accepted)) {
|
|
41
|
+
return buildPreflightFailureResult(input.prepared.protocol, 'pay.sh x402 executor selected an unsupported payment requirement.');
|
|
42
|
+
}
|
|
43
|
+
let merchantResponse;
|
|
44
|
+
try {
|
|
45
|
+
merchantResponse = await fetchImpl(input.prepared.request.url, buildPreparedRequestInit(input.prepared, x402HttpClient.encodePaymentSignatureHeader(paymentPayload)));
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
return buildTransportLossResult(input.prepared.protocol, error, {
|
|
49
|
+
paySh: {
|
|
50
|
+
x402Version: paymentPayload.x402Version,
|
|
51
|
+
accepted: paymentPayload.accepted,
|
|
52
|
+
payloadKeys: Object.keys(paymentPayload.payload),
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const sdkMerchantResponse = await toSdkMerchantResponse(merchantResponse.clone());
|
|
57
|
+
let processedResponse;
|
|
58
|
+
try {
|
|
59
|
+
processedResponse = await x402HttpClient.processResponse(merchantResponse);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
return buildProcessedResponseFailureResult(input.prepared.protocol, sdkMerchantResponse, error, paymentPayload);
|
|
63
|
+
}
|
|
64
|
+
return mapProcessedResponse(input.prepared, sdkMerchantResponse, processedResponse, paymentPayload);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function createDefaultX402HttpClient(options) {
|
|
69
|
+
const client = new x402Client(options.paymentRequirementsSelector);
|
|
70
|
+
for (const policy of options.policies ?? []) {
|
|
71
|
+
client.registerPolicy(policy);
|
|
72
|
+
}
|
|
73
|
+
const networks = options.networks?.length
|
|
74
|
+
? options.networks
|
|
75
|
+
: ['solana:*'];
|
|
76
|
+
for (const network of networks) {
|
|
77
|
+
client.register(network, new ExactSvmScheme(options.signer, options.rpcUrl ? { rpcUrl: options.rpcUrl } : undefined));
|
|
78
|
+
}
|
|
79
|
+
return new x402HTTPClient(client);
|
|
80
|
+
}
|
|
81
|
+
function readPreparedPaymentRequired(prepared, x402HttpClient) {
|
|
82
|
+
const challengeHeaders = new Headers(prepared.challenge.headers);
|
|
83
|
+
return x402HttpClient.getPaymentRequiredResponse((name) => challengeHeaders.get(name) ?? undefined, prepared.challenge.body);
|
|
84
|
+
}
|
|
85
|
+
function filterSupportedPaymentRequired(paymentRequired) {
|
|
86
|
+
const accepts = paymentRequired.accepts.filter(isSupportedSvmExactRequirement);
|
|
87
|
+
if (accepts.length === 0) {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
...paymentRequired,
|
|
92
|
+
accepts,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function isSupportedSvmExactRequirement(requirement) {
|
|
96
|
+
return (requirement.scheme === 'exact'
|
|
97
|
+
&& requirement.network.startsWith('solana:')
|
|
98
|
+
&& typeof requirement.amount === 'string'
|
|
99
|
+
&& requirement.amount.length > 0
|
|
100
|
+
&& typeof requirement.asset === 'string'
|
|
101
|
+
&& requirement.asset.length > 0
|
|
102
|
+
&& typeof requirement.payTo === 'string'
|
|
103
|
+
&& requirement.payTo.length > 0
|
|
104
|
+
&& typeof requirement.extra?.feePayer === 'string'
|
|
105
|
+
&& requirement.extra.feePayer.length > 0);
|
|
106
|
+
}
|
|
107
|
+
function mapProcessedResponse(prepared, merchantResponse, processedResponse, paymentPayload) {
|
|
108
|
+
switch (processedResponse.kind) {
|
|
109
|
+
case 'success':
|
|
110
|
+
return buildSuccessfulResult(prepared.protocol, merchantResponse, processedResponse.settleResponse, paymentPayload);
|
|
111
|
+
case 'settle_failed':
|
|
112
|
+
return buildSettlementFailureResult(prepared.protocol, merchantResponse, processedResponse.settleResponse, paymentPayload);
|
|
113
|
+
case 'payment_required':
|
|
114
|
+
return {
|
|
115
|
+
protocol: prepared.protocol,
|
|
116
|
+
executionStatus: 'failed',
|
|
117
|
+
settlementEvidenceClass: 'none',
|
|
118
|
+
merchantOutcome: 'failure_response',
|
|
119
|
+
merchantResponse,
|
|
120
|
+
diagnostic: {
|
|
121
|
+
code: 'merchant_rejected',
|
|
122
|
+
message: processedResponse.paymentRequired.error
|
|
123
|
+
?? 'merchant HTTP 402: payment required',
|
|
124
|
+
},
|
|
125
|
+
protocolArtifacts: {
|
|
126
|
+
paySh: {
|
|
127
|
+
x402Version: paymentPayload.x402Version,
|
|
128
|
+
accepted: paymentPayload.accepted,
|
|
129
|
+
payloadKeys: Object.keys(paymentPayload.payload),
|
|
130
|
+
paymentRequired: processedResponse.paymentRequired,
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
case 'passthrough':
|
|
135
|
+
return {
|
|
136
|
+
protocol: prepared.protocol,
|
|
137
|
+
executionStatus: 'preflight_failed',
|
|
138
|
+
settlementEvidenceClass: 'none',
|
|
139
|
+
merchantOutcome: classifyMerchantOutcome(merchantResponse.status),
|
|
140
|
+
merchantResponse,
|
|
141
|
+
diagnostic: {
|
|
142
|
+
code: 'preflight_incompatible',
|
|
143
|
+
message: 'Merchant completed the request without returning x402 settlement evidence.',
|
|
144
|
+
},
|
|
145
|
+
protocolArtifacts: {
|
|
146
|
+
paySh: {
|
|
147
|
+
x402Version: paymentPayload.x402Version,
|
|
148
|
+
accepted: paymentPayload.accepted,
|
|
149
|
+
payloadKeys: Object.keys(paymentPayload.payload),
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
case 'error': {
|
|
154
|
+
const diagnosticCode = merchantResponse.status >= 500
|
|
155
|
+
? 'merchant_execution_failed'
|
|
156
|
+
: 'merchant_rejected';
|
|
157
|
+
return {
|
|
158
|
+
protocol: prepared.protocol,
|
|
159
|
+
executionStatus: 'failed',
|
|
160
|
+
settlementEvidenceClass: 'none',
|
|
161
|
+
merchantOutcome: classifyMerchantOutcome(merchantResponse.status),
|
|
162
|
+
merchantResponse,
|
|
163
|
+
diagnostic: {
|
|
164
|
+
code: diagnosticCode,
|
|
165
|
+
message: `merchant HTTP ${processedResponse.status}`,
|
|
166
|
+
},
|
|
167
|
+
protocolArtifacts: {
|
|
168
|
+
paySh: {
|
|
169
|
+
x402Version: paymentPayload.x402Version,
|
|
170
|
+
accepted: paymentPayload.accepted,
|
|
171
|
+
payloadKeys: Object.keys(paymentPayload.payload),
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function buildSuccessfulResult(protocol, merchantResponse, settleResponse, paymentPayload) {
|
|
179
|
+
const settlementReference = settleResponse.transaction;
|
|
180
|
+
return {
|
|
181
|
+
protocol,
|
|
182
|
+
executionStatus: 'succeeded',
|
|
183
|
+
settlementEvidenceClass: 'merchant_verifiable_success',
|
|
184
|
+
merchantOutcome: 'success_response',
|
|
185
|
+
settlementReference,
|
|
186
|
+
paymentReference: settlementReference,
|
|
187
|
+
evidenceSource: 'merchant',
|
|
188
|
+
signerSubmissionEvidence: {
|
|
189
|
+
txHash: settlementReference,
|
|
190
|
+
paymentReference: settlementReference,
|
|
191
|
+
...(settleResponse.payer ? { payer: settleResponse.payer } : {}),
|
|
192
|
+
...(settleResponse.amount ? { amountMinor: settleResponse.amount } : {}),
|
|
193
|
+
network: settleResponse.network,
|
|
194
|
+
},
|
|
195
|
+
merchantResponse,
|
|
196
|
+
protocolArtifacts: {
|
|
197
|
+
paySh: {
|
|
198
|
+
x402Version: paymentPayload.x402Version,
|
|
199
|
+
accepted: paymentPayload.accepted,
|
|
200
|
+
payloadKeys: Object.keys(paymentPayload.payload),
|
|
201
|
+
settleResponse,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function buildSettlementFailureResult(protocol, merchantResponse, settleResponse, paymentPayload) {
|
|
207
|
+
const settlementReference = settleResponse.transaction || undefined;
|
|
208
|
+
return {
|
|
209
|
+
protocol,
|
|
210
|
+
executionStatus: 'failed',
|
|
211
|
+
settlementEvidenceClass: settlementReference ? 'inconclusive' : 'none',
|
|
212
|
+
merchantOutcome: classifyMerchantOutcome(merchantResponse.status),
|
|
213
|
+
...(settlementReference
|
|
214
|
+
? {
|
|
215
|
+
settlementReference,
|
|
216
|
+
paymentReference: settlementReference,
|
|
217
|
+
evidenceSource: 'merchant',
|
|
218
|
+
signerSubmissionEvidence: {
|
|
219
|
+
txHash: settlementReference,
|
|
220
|
+
paymentReference: settlementReference,
|
|
221
|
+
...(settleResponse.payer ? { payer: settleResponse.payer } : {}),
|
|
222
|
+
...(settleResponse.amount ? { amountMinor: settleResponse.amount } : {}),
|
|
223
|
+
network: settleResponse.network,
|
|
224
|
+
},
|
|
225
|
+
}
|
|
226
|
+
: {}),
|
|
227
|
+
merchantResponse,
|
|
228
|
+
diagnostic: {
|
|
229
|
+
code: 'merchant_execution_failed',
|
|
230
|
+
message: settleResponse.errorMessage
|
|
231
|
+
?? settleResponse.errorReason
|
|
232
|
+
?? `x402 settlement failed with HTTP ${merchantResponse.status}`,
|
|
233
|
+
},
|
|
234
|
+
protocolArtifacts: {
|
|
235
|
+
paySh: {
|
|
236
|
+
x402Version: paymentPayload.x402Version,
|
|
237
|
+
accepted: paymentPayload.accepted,
|
|
238
|
+
payloadKeys: Object.keys(paymentPayload.payload),
|
|
239
|
+
settleResponse,
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
function buildProcessedResponseFailureResult(protocol, merchantResponse, error, paymentPayload) {
|
|
245
|
+
return {
|
|
246
|
+
protocol,
|
|
247
|
+
executionStatus: merchantResponse.status >= 500 ? 'failed' : 'preflight_failed',
|
|
248
|
+
settlementEvidenceClass: 'none',
|
|
249
|
+
merchantOutcome: classifyMerchantOutcome(merchantResponse.status),
|
|
250
|
+
merchantResponse,
|
|
251
|
+
diagnostic: {
|
|
252
|
+
code: merchantResponse.status >= 500
|
|
253
|
+
? 'merchant_execution_failed'
|
|
254
|
+
: 'preflight_incompatible',
|
|
255
|
+
message: error instanceof Error
|
|
256
|
+
? error.message
|
|
257
|
+
: 'Unable to parse x402 settlement response from merchant.',
|
|
258
|
+
},
|
|
259
|
+
protocolArtifacts: {
|
|
260
|
+
paySh: {
|
|
261
|
+
x402Version: paymentPayload.x402Version,
|
|
262
|
+
accepted: paymentPayload.accepted,
|
|
263
|
+
payloadKeys: Object.keys(paymentPayload.payload),
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
function buildPreflightFailureResult(protocol, message) {
|
|
269
|
+
return {
|
|
270
|
+
protocol,
|
|
271
|
+
executionStatus: 'preflight_failed',
|
|
272
|
+
settlementEvidenceClass: 'none',
|
|
273
|
+
merchantOutcome: 'unknown',
|
|
274
|
+
diagnostic: {
|
|
275
|
+
code: 'preflight_incompatible',
|
|
276
|
+
message,
|
|
277
|
+
},
|
|
278
|
+
protocolArtifacts: {
|
|
279
|
+
paySh: {
|
|
280
|
+
stage: 'preflight',
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
function buildTransportLossResult(protocol, error, protocolArtifacts) {
|
|
286
|
+
return {
|
|
287
|
+
protocol,
|
|
288
|
+
executionStatus: 'inconclusive',
|
|
289
|
+
settlementEvidenceClass: 'none',
|
|
290
|
+
merchantOutcome: 'no_response',
|
|
291
|
+
diagnostic: {
|
|
292
|
+
code: 'merchant_transport_lost',
|
|
293
|
+
message: error instanceof Error
|
|
294
|
+
? error.message
|
|
295
|
+
: 'Merchant transport failed after x402 payment dispatch.',
|
|
296
|
+
},
|
|
297
|
+
...(protocolArtifacts ? { protocolArtifacts } : {}),
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
function classifyMerchantOutcome(status) {
|
|
301
|
+
if (status >= 400) {
|
|
302
|
+
return 'failure_response';
|
|
303
|
+
}
|
|
304
|
+
if (status >= 200 && status < 400) {
|
|
305
|
+
return 'success_response';
|
|
306
|
+
}
|
|
307
|
+
return 'unknown';
|
|
308
|
+
}
|
|
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YACV,IAAI,EAAE,wBAAwB;YAC9B,OAAO;SACR;QACD,iBAAiB,EAAE;YACjB,KAAK,EAAE;gBACL,KAAK,EAAE,WAAW;aACnB;SACF;KACF,CAAC;AACJ,CAAC;AAED,SAAS,wBAAwB,CAC/B,QAAiD,EACjD,KAAc,EACd,iBAA2C;IAE3C,OAAO;QACL,QAAQ;QACR,eAAe,EAAE,cAAc;QAC/B,uBAAuB,EAAE,MAAM;QAC/B,eAAe,EAAE,aAAa;QAC9B,UAAU,EAAE;YACV,IAAI,EAAE,yBAAyB;YAC/B,OAAO,EACL,KAAK,YAAY,KAAK;gBACpB,CAAC,CAAC,KAAK,CAAC,OAAO;gBACf,CAAC,CAAC,wDAAwD;SAC/D;QACD,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpD,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAAC,MAAc;IAC7C,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;QAClB,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,EAAE,CAAC;QAClC,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SdkMerchantResponse, SdkPreparedPaidRequestReady } from '@402flow/sdk';
|
|
2
|
+
export declare function buildPreparedRequestInit(prepared: SdkPreparedPaidRequestReady, extraHeaders?: HeadersInit): RequestInit;
|
|
3
|
+
export declare function toSdkMerchantResponse(response: Response): Promise<SdkMerchantResponse>;
|
|
4
|
+
export declare function normalizeHeaders(headers: HeadersInit | undefined): Record<string, string>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export function buildPreparedRequestInit(prepared, extraHeaders) {
|
|
2
|
+
const headers = normalizeHeaders(prepared.request.headers);
|
|
3
|
+
if (extraHeaders) {
|
|
4
|
+
const extraHeaderMap = new Headers(extraHeaders);
|
|
5
|
+
extraHeaderMap.forEach((value, key) => {
|
|
6
|
+
headers[key] = value;
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
method: prepared.request.method,
|
|
11
|
+
...(Object.keys(headers).length > 0 ? { headers } : {}),
|
|
12
|
+
...(prepared.request.body !== undefined ? { body: prepared.request.body } : {}),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export async function toSdkMerchantResponse(response) {
|
|
16
|
+
return {
|
|
17
|
+
status: response.status,
|
|
18
|
+
headers: normalizeHeaders(response.headers),
|
|
19
|
+
body: await response.text(),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function normalizeHeaders(headers) {
|
|
23
|
+
if (!headers) {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
const normalizedHeaders = {};
|
|
27
|
+
const headerMap = new Headers(headers);
|
|
28
|
+
headerMap.forEach((value, key) => {
|
|
29
|
+
normalizedHeaders[key] = value;
|
|
30
|
+
});
|
|
31
|
+
return normalizedHeaders;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=request-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-utils.js","sourceRoot":"","sources":["../src/request-utils.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,wBAAwB,CACtC,QAAqC,EACrC,YAA0B;IAE1B,MAAM,OAAO,GAAG,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3D,IAAI,YAAY,EAAE,CAAC;QACjB,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;QAEjD,cAAc,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YACpC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM;QAC/B,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,QAAkB;IAElB,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,OAAO,EAAE,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC;QAC3C,IAAI,EAAE,MAAM,QAAQ,CAAC,IAAI,EAAE;KAC5B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAgC;IAC/D,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,iBAAiB,GAA2B,EAAE,CAAC;IACrD,MAAM,SAAS,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAEvC,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAC/B,iBAAiB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@402flow/sdk-third-party-executors",
|
|
3
|
+
"version": "0.1.0-alpha.26",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Official supported delegated-execution adapters for @402flow/sdk.",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=20.0.0"
|
|
10
|
+
},
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"author": "402flow",
|
|
13
|
+
"homepage": "https://github.com/402flow/sdk/tree/main/third-party-executors#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/402flow/sdk/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/402flow/sdk.git",
|
|
20
|
+
"directory": "third-party-executors"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"402flow",
|
|
24
|
+
"sdk",
|
|
25
|
+
"x402",
|
|
26
|
+
"adapters",
|
|
27
|
+
"dexter",
|
|
28
|
+
"pay.sh"
|
|
29
|
+
],
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"import": "./dist/index.js",
|
|
40
|
+
"default": "./dist/index.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@402flow/sdk": "0.1.0-alpha.26"
|
|
45
|
+
},
|
|
46
|
+
"peerDependenciesMeta": {
|
|
47
|
+
"@402flow/sdk": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"overrides": {
|
|
52
|
+
"jayson": {
|
|
53
|
+
"uuid": "11.1.1"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "npm --prefix .. run build && npm run clean && tsc -p tsconfig.build.json",
|
|
58
|
+
"check": "npm run lint && npm test",
|
|
59
|
+
"clean": "node -e \"const fs = require('node:fs'); for (const path of ['dist', 'tsconfig.build.tsbuildinfo', 'tsconfig.tsbuildinfo', 'tsconfig.typecheck.tsbuildinfo']) { fs.rmSync(path, { recursive: true, force: true }); }\"",
|
|
60
|
+
"example:dexter-delegated-executor": "npm run build && node examples/dexter-delegated-executor.mjs",
|
|
61
|
+
"example:pay-sh-delegated-executor": "npm run build && node examples/pay-sh-delegated-executor.mjs",
|
|
62
|
+
"lint": "eslint src test vitest.config.ts && npm run typecheck",
|
|
63
|
+
"pack:check": "npm run build && npm pack --dry-run",
|
|
64
|
+
"prepack": "npm run build",
|
|
65
|
+
"prepublishOnly": "npm run check",
|
|
66
|
+
"test": "vitest run",
|
|
67
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
68
|
+
},
|
|
69
|
+
"dependencies": {
|
|
70
|
+
"@dexterai/x402": "^3.9.0",
|
|
71
|
+
"@solana/kit": "^6.5.0",
|
|
72
|
+
"@x402/core": "^2.13.0",
|
|
73
|
+
"@x402/svm": "^2.13.0"
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"@eslint/js": "^9.22.0",
|
|
77
|
+
"@types/node": "^22.13.10",
|
|
78
|
+
"eslint": "^9.22.0",
|
|
79
|
+
"globals": "^15.15.0",
|
|
80
|
+
"typescript": "^5.8.2",
|
|
81
|
+
"typescript-eslint": "^8.26.1",
|
|
82
|
+
"vitest": "^3.0.8"
|
|
83
|
+
}
|
|
84
|
+
}
|