@coinbase/cdp-sdk 1.38.6 → 1.40.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 +12 -0
- package/README.md +17 -0
- package/_cjs/actions/evm/sendUserOperation.js +1 -0
- package/_cjs/actions/evm/sendUserOperation.js.map +1 -1
- package/_cjs/auth/utils/http.js +2 -1
- package/_cjs/auth/utils/http.js.map +1 -1
- package/_cjs/client/end-user/endUser.js +39 -0
- package/_cjs/client/end-user/endUser.js.map +1 -1
- package/_cjs/client/evm/evm.js +2 -0
- package/_cjs/client/evm/evm.js.map +1 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +19 -2
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/end-user-accounts/end-user-accounts.js +25 -1
- package/_cjs/openapi-client/generated/end-user-accounts/end-user-accounts.js.map +1 -1
- package/_cjs/openapi-client/generated/onramp/onramp.js +1 -1
- package/_cjs/openapi-client/generated/sql-api-alpha/sql-api-alpha.js +1 -2
- package/_cjs/openapi-client/generated/sql-api-alpha/sql-api-alpha.js.map +1 -1
- package/_cjs/openapi-client/generated/webhooks/webhooks.js +130 -0
- package/_cjs/openapi-client/generated/webhooks/webhooks.js.map +1 -0
- package/_cjs/openapi-client/index.js +2 -0
- package/_cjs/openapi-client/index.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/actions/evm/sendUserOperation.js +1 -0
- package/_esm/actions/evm/sendUserOperation.js.map +1 -1
- package/_esm/auth/utils/http.js +2 -1
- package/_esm/auth/utils/http.js.map +1 -1
- package/_esm/client/end-user/endUser.js +39 -0
- package/_esm/client/end-user/endUser.js.map +1 -1
- package/_esm/client/evm/evm.js +2 -0
- package/_esm/client/evm/evm.js.map +1 -1
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +17 -0
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/end-user-accounts/end-user-accounts.js +22 -0
- package/_esm/openapi-client/generated/end-user-accounts/end-user-accounts.js.map +1 -1
- package/_esm/openapi-client/generated/onramp/onramp.js +1 -1
- package/_esm/openapi-client/generated/sql-api-alpha/sql-api-alpha.js +1 -2
- package/_esm/openapi-client/generated/sql-api-alpha/sql-api-alpha.js.map +1 -1
- package/_esm/openapi-client/generated/webhooks/webhooks.js +122 -0
- package/_esm/openapi-client/generated/webhooks/webhooks.js.map +1 -0
- package/_esm/openapi-client/index.js +2 -0
- package/_esm/openapi-client/index.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/actions/evm/sendUserOperation.d.ts +2 -0
- package/_types/actions/evm/sendUserOperation.d.ts.map +1 -1
- package/_types/auth/utils/http.d.ts.map +1 -1
- package/_types/client/end-user/endUser.d.ts +30 -1
- package/_types/client/end-user/endUser.d.ts.map +1 -1
- package/_types/client/end-user/endUser.types.d.ts +5 -1
- package/_types/client/end-user/endUser.types.d.ts.map +1 -1
- package/_types/client/evm/evm.d.ts.map +1 -1
- package/_types/client/evm/evm.types.d.ts +2 -0
- package/_types/client/evm/evm.types.d.ts.map +1 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +386 -41
- 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 +16 -1
- 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 +1 -1
- package/_types/openapi-client/generated/sql-api-alpha/sql-api-alpha.d.ts +1 -2
- package/_types/openapi-client/generated/sql-api-alpha/sql-api-alpha.d.ts.map +1 -1
- package/_types/openapi-client/generated/webhooks/webhooks.d.ts +117 -0
- package/_types/openapi-client/generated/webhooks/webhooks.d.ts.map +1 -0
- package/_types/openapi-client/index.d.ts +7 -0
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/actions/evm/sendUserOperation.ts +3 -0
- package/auth/utils/http.ts +2 -1
- package/client/end-user/endUser.ts +48 -1
- package/client/end-user/endUser.types.ts +6 -1
- package/client/evm/evm.ts +2 -0
- package/client/evm/evm.types.ts +2 -0
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +407 -41
- package/openapi-client/generated/end-user-accounts/end-user-accounts.ts +31 -0
- package/openapi-client/generated/onramp/onramp.ts +1 -1
- package/openapi-client/generated/sql-api-alpha/sql-api-alpha.ts +1 -2
- package/openapi-client/generated/webhooks/webhooks.ts +185 -0
- package/openapi-client/index.ts +2 -0
- package/package.json +1 -1
- package/version.ts +1 -1
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* OpenAPI spec version: 2.0.0
|
|
7
7
|
*/
|
|
8
8
|
import type {
|
|
9
|
+
CreateEndUserBody,
|
|
9
10
|
EndUser,
|
|
10
11
|
ListEndUsers200,
|
|
11
12
|
ListEndUsersParams,
|
|
@@ -16,6 +17,25 @@ import { cdpApiClient } from "../../cdpApiClient.js";
|
|
|
16
17
|
|
|
17
18
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
18
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Creates an end user. An end user is an entity that can own CDP EVM accounts, EVM smart accounts, and/or Solana accounts. 1 or more authentication methods must be associated with an end user. By default, no accounts are created unless the optional `evmAccount` and/or `solanaAccount` fields are provided.
|
|
22
|
+
This API is intended to be used by the developer's own backend, and is authenticated using the developer's CDP API key.
|
|
23
|
+
* @summary Create an end user
|
|
24
|
+
*/
|
|
25
|
+
export const createEndUser = (
|
|
26
|
+
createEndUserBody: CreateEndUserBody,
|
|
27
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
28
|
+
) => {
|
|
29
|
+
return cdpApiClient<EndUser>(
|
|
30
|
+
{
|
|
31
|
+
url: `/v2/end-users`,
|
|
32
|
+
method: "POST",
|
|
33
|
+
headers: { "Content-Type": "application/json" },
|
|
34
|
+
data: createEndUserBody,
|
|
35
|
+
},
|
|
36
|
+
options,
|
|
37
|
+
);
|
|
38
|
+
};
|
|
19
39
|
/**
|
|
20
40
|
* Lists the end users belonging to the developer's CDP Project.
|
|
21
41
|
By default, the response is sorted by creation date in ascending order and paginated to 20 users per page.
|
|
@@ -47,7 +67,18 @@ export const validateEndUserAccessToken = (
|
|
|
47
67
|
options,
|
|
48
68
|
);
|
|
49
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* Gets an end user by ID.
|
|
72
|
+
|
|
73
|
+
This API is intended to be used by the developer's own backend, and is authenticated using the developer's CDP API key.
|
|
74
|
+
* @summary Get an end user
|
|
75
|
+
*/
|
|
76
|
+
export const getEndUser = (userId: string, options?: SecondParameter<typeof cdpApiClient>) => {
|
|
77
|
+
return cdpApiClient<EndUser>({ url: `/v2/end-users/${userId}`, method: "GET" }, options);
|
|
78
|
+
};
|
|
79
|
+
export type CreateEndUserResult = NonNullable<Awaited<ReturnType<typeof createEndUser>>>;
|
|
50
80
|
export type ListEndUsersResult = NonNullable<Awaited<ReturnType<typeof listEndUsers>>>;
|
|
51
81
|
export type ValidateEndUserAccessTokenResult = NonNullable<
|
|
52
82
|
Awaited<ReturnType<typeof validateEndUserAccessToken>>
|
|
53
83
|
>;
|
|
84
|
+
export type GetEndUserResult = NonNullable<Awaited<ReturnType<typeof getEndUser>>>;
|
|
@@ -20,7 +20,7 @@ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
|
20
20
|
/**
|
|
21
21
|
* Create a new Onramp order or get a quote for an Onramp order. Either `paymentAmount` or `purchaseAmount` must be provided.
|
|
22
22
|
|
|
23
|
-
This API currently only supports the payment method `GUEST_CHECKOUT_APPLE_PAY
|
|
23
|
+
This API currently only supports the payment method `GUEST_CHECKOUT_APPLE_PAY`.
|
|
24
24
|
|
|
25
25
|
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).
|
|
26
26
|
* @summary Create an onramp order
|
|
@@ -37,9 +37,8 @@ Queries are executed against optimized data structures for high-performance anal
|
|
|
37
37
|
|
|
38
38
|
### Query Limits
|
|
39
39
|
|
|
40
|
-
- Maximum result set:
|
|
40
|
+
- Maximum result set: 100,000 rows
|
|
41
41
|
- Query timeout: 30 seconds
|
|
42
|
-
- Maximum JOINs: 5
|
|
43
42
|
|
|
44
43
|
* @summary Run SQL Query
|
|
45
44
|
*/
|
|
@@ -0,0 +1,185 @@
|
|
|
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
|
+
ListWebhookSubscriptionsParams,
|
|
10
|
+
WebhookSubscriptionListResponse,
|
|
11
|
+
WebhookSubscriptionRequest,
|
|
12
|
+
WebhookSubscriptionResponse,
|
|
13
|
+
WebhookSubscriptionUpdateRequest,
|
|
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
|
+
* Retrieve a paginated list of webhook subscriptions for the authenticated project.
|
|
22
|
+
Returns subscriptions for all CDP product events (onchain, onramp/offramp, wallet, etc.)
|
|
23
|
+
in descending order by creation time.
|
|
24
|
+
|
|
25
|
+
### Use Cases
|
|
26
|
+
- Monitor all active webhook subscriptions across CDP products
|
|
27
|
+
- Audit webhook configurations
|
|
28
|
+
- Manage subscription lifecycle
|
|
29
|
+
|
|
30
|
+
* @summary List webhook subscriptions
|
|
31
|
+
*/
|
|
32
|
+
export const listWebhookSubscriptions = (
|
|
33
|
+
params?: ListWebhookSubscriptionsParams,
|
|
34
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
35
|
+
) => {
|
|
36
|
+
return cdpApiClient<WebhookSubscriptionListResponse>(
|
|
37
|
+
{ url: `/v2/data/webhooks/subscriptions`, method: "GET", params },
|
|
38
|
+
options,
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Subscribe to real-time events across CDP products using flexible filtering.
|
|
43
|
+
|
|
44
|
+
### Event Types
|
|
45
|
+
|
|
46
|
+
**Onchain Events** - Monitor Base mainnet with microsecond precision:
|
|
47
|
+
- `onchain.activity.detected` - Smart contract events, transfers, swaps, NFT activity
|
|
48
|
+
- **Requires** `labels` for filtering (e.g., `contract_address`, `event_name`)
|
|
49
|
+
|
|
50
|
+
**Onramp/Offramp Events** - Transaction lifecycle notifications:
|
|
51
|
+
- `onramp.transaction.created`, `onramp.transaction.updated`
|
|
52
|
+
- `onramp.transaction.success`, `onramp.transaction.failed`
|
|
53
|
+
- `offramp.transaction.created`, `offramp.transaction.updated`
|
|
54
|
+
- `offramp.transaction.success`, `offramp.transaction.failed`
|
|
55
|
+
- **No labels required** - maximum simplicity for transaction monitoring
|
|
56
|
+
|
|
57
|
+
**Wallet Events** - Wallet activity notifications:
|
|
58
|
+
- `wallet.activity.detected`
|
|
59
|
+
|
|
60
|
+
### Webhook Signature Verification
|
|
61
|
+
All webhooks include cryptographic signatures for security.
|
|
62
|
+
The signature secret is returned in `metadata.secret` when creating a subscription.
|
|
63
|
+
|
|
64
|
+
**Note:** Webhooks are in beta and this interface is subject to change.
|
|
65
|
+
|
|
66
|
+
See the [verification guide](https://docs.cdp.coinbase.com/onramp-&-offramp/webhooks#webhook-signature-verification) for implementation details.
|
|
67
|
+
|
|
68
|
+
### Onchain Label Filtering
|
|
69
|
+
|
|
70
|
+
For `onchain.activity.detected` events, use `labels` for precise filtering with AND logic (max 20 labels per webhook).
|
|
71
|
+
|
|
72
|
+
**Allowed labels** (all in snake_case format):
|
|
73
|
+
- `network` (required) - Blockchain network
|
|
74
|
+
- `contract_address` - Smart contract address
|
|
75
|
+
- `event_name` - Event name (e.g., "Transfer", "Burn")
|
|
76
|
+
- `event_signature` - Event signature hash
|
|
77
|
+
- `transaction_from` - Transaction sender address
|
|
78
|
+
- `transaction_to` - Transaction recipient address
|
|
79
|
+
- `params.*` - Any event parameter (e.g., `params.from`, `params.to`, `params.sender`, `params.tokenId`)
|
|
80
|
+
|
|
81
|
+
**Examples**:
|
|
82
|
+
- **Liquidity Pool Monitor**: `{"network": "base-mainnet", "contract_address": "0xcd1f9777571493aeacb7eae45cd30a226d3e612d", "event_name": "Burn"}`
|
|
83
|
+
- **Price Oracle Tracker**: `{"network": "base-mainnet", "contract_address": "0xbac4a9428ea707c51f171ed9890c3c2fa810305d", "event_name": "PriceUpdated"}`
|
|
84
|
+
- **DeFi Protocol Activity**: `{"network": "base-mainnet", "contract_address": "0x45c6e6a47a711b14d8357d5243f46704904578e3", "event_name": "Deposit"}`
|
|
85
|
+
|
|
86
|
+
* @summary Create webhook subscription
|
|
87
|
+
*/
|
|
88
|
+
export const createWebhookSubscription = (
|
|
89
|
+
webhookSubscriptionRequest: WebhookSubscriptionRequest,
|
|
90
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
91
|
+
) => {
|
|
92
|
+
return cdpApiClient<WebhookSubscriptionResponse>(
|
|
93
|
+
{
|
|
94
|
+
url: `/v2/data/webhooks/subscriptions`,
|
|
95
|
+
method: "POST",
|
|
96
|
+
headers: { "Content-Type": "application/json" },
|
|
97
|
+
data: webhookSubscriptionRequest,
|
|
98
|
+
},
|
|
99
|
+
options,
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Retrieve detailed information about a specific webhook subscription including
|
|
104
|
+
configuration, status, creation timestamp, and webhook signature secret.
|
|
105
|
+
|
|
106
|
+
### Response Includes
|
|
107
|
+
- Subscription configuration and filters
|
|
108
|
+
- Target URL and custom headers
|
|
109
|
+
- Webhook signature secret for verification
|
|
110
|
+
- Creation timestamp and status
|
|
111
|
+
|
|
112
|
+
* @summary Get webhook subscription details
|
|
113
|
+
*/
|
|
114
|
+
export const getWebhookSubscription = (
|
|
115
|
+
subscriptionId: string,
|
|
116
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
117
|
+
) => {
|
|
118
|
+
return cdpApiClient<WebhookSubscriptionResponse>(
|
|
119
|
+
{ url: `/v2/data/webhooks/subscriptions/${subscriptionId}`, method: "GET" },
|
|
120
|
+
options,
|
|
121
|
+
);
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Update an existing webhook subscription's configuration including
|
|
125
|
+
event types, target URL, filtering criteria, and enabled status.
|
|
126
|
+
All required fields must be provided, even if they are not being changed.
|
|
127
|
+
|
|
128
|
+
### Common Updates
|
|
129
|
+
- Change target URL or headers
|
|
130
|
+
- Add/remove event type filters
|
|
131
|
+
- Update multi-label filtering criteria
|
|
132
|
+
- Enable/disable subscription
|
|
133
|
+
|
|
134
|
+
* @summary Update webhook subscription
|
|
135
|
+
*/
|
|
136
|
+
export const updateWebhookSubscription = (
|
|
137
|
+
subscriptionId: string,
|
|
138
|
+
webhookSubscriptionUpdateRequest: WebhookSubscriptionUpdateRequest,
|
|
139
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
140
|
+
) => {
|
|
141
|
+
return cdpApiClient<WebhookSubscriptionResponse>(
|
|
142
|
+
{
|
|
143
|
+
url: `/v2/data/webhooks/subscriptions/${subscriptionId}`,
|
|
144
|
+
method: "PUT",
|
|
145
|
+
headers: { "Content-Type": "application/json" },
|
|
146
|
+
data: webhookSubscriptionUpdateRequest,
|
|
147
|
+
},
|
|
148
|
+
options,
|
|
149
|
+
);
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Permanently delete a webhook subscription and stop all event deliveries.
|
|
153
|
+
This action cannot be undone.
|
|
154
|
+
|
|
155
|
+
### Important Notes
|
|
156
|
+
- All webhook deliveries will cease immediately
|
|
157
|
+
- Subscription cannot be recovered after deletion
|
|
158
|
+
- Consider disabling instead of deleting for temporary pauses
|
|
159
|
+
|
|
160
|
+
* @summary Delete webhook subscription
|
|
161
|
+
*/
|
|
162
|
+
export const deleteWebhookSubscription = (
|
|
163
|
+
subscriptionId: string,
|
|
164
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
165
|
+
) => {
|
|
166
|
+
return cdpApiClient<void>(
|
|
167
|
+
{ url: `/v2/data/webhooks/subscriptions/${subscriptionId}`, method: "DELETE" },
|
|
168
|
+
options,
|
|
169
|
+
);
|
|
170
|
+
};
|
|
171
|
+
export type ListWebhookSubscriptionsResult = NonNullable<
|
|
172
|
+
Awaited<ReturnType<typeof listWebhookSubscriptions>>
|
|
173
|
+
>;
|
|
174
|
+
export type CreateWebhookSubscriptionResult = NonNullable<
|
|
175
|
+
Awaited<ReturnType<typeof createWebhookSubscription>>
|
|
176
|
+
>;
|
|
177
|
+
export type GetWebhookSubscriptionResult = NonNullable<
|
|
178
|
+
Awaited<ReturnType<typeof getWebhookSubscription>>
|
|
179
|
+
>;
|
|
180
|
+
export type UpdateWebhookSubscriptionResult = NonNullable<
|
|
181
|
+
Awaited<ReturnType<typeof updateWebhookSubscription>>
|
|
182
|
+
>;
|
|
183
|
+
export type DeleteWebhookSubscriptionResult = NonNullable<
|
|
184
|
+
Awaited<ReturnType<typeof deleteWebhookSubscription>>
|
|
185
|
+
>;
|
package/openapi-client/index.ts
CHANGED
|
@@ -24,12 +24,14 @@ import * as onchainData from "./generated/onchain-data/onchain-data.js";
|
|
|
24
24
|
import * as policies from "./generated/policy-engine/policy-engine.js";
|
|
25
25
|
import * as solana from "./generated/solana-accounts/solana-accounts.js";
|
|
26
26
|
import * as solanaTokenBalances from "./generated/solana-token-balances/solana-token-balances.js";
|
|
27
|
+
import * as webhooks from "./generated/webhooks/webhooks.js";
|
|
27
28
|
|
|
28
29
|
export const CdpOpenApiClient = {
|
|
29
30
|
...evm,
|
|
30
31
|
...evmSmartAccounts,
|
|
31
32
|
...evmSwaps,
|
|
32
33
|
...evmTokenBalances,
|
|
34
|
+
...webhooks,
|
|
33
35
|
...solana,
|
|
34
36
|
...solanaTokenBalances,
|
|
35
37
|
...faucets,
|
package/package.json
CHANGED
package/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "1.
|
|
1
|
+
export const version = "1.40.0";
|