@atxp/client 0.7.3 → 0.8.0
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/atxpAccount.d.ts +20 -0
- package/dist/atxpAccount.d.ts.map +1 -0
- package/dist/atxpAccount.js +82 -19
- package/dist/atxpAccount.js.map +1 -1
- package/dist/atxpClient.d.ts +12 -0
- package/dist/atxpClient.d.ts.map +1 -0
- package/dist/atxpClient.js +18 -2
- package/dist/atxpClient.js.map +1 -1
- package/dist/atxpFetcher.d.ts +77 -0
- package/dist/atxpFetcher.d.ts.map +1 -0
- package/dist/atxpFetcher.js +95 -140
- package/dist/atxpFetcher.js.map +1 -1
- package/dist/atxpLocalAccount.d.ts +50 -0
- package/dist/atxpLocalAccount.d.ts.map +1 -0
- package/dist/baseAccount.d.ts +20 -0
- package/dist/baseAccount.d.ts.map +1 -0
- package/dist/baseAccount.js +15 -4
- package/dist/baseAccount.js.map +1 -1
- package/dist/baseConstants.d.ts +10 -0
- package/dist/baseConstants.d.ts.map +1 -0
- package/dist/basePaymentMaker.d.ts +23 -0
- package/dist/basePaymentMaker.d.ts.map +1 -0
- package/dist/basePaymentMaker.js +23 -3
- package/dist/basePaymentMaker.js.map +1 -1
- package/dist/clientTestHelpers.d.ts +6 -0
- package/dist/clientTestHelpers.d.ts.map +1 -0
- package/dist/destinationMakers/atxpDestinationMaker.d.ts +15 -0
- package/dist/destinationMakers/atxpDestinationMaker.d.ts.map +1 -0
- package/dist/destinationMakers/atxpDestinationMaker.js +128 -0
- package/dist/destinationMakers/atxpDestinationMaker.js.map +1 -0
- package/dist/destinationMakers/index.d.ts +9 -0
- package/dist/destinationMakers/index.d.ts.map +1 -0
- package/dist/destinationMakers/index.js +42 -0
- package/dist/destinationMakers/index.js.map +1 -0
- package/dist/destinationMakers/passthroughDestinationMaker.d.ts +8 -0
- package/dist/destinationMakers/passthroughDestinationMaker.d.ts.map +1 -0
- package/dist/destinationMakers/passthroughDestinationMaker.js +27 -0
- package/dist/destinationMakers/passthroughDestinationMaker.js.map +1 -0
- package/dist/index.cjs +793 -454
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +111 -36
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +788 -456
- package/dist/index.js.map +1 -1
- package/dist/oAuth.d.ts +44 -0
- package/dist/oAuth.d.ts.map +1 -0
- package/dist/polygonConstants.d.ts +46 -0
- package/dist/polygonConstants.d.ts.map +1 -0
- package/dist/polygonConstants.js +54 -0
- package/dist/polygonConstants.js.map +1 -0
- package/dist/setup.expo.d.ts +2 -0
- package/dist/setup.expo.d.ts.map +1 -0
- package/dist/solanaAccount.d.ts +13 -0
- package/dist/solanaAccount.d.ts.map +1 -0
- package/dist/solanaAccount.js +16 -4
- package/dist/solanaAccount.js.map +1 -1
- package/dist/solanaPaymentMaker.d.ts +25 -0
- package/dist/solanaPaymentMaker.d.ts.map +1 -0
- package/dist/solanaPaymentMaker.js +27 -5
- package/dist/solanaPaymentMaker.js.map +1 -1
- package/dist/types.d.ts +63 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js.map +1 -1
- package/dist/worldConstants.d.ts +53 -0
- package/dist/worldConstants.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/atxpFetcher.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BigNumber } from 'bignumber.js';
|
|
2
1
|
import { OAuthAuthenticationRequiredError, OAuthClient } from './oAuth.js';
|
|
3
2
|
import { PAYMENT_REQUIRED_ERROR_CODE, isSSEResponse, parseMcpMessages, parsePaymentRequests, paymentRequiredError, DEFAULT_AUTHORIZATION_SERVER, ConsoleLogger, getIsReactNative, createReactNativeSafeFetch } from '@atxp/common';
|
|
4
3
|
import { InsufficientFundsError, PaymentNetworkError } from './types.js';
|
|
4
|
+
import { BigNumber } from 'bignumber.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Creates an ATXP fetch wrapper that handles OAuth authentication and payments.
|
|
@@ -12,9 +12,9 @@ import { InsufficientFundsError, PaymentNetworkError } from './types.js';
|
|
|
12
12
|
*/
|
|
13
13
|
function atxpFetch(config) {
|
|
14
14
|
const fetcher = new ATXPFetcher({
|
|
15
|
-
|
|
15
|
+
account: config.account,
|
|
16
16
|
db: config.oAuthDb,
|
|
17
|
-
|
|
17
|
+
destinationMakers: config.destinationMakers,
|
|
18
18
|
fetchFn: config.fetchFn,
|
|
19
19
|
sideChannelFetch: config.oAuthChannelFetch,
|
|
20
20
|
allowInsecureRequests: config.allowHttp,
|
|
@@ -32,7 +32,8 @@ class ATXPFetcher {
|
|
|
32
32
|
constructor(config) {
|
|
33
33
|
this.defaultPaymentFailureHandler = async ({ payment, error }) => {
|
|
34
34
|
if (error instanceof InsufficientFundsError) {
|
|
35
|
-
|
|
35
|
+
const networkText = error.network ? ` on ${error.network}` : '';
|
|
36
|
+
this.logger.info(`PAYMENT FAILED: Insufficient ${error.currency} funds${networkText}`);
|
|
36
37
|
this.logger.info(`Required: ${error.required} ${error.currency}`);
|
|
37
38
|
if (error.available) {
|
|
38
39
|
this.logger.info(`Available: ${error.available} ${error.currency}`);
|
|
@@ -40,7 +41,7 @@ class ATXPFetcher {
|
|
|
40
41
|
this.logger.info(`Account: ${payment.accountId}`);
|
|
41
42
|
}
|
|
42
43
|
else if (error instanceof PaymentNetworkError) {
|
|
43
|
-
this.logger.info(`PAYMENT FAILED: Network error
|
|
44
|
+
this.logger.info(`PAYMENT FAILED: Network error: ${error.message}`);
|
|
44
45
|
}
|
|
45
46
|
else {
|
|
46
47
|
this.logger.info(`PAYMENT FAILED: ${error.message}`);
|
|
@@ -50,35 +51,61 @@ class ATXPFetcher {
|
|
|
50
51
|
if (!paymentRequestData.destinations || paymentRequestData.destinations.length === 0) {
|
|
51
52
|
return false;
|
|
52
53
|
}
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
// Get sources from the account
|
|
55
|
+
const sources = await this.account.getSources();
|
|
56
|
+
// Apply destination mappers to transform destinations
|
|
57
|
+
// Convert PaymentRequestDestination[] to Destination[] for mapper compatibility
|
|
58
|
+
const mappedDestinations = [];
|
|
59
|
+
for (const option of paymentRequestData.destinations) {
|
|
60
|
+
const destinationMaker = this.destinationMakers.get(option.network);
|
|
61
|
+
if (!destinationMaker) {
|
|
62
|
+
this.logger.debug(`ATXP: destination maker for network '${option.network}' not available, trying next destination`);
|
|
58
63
|
continue;
|
|
59
64
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
};
|
|
71
|
-
if (!await this.approvePayment(prospectivePayment)) {
|
|
72
|
-
this.logger.info(`ATXP: payment request denied by callback function for destination on ${dest.network}`);
|
|
73
|
-
continue;
|
|
65
|
+
mappedDestinations.push(...(await destinationMaker.makeDestinations(option, this.logger, paymentRequestId, sources)));
|
|
66
|
+
}
|
|
67
|
+
if (mappedDestinations.length === 0) {
|
|
68
|
+
this.logger.info(`ATXP: no destinations found after mapping`);
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
// Validate amounts are not negative
|
|
72
|
+
for (const dest of mappedDestinations) {
|
|
73
|
+
if (dest.amount.isLessThan(0)) {
|
|
74
|
+
throw new Error(`ATXP: payment amount cannot be negative: ${dest.amount.toString()} ${dest.currency}`);
|
|
74
75
|
}
|
|
75
|
-
|
|
76
|
+
}
|
|
77
|
+
// Create prospective payment for approval (using first destination for display)
|
|
78
|
+
const firstDest = mappedDestinations[0];
|
|
79
|
+
const prospectivePayment = {
|
|
80
|
+
accountId: this.account.accountId,
|
|
81
|
+
resourceUrl: paymentRequestData.resource?.toString() ?? '',
|
|
82
|
+
resourceName: paymentRequestData.resourceName ?? '',
|
|
83
|
+
currency: firstDest.currency,
|
|
84
|
+
amount: firstDest.amount,
|
|
85
|
+
iss: paymentRequestData.iss ?? '',
|
|
86
|
+
};
|
|
87
|
+
// Ask for approval once for all payment attempts
|
|
88
|
+
if (!await this.approvePayment(prospectivePayment)) {
|
|
89
|
+
this.logger.info(`ATXP: payment request denied by callback function`);
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
// Try each payment maker in order
|
|
93
|
+
let lastPaymentError = null;
|
|
94
|
+
let paymentAttempted = false;
|
|
95
|
+
for (const paymentMaker of this.account.paymentMakers) {
|
|
76
96
|
try {
|
|
77
|
-
|
|
78
|
-
|
|
97
|
+
// Pass all destinations to payment maker - it will filter and pick the one it can handle
|
|
98
|
+
const result = await paymentMaker.makePayment(mappedDestinations, paymentRequestData.iss, paymentRequestId);
|
|
99
|
+
if (result === null) {
|
|
100
|
+
this.logger.debug(`ATXP: payment maker cannot handle these destinations, trying next`);
|
|
101
|
+
continue; // Try next payment maker
|
|
102
|
+
}
|
|
103
|
+
paymentAttempted = true;
|
|
104
|
+
// Payment was successful
|
|
105
|
+
this.logger.info(`ATXP: made payment of ${firstDest.amount.toString()} ${firstDest.currency} on ${result.chain}: ${result.transactionId}`);
|
|
79
106
|
await this.onPayment({ payment: prospectivePayment });
|
|
80
107
|
// Submit payment to the server
|
|
81
|
-
const jwt = await paymentMaker.generateJWT({ paymentRequestId, codeChallenge: '' });
|
|
108
|
+
const jwt = await paymentMaker.generateJWT({ paymentRequestId, codeChallenge: '', accountId: this.account.accountId });
|
|
82
109
|
const response = await this.sideChannelFetch(paymentRequestUrl.toString(), {
|
|
83
110
|
method: 'PUT',
|
|
84
111
|
headers: {
|
|
@@ -86,9 +113,10 @@ class ATXPFetcher {
|
|
|
86
113
|
'Content-Type': 'application/json'
|
|
87
114
|
},
|
|
88
115
|
body: JSON.stringify({
|
|
89
|
-
transactionId:
|
|
90
|
-
|
|
91
|
-
|
|
116
|
+
transactionId: result.transactionId,
|
|
117
|
+
...(result.transactionSubId ? { transactionSubId: result.transactionSubId } : {}),
|
|
118
|
+
chain: result.chain,
|
|
119
|
+
currency: result.currency
|
|
92
120
|
})
|
|
93
121
|
});
|
|
94
122
|
this.logger.debug(`ATXP: payment was ${response.ok ? 'successfully' : 'not successfully'} PUT to ${paymentRequestUrl} : status ${response.status} ${response.statusText}`);
|
|
@@ -101,13 +129,18 @@ class ATXPFetcher {
|
|
|
101
129
|
}
|
|
102
130
|
catch (error) {
|
|
103
131
|
const typedError = error;
|
|
104
|
-
|
|
132
|
+
paymentAttempted = true;
|
|
133
|
+
lastPaymentError = typedError;
|
|
134
|
+
this.logger.warn(`ATXP: payment maker failed: ${typedError.message}`);
|
|
105
135
|
await this.onPaymentFailure({ payment: prospectivePayment, error: typedError });
|
|
106
|
-
//
|
|
107
|
-
continue;
|
|
136
|
+
// Continue to next payment maker
|
|
108
137
|
}
|
|
109
138
|
}
|
|
110
|
-
|
|
139
|
+
// If payment was attempted but all failed, rethrow the last error
|
|
140
|
+
if (paymentAttempted && lastPaymentError) {
|
|
141
|
+
throw lastPaymentError;
|
|
142
|
+
}
|
|
143
|
+
this.logger.info(`ATXP: no payment maker could handle these destinations`);
|
|
111
144
|
return false;
|
|
112
145
|
};
|
|
113
146
|
this.handlePaymentRequestError = async (paymentRequestError) => {
|
|
@@ -134,94 +167,8 @@ class ATXPFetcher {
|
|
|
134
167
|
if (paymentRequestData.destinations && paymentRequestData.destinations.length > 0) {
|
|
135
168
|
return this.handleMultiDestinationPayment(paymentRequestData, paymentRequestUrl, paymentRequestId);
|
|
136
169
|
}
|
|
137
|
-
//
|
|
138
|
-
|
|
139
|
-
if (!requestedNetwork) {
|
|
140
|
-
throw new Error(`Payment network not provided`);
|
|
141
|
-
}
|
|
142
|
-
const destination = paymentRequestData.destination;
|
|
143
|
-
if (!destination) {
|
|
144
|
-
throw new Error(`destination not provided`);
|
|
145
|
-
}
|
|
146
|
-
let amount = new BigNumber(0);
|
|
147
|
-
if (!paymentRequestData.amount) {
|
|
148
|
-
throw new Error(`amount not provided`);
|
|
149
|
-
}
|
|
150
|
-
try {
|
|
151
|
-
amount = new BigNumber(paymentRequestData.amount);
|
|
152
|
-
}
|
|
153
|
-
catch {
|
|
154
|
-
throw new Error(`Invalid amount ${paymentRequestData.amount}`);
|
|
155
|
-
}
|
|
156
|
-
if (amount.lte(0)) {
|
|
157
|
-
throw new Error(`Invalid amount ${paymentRequestData.amount}`);
|
|
158
|
-
}
|
|
159
|
-
const currency = paymentRequestData.currency;
|
|
160
|
-
if (!currency) {
|
|
161
|
-
throw new Error(`Currency not provided`);
|
|
162
|
-
}
|
|
163
|
-
const paymentMaker = this.paymentMakers.get(requestedNetwork);
|
|
164
|
-
if (!paymentMaker) {
|
|
165
|
-
this.logger.info(`ATXP: payment network '${requestedNetwork}' not set up for this client (available networks: ${Array.from(this.paymentMakers.keys()).join(', ')})`);
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
const prospectivePayment = {
|
|
169
|
-
accountId: this.accountId,
|
|
170
|
-
resourceUrl: paymentRequestData.resource?.toString() ?? '',
|
|
171
|
-
resourceName: paymentRequestData.resourceName ?? '',
|
|
172
|
-
network: requestedNetwork,
|
|
173
|
-
currency,
|
|
174
|
-
amount,
|
|
175
|
-
iss: paymentRequestData.iss ?? '',
|
|
176
|
-
};
|
|
177
|
-
if (!await this.approvePayment(prospectivePayment)) {
|
|
178
|
-
this.logger.info(`ATXP: payment request denied by callback function`);
|
|
179
|
-
return false;
|
|
180
|
-
}
|
|
181
|
-
let paymentId;
|
|
182
|
-
try {
|
|
183
|
-
paymentId = await paymentMaker.makePayment(amount, currency, destination, paymentRequestData.iss);
|
|
184
|
-
this.logger.info(`ATXP: made payment of ${amount} ${currency} on ${requestedNetwork}: ${paymentId}`);
|
|
185
|
-
// Call onPayment callback after successful payment
|
|
186
|
-
await this.onPayment({ payment: prospectivePayment });
|
|
187
|
-
}
|
|
188
|
-
catch (paymentError) {
|
|
189
|
-
// Call onPaymentFailure callback if payment fails
|
|
190
|
-
await this.onPaymentFailure({
|
|
191
|
-
payment: prospectivePayment,
|
|
192
|
-
error: paymentError
|
|
193
|
-
});
|
|
194
|
-
throw paymentError;
|
|
195
|
-
}
|
|
196
|
-
const jwt = await paymentMaker.generateJWT({ paymentRequestId, codeChallenge: '' });
|
|
197
|
-
// Make a fetch call to the authorization URL with the payment ID
|
|
198
|
-
// redirect=false is a hack
|
|
199
|
-
// The OAuth spec calls for the authorization url to return with a redirect, but fetch
|
|
200
|
-
// on mobile will automatically follow the redirect (it doesn't support the redirect=manual option)
|
|
201
|
-
// We want the redirect URL so we can extract the code from it, not the contents of the
|
|
202
|
-
// redirect URL (which might not even exist for agentic ATXP clients)
|
|
203
|
-
// So ATXP servers are set up to instead return a 200 with the redirect URL in the body
|
|
204
|
-
// if we pass redirect=false.
|
|
205
|
-
// TODO: Remove the redirect=false hack once we have a way to handle the redirect on mobile
|
|
206
|
-
const response = await this.sideChannelFetch(paymentRequestUrl.toString(), {
|
|
207
|
-
method: 'PUT',
|
|
208
|
-
headers: {
|
|
209
|
-
'Authorization': `Bearer ${jwt}`,
|
|
210
|
-
'Content-Type': 'application/json'
|
|
211
|
-
},
|
|
212
|
-
body: JSON.stringify({
|
|
213
|
-
transactionId: paymentId,
|
|
214
|
-
network: requestedNetwork,
|
|
215
|
-
currency: currency
|
|
216
|
-
})
|
|
217
|
-
});
|
|
218
|
-
this.logger.debug(`ATXP: payment was ${response.ok ? 'successfully' : 'not successfully'} PUT to ${paymentRequestUrl} : status ${response.status} ${response.statusText}`);
|
|
219
|
-
if (!response.ok) {
|
|
220
|
-
const msg = `ATXP: payment to ${paymentRequestUrl} failed: HTTP ${response.status} ${await response.text()}`;
|
|
221
|
-
this.logger.info(msg);
|
|
222
|
-
throw new Error(msg);
|
|
223
|
-
}
|
|
224
|
-
return true;
|
|
170
|
+
// Payment request doesn't have destinations - this shouldn't happen with new SDK
|
|
171
|
+
throw new Error(`ATXP: payment request does not contain destinations array`);
|
|
225
172
|
};
|
|
226
173
|
this.getPaymentRequestData = async (paymentRequestUrl) => {
|
|
227
174
|
const prRequest = await this.sideChannelFetch(paymentRequestUrl);
|
|
@@ -229,6 +176,14 @@ class ATXPFetcher {
|
|
|
229
176
|
throw new Error(`ATXP: GET ${paymentRequestUrl} failed: ${prRequest.status} ${prRequest.statusText}`);
|
|
230
177
|
}
|
|
231
178
|
const paymentRequest = await prRequest.json();
|
|
179
|
+
// Parse amount strings to BigNumber objects
|
|
180
|
+
if (paymentRequest.destinations) {
|
|
181
|
+
for (const dest of paymentRequest.destinations) {
|
|
182
|
+
if (typeof dest.amount === 'string' || typeof dest.amount === 'number') {
|
|
183
|
+
dest.amount = new BigNumber(dest.amount);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
232
187
|
return paymentRequest;
|
|
233
188
|
};
|
|
234
189
|
this.isAllowedAuthServer = (url) => {
|
|
@@ -242,15 +197,15 @@ class ATXPFetcher {
|
|
|
242
197
|
throw new Error(`Code challenge not provided`);
|
|
243
198
|
}
|
|
244
199
|
if (!paymentMaker) {
|
|
245
|
-
const
|
|
246
|
-
throw new Error(`Payment maker is null/undefined. Available payment
|
|
200
|
+
const paymentMakerCount = this.account.paymentMakers.length;
|
|
201
|
+
throw new Error(`Payment maker is null/undefined. Available payment maker count: ${paymentMakerCount}. This usually indicates a payment maker object was not properly instantiated.`);
|
|
247
202
|
}
|
|
248
203
|
// TypeScript should prevent this, but add runtime check for edge cases (untyped JS, version mismatches, etc.)
|
|
249
204
|
if (!paymentMaker.generateJWT) {
|
|
250
|
-
const
|
|
251
|
-
throw new Error(`Payment maker is missing generateJWT method. Available payment
|
|
205
|
+
const paymentMakerCount = this.account.paymentMakers.length;
|
|
206
|
+
throw new Error(`Payment maker is missing generateJWT method. Available payment maker count: ${paymentMakerCount}. This indicates the payment maker object does not implement the PaymentMaker interface. If using TypeScript, ensure your payment maker properly implements the PaymentMaker interface.`);
|
|
252
207
|
}
|
|
253
|
-
const authToken = await paymentMaker.generateJWT({ paymentRequestId: '', codeChallenge: codeChallenge });
|
|
208
|
+
const authToken = await paymentMaker.generateJWT({ paymentRequestId: '', codeChallenge: codeChallenge, accountId: this.account.accountId });
|
|
254
209
|
// Make a fetch call to the authorization URL with the payment ID
|
|
255
210
|
// redirect=false is a hack
|
|
256
211
|
// The OAuth spec calls for the authorization url to return with a redirect, but fetch
|
|
@@ -296,11 +251,11 @@ class ATXPFetcher {
|
|
|
296
251
|
throw new Error(`Expected redirect response from authorization URL, got ${response.status}`);
|
|
297
252
|
};
|
|
298
253
|
this.authToService = async (error) => {
|
|
299
|
-
// TODO: We need to generalize this - we can't assume that there's a single paymentMaker for the auth flow.
|
|
300
|
-
if (this.paymentMakers.
|
|
254
|
+
// TODO: We need to generalize this - we can't assume that there's a single paymentMaker for the auth flow.
|
|
255
|
+
if (this.account.paymentMakers.length > 1) {
|
|
301
256
|
throw new Error(`ATXP: multiple payment makers found - cannot determine which one to use for auth`);
|
|
302
257
|
}
|
|
303
|
-
const paymentMaker =
|
|
258
|
+
const paymentMaker = this.account.paymentMakers[0];
|
|
304
259
|
if (paymentMaker) {
|
|
305
260
|
// We can do the full OAuth flow - we'll generate a signed JWT and call /authorize on the
|
|
306
261
|
// AS to get a code, then exchange the code for an access token
|
|
@@ -315,14 +270,14 @@ class ATXPFetcher {
|
|
|
315
270
|
// Call onAuthorize callback after successful authorization
|
|
316
271
|
await this.onAuthorize({
|
|
317
272
|
authorizationServer: authorizationUrl.origin,
|
|
318
|
-
userId: this.accountId
|
|
273
|
+
userId: this.account.accountId
|
|
319
274
|
});
|
|
320
275
|
}
|
|
321
276
|
catch (authError) {
|
|
322
277
|
// Call onAuthorizeFailure callback if authorization fails
|
|
323
278
|
await this.onAuthorizeFailure({
|
|
324
279
|
authorizationServer: authorizationUrl.origin,
|
|
325
|
-
userId: this.accountId,
|
|
280
|
+
userId: this.account.accountId,
|
|
326
281
|
error: authError
|
|
327
282
|
});
|
|
328
283
|
throw authError;
|
|
@@ -333,13 +288,13 @@ class ATXPFetcher {
|
|
|
333
288
|
// If we do, we'll use it to auth to the downstream resource
|
|
334
289
|
// (In pass-through scenarios, the atxpServer() middleware stores the incoming
|
|
335
290
|
// token in the DB under the '' resource URL).
|
|
336
|
-
const existingToken = await this.db.getAccessToken(this.accountId, '');
|
|
291
|
+
const existingToken = await this.db.getAccessToken(this.account.accountId, '');
|
|
337
292
|
if (!existingToken) {
|
|
338
293
|
this.logger.info(`ATXP: no token found for the current server - we can't exchange a token if we don't have one`);
|
|
339
294
|
throw error;
|
|
340
295
|
}
|
|
341
296
|
const newToken = await this.exchangeToken(existingToken, error.resourceServerUrl);
|
|
342
|
-
this.db.saveAccessToken(this.accountId, error.resourceServerUrl, newToken);
|
|
297
|
+
this.db.saveAccessToken(this.account.accountId, error.resourceServerUrl, newToken);
|
|
343
298
|
}
|
|
344
299
|
};
|
|
345
300
|
this.exchangeToken = async (myToken, newResourceUrl) => {
|
|
@@ -430,15 +385,15 @@ class ATXPFetcher {
|
|
|
430
385
|
throw error;
|
|
431
386
|
}
|
|
432
387
|
};
|
|
433
|
-
const {
|
|
388
|
+
const { account, db, destinationMakers, fetchFn = fetch, sideChannelFetch = fetchFn, strict = true, allowInsecureRequests = process.env.NODE_ENV === 'development', allowedAuthorizationServers = [DEFAULT_AUTHORIZATION_SERVER], approvePayment = async () => true, logger = new ConsoleLogger(), onAuthorize = async () => { }, onAuthorizeFailure = async () => { }, onPayment = async () => { }, onPaymentFailure = async () => { } } = config;
|
|
434
389
|
// Use React Native safe fetch if in React Native environment
|
|
435
390
|
const safeFetchFn = getIsReactNative() ? createReactNativeSafeFetch(fetchFn) : fetchFn;
|
|
436
391
|
const safeSideChannelFetch = getIsReactNative() ? createReactNativeSafeFetch(sideChannelFetch) : sideChannelFetch;
|
|
437
|
-
// ATXPClient should never actually use the callback url - instead of redirecting the user to
|
|
392
|
+
// ATXPClient should never actually use the callback url - instead of redirecting the user to
|
|
438
393
|
// an authorization url which redirects back to the callback url, ATXPClient posts the payment
|
|
439
394
|
// directly to the authorization server, then does the token exchange itself
|
|
440
395
|
this.oauthClient = new OAuthClient({
|
|
441
|
-
userId: accountId,
|
|
396
|
+
userId: account.accountId,
|
|
442
397
|
db,
|
|
443
398
|
callbackUrl: 'http://localhost:3000/unused-dummy-atxp-callback',
|
|
444
399
|
isPublic: false,
|
|
@@ -448,10 +403,10 @@ class ATXPFetcher {
|
|
|
448
403
|
allowInsecureRequests,
|
|
449
404
|
logger: logger
|
|
450
405
|
});
|
|
451
|
-
this.
|
|
406
|
+
this.account = account;
|
|
407
|
+
this.destinationMakers = destinationMakers;
|
|
452
408
|
this.sideChannelFetch = safeSideChannelFetch;
|
|
453
409
|
this.db = db;
|
|
454
|
-
this.accountId = accountId;
|
|
455
410
|
this.allowedAuthorizationServers = allowedAuthorizationServers;
|
|
456
411
|
this.approvePayment = approvePayment;
|
|
457
412
|
this.logger = logger;
|
package/dist/atxpFetcher.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atxpFetcher.js","sources":["../src/atxpFetcher.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAQA;;;;;;AAMG;AACG,SAAU,SAAS,CAAC,MAAoB,EAAA;AAC5C,IAAA,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC;AAC9B,QAAA,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS;QACnC,EAAE,EAAE,MAAM,CAAC,OAAO;AAClB,QAAA,aAAa,EAAE,MAAM,CAAC,OAAO,CAAC,aAAa;QAC3C,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,gBAAgB,EAAE,MAAM,CAAC,iBAAiB;QAC1C,qBAAqB,EAAE,MAAM,CAAC,SAAS;QACvC,2BAA2B,EAAE,MAAM,CAAC,2BAA2B;QAC/D,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;QAC7C,SAAS,EAAE,MAAM,CAAC,SAAS;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essage, TypedData, TransactionSerializable } from 'viem';
|
|
2
|
+
import { FetchLike } from '@atxp/common';
|
|
3
|
+
/**
|
|
4
|
+
* ATXP implementation of viem's LocalAccount interface.
|
|
5
|
+
* Delegates signing operations to the accounts-x402 API.
|
|
6
|
+
* Includes properties needed by x402 library for wallet client compatibility.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ATXPLocalAccount implements LocalAccount {
|
|
9
|
+
readonly address: Address;
|
|
10
|
+
private origin;
|
|
11
|
+
private token;
|
|
12
|
+
private fetchFn;
|
|
13
|
+
readonly type: "local";
|
|
14
|
+
readonly account: LocalAccount;
|
|
15
|
+
readonly chain: {
|
|
16
|
+
id: number;
|
|
17
|
+
};
|
|
18
|
+
readonly transport: object;
|
|
19
|
+
constructor(address: Address, origin: string, token: string, fetchFn?: FetchLike);
|
|
20
|
+
/**
|
|
21
|
+
* Fetch the wallet address from the /address endpoint
|
|
22
|
+
*/
|
|
23
|
+
static create(origin: string, token: string, fetchFn?: FetchLike): Promise<ATXPLocalAccount>;
|
|
24
|
+
/**
|
|
25
|
+
* Sign a typed data structure using EIP-712
|
|
26
|
+
* This is what x402 library will call for EIP-3009 authorization
|
|
27
|
+
*/
|
|
28
|
+
signTypedData<const TTypedData extends TypedData | {
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
}>(typedData: TTypedData): Promise<Hex>;
|
|
31
|
+
/**
|
|
32
|
+
* Sign a message - required by LocalAccount interface but not used for X402
|
|
33
|
+
*/
|
|
34
|
+
signMessage(_: {
|
|
35
|
+
message: SignableMessage;
|
|
36
|
+
}): Promise<Hex>;
|
|
37
|
+
/**
|
|
38
|
+
* Sign a transaction - required by LocalAccount interface but not used for X402
|
|
39
|
+
*/
|
|
40
|
+
signTransaction(_transaction: TransactionSerializable, _args?: unknown): Promise<Hex>;
|
|
41
|
+
/**
|
|
42
|
+
* Get public key - required by LocalAccount interface
|
|
43
|
+
*/
|
|
44
|
+
readonly publicKey: Hex;
|
|
45
|
+
/**
|
|
46
|
+
* Source - required by LocalAccount interface (set to 'custom')
|
|
47
|
+
*/
|
|
48
|
+
readonly source: "custom";
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=atxpLocalAccount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atxpLocalAccount.d.ts","sourceRoot":"","sources":["../src/atxpLocalAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,MAAM,CAAC;AACvG,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQzC;;;;GAIG;AACH,qBAAa,gBAAiB,YAAW,YAAY;aASjC,OAAO,EAAE,OAAO;IAChC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,OAAO;IAXjB,SAAgB,IAAI,EAAG,OAAO,CAAU;IAGxC,SAAgB,OAAO,EAAE,YAAY,CAAC;IACtC,SAAgB,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,SAAgB,SAAS,EAAE,MAAM,CAAC;gBAGhB,OAAO,EAAE,OAAO,EACxB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,SAA8B;IAQjD;;OAEG;WACU,MAAM,CACjB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,SAA8B,GACtC,OAAO,CAAC,gBAAgB,CAAC;IAqC5B;;;OAGG;IACG,aAAa,CACjB,KAAK,CAAC,UAAU,SAAS,SAAS,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,EAC/D,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IAqBtC;;OAEG;IACG,WAAW,CAAC,CAAC,EAAE;QAAE,OAAO,EAAE,eAAe,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAIhE;;OAEG;IACG,eAAe,CAAC,YAAY,EAAE,uBAAuB,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAI3F;;OAEG;IACH,QAAQ,CAAC,SAAS,EAA2E,GAAG,CAAC;IAEjG;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,QAAQ,CAAU;CACrC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Account, PaymentMaker } from './types.js';
|
|
2
|
+
import type { AccountId, Source } from '@atxp/common';
|
|
3
|
+
import { LocalAccount } from 'viem';
|
|
4
|
+
export declare class BaseAccount implements Account {
|
|
5
|
+
accountId: AccountId;
|
|
6
|
+
paymentMakers: PaymentMaker[];
|
|
7
|
+
private walletClient;
|
|
8
|
+
private account;
|
|
9
|
+
constructor(baseRPCUrl: string, sourceSecretKey: string);
|
|
10
|
+
/**
|
|
11
|
+
* Get a signer that can be used with the x402 library
|
|
12
|
+
* This is only available for EVM-based accounts
|
|
13
|
+
*/
|
|
14
|
+
getSigner(): LocalAccount;
|
|
15
|
+
/**
|
|
16
|
+
* Get sources for this account
|
|
17
|
+
*/
|
|
18
|
+
getSources(): Promise<Source[]>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=baseAccount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseAccount.d.ts","sourceRoot":"","sources":["../src/baseAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAO,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtD,OAAO,EAA0C,YAAY,EAAE,MAAM,MAAM,CAAC;AAG5E,qBAAa,WAAY,YAAW,OAAO;IACzC,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,OAAO,CAAoB;gBAEvB,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAsBvD;;;OAGG;IACH,SAAS,IAAI,YAAY;IAKzB;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAOtC"}
|
package/dist/baseAccount.js
CHANGED
|
@@ -12,15 +12,16 @@ class BaseAccount {
|
|
|
12
12
|
throw new Error('Source secret key is required');
|
|
13
13
|
}
|
|
14
14
|
this.account = privateKeyToAccount(sourceSecretKey);
|
|
15
|
-
|
|
15
|
+
// Format accountId as network:address
|
|
16
|
+
this.accountId = `base:${this.account.address}`;
|
|
16
17
|
this.walletClient = createWalletClient({
|
|
17
18
|
account: this.account,
|
|
18
19
|
chain: base,
|
|
19
20
|
transport: http(baseRPCUrl),
|
|
20
21
|
});
|
|
21
|
-
this.paymentMakers =
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
this.paymentMakers = [
|
|
23
|
+
new BasePaymentMaker(baseRPCUrl, this.walletClient)
|
|
24
|
+
];
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
27
|
* Get a signer that can be used with the x402 library
|
|
@@ -30,6 +31,16 @@ class BaseAccount {
|
|
|
30
31
|
// Return the viem account directly - it implements LocalAccount interface
|
|
31
32
|
return this.account;
|
|
32
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Get sources for this account
|
|
36
|
+
*/
|
|
37
|
+
async getSources() {
|
|
38
|
+
return [{
|
|
39
|
+
address: this.account.address,
|
|
40
|
+
chain: 'base',
|
|
41
|
+
walletType: 'eoa'
|
|
42
|
+
}];
|
|
43
|
+
}
|
|
33
44
|
}
|
|
34
45
|
|
|
35
46
|
export { BaseAccount };
|
package/dist/baseAccount.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseAccount.js","sources":["../src/baseAccount.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"baseAccount.js","sources":["../src/baseAccount.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;MAOa,WAAW,CAAA;IAMtB,WAAA,CAAY,UAAkB,EAAE,eAAuB,EAAA;QACrD,IAAI,CAAC,UAAU,EAAE;AACf,YAAA,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC;QAC7C;QACA,IAAI,CAAC,eAAe,EAAE;AACpB,YAAA,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC;QAClD;AAEA,QAAA,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC,eAAsB,CAAC;;QAG1D,IAAI,CAAC,SAAS,GAAG,CAAA,KAAA,EAAQ,IAAI,CAAC,OAAO,CAAC,OAAO,CAAA,CAAe;AAC5D,QAAA,IAAI,CAAC,YAAY,GAAG,kBAAkB,CAAC;YACrC,OAAO,EAAE,IAAI,CAAC,OAAO;AACrB,YAAA,KAAK,EAAE,IAAI;AACX,YAAA,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC;AAC5B,SAAA,CAAC;QACF,IAAI,CAAC,aAAa,GAAG;AACnB,YAAA,IAAI,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,YAAY;SACnD;IACH;AAEA;;;AAGG;IACH,SAAS,GAAA;;QAEP,OAAO,IAAI,CAAC,OAAO;IACrB;AAEA;;AAEG;AACH,IAAA,MAAM,UAAU,GAAA;AACd,QAAA,OAAO,CAAC;AACN,gBAAA,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;AAC7B,gBAAA,KAAK,EAAE,MAAM;AACb,gBAAA,UAAU,EAAE;AACb,aAAA,CAAC;IACJ;AACD;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const USDC_CONTRACT_ADDRESS_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
2
|
+
export declare const USDC_CONTRACT_ADDRESS_BASE_SEPOLIA = "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
|
|
3
|
+
/**
|
|
4
|
+
* Get USDC contract address for Base chain by chain ID
|
|
5
|
+
* @param chainId - Chain ID (8453 for mainnet, 84532 for sepolia)
|
|
6
|
+
* @returns USDC contract address
|
|
7
|
+
* @throws Error if chain ID is not supported
|
|
8
|
+
*/
|
|
9
|
+
export declare const getBaseUSDCAddress: (chainId: number) => string;
|
|
10
|
+
//# sourceMappingURL=baseConstants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseConstants.d.ts","sourceRoot":"","sources":["../src/baseConstants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,+CAA+C,CAAC;AACvF,eAAO,MAAM,kCAAkC,+CAA+C,CAAC;AAE/F;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,KAAG,MASpD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PaymentMaker } from './types.js';
|
|
2
|
+
import { Logger, Currency, AccountId, PaymentIdentifier, Destination } from '@atxp/common';
|
|
3
|
+
import { WalletClient, PublicActions } from "viem";
|
|
4
|
+
type ExtendedWalletClient = WalletClient & PublicActions;
|
|
5
|
+
export declare class BasePaymentMaker implements PaymentMaker {
|
|
6
|
+
protected signingClient: ExtendedWalletClient;
|
|
7
|
+
protected logger: Logger;
|
|
8
|
+
constructor(baseRPCUrl: string, walletClient: WalletClient, logger?: Logger);
|
|
9
|
+
getSourceAddress(_params: {
|
|
10
|
+
amount: BigNumber;
|
|
11
|
+
currency: Currency;
|
|
12
|
+
receiver: string;
|
|
13
|
+
memo: string;
|
|
14
|
+
}): string;
|
|
15
|
+
generateJWT({ paymentRequestId, codeChallenge, accountId }: {
|
|
16
|
+
paymentRequestId: string;
|
|
17
|
+
codeChallenge: string;
|
|
18
|
+
accountId?: AccountId | null;
|
|
19
|
+
}): Promise<string>;
|
|
20
|
+
makePayment(destinations: Destination[], _memo: string, _paymentRequestId?: string): Promise<PaymentIdentifier | null>;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=basePaymentMaker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basePaymentMaker.d.ts","sourceRoot":"","sources":["../src/basePaymentMaker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAO,MAAM,YAAY,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3F,OAAO,EAKL,YAAY,EACZ,aAAa,EACd,MAAM,MAAM,CAAC;AAMd,KAAK,oBAAoB,GAAG,YAAY,GAAG,aAAa,CAAC;AA6CzD,qBAAa,gBAAiB,YAAW,YAAY;IACnD,SAAS,CAAC,aAAa,EAAE,oBAAoB,CAAC;IAC9C,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEb,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,MAAM;IAe3E,gBAAgB,CAAC,OAAO,EAAE;QAAC,MAAM,EAAE,SAAS,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,GAAG,MAAM;IAIpG,WAAW,CAAC,EAAC,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAC,EAAE;QAAC,gBAAgB,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;KAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAsC3J,WAAW,CAAC,YAAY,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;CAmF7H"}
|