@coinbase/cdp-sdk 1.30.0 → 1.31.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/CHANGELOG.md +6 -0
- package/_cjs/openapi-client/cdpApiClient.js +37 -0
- package/_cjs/openapi-client/cdpApiClient.js.map +1 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +8 -19
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +22 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +89 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/index.msw.js +0 -1
- package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/onramp/onramp.js +2 -2
- package/_cjs/openapi-client/generated/onramp/onramp.msw.js +2 -2
- package/_cjs/openapi-client/generated/onramp/onramp.msw.js.map +1 -1
- package/_cjs/openapi-client/index.js +0 -1
- package/_cjs/openapi-client/index.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/openapi-client/cdpApiClient.js +4 -0
- package/_esm/openapi-client/cdpApiClient.js.map +1 -1
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +6 -17
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +19 -0
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +84 -0
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
- package/_esm/openapi-client/generated/index.msw.js +0 -1
- package/_esm/openapi-client/generated/index.msw.js.map +1 -1
- package/_esm/openapi-client/generated/onramp/onramp.js +2 -2
- package/_esm/openapi-client/generated/onramp/onramp.msw.js +2 -2
- package/_esm/openapi-client/generated/onramp/onramp.msw.js.map +1 -1
- package/_esm/openapi-client/index.js +0 -1
- package/_esm/openapi-client/index.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/client/evm/evm.types.d.ts +21 -1
- package/_types/client/evm/evm.types.d.ts.map +1 -1
- package/_types/openapi-client/cdpApiClient.d.ts.map +1 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +86 -154
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +13 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts +5 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/index.msw.d.ts +0 -1
- package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/onramp/onramp.d.ts +2 -2
- package/_types/openapi-client/index.d.ts +4 -1
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/client/evm/evm.types.ts +24 -0
- package/openapi-client/cdpApiClient.ts +5 -0
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +92 -171
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.ts +118 -0
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +42 -0
- package/openapi-client/generated/index.msw.ts +0 -1
- package/openapi-client/generated/onramp/onramp.msw.ts +2 -2
- package/openapi-client/generated/onramp/onramp.ts +2 -2
- package/openapi-client/index.ts +0 -1
- package/package.json +2 -1
- package/version.ts +1 -1
- package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.js +0 -15
- package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.js.map +0 -1
- package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js +0 -69
- package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js.map +0 -1
- package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.js +0 -11
- package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.js.map +0 -1
- package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js +0 -63
- package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js.map +0 -1
- package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.d.ts +0 -20
- package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.d.ts.map +0 -1
- package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.msw.d.ts +0 -6
- package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.msw.d.ts.map +0 -1
- package/openapi-client/generated/x402-facilitator/x402-facilitator.msw.ts +0 -85
- package/openapi-client/generated/x402-facilitator/x402-facilitator.ts +0 -34
|
@@ -12,7 +12,10 @@ import type {
|
|
|
12
12
|
EvmUserOperation,
|
|
13
13
|
ListEvmSmartAccounts200,
|
|
14
14
|
ListEvmSmartAccountsParams,
|
|
15
|
+
ListSpendPermissions200,
|
|
16
|
+
ListSpendPermissionsParams,
|
|
15
17
|
PrepareUserOperationBody,
|
|
18
|
+
RevokeSpendPermissionRequest,
|
|
16
19
|
SendUserOperationBody,
|
|
17
20
|
UpdateEvmSmartAccountBody,
|
|
18
21
|
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
@@ -173,6 +176,39 @@ export const createSpendPermission = (
|
|
|
173
176
|
options,
|
|
174
177
|
);
|
|
175
178
|
};
|
|
179
|
+
/**
|
|
180
|
+
* Lists spend permission for the given smart account address.
|
|
181
|
+
* @summary List spend permissions
|
|
182
|
+
*/
|
|
183
|
+
export const listSpendPermissions = (
|
|
184
|
+
address: string,
|
|
185
|
+
params?: ListSpendPermissionsParams,
|
|
186
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
187
|
+
) => {
|
|
188
|
+
return cdpApiClient<ListSpendPermissions200>(
|
|
189
|
+
{ url: `/v2/evm/smart-accounts/${address}/spend-permissions/list`, method: "GET", params },
|
|
190
|
+
options,
|
|
191
|
+
);
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Revokes an existing spend permission.
|
|
195
|
+
* @summary Revoke a spend permission
|
|
196
|
+
*/
|
|
197
|
+
export const revokeSpendPermission = (
|
|
198
|
+
address: string,
|
|
199
|
+
revokeSpendPermissionRequest: RevokeSpendPermissionRequest,
|
|
200
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
201
|
+
) => {
|
|
202
|
+
return cdpApiClient<EvmUserOperation>(
|
|
203
|
+
{
|
|
204
|
+
url: `/v2/evm/smart-accounts/${address}/spend-permissions/revoke`,
|
|
205
|
+
method: "POST",
|
|
206
|
+
headers: { "Content-Type": "application/json" },
|
|
207
|
+
data: revokeSpendPermissionRequest,
|
|
208
|
+
},
|
|
209
|
+
options,
|
|
210
|
+
);
|
|
211
|
+
};
|
|
176
212
|
export type ListEvmSmartAccountsResult = NonNullable<
|
|
177
213
|
Awaited<ReturnType<typeof listEvmSmartAccounts>>
|
|
178
214
|
>;
|
|
@@ -194,3 +230,9 @@ export type SendUserOperationResult = NonNullable<Awaited<ReturnType<typeof send
|
|
|
194
230
|
export type CreateSpendPermissionResult = NonNullable<
|
|
195
231
|
Awaited<ReturnType<typeof createSpendPermission>>
|
|
196
232
|
>;
|
|
233
|
+
export type ListSpendPermissionsResult = NonNullable<
|
|
234
|
+
Awaited<ReturnType<typeof listSpendPermissions>>
|
|
235
|
+
>;
|
|
236
|
+
export type RevokeSpendPermissionResult = NonNullable<
|
|
237
|
+
Awaited<ReturnType<typeof revokeSpendPermission>>
|
|
238
|
+
>;
|
|
@@ -8,4 +8,3 @@ export * from "./payments-alpha/payments-alpha.msw.js";
|
|
|
8
8
|
export * from "./policy-engine/policy-engine.msw.js";
|
|
9
9
|
export * from "./solana-accounts/solana-accounts.msw.js";
|
|
10
10
|
export * from "./solana-token-balances/solana-token-balances.msw.js";
|
|
11
|
-
export * from "./x402-facilitator/x402-facilitator.msw.js";
|
|
@@ -25,7 +25,7 @@ export const getCreateOnrampOrderResponseMock = (
|
|
|
25
25
|
order: {
|
|
26
26
|
orderId: faker.string.alpha(20),
|
|
27
27
|
paymentTotal: faker.string.alpha(20),
|
|
28
|
-
paymentSubtotal:
|
|
28
|
+
paymentSubtotal: faker.string.alpha(20),
|
|
29
29
|
paymentCurrency: faker.string.alpha(20),
|
|
30
30
|
paymentMethod: faker.helpers.arrayElement(Object.values(OnrampPaymentMethodTypeId)),
|
|
31
31
|
purchaseAmount: faker.string.alpha(20),
|
|
@@ -61,7 +61,7 @@ export const getGetOnrampOrderByIdResponseMock = (
|
|
|
61
61
|
order: {
|
|
62
62
|
orderId: faker.string.alpha(20),
|
|
63
63
|
paymentTotal: faker.string.alpha(20),
|
|
64
|
-
paymentSubtotal:
|
|
64
|
+
paymentSubtotal: faker.string.alpha(20),
|
|
65
65
|
paymentCurrency: faker.string.alpha(20),
|
|
66
66
|
paymentMethod: faker.helpers.arrayElement(Object.values(OnrampPaymentMethodTypeId)),
|
|
67
67
|
purchaseAmount: faker.string.alpha(20),
|
|
@@ -18,9 +18,9 @@ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new Onramp order or get a quote for an Onramp order. Either `paymentAmount` or `purchaseAmount` must be provided.
|
|
20
20
|
|
|
21
|
-
This API currently only supports the payment method `GUEST_CHECKOUT_APPLE_PAY`, and the
|
|
21
|
+
This API currently only supports the payment method `GUEST_CHECKOUT_APPLE_PAY`, and the `paymentLink` returned will only work in iOS apps. We do not support web integration via iframes at this time.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
For detailed integration instructions and to get access to this API, refer to the [Apple Pay Onramp API docs](https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/apple-pay-onramp-api).
|
|
24
24
|
* @summary Create an onramp order
|
|
25
25
|
*/
|
|
26
26
|
export const createOnrampOrder = (
|
package/openapi-client/index.ts
CHANGED
|
@@ -8,7 +8,6 @@ export * from "./generated/solana-token-balances/solana-token-balances.js";
|
|
|
8
8
|
export * from "./generated/faucets/faucets.js";
|
|
9
9
|
export * from "./generated/policy-engine/policy-engine.js";
|
|
10
10
|
export * from "./generated/payments-alpha/payments-alpha.js";
|
|
11
|
-
export * from "./generated/x402-facilitator/x402-facilitator.js";
|
|
12
11
|
export * from "./generated/onramp/onramp.js";
|
|
13
12
|
|
|
14
13
|
import { configure } from "./cdpApiClient.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cdp-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"description": "SDK for interacting with the Coinbase Developer Platform Wallet API",
|
|
5
5
|
"main": "./_cjs/index.js",
|
|
6
6
|
"module": "./_esm/index.js",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"@solana/web3.js": "^1.98.1",
|
|
23
23
|
"abitype": "1.0.6",
|
|
24
24
|
"axios": "^1.8.2",
|
|
25
|
+
"axios-retry": "^4.5.0",
|
|
25
26
|
"jose": "^6.0.8",
|
|
26
27
|
"md5": "^2.3.0",
|
|
27
28
|
"uncrypto": "^0.1.3",
|
package/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "1.
|
|
1
|
+
export const version = "1.31.0";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.listX402DiscoveryResources = void 0;
|
|
4
|
-
const cdpApiClient_js_1 = require("../../cdpApiClient.js");
|
|
5
|
-
/**
|
|
6
|
-
* Lists all active discovered x402 resources.
|
|
7
|
-
This endpoint returns resources that have been discovered and cached by the x402 facilitator, including their payment requirements and metadata.
|
|
8
|
-
The response is paginated, and by default, returns 100 items per page.
|
|
9
|
-
* @summary List discovered x402 resources
|
|
10
|
-
*/
|
|
11
|
-
const listX402DiscoveryResources = (params, options) => {
|
|
12
|
-
return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/x402/discovery/resources`, method: "GET", params }, options);
|
|
13
|
-
};
|
|
14
|
-
exports.listX402DiscoveryResources = listX402DiscoveryResources;
|
|
15
|
-
//# sourceMappingURL=x402-facilitator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x402-facilitator.js","sourceRoot":"","sources":["../../../../openapi-client/generated/x402-facilitator/x402-facilitator.ts"],"names":[],"mappings":";;;AAYA,2DAAqD;AAIrD;;;;;GAKG;AACI,MAAM,0BAA0B,GAAG,CACxC,MAAyC,EACzC,OAA8C,EAC9C,EAAE;IACF,OAAO,IAAA,8BAAY,EACjB,EAAE,GAAG,EAAE,8BAA8B,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAC9D,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,0BAA0B,8BAQrC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getX402FacilitatorMock = exports.getListX402DiscoveryResourcesMockHandler = exports.getListX402DiscoveryResourcesResponseMock = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Generated by orval v7.6.0 🍺
|
|
6
|
-
* Do not edit manually.
|
|
7
|
-
* Coinbase Developer Platform APIs
|
|
8
|
-
* The Coinbase Developer Platform APIs - leading the world's transition onchain.
|
|
9
|
-
* OpenAPI spec version: 2.0.0
|
|
10
|
-
*/
|
|
11
|
-
const faker_1 = require("@faker-js/faker");
|
|
12
|
-
const msw_1 = require("msw");
|
|
13
|
-
const coinbaseDeveloperPlatformAPIs_schemas_js_1 = require("../coinbaseDeveloperPlatformAPIs.schemas.js");
|
|
14
|
-
const getListX402DiscoveryResourcesResponseMock = (overrideResponse = {}) => ({
|
|
15
|
-
x402Version: faker_1.faker.helpers.arrayElement(Object.values(coinbaseDeveloperPlatformAPIs_schemas_js_1.X402Version)),
|
|
16
|
-
items: Array.from({ length: faker_1.faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
17
|
-
resource: faker_1.faker.string.alpha(20),
|
|
18
|
-
type: faker_1.faker.helpers.arrayElement(["http"]),
|
|
19
|
-
x402Version: faker_1.faker.helpers.arrayElement(Object.values(coinbaseDeveloperPlatformAPIs_schemas_js_1.X402Version)),
|
|
20
|
-
accepts: faker_1.faker.helpers.arrayElement([
|
|
21
|
-
Array.from({ length: faker_1.faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
22
|
-
scheme: faker_1.faker.helpers.arrayElement(["exact"]),
|
|
23
|
-
network: faker_1.faker.helpers.arrayElement(["base-sepolia", "base"]),
|
|
24
|
-
maxAmountRequired: faker_1.faker.string.alpha(20),
|
|
25
|
-
resource: faker_1.faker.string.alpha(20),
|
|
26
|
-
description: faker_1.faker.string.alpha(20),
|
|
27
|
-
mimeType: faker_1.faker.string.alpha(20),
|
|
28
|
-
outputSchema: faker_1.faker.helpers.arrayElement([{}, undefined]),
|
|
29
|
-
payTo: faker_1.faker.helpers.fromRegExp("^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
30
|
-
maxTimeoutSeconds: faker_1.faker.number.int({ min: undefined, max: undefined }),
|
|
31
|
-
asset: faker_1.faker.helpers.fromRegExp("^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
32
|
-
extra: faker_1.faker.helpers.arrayElement([{}, undefined]),
|
|
33
|
-
})),
|
|
34
|
-
undefined,
|
|
35
|
-
]),
|
|
36
|
-
lastUpdated: `${faker_1.faker.date.past().toISOString().split(".")[0]}Z`,
|
|
37
|
-
metadata: faker_1.faker.helpers.arrayElement([{}, undefined]),
|
|
38
|
-
})),
|
|
39
|
-
pagination: {
|
|
40
|
-
limit: faker_1.faker.helpers.arrayElement([
|
|
41
|
-
faker_1.faker.number.int({ min: undefined, max: undefined }),
|
|
42
|
-
undefined,
|
|
43
|
-
]),
|
|
44
|
-
offset: faker_1.faker.helpers.arrayElement([
|
|
45
|
-
faker_1.faker.number.int({ min: undefined, max: undefined }),
|
|
46
|
-
undefined,
|
|
47
|
-
]),
|
|
48
|
-
total: faker_1.faker.helpers.arrayElement([
|
|
49
|
-
faker_1.faker.number.int({ min: undefined, max: undefined }),
|
|
50
|
-
undefined,
|
|
51
|
-
]),
|
|
52
|
-
},
|
|
53
|
-
...overrideResponse,
|
|
54
|
-
});
|
|
55
|
-
exports.getListX402DiscoveryResourcesResponseMock = getListX402DiscoveryResourcesResponseMock;
|
|
56
|
-
const getListX402DiscoveryResourcesMockHandler = (overrideResponse) => {
|
|
57
|
-
return msw_1.http.get("*/v2/x402/discovery/resources", async (info) => {
|
|
58
|
-
await (0, msw_1.delay)(0);
|
|
59
|
-
return new msw_1.HttpResponse(JSON.stringify(overrideResponse !== undefined
|
|
60
|
-
? typeof overrideResponse === "function"
|
|
61
|
-
? await overrideResponse(info)
|
|
62
|
-
: overrideResponse
|
|
63
|
-
: (0, exports.getListX402DiscoveryResourcesResponseMock)()), { status: 200, headers: { "Content-Type": "application/json" } });
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
exports.getListX402DiscoveryResourcesMockHandler = getListX402DiscoveryResourcesMockHandler;
|
|
67
|
-
const getX402FacilitatorMock = () => [(0, exports.getListX402DiscoveryResourcesMockHandler)()];
|
|
68
|
-
exports.getX402FacilitatorMock = getX402FacilitatorMock;
|
|
69
|
-
//# sourceMappingURL=x402-facilitator.msw.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x402-facilitator.msw.js","sourceRoot":"","sources":["../../../../openapi-client/generated/x402-facilitator/x402-facilitator.msw.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,2CAAwC;AAExC,6BAAgD;AAEhD,0GAA0E;AAGnE,MAAM,yCAAyC,GAAG,CACvD,mBAA4D,EAAE,EAC9B,EAAE,CAAC,CAAC;IACpC,WAAW,EAAE,aAAK,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,sDAAW,CAAC,CAAC;IACnE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,aAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;QAC/F,QAAQ,EAAE,aAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,IAAI,EAAE,aAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,MAAM,CAAU,CAAC;QACnD,WAAW,EAAE,aAAK,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,sDAAW,CAAC,CAAC;QACnE,OAAO,EAAE,aAAK,CAAC,OAAO,CAAC,YAAY,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,aAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC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IAAA,gDAAwC,GAAE,CAAC,CAAC;AAA5E,QAAA,sBAAsB,0BAAsD"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { cdpApiClient } from "../../cdpApiClient.js";
|
|
2
|
-
/**
|
|
3
|
-
* Lists all active discovered x402 resources.
|
|
4
|
-
This endpoint returns resources that have been discovered and cached by the x402 facilitator, including their payment requirements and metadata.
|
|
5
|
-
The response is paginated, and by default, returns 100 items per page.
|
|
6
|
-
* @summary List discovered x402 resources
|
|
7
|
-
*/
|
|
8
|
-
export const listX402DiscoveryResources = (params, options) => {
|
|
9
|
-
return cdpApiClient({ url: `/v2/x402/discovery/resources`, method: "GET", params }, options);
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=x402-facilitator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x402-facilitator.js","sourceRoot":"","sources":["../../../../openapi-client/generated/x402-facilitator/x402-facilitator.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIrD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,MAAyC,EACzC,OAA8C,EAC9C,EAAE;IACF,OAAO,YAAY,CACjB,EAAE,GAAG,EAAE,8BAA8B,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAC9D,OAAO,CACR,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
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
|
-
import { HttpResponse, delay, http } from "msw";
|
|
10
|
-
import { X402Version } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
11
|
-
export const getListX402DiscoveryResourcesResponseMock = (overrideResponse = {}) => ({
|
|
12
|
-
x402Version: faker.helpers.arrayElement(Object.values(X402Version)),
|
|
13
|
-
items: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
14
|
-
resource: faker.string.alpha(20),
|
|
15
|
-
type: faker.helpers.arrayElement(["http"]),
|
|
16
|
-
x402Version: faker.helpers.arrayElement(Object.values(X402Version)),
|
|
17
|
-
accepts: faker.helpers.arrayElement([
|
|
18
|
-
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
19
|
-
scheme: faker.helpers.arrayElement(["exact"]),
|
|
20
|
-
network: faker.helpers.arrayElement(["base-sepolia", "base"]),
|
|
21
|
-
maxAmountRequired: faker.string.alpha(20),
|
|
22
|
-
resource: faker.string.alpha(20),
|
|
23
|
-
description: faker.string.alpha(20),
|
|
24
|
-
mimeType: faker.string.alpha(20),
|
|
25
|
-
outputSchema: faker.helpers.arrayElement([{}, undefined]),
|
|
26
|
-
payTo: faker.helpers.fromRegExp("^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
27
|
-
maxTimeoutSeconds: faker.number.int({ min: undefined, max: undefined }),
|
|
28
|
-
asset: faker.helpers.fromRegExp("^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
29
|
-
extra: faker.helpers.arrayElement([{}, undefined]),
|
|
30
|
-
})),
|
|
31
|
-
undefined,
|
|
32
|
-
]),
|
|
33
|
-
lastUpdated: `${faker.date.past().toISOString().split(".")[0]}Z`,
|
|
34
|
-
metadata: faker.helpers.arrayElement([{}, undefined]),
|
|
35
|
-
})),
|
|
36
|
-
pagination: {
|
|
37
|
-
limit: faker.helpers.arrayElement([
|
|
38
|
-
faker.number.int({ min: undefined, max: undefined }),
|
|
39
|
-
undefined,
|
|
40
|
-
]),
|
|
41
|
-
offset: faker.helpers.arrayElement([
|
|
42
|
-
faker.number.int({ min: undefined, max: undefined }),
|
|
43
|
-
undefined,
|
|
44
|
-
]),
|
|
45
|
-
total: faker.helpers.arrayElement([
|
|
46
|
-
faker.number.int({ min: undefined, max: undefined }),
|
|
47
|
-
undefined,
|
|
48
|
-
]),
|
|
49
|
-
},
|
|
50
|
-
...overrideResponse,
|
|
51
|
-
});
|
|
52
|
-
export const getListX402DiscoveryResourcesMockHandler = (overrideResponse) => {
|
|
53
|
-
return http.get("*/v2/x402/discovery/resources", async (info) => {
|
|
54
|
-
await delay(0);
|
|
55
|
-
return new HttpResponse(JSON.stringify(overrideResponse !== undefined
|
|
56
|
-
? typeof overrideResponse === "function"
|
|
57
|
-
? await overrideResponse(info)
|
|
58
|
-
: overrideResponse
|
|
59
|
-
: getListX402DiscoveryResourcesResponseMock()), { status: 200, headers: { "Content-Type": "application/json" } });
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
export const getX402FacilitatorMock = () => [getListX402DiscoveryResourcesMockHandler()];
|
|
63
|
-
//# sourceMappingURL=x402-facilitator.msw.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x402-facilitator.msw.js","sourceRoot":"","sources":["../../../../openapi-client/generated/x402-facilitator/x402-facilitator.msw.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;AAG1E,MAAM,CAAC,MAAM,yCAAyC,GAAG,CACvD,mBAA4D,EAAE,EAC9B,EAAE,CAAC,CAAC;IACpC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC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GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YACpD,SAAS;SACV,CAAC;KACH;IACD,GAAG,gBAAgB;CACpB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wCAAwC,GAAG,CACtD,gBAIkF,EAClF,EAAE;IACF,OAAO,IAAI,CAAC,GAAG,CAAC,+BAA+B,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;QAC5D,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;QAEf,OAAO,IAAI,YAAY,CACrB,IAAI,CAAC,SAAS,CACZ,gBAAgB,KAAK,SAAS;YAC5B,CAAC,CAAC,OAAO,gBAAgB,KAAK,UAAU;gBACtC,CAAC,CAAC,MAAM,gBAAgB,CAAC,IAAI,CAAC;gBAC9B,CAAC,CAAC,gBAAgB;YACpB,CAAC,CAAC,yCAAyC,EAAE,CAChD,EACD,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,EAAE,CACjE,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,EAAE,CAAC,CAAC,wCAAwC,EAAE,CAAC,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
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 { ListX402DiscoveryResourcesParams, X402DiscoveryResourcesResponse } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
9
|
-
import { cdpApiClient } from "../../cdpApiClient.js";
|
|
10
|
-
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
11
|
-
/**
|
|
12
|
-
* Lists all active discovered x402 resources.
|
|
13
|
-
This endpoint returns resources that have been discovered and cached by the x402 facilitator, including their payment requirements and metadata.
|
|
14
|
-
The response is paginated, and by default, returns 100 items per page.
|
|
15
|
-
* @summary List discovered x402 resources
|
|
16
|
-
*/
|
|
17
|
-
export declare const listX402DiscoveryResources: (params?: ListX402DiscoveryResourcesParams, options?: SecondParameter<typeof cdpApiClient>) => Promise<X402DiscoveryResourcesResponse>;
|
|
18
|
-
export type ListX402DiscoveryResourcesResult = NonNullable<Awaited<ReturnType<typeof listX402DiscoveryResources>>>;
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=x402-facilitator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x402-facilitator.d.ts","sourceRoot":"","sources":["../../../../openapi-client/generated/x402-facilitator/x402-facilitator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EACV,gCAAgC,EAChC,8BAA8B,EAC/B,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,KAAK,eAAe,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GACrC,SAAS,gCAAgC,EACzC,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,4CAM/C,CAAC;AACF,MAAM,MAAM,gCAAgC,GAAG,WAAW,CACxD,OAAO,CAAC,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC,CACvD,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { http } from "msw";
|
|
2
|
-
import type { X402DiscoveryResourcesResponse } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
3
|
-
export declare const getListX402DiscoveryResourcesResponseMock: (overrideResponse?: Partial<X402DiscoveryResourcesResponse>) => X402DiscoveryResourcesResponse;
|
|
4
|
-
export declare const getListX402DiscoveryResourcesMockHandler: (overrideResponse?: X402DiscoveryResourcesResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<X402DiscoveryResourcesResponse> | X402DiscoveryResourcesResponse)) => import("msw").HttpHandler;
|
|
5
|
-
export declare const getX402FacilitatorMock: () => import("msw").HttpHandler[];
|
|
6
|
-
//# sourceMappingURL=x402-facilitator.msw.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x402-facilitator.msw.d.ts","sourceRoot":"","sources":["../../../../openapi-client/generated/x402-facilitator/x402-facilitator.msw.ts"],"names":[],"mappings":"AASA,OAAO,EAAuB,IAAI,EAAE,MAAM,KAAK,CAAC;AAGhD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAElG,eAAO,MAAM,yCAAyC,GACpD,mBAAkB,OAAO,CAAC,8BAA8B,CAAM,KAC7D,8BA4CD,CAAC;AAEH,eAAO,MAAM,wCAAwC,GACnD,mBACI,8BAA8B,GAC9B,CAAC,CACC,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAChD,OAAO,CAAC,8BAA8B,CAAC,GAAG,8BAA8B,CAAC,8BAgBnF,CAAC;AACF,eAAO,MAAM,sBAAsB,mCAAqD,CAAC"}
|
|
@@ -1,85 +0,0 @@
|
|
|
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 { X402Version } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
13
|
-
import type { X402DiscoveryResourcesResponse } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
14
|
-
|
|
15
|
-
export const getListX402DiscoveryResourcesResponseMock = (
|
|
16
|
-
overrideResponse: Partial<X402DiscoveryResourcesResponse> = {},
|
|
17
|
-
): X402DiscoveryResourcesResponse => ({
|
|
18
|
-
x402Version: faker.helpers.arrayElement(Object.values(X402Version)),
|
|
19
|
-
items: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
20
|
-
resource: faker.string.alpha(20),
|
|
21
|
-
type: faker.helpers.arrayElement(["http"] as const),
|
|
22
|
-
x402Version: faker.helpers.arrayElement(Object.values(X402Version)),
|
|
23
|
-
accepts: faker.helpers.arrayElement([
|
|
24
|
-
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
25
|
-
scheme: faker.helpers.arrayElement(["exact"] as const),
|
|
26
|
-
network: faker.helpers.arrayElement(["base-sepolia", "base"] as const),
|
|
27
|
-
maxAmountRequired: faker.string.alpha(20),
|
|
28
|
-
resource: faker.string.alpha(20),
|
|
29
|
-
description: faker.string.alpha(20),
|
|
30
|
-
mimeType: faker.string.alpha(20),
|
|
31
|
-
outputSchema: faker.helpers.arrayElement([{}, undefined]),
|
|
32
|
-
payTo: faker.helpers.fromRegExp(
|
|
33
|
-
"^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$",
|
|
34
|
-
),
|
|
35
|
-
maxTimeoutSeconds: faker.number.int({ min: undefined, max: undefined }),
|
|
36
|
-
asset: faker.helpers.fromRegExp(
|
|
37
|
-
"^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$",
|
|
38
|
-
),
|
|
39
|
-
extra: faker.helpers.arrayElement([{}, undefined]),
|
|
40
|
-
})),
|
|
41
|
-
undefined,
|
|
42
|
-
]),
|
|
43
|
-
lastUpdated: `${faker.date.past().toISOString().split(".")[0]}Z`,
|
|
44
|
-
metadata: faker.helpers.arrayElement([{}, undefined]),
|
|
45
|
-
})),
|
|
46
|
-
pagination: {
|
|
47
|
-
limit: faker.helpers.arrayElement([
|
|
48
|
-
faker.number.int({ min: undefined, max: undefined }),
|
|
49
|
-
undefined,
|
|
50
|
-
]),
|
|
51
|
-
offset: faker.helpers.arrayElement([
|
|
52
|
-
faker.number.int({ min: undefined, max: undefined }),
|
|
53
|
-
undefined,
|
|
54
|
-
]),
|
|
55
|
-
total: faker.helpers.arrayElement([
|
|
56
|
-
faker.number.int({ min: undefined, max: undefined }),
|
|
57
|
-
undefined,
|
|
58
|
-
]),
|
|
59
|
-
},
|
|
60
|
-
...overrideResponse,
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
export const getListX402DiscoveryResourcesMockHandler = (
|
|
64
|
-
overrideResponse?:
|
|
65
|
-
| X402DiscoveryResourcesResponse
|
|
66
|
-
| ((
|
|
67
|
-
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
|
68
|
-
) => Promise<X402DiscoveryResourcesResponse> | X402DiscoveryResourcesResponse),
|
|
69
|
-
) => {
|
|
70
|
-
return http.get("*/v2/x402/discovery/resources", async info => {
|
|
71
|
-
await delay(0);
|
|
72
|
-
|
|
73
|
-
return new HttpResponse(
|
|
74
|
-
JSON.stringify(
|
|
75
|
-
overrideResponse !== undefined
|
|
76
|
-
? typeof overrideResponse === "function"
|
|
77
|
-
? await overrideResponse(info)
|
|
78
|
-
: overrideResponse
|
|
79
|
-
: getListX402DiscoveryResourcesResponseMock(),
|
|
80
|
-
),
|
|
81
|
-
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
82
|
-
);
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
export const getX402FacilitatorMock = () => [getListX402DiscoveryResourcesMockHandler()];
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
ListX402DiscoveryResourcesParams,
|
|
10
|
-
X402DiscoveryResourcesResponse,
|
|
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
|
-
* Lists all active discovered x402 resources.
|
|
19
|
-
This endpoint returns resources that have been discovered and cached by the x402 facilitator, including their payment requirements and metadata.
|
|
20
|
-
The response is paginated, and by default, returns 100 items per page.
|
|
21
|
-
* @summary List discovered x402 resources
|
|
22
|
-
*/
|
|
23
|
-
export const listX402DiscoveryResources = (
|
|
24
|
-
params?: ListX402DiscoveryResourcesParams,
|
|
25
|
-
options?: SecondParameter<typeof cdpApiClient>,
|
|
26
|
-
) => {
|
|
27
|
-
return cdpApiClient<X402DiscoveryResourcesResponse>(
|
|
28
|
-
{ url: `/v2/x402/discovery/resources`, method: "GET", params },
|
|
29
|
-
options,
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
export type ListX402DiscoveryResourcesResult = NonNullable<
|
|
33
|
-
Awaited<ReturnType<typeof listX402DiscoveryResources>>
|
|
34
|
-
>;
|