@coinbase/cdp-sdk 1.48.3 → 1.49.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/CHANGELOG.md +14 -0
- package/_cjs/client/end-user/endUser.js +47 -0
- package/_cjs/client/end-user/endUser.js.map +1 -1
- package/_cjs/client/end-user/toEndUserAccount.js +11 -0
- package/_cjs/client/end-user/toEndUserAccount.js.map +1 -1
- package/_cjs/index.js +5 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +52 -2
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/embedded-wallets/embedded-wallets.js +47 -2
- package/_cjs/openapi-client/generated/embedded-wallets/embedded-wallets.js.map +1 -1
- package/_cjs/openapi-client/generated/end-user-accounts/end-user-accounts.js +24 -2
- package/_cjs/openapi-client/generated/end-user-accounts/end-user-accounts.js.map +1 -1
- package/_cjs/openapi-client/generated/onramp/onramp.js +23 -1
- package/_cjs/openapi-client/generated/onramp/onramp.js.map +1 -1
- package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.js +45 -1
- package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.js.map +1 -1
- package/_cjs/policies/evmSchema.js +65 -1
- package/_cjs/policies/evmSchema.js.map +1 -1
- package/_cjs/policies/solanaSchema.js +34 -1
- package/_cjs/policies/solanaSchema.js.map +1 -1
- package/_cjs/policies/types.js +3 -0
- package/_cjs/policies/types.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/client/end-user/endUser.js +47 -0
- package/_esm/client/end-user/endUser.js.map +1 -1
- package/_esm/client/end-user/toEndUserAccount.js +11 -0
- package/_esm/client/end-user/toEndUserAccount.js.map +1 -1
- package/_esm/index.js +1 -0
- package/_esm/index.js.map +1 -1
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +50 -0
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/embedded-wallets/embedded-wallets.js +43 -1
- package/_esm/openapi-client/generated/embedded-wallets/embedded-wallets.js.map +1 -1
- package/_esm/openapi-client/generated/end-user-accounts/end-user-accounts.js +22 -1
- package/_esm/openapi-client/generated/end-user-accounts/end-user-accounts.js.map +1 -1
- package/_esm/openapi-client/generated/onramp/onramp.js +21 -0
- package/_esm/openapi-client/generated/onramp/onramp.js.map +1 -1
- package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.js +40 -0
- package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.js.map +1 -1
- package/_esm/policies/evmSchema.js +64 -0
- package/_esm/policies/evmSchema.js.map +1 -1
- package/_esm/policies/solanaSchema.js +33 -0
- package/_esm/policies/solanaSchema.js.map +1 -1
- package/_esm/policies/types.js +5 -2
- package/_esm/policies/types.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/client/end-user/endUser.d.ts +35 -1
- package/_types/client/end-user/endUser.d.ts.map +1 -1
- package/_types/client/end-user/endUser.types.d.ts +68 -1
- package/_types/client/end-user/endUser.types.d.ts.map +1 -1
- package/_types/client/end-user/toEndUserAccount.d.ts.map +1 -1
- package/_types/index.d.ts +3 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +474 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/embedded-wallets/embedded-wallets.d.ts +24 -2
- package/_types/openapi-client/generated/embedded-wallets/embedded-wallets.d.ts.map +1 -1
- package/_types/openapi-client/generated/end-user-accounts/end-user-accounts.d.ts +22 -2
- package/_types/openapi-client/generated/end-user-accounts/end-user-accounts.d.ts.map +1 -1
- package/_types/openapi-client/generated/onramp/onramp.d.ts +16 -1
- package/_types/openapi-client/generated/onramp/onramp.d.ts.map +1 -1
- package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.d.ts +32 -1
- package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.d.ts.map +1 -1
- package/_types/openapi-client/index.d.ts +5 -1
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/policies/evmSchema.d.ts +1448 -0
- package/_types/policies/evmSchema.d.ts.map +1 -1
- package/_types/policies/solanaSchema.d.ts +472 -0
- package/_types/policies/solanaSchema.d.ts.map +1 -1
- package/_types/policies/types.d.ts +7642 -4536
- package/_types/policies/types.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/client/end-user/endUser.ts +67 -0
- package/client/end-user/endUser.types.ts +83 -0
- package/client/end-user/toEndUserAccount.ts +27 -0
- package/index.ts +21 -0
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +560 -1
- package/openapi-client/generated/embedded-wallets/embedded-wallets.ts +86 -0
- package/openapi-client/generated/end-user-accounts/end-user-accounts.ts +31 -1
- package/openapi-client/generated/onramp/onramp.ts +31 -0
- package/openapi-client/generated/x402-facilitator/x402-facilitator.ts +84 -0
- package/package.json +1 -1
- package/policies/evmSchema.ts +82 -0
- package/policies/solanaSchema.ts +42 -0
- package/policies/types.ts +6 -0
- package/version.ts +1 -1
|
@@ -7,13 +7,21 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type {
|
|
9
9
|
BlockchainAddress,
|
|
10
|
+
CreateDelegationForEndUserAccount201,
|
|
11
|
+
CreateDelegationForEndUserAccountBody,
|
|
12
|
+
CreateDelegationForEndUserAccountParams,
|
|
10
13
|
CreateEvmEip7702DelegationWithEndUserAccount201,
|
|
11
14
|
CreateEvmEip7702DelegationWithEndUserAccountBody,
|
|
12
15
|
CreateEvmEip7702DelegationWithEndUserAccountParams,
|
|
13
16
|
EvmUserOperation,
|
|
14
17
|
GetDelegationForEndUser200,
|
|
18
|
+
GetDelegationForEndUserAccount200,
|
|
19
|
+
GetDelegationForEndUserAccountParams,
|
|
15
20
|
GetDelegationForEndUserParams,
|
|
21
|
+
RevokeDelegationForEndUserAccountBody,
|
|
22
|
+
RevokeDelegationForEndUserAccountParams,
|
|
16
23
|
RevokeDelegationForEndUserBody,
|
|
24
|
+
RevokeDelegationForEndUserParams,
|
|
17
25
|
SendEvmAssetWithEndUserAccount200,
|
|
18
26
|
SendEvmAssetWithEndUserAccountBody,
|
|
19
27
|
SendEvmAssetWithEndUserAccountParams,
|
|
@@ -208,6 +216,7 @@ export const getDelegationForEndUser = (
|
|
|
208
216
|
export const revokeDelegationForEndUser = (
|
|
209
217
|
userId: string,
|
|
210
218
|
revokeDelegationForEndUserBody: RevokeDelegationForEndUserBody,
|
|
219
|
+
params?: RevokeDelegationForEndUserParams,
|
|
211
220
|
options?: SecondParameter<typeof cdpApiClient<void>>,
|
|
212
221
|
) => {
|
|
213
222
|
return cdpApiClient<void>(
|
|
@@ -216,6 +225,74 @@ export const revokeDelegationForEndUser = (
|
|
|
216
225
|
method: "DELETE",
|
|
217
226
|
headers: { "Content-Type": "application/json" },
|
|
218
227
|
data: revokeDelegationForEndUserBody,
|
|
228
|
+
params,
|
|
229
|
+
},
|
|
230
|
+
options,
|
|
231
|
+
);
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Creates an account-scoped delegation that allows a developer to sign on behalf of an end user for a single blockchain account (identified by its address) for the specified duration. The end user must be authenticated to authorize this delegation.
|
|
235
|
+
Multiple account-scoped delegations may exist concurrently for a single end user (one per canonical account address). Account-scoped and user-scoped delegations cannot coexist for the same user.
|
|
236
|
+
When the address corresponds to an EVM Smart Account, the delegation is scoped to the Smart Account's owner EOA rather than the Smart Account address itself. This means `/address/{smartAccountAddress}/delegation` and `/address/{ownerEoaAddress}/delegation` resolve to the same delegation, and the 409 `account_scoped_delegation_active` error may be returned when creating via either address if one already exists for the canonical owner.
|
|
237
|
+
* @summary Create account-scoped delegation for an end user account
|
|
238
|
+
*/
|
|
239
|
+
export const createDelegationForEndUserAccount = (
|
|
240
|
+
userId: string,
|
|
241
|
+
address: BlockchainAddress,
|
|
242
|
+
createDelegationForEndUserAccountBody: CreateDelegationForEndUserAccountBody,
|
|
243
|
+
params?: CreateDelegationForEndUserAccountParams,
|
|
244
|
+
options?: SecondParameter<typeof cdpApiClient<CreateDelegationForEndUserAccount201>>,
|
|
245
|
+
) => {
|
|
246
|
+
return cdpApiClient<CreateDelegationForEndUserAccount201>(
|
|
247
|
+
{
|
|
248
|
+
url: `/v2/embedded-wallet-api/end-users/${userId}/address/${address}/delegation`,
|
|
249
|
+
method: "POST",
|
|
250
|
+
headers: { "Content-Type": "application/json" },
|
|
251
|
+
data: createDelegationForEndUserAccountBody,
|
|
252
|
+
params,
|
|
253
|
+
},
|
|
254
|
+
options,
|
|
255
|
+
);
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Returns the active account-scoped delegation for the specified end user account, if one exists. Useful for showing delegation status in a UI.
|
|
259
|
+
When the address corresponds to an EVM Smart Account, this returns the delegation for the Smart Account's owner EOA.
|
|
260
|
+
* @summary Get account-scoped delegation for an end user account
|
|
261
|
+
*/
|
|
262
|
+
export const getDelegationForEndUserAccount = (
|
|
263
|
+
userId: string,
|
|
264
|
+
address: BlockchainAddress,
|
|
265
|
+
params?: GetDelegationForEndUserAccountParams,
|
|
266
|
+
options?: SecondParameter<typeof cdpApiClient<GetDelegationForEndUserAccount200>>,
|
|
267
|
+
) => {
|
|
268
|
+
return cdpApiClient<GetDelegationForEndUserAccount200>(
|
|
269
|
+
{
|
|
270
|
+
url: `/v2/embedded-wallet-api/end-users/${userId}/address/${address}/delegation`,
|
|
271
|
+
method: "GET",
|
|
272
|
+
params,
|
|
273
|
+
},
|
|
274
|
+
options,
|
|
275
|
+
);
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* Revokes the active account-scoped delegation for the specified end user account. Other account-scoped delegations for the same user are unaffected. This operation can be performed by the end user themselves or by a developer using their API key.
|
|
279
|
+
When the address corresponds to an EVM Smart Account, this revokes the delegation for the Smart Account's owner EOA.
|
|
280
|
+
* @summary Revoke account-scoped delegation for an end user account
|
|
281
|
+
*/
|
|
282
|
+
export const revokeDelegationForEndUserAccount = (
|
|
283
|
+
userId: string,
|
|
284
|
+
address: BlockchainAddress,
|
|
285
|
+
revokeDelegationForEndUserAccountBody: RevokeDelegationForEndUserAccountBody,
|
|
286
|
+
params?: RevokeDelegationForEndUserAccountParams,
|
|
287
|
+
options?: SecondParameter<typeof cdpApiClient<void>>,
|
|
288
|
+
) => {
|
|
289
|
+
return cdpApiClient<void>(
|
|
290
|
+
{
|
|
291
|
+
url: `/v2/embedded-wallet-api/end-users/${userId}/address/${address}/delegation`,
|
|
292
|
+
method: "DELETE",
|
|
293
|
+
headers: { "Content-Type": "application/json" },
|
|
294
|
+
data: revokeDelegationForEndUserAccountBody,
|
|
295
|
+
params,
|
|
219
296
|
},
|
|
220
297
|
options,
|
|
221
298
|
);
|
|
@@ -400,6 +477,15 @@ export type GetDelegationForEndUserResult = NonNullable<
|
|
|
400
477
|
export type RevokeDelegationForEndUserResult = NonNullable<
|
|
401
478
|
Awaited<ReturnType<typeof revokeDelegationForEndUser>>
|
|
402
479
|
>;
|
|
480
|
+
export type CreateDelegationForEndUserAccountResult = NonNullable<
|
|
481
|
+
Awaited<ReturnType<typeof createDelegationForEndUserAccount>>
|
|
482
|
+
>;
|
|
483
|
+
export type GetDelegationForEndUserAccountResult = NonNullable<
|
|
484
|
+
Awaited<ReturnType<typeof getDelegationForEndUserAccount>>
|
|
485
|
+
>;
|
|
486
|
+
export type RevokeDelegationForEndUserAccountResult = NonNullable<
|
|
487
|
+
Awaited<ReturnType<typeof revokeDelegationForEndUserAccount>>
|
|
488
|
+
>;
|
|
403
489
|
export type CreateEvmEip7702DelegationWithEndUserAccountResult = NonNullable<
|
|
404
490
|
Awaited<ReturnType<typeof createEvmEip7702DelegationWithEndUserAccount>>
|
|
405
491
|
>;
|
|
@@ -17,6 +17,8 @@ import type {
|
|
|
17
17
|
ImportEndUserBody,
|
|
18
18
|
ListEndUsers200,
|
|
19
19
|
ListEndUsersParams,
|
|
20
|
+
LookupEndUser200,
|
|
21
|
+
LookupEndUserParams,
|
|
20
22
|
ValidateEndUserAccessTokenBody,
|
|
21
23
|
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
22
24
|
|
|
@@ -86,6 +88,33 @@ export const getEndUser = (
|
|
|
86
88
|
) => {
|
|
87
89
|
return cdpApiClient<EndUser>({ url: `/v2/end-users/${userId}`, method: "GET" }, options);
|
|
88
90
|
};
|
|
91
|
+
/**
|
|
92
|
+
* Looks up end users. Exactly one lookup type must be provided per request:
|
|
93
|
+
|
|
94
|
+
- **email**: searches across all email-based authentication methods
|
|
95
|
+
(email, Google, Apple, GitHub). May return multiple end users if the
|
|
96
|
+
same email address appears across different auth methods.
|
|
97
|
+
|
|
98
|
+
- **oauthProvider + oauthSubject**: looks up a user by their OAuth
|
|
99
|
+
provider and subject (the `sub` claim from the provider's ID token).
|
|
100
|
+
Both params must be provided together.
|
|
101
|
+
|
|
102
|
+
- **phoneNumber**: looks up a user by their SMS-verified phone number.
|
|
103
|
+
|
|
104
|
+
Returns all matching end users. If no end users match, an empty array is returned.
|
|
105
|
+
|
|
106
|
+
This API is intended to be used by the developer's own backend, and is authenticated using the developer's CDP API key.
|
|
107
|
+
* @summary Look up end users by identity
|
|
108
|
+
*/
|
|
109
|
+
export const lookupEndUser = (
|
|
110
|
+
params?: LookupEndUserParams,
|
|
111
|
+
options?: SecondParameter<typeof cdpApiClient<LookupEndUser200>>,
|
|
112
|
+
) => {
|
|
113
|
+
return cdpApiClient<LookupEndUser200>(
|
|
114
|
+
{ url: `/v2/end-users/lookup`, method: "GET", params },
|
|
115
|
+
options,
|
|
116
|
+
);
|
|
117
|
+
};
|
|
89
118
|
/**
|
|
90
119
|
* Adds a new EVM EOA account to an existing end user. End users can have up to 10 EVM accounts.
|
|
91
120
|
This API is intended to be used by the developer's own backend, and is authenticated using the developer's CDP API key.
|
|
@@ -127,7 +156,7 @@ export const addEndUserEvmSmartAccount = (
|
|
|
127
156
|
);
|
|
128
157
|
};
|
|
129
158
|
/**
|
|
130
|
-
* Adds a new Solana account to an existing end user. End users can have
|
|
159
|
+
* Adds a new Solana account to an existing end user. End users can have up to 10 Solana accounts.
|
|
131
160
|
This API is intended to be used by the developer's own backend, and is authenticated using the developer's CDP API key.
|
|
132
161
|
* @summary Add a Solana account to an end user
|
|
133
162
|
*/
|
|
@@ -172,6 +201,7 @@ export type ValidateEndUserAccessTokenResult = NonNullable<
|
|
|
172
201
|
Awaited<ReturnType<typeof validateEndUserAccessToken>>
|
|
173
202
|
>;
|
|
174
203
|
export type GetEndUserResult = NonNullable<Awaited<ReturnType<typeof getEndUser>>>;
|
|
204
|
+
export type LookupEndUserResult = NonNullable<Awaited<ReturnType<typeof lookupEndUser>>>;
|
|
175
205
|
export type AddEndUserEvmAccountResult = NonNullable<
|
|
176
206
|
Awaited<ReturnType<typeof addEndUserEvmAccount>>
|
|
177
207
|
>;
|
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
GetOnrampOrderById200,
|
|
14
14
|
GetOnrampUserLimits200,
|
|
15
15
|
GetOnrampUserLimitsBody,
|
|
16
|
+
OnrampLimitUpgradeRequest,
|
|
16
17
|
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
17
18
|
|
|
18
19
|
import { cdpApiClient } from "../../cdpApiClient.js";
|
|
@@ -108,6 +109,33 @@ export const getOnrampUserLimits = (
|
|
|
108
109
|
options,
|
|
109
110
|
);
|
|
110
111
|
};
|
|
112
|
+
/**
|
|
113
|
+
* Requests a limit upgrade for an onramp user by submitting identity information. Only phone number is currently supported as a userId.
|
|
114
|
+
|
|
115
|
+
The verification process is asynchronous. After calling this endpoint, use the [Get Onramp User Limits](https://docs.cdp.coinbase.com/api-reference/v2/rest-api/onramp/get-onramp-user-limits) endpoint to check the status in the `limitUpgradeOptions` array.
|
|
116
|
+
|
|
117
|
+
**Prerequisites:**
|
|
118
|
+
- The phone number must have been previously verified by your app via OTP. - Upgrades may not be available until a certain number of successful transactions by the user.
|
|
119
|
+
|
|
120
|
+
**Supported fields:**
|
|
121
|
+
- `ssnLast4`: Last 4 digits of the Social Security Number (no dashes or spaces).
|
|
122
|
+
- `dateOfBirth`: Date of birth (day, month, year as zero-padded strings).
|
|
123
|
+
* @summary Request limit upgrade
|
|
124
|
+
*/
|
|
125
|
+
export const requestLimitsUpgrade = (
|
|
126
|
+
onrampLimitUpgradeRequest: OnrampLimitUpgradeRequest,
|
|
127
|
+
options?: SecondParameter<typeof cdpApiClient<void>>,
|
|
128
|
+
) => {
|
|
129
|
+
return cdpApiClient<void>(
|
|
130
|
+
{
|
|
131
|
+
url: `/v2/onramp/limits/upgrade`,
|
|
132
|
+
method: "POST",
|
|
133
|
+
headers: { "Content-Type": "application/json" },
|
|
134
|
+
data: onrampLimitUpgradeRequest,
|
|
135
|
+
},
|
|
136
|
+
options,
|
|
137
|
+
);
|
|
138
|
+
};
|
|
111
139
|
export type CreateOnrampOrderResult = NonNullable<Awaited<ReturnType<typeof createOnrampOrder>>>;
|
|
112
140
|
export type GetOnrampOrderByIdResult = NonNullable<Awaited<ReturnType<typeof getOnrampOrderById>>>;
|
|
113
141
|
export type CreateOnrampSessionResult = NonNullable<
|
|
@@ -116,3 +144,6 @@ export type CreateOnrampSessionResult = NonNullable<
|
|
|
116
144
|
export type GetOnrampUserLimitsResult = NonNullable<
|
|
117
145
|
Awaited<ReturnType<typeof getOnrampUserLimits>>
|
|
118
146
|
>;
|
|
147
|
+
export type RequestLimitsUpgradeResult = NonNullable<
|
|
148
|
+
Awaited<ReturnType<typeof requestLimitsUpgrade>>
|
|
149
|
+
>;
|
|
@@ -6,8 +6,16 @@
|
|
|
6
6
|
* OpenAPI spec version: 2.0.0
|
|
7
7
|
*/
|
|
8
8
|
import type {
|
|
9
|
+
ListX402DiscoveryMerchantParams,
|
|
10
|
+
ListX402DiscoveryResourcesParams,
|
|
11
|
+
SearchX402ResourcesParams,
|
|
9
12
|
SettleX402PaymentBody,
|
|
10
13
|
VerifyX402PaymentBody,
|
|
14
|
+
X402DiscoveryMerchantResponse,
|
|
15
|
+
X402DiscoveryResourcesResponse,
|
|
16
|
+
X402McpRequest,
|
|
17
|
+
X402McpResponse,
|
|
18
|
+
X402SearchResourcesResponse,
|
|
11
19
|
X402SettleResponseResponse,
|
|
12
20
|
X402SupportedPaymentKindsResponseResponse,
|
|
13
21
|
X402VerifyResponseResponse,
|
|
@@ -65,8 +73,84 @@ export const supportedX402PaymentKinds = (
|
|
|
65
73
|
options,
|
|
66
74
|
);
|
|
67
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* Lists all active discovered x402 resources.
|
|
78
|
+
This endpoint returns resources that have been discovered and cached by the x402 facilitator, including their payment requirements and metadata.
|
|
79
|
+
The response is paginated, and by default, returns 100 items per page.
|
|
80
|
+
* @summary List discovered x402 resources
|
|
81
|
+
*/
|
|
82
|
+
export const listX402DiscoveryResources = (
|
|
83
|
+
params?: ListX402DiscoveryResourcesParams,
|
|
84
|
+
options?: SecondParameter<typeof cdpApiClient<X402DiscoveryResourcesResponse>>,
|
|
85
|
+
) => {
|
|
86
|
+
return cdpApiClient<X402DiscoveryResourcesResponse>(
|
|
87
|
+
{ url: `/v2/x402/discovery/resources`, method: "GET", params },
|
|
88
|
+
options,
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Gets x402 merchant discovery information for a given merchant payment address.
|
|
93
|
+
This endpoint returns all active x402 resources associated with the specified `payTo` address, allowing clients to discover what payment-gated resources a merchant exposes and their corresponding payment requirements.
|
|
94
|
+
The response is paginated, and by default, returns 20 items per page.
|
|
95
|
+
* @summary List merchant discovery info
|
|
96
|
+
*/
|
|
97
|
+
export const listX402DiscoveryMerchant = (
|
|
98
|
+
params: ListX402DiscoveryMerchantParams,
|
|
99
|
+
options?: SecondParameter<typeof cdpApiClient<X402DiscoveryMerchantResponse>>,
|
|
100
|
+
) => {
|
|
101
|
+
return cdpApiClient<X402DiscoveryMerchantResponse>(
|
|
102
|
+
{ url: `/v2/x402/discovery/merchant`, method: "GET", params },
|
|
103
|
+
options,
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Searches for active x402 resources using a text query and optional filters.
|
|
108
|
+
Supports both text-based and vector-based search depending on availability. Results are sorted by relevance and quality score.
|
|
109
|
+
Legacy network names (e.g., `base`, `base-sepolia`, `solana`) are automatically normalized to their CAIP-2 equivalents.
|
|
110
|
+
The response is limited to 20 items per request. If more results exist, `partialResults` will be `true`.
|
|
111
|
+
* @summary Search x402 resources
|
|
112
|
+
*/
|
|
113
|
+
export const searchX402Resources = (
|
|
114
|
+
params?: SearchX402ResourcesParams,
|
|
115
|
+
options?: SecondParameter<typeof cdpApiClient<X402SearchResourcesResponse>>,
|
|
116
|
+
) => {
|
|
117
|
+
return cdpApiClient<X402SearchResourcesResponse>(
|
|
118
|
+
{ url: `/v2/x402/discovery/search`, method: "GET", params },
|
|
119
|
+
options,
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Handles JSON-RPC requests for the Model Context Protocol (MCP). Supports MCP methods for discovering x402 payment resources and tools.
|
|
124
|
+
* @summary Handle MCP JSON-RPC request
|
|
125
|
+
*/
|
|
126
|
+
export const postX402DiscoveryMcp = (
|
|
127
|
+
x402McpRequest: X402McpRequest,
|
|
128
|
+
options?: SecondParameter<typeof cdpApiClient<X402McpResponse>>,
|
|
129
|
+
) => {
|
|
130
|
+
return cdpApiClient<X402McpResponse>(
|
|
131
|
+
{
|
|
132
|
+
url: `/v2/x402/discovery/mcp`,
|
|
133
|
+
method: "POST",
|
|
134
|
+
headers: { "Content-Type": "application/json" },
|
|
135
|
+
data: x402McpRequest,
|
|
136
|
+
},
|
|
137
|
+
options,
|
|
138
|
+
);
|
|
139
|
+
};
|
|
68
140
|
export type VerifyX402PaymentResult = NonNullable<Awaited<ReturnType<typeof verifyX402Payment>>>;
|
|
69
141
|
export type SettleX402PaymentResult = NonNullable<Awaited<ReturnType<typeof settleX402Payment>>>;
|
|
70
142
|
export type SupportedX402PaymentKindsResult = NonNullable<
|
|
71
143
|
Awaited<ReturnType<typeof supportedX402PaymentKinds>>
|
|
72
144
|
>;
|
|
145
|
+
export type ListX402DiscoveryResourcesResult = NonNullable<
|
|
146
|
+
Awaited<ReturnType<typeof listX402DiscoveryResources>>
|
|
147
|
+
>;
|
|
148
|
+
export type ListX402DiscoveryMerchantResult = NonNullable<
|
|
149
|
+
Awaited<ReturnType<typeof listX402DiscoveryMerchant>>
|
|
150
|
+
>;
|
|
151
|
+
export type SearchX402ResourcesResult = NonNullable<
|
|
152
|
+
Awaited<ReturnType<typeof searchX402Resources>>
|
|
153
|
+
>;
|
|
154
|
+
export type PostX402DiscoveryMcpResult = NonNullable<
|
|
155
|
+
Awaited<ReturnType<typeof postX402DiscoveryMcp>>
|
|
156
|
+
>;
|
package/package.json
CHANGED
package/policies/evmSchema.ts
CHANGED
|
@@ -855,3 +855,85 @@ export const SignEndUserEvmTypedDataRuleSchema = z.object({
|
|
|
855
855
|
criteria: SignEndUserEvmTypedDataCriteriaSchema,
|
|
856
856
|
});
|
|
857
857
|
export type SignEndUserEvmTypedDataRule = z.infer<typeof SignEndUserEvmTypedDataRuleSchema>;
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* Schema for criteria used in SendEndUserEvmAsset operations
|
|
861
|
+
*/
|
|
862
|
+
export const SendEndUserEvmAssetCriteriaSchema = z
|
|
863
|
+
.array(
|
|
864
|
+
z.discriminatedUnion("type", [
|
|
865
|
+
SendEvmTransactionEvmNetworkCriterionSchema,
|
|
866
|
+
EvmDataCriterionSchema,
|
|
867
|
+
NetUSDChangeCriterionSchema,
|
|
868
|
+
]),
|
|
869
|
+
)
|
|
870
|
+
.max(10)
|
|
871
|
+
.min(1);
|
|
872
|
+
/**
|
|
873
|
+
* Type representing a set of criteria for the sendEndUserEvmAsset operation.
|
|
874
|
+
*/
|
|
875
|
+
export type SendEndUserEvmAssetCriteria = z.infer<typeof SendEndUserEvmAssetCriteriaSchema>;
|
|
876
|
+
|
|
877
|
+
/**
|
|
878
|
+
* Type representing a 'sendEndUserEvmAsset' policy rule that can accept or reject specific operations
|
|
879
|
+
* based on a set of criteria.
|
|
880
|
+
*/
|
|
881
|
+
export const SendEndUserEvmAssetRuleSchema = z.object({
|
|
882
|
+
/**
|
|
883
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
884
|
+
* "accept" will allow the operation, "reject" will block it.
|
|
885
|
+
*/
|
|
886
|
+
action: ActionEnum,
|
|
887
|
+
/**
|
|
888
|
+
* The operation to which this rule applies.
|
|
889
|
+
* Must be "sendEndUserEvmAsset".
|
|
890
|
+
*/
|
|
891
|
+
operation: z.literal("sendEndUserEvmAsset"),
|
|
892
|
+
/**
|
|
893
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
894
|
+
* Must be compatible with the specified operation type.
|
|
895
|
+
*/
|
|
896
|
+
criteria: SendEndUserEvmAssetCriteriaSchema,
|
|
897
|
+
});
|
|
898
|
+
export type SendEndUserEvmAssetRule = z.infer<typeof SendEndUserEvmAssetRuleSchema>;
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* Schema for criteria used in CreateEndUserEvmSwap operations
|
|
902
|
+
*/
|
|
903
|
+
export const CreateEndUserEvmSwapCriteriaSchema = z
|
|
904
|
+
.array(
|
|
905
|
+
z.discriminatedUnion("type", [
|
|
906
|
+
SendEvmTransactionEvmNetworkCriterionSchema,
|
|
907
|
+
EvmDataCriterionSchema,
|
|
908
|
+
NetUSDChangeCriterionSchema,
|
|
909
|
+
]),
|
|
910
|
+
)
|
|
911
|
+
.max(10)
|
|
912
|
+
.min(1);
|
|
913
|
+
/**
|
|
914
|
+
* Type representing a set of criteria for the createEndUserEvmSwap operation.
|
|
915
|
+
*/
|
|
916
|
+
export type CreateEndUserEvmSwapCriteria = z.infer<typeof CreateEndUserEvmSwapCriteriaSchema>;
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Type representing a 'createEndUserEvmSwap' policy rule that can accept or reject specific operations
|
|
920
|
+
* based on a set of criteria.
|
|
921
|
+
*/
|
|
922
|
+
export const CreateEndUserEvmSwapRuleSchema = z.object({
|
|
923
|
+
/**
|
|
924
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
925
|
+
* "accept" will allow the operation, "reject" will block it.
|
|
926
|
+
*/
|
|
927
|
+
action: ActionEnum,
|
|
928
|
+
/**
|
|
929
|
+
* The operation to which this rule applies.
|
|
930
|
+
* Must be "createEndUserEvmSwap".
|
|
931
|
+
*/
|
|
932
|
+
operation: z.literal("createEndUserEvmSwap"),
|
|
933
|
+
/**
|
|
934
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
935
|
+
* Must be compatible with the specified operation type.
|
|
936
|
+
*/
|
|
937
|
+
criteria: CreateEndUserEvmSwapCriteriaSchema,
|
|
938
|
+
});
|
|
939
|
+
export type CreateEndUserEvmSwapRule = z.infer<typeof CreateEndUserEvmSwapRuleSchema>;
|
package/policies/solanaSchema.ts
CHANGED
|
@@ -600,3 +600,45 @@ export const SignEndUserSolMessageRuleSchema = z.object({
|
|
|
600
600
|
criteria: SignEndUserSolMessageCriteriaSchema,
|
|
601
601
|
});
|
|
602
602
|
export type SignEndUserSolMessageRule = z.infer<typeof SignEndUserSolMessageRuleSchema>;
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Schema for criteria used in SendEndUserSolAsset operations
|
|
606
|
+
*/
|
|
607
|
+
export const SendEndUserSolAssetCriteriaSchema = z
|
|
608
|
+
.array(
|
|
609
|
+
z.discriminatedUnion("type", [
|
|
610
|
+
SplAddressCriterionSchema,
|
|
611
|
+
SplValueCriterionSchema,
|
|
612
|
+
SolDataCriterionSchema,
|
|
613
|
+
SolNetworkCriterionSchema,
|
|
614
|
+
]),
|
|
615
|
+
)
|
|
616
|
+
.max(10)
|
|
617
|
+
.min(1);
|
|
618
|
+
/**
|
|
619
|
+
* Type representing a set of criteria for the sendEndUserSolAsset operation.
|
|
620
|
+
*/
|
|
621
|
+
export type SendEndUserSolAssetCriteria = z.infer<typeof SendEndUserSolAssetCriteriaSchema>;
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Type representing a 'sendEndUserSolAsset' policy rule that can accept or reject specific operations
|
|
625
|
+
* based on a set of criteria.
|
|
626
|
+
*/
|
|
627
|
+
export const SendEndUserSolAssetRuleSchema = z.object({
|
|
628
|
+
/**
|
|
629
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
630
|
+
* "accept" will allow the operation, "reject" will block it.
|
|
631
|
+
*/
|
|
632
|
+
action: ActionEnum,
|
|
633
|
+
/**
|
|
634
|
+
* The operation to which this rule applies.
|
|
635
|
+
* Must be "sendEndUserSolAsset".
|
|
636
|
+
*/
|
|
637
|
+
operation: z.literal("sendEndUserSolAsset"),
|
|
638
|
+
/**
|
|
639
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
640
|
+
* Must be compatible with the specified operation type.
|
|
641
|
+
*/
|
|
642
|
+
criteria: SendEndUserSolAssetCriteriaSchema,
|
|
643
|
+
});
|
|
644
|
+
export type SendEndUserSolAssetRule = z.infer<typeof SendEndUserSolAssetRuleSchema>;
|
package/policies/types.ts
CHANGED
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
SendEndUserEvmTransactionRuleSchema,
|
|
13
13
|
SignEndUserEvmMessageRuleSchema,
|
|
14
14
|
SignEndUserEvmTypedDataRuleSchema,
|
|
15
|
+
SendEndUserEvmAssetRuleSchema,
|
|
16
|
+
CreateEndUserEvmSwapRuleSchema,
|
|
15
17
|
} from "./evmSchema.js";
|
|
16
18
|
import {
|
|
17
19
|
SendSolTransactionRuleSchema,
|
|
@@ -20,6 +22,7 @@ import {
|
|
|
20
22
|
SignEndUserSolTransactionRuleSchema,
|
|
21
23
|
SendEndUserSolTransactionRuleSchema,
|
|
22
24
|
SignEndUserSolMessageRuleSchema,
|
|
25
|
+
SendEndUserSolAssetRuleSchema,
|
|
23
26
|
} from "./solanaSchema.js";
|
|
24
27
|
|
|
25
28
|
/**
|
|
@@ -71,6 +74,9 @@ export const RuleSchema = z.discriminatedUnion("operation", [
|
|
|
71
74
|
SignEndUserSolTransactionRuleSchema,
|
|
72
75
|
SendEndUserSolTransactionRuleSchema,
|
|
73
76
|
SignEndUserSolMessageRuleSchema,
|
|
77
|
+
SendEndUserEvmAssetRuleSchema,
|
|
78
|
+
CreateEndUserEvmSwapRuleSchema,
|
|
79
|
+
SendEndUserSolAssetRuleSchema,
|
|
74
80
|
]);
|
|
75
81
|
|
|
76
82
|
/**
|
package/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "1.
|
|
1
|
+
export const version = "1.49.1";
|