@atxp/client 0.2.22 → 0.4.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.
Files changed (191) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +6 -0
  2. package/dist/_virtual/_commonjsHelpers.js.map +1 -0
  3. package/dist/_virtual/ajv.js +8 -0
  4. package/dist/_virtual/ajv.js.map +1 -0
  5. package/dist/_virtual/cache.js +4 -0
  6. package/dist/_virtual/cache.js.map +1 -0
  7. package/dist/_virtual/index.js +4 -0
  8. package/dist/_virtual/index.js.map +1 -0
  9. package/dist/_virtual/uri.all.js +4 -0
  10. package/dist/_virtual/uri.all.js.map +1 -0
  11. package/dist/atxpAccount.js +4 -2
  12. package/dist/atxpAccount.js.map +1 -1
  13. package/dist/atxpClient.js +12 -10
  14. package/dist/atxpClient.js.map +1 -1
  15. package/dist/atxpFetcher.js +10 -8
  16. package/dist/atxpFetcher.js.map +1 -1
  17. package/dist/baseAccount.js +5 -3
  18. package/dist/baseAccount.js.map +1 -1
  19. package/dist/baseConstants.js +4 -0
  20. package/dist/baseConstants.js.map +1 -0
  21. package/dist/basePaymentMaker.js +15 -12
  22. package/dist/basePaymentMaker.js.map +1 -1
  23. package/dist/index.cjs +16198 -0
  24. package/dist/index.cjs.map +1 -0
  25. package/dist/index.d.ts +250 -10
  26. package/dist/index.js +16161 -10
  27. package/dist/index.js.map +1 -1
  28. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js +668 -0
  29. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js.map +1 -0
  30. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js +273 -0
  31. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js.map +1 -0
  32. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js +378 -0
  33. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js.map +1 -0
  34. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js +162 -0
  35. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js.map +1 -0
  36. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js +46 -0
  37. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js.map +1 -0
  38. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js +192 -0
  39. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js.map +1 -0
  40. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +418 -0
  41. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -0
  42. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +1313 -0
  43. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +1 -0
  44. package/dist/node_modules/ajv/lib/ajv.js +531 -0
  45. package/dist/node_modules/ajv/lib/ajv.js.map +1 -0
  46. package/dist/node_modules/ajv/lib/cache.js +37 -0
  47. package/dist/node_modules/ajv/lib/cache.js.map +1 -0
  48. package/dist/node_modules/ajv/lib/compile/async.js +102 -0
  49. package/dist/node_modules/ajv/lib/compile/async.js.map +1 -0
  50. package/dist/node_modules/ajv/lib/compile/error_classes.js +46 -0
  51. package/dist/node_modules/ajv/lib/compile/error_classes.js.map +1 -0
  52. package/dist/node_modules/ajv/lib/compile/formats.js +154 -0
  53. package/dist/node_modules/ajv/lib/compile/formats.js.map +1 -0
  54. package/dist/node_modules/ajv/lib/compile/index.js +404 -0
  55. package/dist/node_modules/ajv/lib/compile/index.js.map +1 -0
  56. package/dist/node_modules/ajv/lib/compile/resolve.js +286 -0
  57. package/dist/node_modules/ajv/lib/compile/resolve.js.map +1 -0
  58. package/dist/node_modules/ajv/lib/compile/rules.js +79 -0
  59. package/dist/node_modules/ajv/lib/compile/rules.js.map +1 -0
  60. package/dist/node_modules/ajv/lib/compile/schema_obj.js +21 -0
  61. package/dist/node_modules/ajv/lib/compile/schema_obj.js.map +1 -0
  62. package/dist/node_modules/ajv/lib/compile/ucs2length.js +30 -0
  63. package/dist/node_modules/ajv/lib/compile/ucs2length.js.map +1 -0
  64. package/dist/node_modules/ajv/lib/compile/util.js +252 -0
  65. package/dist/node_modules/ajv/lib/compile/util.js.map +1 -0
  66. package/dist/node_modules/ajv/lib/data.js +59 -0
  67. package/dist/node_modules/ajv/lib/data.js.map +1 -0
  68. package/dist/node_modules/ajv/lib/definition_schema.js +49 -0
  69. package/dist/node_modules/ajv/lib/definition_schema.js.map +1 -0
  70. package/dist/node_modules/ajv/lib/dotjs/_limit.js +173 -0
  71. package/dist/node_modules/ajv/lib/dotjs/_limit.js.map +1 -0
  72. package/dist/node_modules/ajv/lib/dotjs/_limitItems.js +90 -0
  73. package/dist/node_modules/ajv/lib/dotjs/_limitItems.js.map +1 -0
  74. package/dist/node_modules/ajv/lib/dotjs/_limitLength.js +95 -0
  75. package/dist/node_modules/ajv/lib/dotjs/_limitLength.js.map +1 -0
  76. package/dist/node_modules/ajv/lib/dotjs/_limitProperties.js +90 -0
  77. package/dist/node_modules/ajv/lib/dotjs/_limitProperties.js.map +1 -0
  78. package/dist/node_modules/ajv/lib/dotjs/allOf.js +52 -0
  79. package/dist/node_modules/ajv/lib/dotjs/allOf.js.map +1 -0
  80. package/dist/node_modules/ajv/lib/dotjs/anyOf.js +83 -0
  81. package/dist/node_modules/ajv/lib/dotjs/anyOf.js.map +1 -0
  82. package/dist/node_modules/ajv/lib/dotjs/comment.js +24 -0
  83. package/dist/node_modules/ajv/lib/dotjs/comment.js.map +1 -0
  84. package/dist/node_modules/ajv/lib/dotjs/const.js +62 -0
  85. package/dist/node_modules/ajv/lib/dotjs/const.js.map +1 -0
  86. package/dist/node_modules/ajv/lib/dotjs/contains.js +91 -0
  87. package/dist/node_modules/ajv/lib/dotjs/contains.js.map +1 -0
  88. package/dist/node_modules/ajv/lib/dotjs/custom.js +238 -0
  89. package/dist/node_modules/ajv/lib/dotjs/custom.js.map +1 -0
  90. package/dist/node_modules/ajv/lib/dotjs/dependencies.js +178 -0
  91. package/dist/node_modules/ajv/lib/dotjs/dependencies.js.map +1 -0
  92. package/dist/node_modules/ajv/lib/dotjs/enum.js +72 -0
  93. package/dist/node_modules/ajv/lib/dotjs/enum.js.map +1 -0
  94. package/dist/node_modules/ajv/lib/dotjs/format.js +160 -0
  95. package/dist/node_modules/ajv/lib/dotjs/format.js.map +1 -0
  96. package/dist/node_modules/ajv/lib/dotjs/if.js +113 -0
  97. package/dist/node_modules/ajv/lib/dotjs/if.js.map +1 -0
  98. package/dist/node_modules/ajv/lib/dotjs/index.js +68 -0
  99. package/dist/node_modules/ajv/lib/dotjs/index.js.map +1 -0
  100. package/dist/node_modules/ajv/lib/dotjs/items.js +150 -0
  101. package/dist/node_modules/ajv/lib/dotjs/items.js.map +1 -0
  102. package/dist/node_modules/ajv/lib/dotjs/multipleOf.js +90 -0
  103. package/dist/node_modules/ajv/lib/dotjs/multipleOf.js.map +1 -0
  104. package/dist/node_modules/ajv/lib/dotjs/not.js +94 -0
  105. package/dist/node_modules/ajv/lib/dotjs/not.js.map +1 -0
  106. package/dist/node_modules/ajv/lib/dotjs/oneOf.js +83 -0
  107. package/dist/node_modules/ajv/lib/dotjs/oneOf.js.map +1 -0
  108. package/dist/node_modules/ajv/lib/dotjs/pattern.js +85 -0
  109. package/dist/node_modules/ajv/lib/dotjs/pattern.js.map +1 -0
  110. package/dist/node_modules/ajv/lib/dotjs/properties.js +345 -0
  111. package/dist/node_modules/ajv/lib/dotjs/properties.js.map +1 -0
  112. package/dist/node_modules/ajv/lib/dotjs/propertyNames.js +91 -0
  113. package/dist/node_modules/ajv/lib/dotjs/propertyNames.js.map +1 -0
  114. package/dist/node_modules/ajv/lib/dotjs/ref.js +134 -0
  115. package/dist/node_modules/ajv/lib/dotjs/ref.js.map +1 -0
  116. package/dist/node_modules/ajv/lib/dotjs/required.js +276 -0
  117. package/dist/node_modules/ajv/lib/dotjs/required.js.map +1 -0
  118. package/dist/node_modules/ajv/lib/dotjs/uniqueItems.js +96 -0
  119. package/dist/node_modules/ajv/lib/dotjs/uniqueItems.js.map +1 -0
  120. package/dist/node_modules/ajv/lib/dotjs/validate.js +492 -0
  121. package/dist/node_modules/ajv/lib/dotjs/validate.js.map +1 -0
  122. package/dist/node_modules/ajv/lib/keyword.js +159 -0
  123. package/dist/node_modules/ajv/lib/keyword.js.map +1 -0
  124. package/dist/node_modules/ajv/lib/refs/data.json.js +33 -0
  125. package/dist/node_modules/ajv/lib/refs/data.json.js.map +1 -0
  126. package/dist/node_modules/ajv/lib/refs/json-schema-draft-07.json.js +254 -0
  127. package/dist/node_modules/ajv/lib/refs/json-schema-draft-07.json.js.map +1 -0
  128. package/dist/node_modules/eventsource-parser/dist/index.js +104 -0
  129. package/dist/node_modules/eventsource-parser/dist/index.js.map +1 -0
  130. package/dist/node_modules/eventsource-parser/dist/stream.js +28 -0
  131. package/dist/node_modules/eventsource-parser/dist/stream.js.map +1 -0
  132. package/dist/node_modules/fast-deep-equal/index.js +56 -0
  133. package/dist/node_modules/fast-deep-equal/index.js.map +1 -0
  134. package/dist/node_modules/fast-json-stable-stringify/index.js +69 -0
  135. package/dist/node_modules/fast-json-stable-stringify/index.js.map +1 -0
  136. package/dist/node_modules/json-schema-traverse/index.js +100 -0
  137. package/dist/node_modules/json-schema-traverse/index.js.map +1 -0
  138. package/dist/node_modules/pkce-challenge/dist/index.browser.js +66 -0
  139. package/dist/node_modules/pkce-challenge/dist/index.browser.js.map +1 -0
  140. package/dist/node_modules/uri-js/dist/es5/uri.all.js +1418 -0
  141. package/dist/node_modules/uri-js/dist/es5/uri.all.js.map +1 -0
  142. package/dist/node_modules/zod/v3/ZodError.js +133 -0
  143. package/dist/node_modules/zod/v3/ZodError.js.map +1 -0
  144. package/dist/node_modules/zod/v3/errors.js +9 -0
  145. package/dist/node_modules/zod/v3/errors.js.map +1 -0
  146. package/dist/node_modules/zod/v3/helpers/errorUtil.js +9 -0
  147. package/dist/node_modules/zod/v3/helpers/errorUtil.js.map +1 -0
  148. package/dist/node_modules/zod/v3/helpers/parseUtil.js +112 -0
  149. package/dist/node_modules/zod/v3/helpers/parseUtil.js.map +1 -0
  150. package/dist/node_modules/zod/v3/helpers/util.js +136 -0
  151. package/dist/node_modules/zod/v3/helpers/util.js.map +1 -0
  152. package/dist/node_modules/zod/v3/locales/en.js +112 -0
  153. package/dist/node_modules/zod/v3/locales/en.js.map +1 -0
  154. package/dist/node_modules/zod/v3/types.js +3491 -0
  155. package/dist/node_modules/zod/v3/types.js.map +1 -0
  156. package/dist/oAuth.js +7 -6
  157. package/dist/oAuth.js.map +1 -1
  158. package/dist/solanaAccount.js +7 -4
  159. package/dist/solanaAccount.js.map +1 -1
  160. package/dist/solanaPaymentMaker.js +13 -11
  161. package/dist/solanaPaymentMaker.js.map +1 -1
  162. package/dist/types.js +5 -3
  163. package/dist/types.js.map +1 -1
  164. package/package.json +26 -10
  165. package/dist/atxpAccount.d.ts +0 -13
  166. package/dist/atxpAccount.d.ts.map +0 -1
  167. package/dist/atxpClient.d.ts +0 -14
  168. package/dist/atxpClient.d.ts.map +0 -1
  169. package/dist/atxpFetcher.d.ts +0 -72
  170. package/dist/atxpFetcher.d.ts.map +0 -1
  171. package/dist/baseAccount.d.ts +0 -10
  172. package/dist/baseAccount.d.ts.map +0 -1
  173. package/dist/basePaymentMaker.d.ts +0 -16
  174. package/dist/basePaymentMaker.d.ts.map +0 -1
  175. package/dist/clientTestHelpers.d.ts +0 -6
  176. package/dist/clientTestHelpers.d.ts.map +0 -1
  177. package/dist/clientTestHelpers.js +0 -94
  178. package/dist/clientTestHelpers.js.map +0 -1
  179. package/dist/index.d.ts.map +0 -1
  180. package/dist/oAuth.d.ts +0 -44
  181. package/dist/oAuth.d.ts.map +0 -1
  182. package/dist/setup.expo.d.ts +0 -2
  183. package/dist/setup.expo.d.ts.map +0 -1
  184. package/dist/setup.expo.js +0 -30
  185. package/dist/setup.expo.js.map +0 -1
  186. package/dist/solanaAccount.d.ts +0 -9
  187. package/dist/solanaAccount.d.ts.map +0 -1
  188. package/dist/solanaPaymentMaker.d.ts +0 -18
  189. package/dist/solanaPaymentMaker.d.ts.map +0 -1
  190. package/dist/types.d.ts +0 -70
  191. package/dist/types.d.ts.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,10 +1,250 @@
