@coinbase/cdp-sdk 1.34.0 → 1.34.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 +8 -0
- package/README.md +19 -0
- package/_cjs/client/cdp.js +4 -0
- package/_cjs/client/cdp.js.map +1 -1
- package/_cjs/client/end-user/endUser.js +28 -0
- package/_cjs/client/end-user/endUser.js.map +1 -0
- package/_cjs/client/end-user/endUser.types.js +3 -0
- package/_cjs/client/end-user/endUser.types.js.map +1 -0
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +78 -2
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/end-user-accounts/end-user-accounts.js +20 -0
- package/_cjs/openapi-client/generated/end-user-accounts/end-user-accounts.js.map +1 -0
- package/_cjs/openapi-client/generated/end-user-accounts/end-user-accounts.msw.js +61 -0
- package/_cjs/openapi-client/generated/end-user-accounts/end-user-accounts.msw.js.map +1 -0
- package/_cjs/openapi-client/generated/index.msw.js +2 -0
- package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.js +39 -0
- package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.js.map +1 -0
- package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js +84 -0
- package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js.map +1 -0
- package/_cjs/openapi-client/index.js +4 -0
- package/_cjs/openapi-client/index.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/client/cdp.js +4 -0
- package/_esm/client/cdp.js.map +1 -1
- package/_esm/client/end-user/endUser.js +24 -0
- package/_esm/client/end-user/endUser.js.map +1 -0
- package/_esm/client/end-user/endUser.types.js +2 -0
- package/_esm/client/end-user/endUser.types.js.map +1 -0
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +76 -0
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/end-user-accounts/end-user-accounts.js +16 -0
- package/_esm/openapi-client/generated/end-user-accounts/end-user-accounts.js.map +1 -0
- package/_esm/openapi-client/generated/end-user-accounts/end-user-accounts.msw.js +52 -0
- package/_esm/openapi-client/generated/end-user-accounts/end-user-accounts.msw.js.map +1 -0
- package/_esm/openapi-client/generated/index.msw.js +2 -0
- package/_esm/openapi-client/generated/index.msw.js.map +1 -1
- package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.js +33 -0
- package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.js.map +1 -0
- package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js +74 -0
- package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js.map +1 -0
- package/_esm/openapi-client/index.js +4 -0
- package/_esm/openapi-client/index.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/auth/utils/jwt.d.ts +1 -1
- package/_types/client/cdp.d.ts +3 -0
- package/_types/client/cdp.d.ts.map +1 -1
- package/_types/client/end-user/endUser.d.ts +16 -0
- package/_types/client/end-user/endUser.d.ts.map +1 -0
- package/_types/client/end-user/endUser.types.d.ts +10 -0
- package/_types/client/end-user/endUser.types.d.ts.map +1 -0
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +353 -19
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/end-user-accounts/end-user-accounts.d.ts +20 -0
- package/_types/openapi-client/generated/end-user-accounts/end-user-accounts.d.ts.map +1 -0
- package/_types/openapi-client/generated/end-user-accounts/end-user-accounts.msw.d.ts +9 -0
- package/_types/openapi-client/generated/end-user-accounts/end-user-accounts.msw.d.ts.map +1 -0
- package/_types/openapi-client/generated/index.msw.d.ts +2 -0
- package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.d.ts +30 -0
- package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.d.ts.map +1 -0
- package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.msw.d.ts +10 -0
- package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.msw.d.ts.map +1 -0
- package/_types/openapi-client/index.d.ts +3 -0
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/auth/utils/jwt.ts +1 -1
- package/client/cdp.ts +5 -0
- package/client/end-user/endUser.ts +27 -0
- package/client/end-user/endUser.types.ts +9 -0
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +429 -20
- package/openapi-client/generated/end-user-accounts/end-user-accounts.msw.ts +95 -0
- package/openapi-client/generated/end-user-accounts/end-user-accounts.ts +39 -0
- package/openapi-client/generated/index.msw.ts +2 -0
- package/openapi-client/generated/x402-facilitator/x402-facilitator.msw.ts +136 -0
- package/openapi-client/generated/x402-facilitator/x402-facilitator.ts +70 -0
- package/openapi-client/index.ts +4 -0
- package/package.json +1 -1
- package/version.ts +1 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.6.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Coinbase Developer Platform APIs
|
|
5
|
+
* The Coinbase Developer Platform APIs - leading the world's transition onchain.
|
|
6
|
+
* OpenAPI spec version: 2.0.0
|
|
7
|
+
*/
|
|
8
|
+
import { faker } from "@faker-js/faker";
|
|
9
|
+
|
|
10
|
+
import { HttpResponse, delay, http } from "msw";
|
|
11
|
+
|
|
12
|
+
import type {
|
|
13
|
+
DeveloperJWTAuthentication,
|
|
14
|
+
EmailAuthentication,
|
|
15
|
+
EndUser,
|
|
16
|
+
SmsAuthentication,
|
|
17
|
+
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
18
|
+
|
|
19
|
+
export const getValidateEndUserAccessTokenResponseEmailAuthenticationMock = (
|
|
20
|
+
overrideResponse: Partial<EmailAuthentication> = {},
|
|
21
|
+
): EmailAuthentication => ({
|
|
22
|
+
...{ type: faker.helpers.arrayElement(["email"] as const), email: faker.internet.email() },
|
|
23
|
+
...overrideResponse,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const getValidateEndUserAccessTokenResponseSmsAuthenticationMock = (
|
|
27
|
+
overrideResponse: Partial<SmsAuthentication> = {},
|
|
28
|
+
): SmsAuthentication => ({
|
|
29
|
+
...{
|
|
30
|
+
type: faker.helpers.arrayElement(["sms"] as const),
|
|
31
|
+
phoneNumber: faker.helpers.fromRegExp("^\+[1-9]\d{1,14}$"),
|
|
32
|
+
},
|
|
33
|
+
...overrideResponse,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const getValidateEndUserAccessTokenResponseDeveloperJWTAuthenticationMock = (
|
|
37
|
+
overrideResponse: Partial<DeveloperJWTAuthentication> = {},
|
|
38
|
+
): DeveloperJWTAuthentication => ({
|
|
39
|
+
...{
|
|
40
|
+
type: faker.helpers.arrayElement(["jwt"] as const),
|
|
41
|
+
kid: faker.string.alpha(20),
|
|
42
|
+
sub: faker.string.alpha(20),
|
|
43
|
+
},
|
|
44
|
+
...overrideResponse,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const getValidateEndUserAccessTokenResponseMock = (
|
|
48
|
+
overrideResponse: Partial<EndUser> = {},
|
|
49
|
+
): EndUser => ({
|
|
50
|
+
userId: faker.helpers.fromRegExp("^[a-zA-Z0-9-]{1,100}$"),
|
|
51
|
+
authenticationMethods: Array.from(
|
|
52
|
+
{ length: faker.number.int({ min: 1, max: 10 }) },
|
|
53
|
+
(_, i) => i + 1,
|
|
54
|
+
).map(() =>
|
|
55
|
+
faker.helpers.arrayElement([
|
|
56
|
+
{ ...getValidateEndUserAccessTokenResponseEmailAuthenticationMock() },
|
|
57
|
+
{ ...getValidateEndUserAccessTokenResponseSmsAuthenticationMock() },
|
|
58
|
+
{ ...getValidateEndUserAccessTokenResponseDeveloperJWTAuthenticationMock() },
|
|
59
|
+
]),
|
|
60
|
+
),
|
|
61
|
+
evmAccounts: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
|
|
62
|
+
() => faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
63
|
+
),
|
|
64
|
+
evmSmartAccounts: Array.from(
|
|
65
|
+
{ length: faker.number.int({ min: 1, max: 10 }) },
|
|
66
|
+
(_, i) => i + 1,
|
|
67
|
+
).map(() => faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$")),
|
|
68
|
+
solanaAccounts: Array.from(
|
|
69
|
+
{ length: faker.number.int({ min: 1, max: 10 }) },
|
|
70
|
+
(_, i) => i + 1,
|
|
71
|
+
).map(() => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$")),
|
|
72
|
+
...overrideResponse,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export const getValidateEndUserAccessTokenMockHandler = (
|
|
76
|
+
overrideResponse?:
|
|
77
|
+
| EndUser
|
|
78
|
+
| ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<EndUser> | EndUser),
|
|
79
|
+
) => {
|
|
80
|
+
return http.post("*/v2/end-users/auth/validate-token", async info => {
|
|
81
|
+
await delay(0);
|
|
82
|
+
|
|
83
|
+
return new HttpResponse(
|
|
84
|
+
JSON.stringify(
|
|
85
|
+
overrideResponse !== undefined
|
|
86
|
+
? typeof overrideResponse === "function"
|
|
87
|
+
? await overrideResponse(info)
|
|
88
|
+
: overrideResponse
|
|
89
|
+
: getValidateEndUserAccessTokenResponseMock(),
|
|
90
|
+
),
|
|
91
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
export const getEndUserAccountsMock = () => [getValidateEndUserAccessTokenMockHandler()];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.6.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Coinbase Developer Platform APIs
|
|
5
|
+
* The Coinbase Developer Platform APIs - leading the world's transition onchain.
|
|
6
|
+
* OpenAPI spec version: 2.0.0
|
|
7
|
+
*/
|
|
8
|
+
import type {
|
|
9
|
+
EndUser,
|
|
10
|
+
ValidateEndUserAccessTokenBody,
|
|
11
|
+
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
12
|
+
|
|
13
|
+
import { cdpApiClient } from "../../cdpApiClient.js";
|
|
14
|
+
|
|
15
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Validates the end user's access token and returns the end user's information. Returns an error if the access token is invalid or expired.
|
|
19
|
+
|
|
20
|
+
This API is intended to be used by the developer's own backend, and is authenticated using the developer's CDP API key.
|
|
21
|
+
* @summary Validate end user access token
|
|
22
|
+
*/
|
|
23
|
+
export const validateEndUserAccessToken = (
|
|
24
|
+
validateEndUserAccessTokenBody: ValidateEndUserAccessTokenBody,
|
|
25
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
26
|
+
) => {
|
|
27
|
+
return cdpApiClient<EndUser>(
|
|
28
|
+
{
|
|
29
|
+
url: `/v2/end-users/auth/validate-token`,
|
|
30
|
+
method: "POST",
|
|
31
|
+
headers: { "Content-Type": "application/json" },
|
|
32
|
+
data: validateEndUserAccessTokenBody,
|
|
33
|
+
},
|
|
34
|
+
options,
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
export type ValidateEndUserAccessTokenResult = NonNullable<
|
|
38
|
+
Awaited<ReturnType<typeof validateEndUserAccessToken>>
|
|
39
|
+
>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./end-user-accounts/end-user-accounts.msw.js";
|
|
1
2
|
export * from "./evm-accounts/evm-accounts.msw.js";
|
|
2
3
|
export * from "./evm-smart-accounts/evm-smart-accounts.msw.js";
|
|
3
4
|
export * from "./evm-swaps/evm-swaps.msw.js";
|
|
@@ -9,3 +10,4 @@ export * from "./payments-alpha/payments-alpha.msw.js";
|
|
|
9
10
|
export * from "./policy-engine/policy-engine.msw.js";
|
|
10
11
|
export * from "./solana-accounts/solana-accounts.msw.js";
|
|
11
12
|
export * from "./solana-token-balances/solana-token-balances.msw.js";
|
|
13
|
+
export * from "./x402-facilitator/x402-facilitator.msw.js";
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.6.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Coinbase Developer Platform APIs
|
|
5
|
+
* The Coinbase Developer Platform APIs - leading the world's transition onchain.
|
|
6
|
+
* OpenAPI spec version: 2.0.0
|
|
7
|
+
*/
|
|
8
|
+
import { faker } from "@faker-js/faker";
|
|
9
|
+
|
|
10
|
+
import { HttpResponse, delay, http } from "msw";
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
X402SettleErrorReason,
|
|
14
|
+
X402VerifyInvalidReason,
|
|
15
|
+
X402Version,
|
|
16
|
+
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
17
|
+
import type {
|
|
18
|
+
X402SettleResponseResponse,
|
|
19
|
+
X402SupportedPaymentKindsResponseResponse,
|
|
20
|
+
X402VerifyResponseResponse,
|
|
21
|
+
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
22
|
+
|
|
23
|
+
export const getVerifyX402PaymentResponseMock = (
|
|
24
|
+
overrideResponse: Partial<X402VerifyResponseResponse> = {},
|
|
25
|
+
): X402VerifyResponseResponse => ({
|
|
26
|
+
isValid: faker.datatype.boolean(),
|
|
27
|
+
invalidReason: faker.helpers.arrayElement([
|
|
28
|
+
faker.helpers.arrayElement(Object.values(X402VerifyInvalidReason)),
|
|
29
|
+
undefined,
|
|
30
|
+
]),
|
|
31
|
+
payer: faker.helpers.fromRegExp("^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
32
|
+
...overrideResponse,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const getSettleX402PaymentResponseMock = (
|
|
36
|
+
overrideResponse: Partial<X402SettleResponseResponse> = {},
|
|
37
|
+
): X402SettleResponseResponse => ({
|
|
38
|
+
success: faker.datatype.boolean(),
|
|
39
|
+
errorReason: faker.helpers.arrayElement([
|
|
40
|
+
faker.helpers.arrayElement(Object.values(X402SettleErrorReason)),
|
|
41
|
+
undefined,
|
|
42
|
+
]),
|
|
43
|
+
payer: faker.helpers.fromRegExp("^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
44
|
+
transaction: faker.helpers.fromRegExp(
|
|
45
|
+
"^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$",
|
|
46
|
+
),
|
|
47
|
+
network: faker.string.alpha(20),
|
|
48
|
+
...overrideResponse,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export const getSupportedX402PaymentKindsResponseMock = (
|
|
52
|
+
overrideResponse: Partial<X402SupportedPaymentKindsResponseResponse> = {},
|
|
53
|
+
): X402SupportedPaymentKindsResponseResponse => ({
|
|
54
|
+
kinds: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
55
|
+
x402Version: faker.helpers.arrayElement(Object.values(X402Version)),
|
|
56
|
+
scheme: faker.helpers.arrayElement(["exact"] as const),
|
|
57
|
+
network: faker.helpers.arrayElement(["base-sepolia", "base"] as const),
|
|
58
|
+
})),
|
|
59
|
+
...overrideResponse,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const getVerifyX402PaymentMockHandler = (
|
|
63
|
+
overrideResponse?:
|
|
64
|
+
| X402VerifyResponseResponse
|
|
65
|
+
| ((
|
|
66
|
+
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
|
67
|
+
) => Promise<X402VerifyResponseResponse> | X402VerifyResponseResponse),
|
|
68
|
+
) => {
|
|
69
|
+
return http.post("*/v2/x402/verify", async info => {
|
|
70
|
+
await delay(0);
|
|
71
|
+
|
|
72
|
+
return new HttpResponse(
|
|
73
|
+
JSON.stringify(
|
|
74
|
+
overrideResponse !== undefined
|
|
75
|
+
? typeof overrideResponse === "function"
|
|
76
|
+
? await overrideResponse(info)
|
|
77
|
+
: overrideResponse
|
|
78
|
+
: getVerifyX402PaymentResponseMock(),
|
|
79
|
+
),
|
|
80
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
81
|
+
);
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const getSettleX402PaymentMockHandler = (
|
|
86
|
+
overrideResponse?:
|
|
87
|
+
| X402SettleResponseResponse
|
|
88
|
+
| ((
|
|
89
|
+
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
|
90
|
+
) => Promise<X402SettleResponseResponse> | X402SettleResponseResponse),
|
|
91
|
+
) => {
|
|
92
|
+
return http.post("*/v2/x402/settle", async info => {
|
|
93
|
+
await delay(0);
|
|
94
|
+
|
|
95
|
+
return new HttpResponse(
|
|
96
|
+
JSON.stringify(
|
|
97
|
+
overrideResponse !== undefined
|
|
98
|
+
? typeof overrideResponse === "function"
|
|
99
|
+
? await overrideResponse(info)
|
|
100
|
+
: overrideResponse
|
|
101
|
+
: getSettleX402PaymentResponseMock(),
|
|
102
|
+
),
|
|
103
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
104
|
+
);
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const getSupportedX402PaymentKindsMockHandler = (
|
|
109
|
+
overrideResponse?:
|
|
110
|
+
| X402SupportedPaymentKindsResponseResponse
|
|
111
|
+
| ((
|
|
112
|
+
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
|
113
|
+
) =>
|
|
114
|
+
| Promise<X402SupportedPaymentKindsResponseResponse>
|
|
115
|
+
| X402SupportedPaymentKindsResponseResponse),
|
|
116
|
+
) => {
|
|
117
|
+
return http.get("*/v2/x402/supported", async info => {
|
|
118
|
+
await delay(0);
|
|
119
|
+
|
|
120
|
+
return new HttpResponse(
|
|
121
|
+
JSON.stringify(
|
|
122
|
+
overrideResponse !== undefined
|
|
123
|
+
? typeof overrideResponse === "function"
|
|
124
|
+
? await overrideResponse(info)
|
|
125
|
+
: overrideResponse
|
|
126
|
+
: getSupportedX402PaymentKindsResponseMock(),
|
|
127
|
+
),
|
|
128
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
129
|
+
);
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
export const getX402FacilitatorMock = () => [
|
|
133
|
+
getVerifyX402PaymentMockHandler(),
|
|
134
|
+
getSettleX402PaymentMockHandler(),
|
|
135
|
+
getSupportedX402PaymentKindsMockHandler(),
|
|
136
|
+
];
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.6.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Coinbase Developer Platform APIs
|
|
5
|
+
* The Coinbase Developer Platform APIs - leading the world's transition onchain.
|
|
6
|
+
* OpenAPI spec version: 2.0.0
|
|
7
|
+
*/
|
|
8
|
+
import type {
|
|
9
|
+
SettleX402PaymentBody,
|
|
10
|
+
VerifyX402PaymentBody,
|
|
11
|
+
X402SettleResponseResponse,
|
|
12
|
+
X402SupportedPaymentKindsResponseResponse,
|
|
13
|
+
X402VerifyResponseResponse,
|
|
14
|
+
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
15
|
+
|
|
16
|
+
import { cdpApiClient } from "../../cdpApiClient.js";
|
|
17
|
+
|
|
18
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Verify an x402 protocol payment with a specific scheme and network.
|
|
22
|
+
* @summary Verify a payment
|
|
23
|
+
*/
|
|
24
|
+
export const verifyX402Payment = (
|
|
25
|
+
verifyX402PaymentBody: VerifyX402PaymentBody,
|
|
26
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
27
|
+
) => {
|
|
28
|
+
return cdpApiClient<X402VerifyResponseResponse>(
|
|
29
|
+
{
|
|
30
|
+
url: `/v2/x402/verify`,
|
|
31
|
+
method: "POST",
|
|
32
|
+
headers: { "Content-Type": "application/json" },
|
|
33
|
+
data: verifyX402PaymentBody,
|
|
34
|
+
},
|
|
35
|
+
options,
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Settle an x402 protocol payment with a specific scheme and network.
|
|
40
|
+
* @summary Settle a payment
|
|
41
|
+
*/
|
|
42
|
+
export const settleX402Payment = (
|
|
43
|
+
settleX402PaymentBody: SettleX402PaymentBody,
|
|
44
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
45
|
+
) => {
|
|
46
|
+
return cdpApiClient<X402SettleResponseResponse>(
|
|
47
|
+
{
|
|
48
|
+
url: `/v2/x402/settle`,
|
|
49
|
+
method: "POST",
|
|
50
|
+
headers: { "Content-Type": "application/json" },
|
|
51
|
+
data: settleX402PaymentBody,
|
|
52
|
+
},
|
|
53
|
+
options,
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Get the supported x402 protocol payment schemes and networks that the facilitator is able to verify and settle payments for.
|
|
58
|
+
* @summary Get supported payment schemes and networks
|
|
59
|
+
*/
|
|
60
|
+
export const supportedX402PaymentKinds = (options?: SecondParameter<typeof cdpApiClient>) => {
|
|
61
|
+
return cdpApiClient<X402SupportedPaymentKindsResponseResponse>(
|
|
62
|
+
{ url: `/v2/x402/supported`, method: "GET" },
|
|
63
|
+
options,
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
export type VerifyX402PaymentResult = NonNullable<Awaited<ReturnType<typeof verifyX402Payment>>>;
|
|
67
|
+
export type SettleX402PaymentResult = NonNullable<Awaited<ReturnType<typeof settleX402Payment>>>;
|
|
68
|
+
export type SupportedX402PaymentKindsResult = NonNullable<
|
|
69
|
+
Awaited<ReturnType<typeof supportedX402PaymentKinds>>
|
|
70
|
+
>;
|
package/openapi-client/index.ts
CHANGED
|
@@ -10,8 +10,11 @@ export * from "./generated/policy-engine/policy-engine.js";
|
|
|
10
10
|
export * from "./generated/payments-alpha/payments-alpha.js";
|
|
11
11
|
export * from "./generated/onramp/onramp.js";
|
|
12
12
|
export * from "./generated/onchain-data/onchain-data.js";
|
|
13
|
+
export * from "./generated/end-user-accounts/end-user-accounts.js";
|
|
14
|
+
export * from "./generated/x402-facilitator/x402-facilitator.js";
|
|
13
15
|
|
|
14
16
|
import { configure } from "./cdpApiClient.js";
|
|
17
|
+
import * as endUserAccounts from "./generated/end-user-accounts/end-user-accounts.js";
|
|
15
18
|
import * as evm from "./generated/evm-accounts/evm-accounts.js";
|
|
16
19
|
import * as evmSmartAccounts from "./generated/evm-smart-accounts/evm-smart-accounts.js";
|
|
17
20
|
import * as evmSwaps from "./generated/evm-swaps/evm-swaps.js";
|
|
@@ -32,6 +35,7 @@ export const CdpOpenApiClient = {
|
|
|
32
35
|
...faucets,
|
|
33
36
|
...policies,
|
|
34
37
|
...payments,
|
|
38
|
+
...endUserAccounts,
|
|
35
39
|
configure,
|
|
36
40
|
};
|
|
37
41
|
|
package/package.json
CHANGED
package/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "1.34.
|
|
1
|
+
export const version = "1.34.1";
|