1
- export * from './atxpClient.js';
2
- export * from './oAuth.js';
3
- export * from './atxpFetcher.js';
4
- export * from './solanaPaymentMaker.js';
5
- export * from './solanaAccount.js';
6
- export * from './atxpAccount.js';
7
- export * from './baseAccount.js';
8
- export * from './basePaymentMaker.js';
9
- export * from './types.js';
10
- //# sourceMappingURL=index.d.ts.map
1
+ import { Currency, AuthorizationServerUrl, Network, OAuthDb, FetchLike, Logger, OAuthResourceClient, ClientCredentials, PKCEValues, AccessToken, PaymentRequestData } from '@atxp/common';
2
+ import { ClientOptions, Client } from '@modelcontextprotocol/sdk/client/index.js';
3
+ import { Implementation, McpError } from '@modelcontextprotocol/sdk/types.js';
4
+ import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
5
+ import * as oauth from 'oauth4webapi';
6
+ import { ValidateTransferError as ValidateTransferError$1 } from '@solana/pay';
7
+ import BigNumber$1 from 'bignumber.js';
8
+ import { WalletClient, PublicActions } from 'viem';
9
+
10
+ type Hex = `0x${string}`;
11
+ type AccountPrefix = Network;
12
+ type AccountIdString = `${AccountPrefix}${string}`;
13
+ type Account = {
14
+ accountId: string;
15
+ paymentMakers: {
16
+ [key: string]: PaymentMaker;
17
+ };
18
+ };
19
+ type ProspectivePayment = {
20
+ accountId: string;
21
+ resourceUrl: string;
22
+ resourceName: string;
23
+ network: Network;
24
+ currency: Currency;
25
+ amount: BigNumber;
26
+ iss: string;
27
+ };
28
+ type ClientConfig = {
29
+ mcpServer: string;
30
+ account: Account;
31
+ allowedAuthorizationServers: AuthorizationServerUrl[];
32
+ approvePayment: (payment: ProspectivePayment) => Promise<boolean>;
33
+ oAuthDb: OAuthDb;
34
+ fetchFn: FetchLike;
35
+ oAuthChannelFetch: FetchLike;
36
+ allowHttp: boolean;
37
+ logger: Logger;
38
+ clientInfo: Implementation;
39
+ clientOptions: ClientOptions;
40
+ onAuthorize: (args: {
41
+ authorizationServer: AuthorizationServerUrl;
42
+ userId: string;
43
+ }) => Promise<void>;
44
+ onAuthorizeFailure: (args: {
45
+ authorizationServer: AuthorizationServerUrl;
46
+ userId: string;
47
+ error: Error;
48
+ }) => Promise<void>;
49
+ onPayment: (args: {
50
+ payment: ProspectivePayment;
51
+ }) => Promise<void>;
52
+ onPaymentFailure: (args: {
53
+ payment: ProspectivePayment;
54
+ error: Error;
55
+ }) => Promise<void>;
56
+ };
57
+ declare class InsufficientFundsError extends Error {
58
+ readonly currency: Currency;
59
+ readonly required: BigNumber;
60
+ readonly available?: BigNumber | undefined;
61
+ readonly network?: string | undefined;
62
+ constructor(currency: Currency, required: BigNumber, available?: BigNumber | undefined, network?: string | undefined);
63
+ }
64
+ declare class PaymentNetworkError extends Error {
65
+ readonly originalError?: Error | undefined;
66
+ constructor(message: string, originalError?: Error | undefined);
67
+ }
68
+ interface PaymentMaker {
69
+ makePayment: (amount: BigNumber, currency: Currency, receiver: string, memo: string) => Promise<string>;
70
+ generateJWT: (params: {
71
+ paymentRequestId: string;
72
+ codeChallenge: string;
73
+ }) => Promise<string>;
74
+ }
75
+
76
+ type RequiredClientConfigFields = 'mcpServer' | 'account';
77
+ type RequiredClientConfig = Pick<ClientConfig, RequiredClientConfigFields>;
78
+ type OptionalClientConfig = Omit<ClientConfig, RequiredClientConfigFields>;
79
+ type ClientArgs = RequiredClientConfig & Partial<OptionalClientConfig>;
80
+ type BuildableClientConfigFields = 'oAuthDb' | 'logger';
81
+ declare const DEFAULT_CLIENT_CONFIG: Required<Omit<OptionalClientConfig, BuildableClientConfigFields>>;
82
+ declare function buildClientConfig(args: ClientArgs): ClientConfig;
83
+ declare function buildStreamableTransport(args: ClientArgs): StreamableHTTPClientTransport;
84
+ declare function atxpClient(args: ClientArgs): Promise<Client>;
85
+
86
+ declare class OAuthAuthenticationRequiredError extends Error {
87
+ readonly url: string;
88
+ readonly resourceServerUrl: string;
89
+ readonly idempotencyKey: string;
90
+ constructor(url: string, resourceServerUrl: string, idempotencyKey: string);
91
+ static create(url: string, resourceServerUrl: string, token?: string): Promise<OAuthAuthenticationRequiredError>;
92
+ }
93
+ interface OAuthClientConfig {
94
+ userId: string;
95
+ db: OAuthDb;
96
+ callbackUrl: string;
97
+ isPublic: boolean;
98
+ fetchFn?: FetchLike;
99
+ sideChannelFetch?: FetchLike;
100
+ strict?: boolean;
101
+ allowInsecureRequests?: boolean;
102
+ clientName?: string;
103
+ logger?: Logger;
104
+ }
105
+ declare class OAuthClient extends OAuthResourceClient {
106
+ protected db: OAuthDb;
107
+ protected userId: string;
108
+ protected fetchFn: FetchLike;
109
+ constructor({ userId, db, callbackUrl, clientName, isPublic, fetchFn, sideChannelFetch, strict, allowInsecureRequests, logger }: OAuthClientConfig);
110
+ protected extractResourceUrl: (response: Response) => string | null;
111
+ fetch: FetchLike;
112
+ makeAuthorizationUrl: (url: string, resourceUrl: string) => Promise<URL>;
113
+ handleCallback: (url: string) => Promise<void>;
114
+ getRegistrationMetadata: () => Promise<Partial<oauth.OmitSymbolProperties<oauth.Client>>>;
115
+ protected generatePKCE: (url: string, resourceUrl: string) => Promise<{
116
+ codeVerifier: string;
117
+ codeChallenge: string;
118
+ state: string;
119
+ }>;
120
+ protected makeTokenRequestAndClient: (authorizationServer: oauth.AuthorizationServer, credentials: ClientCredentials, codeVerifier: string, authResponse: URLSearchParams) => Promise<[Response, oauth.Client]>;
121
+ protected exchangeCodeForToken: (authResponse: URLSearchParams, pkceValues: PKCEValues, authorizationServer: oauth.AuthorizationServer) => Promise<string>;
122
+ protected getAccessToken: (url: string) => Promise<AccessToken | null>;
123
+ protected tryRefreshToken: (url: string) => Promise<AccessToken | null>;
124
+ protected _doFetch: FetchLike;
125
+ }
126
+
127
+ interface ATXPFetcherConfig {
128
+ accountId: string;
129
+ db: OAuthDb;
130
+ paymentMakers: {
131
+ [key: string]: PaymentMaker;
132
+ };
133
+ fetchFn?: FetchLike;
134
+ sideChannelFetch?: FetchLike;
135
+ strict?: boolean;
136
+ allowInsecureRequests?: boolean;
137
+ allowedAuthorizationServers?: AuthorizationServerUrl[];
138
+ approvePayment?: (payment: ProspectivePayment) => Promise<boolean>;
139
+ logger?: Logger;
140
+ onAuthorize?: (args: {
141
+ authorizationServer: AuthorizationServerUrl;
142
+ userId: string;
143
+ }) => Promise<void>;
144
+ onAuthorizeFailure?: (args: {
145
+ authorizationServer: AuthorizationServerUrl;
146
+ userId: string;
147
+ error: Error;
148
+ }) => Promise<void>;
149
+ onPayment?: (args: {
150
+ payment: ProspectivePayment;
151
+ }) => Promise<void>;
152
+ onPaymentFailure?: (args: {
153
+ payment: ProspectivePayment;
154
+ error: Error;
155
+ }) => Promise<void>;
156
+ }
157
+ declare function atxpFetch(config: ATXPFetcherConfig): FetchLike;
158
+ declare class ATXPFetcher {
159
+ protected oauthClient: OAuthClient;
160
+ protected paymentMakers: Map<string, PaymentMaker>;
161
+ protected sideChannelFetch: FetchLike;
162
+ protected db: OAuthDb;
163
+ protected accountId: string;
164
+ protected allowedAuthorizationServers: AuthorizationServerUrl[];
165
+ protected approvePayment: (payment: ProspectivePayment) => Promise<boolean>;
166
+ protected logger: Logger;
167
+ protected onAuthorize: (args: {
168
+ authorizationServer: AuthorizationServerUrl;
169
+ userId: string;
170
+ }) => Promise<void>;
171
+ protected onAuthorizeFailure: (args: {
172
+ authorizationServer: AuthorizationServerUrl;
173
+ userId: string;
174
+ error: Error;
175
+ }) => Promise<void>;
176
+ protected onPayment: (args: {
177
+ payment: ProspectivePayment;
178
+ }) => Promise<void>;
179
+ protected onPaymentFailure: (args: {
180
+ payment: ProspectivePayment;
181
+ error: Error;
182
+ }) => Promise<void>;
183
+ constructor({ accountId, db, paymentMakers, fetchFn, sideChannelFetch, strict, allowInsecureRequests, allowedAuthorizationServers, approvePayment, logger, onAuthorize, onAuthorizeFailure, onPayment, onPaymentFailure }: ATXPFetcherConfig);
184
+ private defaultPaymentFailureHandler;
185
+ protected handlePaymentRequestError: (paymentRequestError: McpError) => Promise<boolean>;
186
+ protected getPaymentRequestData: (paymentRequestUrl: string) => Promise<PaymentRequestData | null>;
187
+ protected isAllowedAuthServer: (url: string | URL) => boolean;
188
+ protected makeAuthRequestWithPaymentMaker: (authorizationUrl: URL, paymentMaker: PaymentMaker) => Promise<string>;
189
+ protected authToService: (error: OAuthAuthenticationRequiredError) => Promise<void>;
190
+ protected exchangeToken: (myToken: AccessToken, newResourceUrl: string) => Promise<AccessToken>;
191
+ protected checkForATXPResponse: (response: Response) => Promise<void>;
192
+ fetch: FetchLike;
193
+ }
194
+
195
+ declare const ValidateTransferError: typeof ValidateTransferError$1;
196
+ declare class SolanaPaymentMaker implements PaymentMaker {
197
+ private connection;
198
+ private source;
199
+ private logger;
200
+ constructor(solanaEndpoint: string, sourceSecretKey: string, logger?: Logger);
201
+ generateJWT: ({ paymentRequestId, codeChallenge }: {
202
+ paymentRequestId: string;
203
+ codeChallenge: string;
204
+ }) => Promise<string>;
205
+ makePayment: (amount: BigNumber$1, currency: Currency, receiver: string, memo: string) => Promise<string>;
206
+ }
207
+
208
+ type ExtendedWalletClient = WalletClient & PublicActions;
209
+ declare class BasePaymentMaker implements PaymentMaker {
210
+ protected signingClient: ExtendedWalletClient;
211
+ protected logger: Logger;
212
+ constructor(baseRPCUrl: string, walletClient: WalletClient, logger?: Logger);
213
+ generateJWT({ paymentRequestId, codeChallenge }: {
214
+ paymentRequestId: string;
215
+ codeChallenge: string;
216
+ }): Promise<string>;
217
+ makePayment(amount: BigNumber, currency: Currency, receiver: string): Promise<string>;
218
+ }
219
+
220
+ declare class SolanaAccount implements Account {
221
+ accountId: string;
222
+ paymentMakers: {
223
+ [key: string]: PaymentMaker;
224
+ };
225
+ constructor(solanaEndpoint: string, sourceSecretKey: string);
226
+ }
227
+
228
+ declare class ATXPAccount implements Account {
229
+ accountId: string;
230
+ paymentMakers: {
231
+ [key: string]: PaymentMaker;
232
+ };
233
+ constructor(connectionString: string, opts?: {
234
+ fetchFn?: FetchLike;
235
+ network?: Network;
236
+ });
237
+ }
238
+
239
+ declare const USDC_CONTRACT_ADDRESS_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
240
+
241
+ declare class BaseAccount implements Account {
242
+ accountId: string;
243
+ paymentMakers: {
244
+ [key: string]: PaymentMaker;
245
+ };
246
+ constructor(baseRPCUrl: string, sourceSecretKey: string);
247
+ }
248
+
249
+ export { ATXPAccount, ATXPFetcher, BaseAccount, BasePaymentMaker, DEFAULT_CLIENT_CONFIG, InsufficientFundsError, OAuthAuthenticationRequiredError, OAuthClient, PaymentNetworkError, SolanaAccount, SolanaPaymentMaker, USDC_CONTRACT_ADDRESS_BASE, ValidateTransferError, atxpClient, atxpFetch, buildClientConfig, buildStreamableTransport };
250
+ export type { ATXPFetcherConfig, Account, AccountIdString, ClientArgs, ClientConfig, Hex, OAuthClientConfig, PaymentMaker, ProspectivePayment };