@coinbase/cdp-sdk 1.47.0 → 1.48.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 +8 -0
- package/README.md +282 -0
- package/_cjs/client/cdp.js +1 -4
- package/_cjs/client/cdp.js.map +1 -1
- package/_cjs/client/end-user/endUser.js +19 -89
- package/_cjs/client/end-user/endUser.js.map +1 -1
- package/_cjs/client/end-user/toEndUserAccount.js +13 -43
- package/_cjs/client/end-user/toEndUserAccount.js.map +1 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/openapi-client/cdpApiClient.js +0 -32
- package/_cjs/openapi-client/cdpApiClient.js.map +1 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +54 -10
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/{embedded-wallets-core-functionality/embedded-wallets-core-functionality.js → embedded-wallets/embedded-wallets.js} +37 -97
- package/_cjs/openapi-client/generated/embedded-wallets/embedded-wallets.js.map +1 -0
- package/_cjs/openapi-client/generated/webhooks/webhooks.js +6 -6
- package/_cjs/openapi-client/index.js +2 -2
- package/_cjs/openapi-client/index.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/client/cdp.js +2 -5
- package/_esm/client/cdp.js.map +1 -1
- package/_esm/client/end-user/endUser.js +17 -87
- package/_esm/client/end-user/endUser.js.map +1 -1
- package/_esm/client/end-user/toEndUserAccount.js +13 -43
- package/_esm/client/end-user/toEndUserAccount.js.map +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/openapi-client/cdpApiClient.js +0 -32
- package/_esm/openapi-client/cdpApiClient.js.map +1 -1
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +52 -8
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/{embedded-wallets-core-functionality/embedded-wallets-core-functionality.js → embedded-wallets/embedded-wallets.js} +36 -93
- package/_esm/openapi-client/generated/embedded-wallets/embedded-wallets.js.map +1 -0
- package/_esm/openapi-client/generated/webhooks/webhooks.js +6 -6
- package/_esm/openapi-client/index.js +2 -2
- package/_esm/openapi-client/index.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/client/cdp.d.ts +2 -6
- package/_types/client/cdp.d.ts.map +1 -1
- package/_types/client/end-user/endUser.d.ts +2 -52
- package/_types/client/end-user/endUser.d.ts.map +1 -1
- package/_types/client/end-user/endUser.types.d.ts +1 -63
- package/_types/client/end-user/endUser.types.d.ts.map +1 -1
- package/_types/client/end-user/toEndUserAccount.d.ts +0 -2
- package/_types/client/end-user/toEndUserAccount.d.ts.map +1 -1
- package/_types/index.d.ts +1 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/openapi-client/cdpApiClient.d.ts.map +1 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +476 -79
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/embedded-wallets/embedded-wallets.d.ts +145 -0
- package/_types/openapi-client/generated/embedded-wallets/embedded-wallets.d.ts.map +1 -0
- package/_types/openapi-client/generated/webhooks/webhooks.d.ts +6 -6
- package/_types/openapi-client/index.d.ts +13 -45
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/client/cdp.ts +3 -8
- package/client/end-user/endUser.ts +55 -187
- package/client/end-user/endUser.types.ts +0 -72
- package/client/end-user/toEndUserAccount.ts +57 -152
- package/index.ts +0 -4
- package/openapi-client/cdpApiClient.ts +0 -34
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +535 -85
- package/openapi-client/generated/{embedded-wallets-core-functionality/embedded-wallets-core-functionality.ts → embedded-wallets/embedded-wallets.ts} +67 -249
- package/openapi-client/generated/webhooks/webhooks.ts +6 -6
- package/openapi-client/index.ts +2 -2
- package/package.json +1 -1
- package/version.ts +1 -1
- package/_cjs/openapi-client/generated/embedded-wallets-core-functionality/embedded-wallets-core-functionality.js.map +0 -1
- package/_esm/openapi-client/generated/embedded-wallets-core-functionality/embedded-wallets-core-functionality.js.map +0 -1
- package/_types/openapi-client/generated/embedded-wallets-core-functionality/embedded-wallets-core-functionality.d.ts +0 -312
- package/_types/openapi-client/generated/embedded-wallets-core-functionality/embedded-wallets-core-functionality.d.ts.map +0 -1
|
@@ -1,52 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sendSolanaAssetWithEndUserAccount = exports.sendSolanaTransactionWithEndUserAccount = exports.signSolanaTransactionWithEndUserAccount = exports.signSolanaMessageWithEndUserAccount = exports.
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
5
|
-
exports.SendEvmTransactionWithEndUserAccountBodyNetwork = {
|
|
6
|
-
base: "base",
|
|
7
|
-
"base-sepolia": "base-sepolia",
|
|
8
|
-
ethereum: "ethereum",
|
|
9
|
-
"ethereum-sepolia": "ethereum-sepolia",
|
|
10
|
-
avalanche: "avalanche",
|
|
11
|
-
polygon: "polygon",
|
|
12
|
-
optimism: "optimism",
|
|
13
|
-
arbitrum: "arbitrum",
|
|
14
|
-
};
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
16
|
-
exports.SendEvmAssetWithEndUserAccountBodyNetwork = {
|
|
17
|
-
base: "base",
|
|
18
|
-
"base-sepolia": "base-sepolia",
|
|
19
|
-
ethereum: "ethereum",
|
|
20
|
-
"ethereum-sepolia": "ethereum-sepolia",
|
|
21
|
-
avalanche: "avalanche",
|
|
22
|
-
polygon: "polygon",
|
|
23
|
-
optimism: "optimism",
|
|
24
|
-
arbitrum: "arbitrum",
|
|
25
|
-
};
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
27
|
-
exports.SendSolanaTransactionWithEndUserAccountBodyNetwork = {
|
|
28
|
-
solana: "solana",
|
|
29
|
-
"solana-devnet": "solana-devnet",
|
|
30
|
-
};
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
32
|
-
exports.SendSolanaAssetWithEndUserAccountBodyNetwork = {
|
|
33
|
-
solana: "solana",
|
|
34
|
-
"solana-devnet": "solana-devnet",
|
|
35
|
-
};
|
|
3
|
+
exports.sendSolanaAssetWithEndUserAccount = exports.sendSolanaTransactionWithEndUserAccount = exports.signSolanaTransactionWithEndUserAccount = exports.signSolanaMessageWithEndUserAccount = exports.sendUserOperationWithEndUserAccount = exports.createEvmEip7702DelegationWithEndUserAccount = exports.revokeDelegationForEndUser = exports.signEvmTypedDataWithEndUserAccount = exports.signEvmMessageWithEndUserAccount = exports.sendEvmAssetWithEndUserAccount = exports.sendEvmTransactionWithEndUserAccount = exports.signEvmTransactionWithEndUserAccount = void 0;
|
|
36
4
|
const cdpApiClient_js_1 = require("../../cdpApiClient.js");
|
|
37
|
-
/**
|
|
38
|
-
* Signs an arbitrary 32 byte hash with the end user's given EVM account.
|
|
39
|
-
* @summary Sign a hash with end user EVM account
|
|
40
|
-
*/
|
|
41
|
-
const signEvmHashWithEndUserAccount = (projectId, userId, signEvmHashWithEndUserAccountBody, options) => {
|
|
42
|
-
return (0, cdpApiClient_js_1.cdpApiClient)({
|
|
43
|
-
url: `/v2/embedded-wallet-api/projects/${projectId}/end-users/${userId}/evm/sign`,
|
|
44
|
-
method: "POST",
|
|
45
|
-
headers: { "Content-Type": "application/json" },
|
|
46
|
-
data: signEvmHashWithEndUserAccountBody,
|
|
47
|
-
}, options);
|
|
48
|
-
};
|
|
49
|
-
exports.signEvmHashWithEndUserAccount = signEvmHashWithEndUserAccount;
|
|
50
5
|
/**
|
|
51
6
|
* Signs a transaction with the given end user EVM account.
|
|
52
7
|
The transaction should be serialized as a hex string using [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/).
|
|
@@ -54,12 +9,13 @@ The transaction should be serialized as a hex string using [RLP](https://ethereu
|
|
|
54
9
|
The transaction must be an [EIP-1559 dynamic fee transaction](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md). The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
|
|
55
10
|
* @summary Sign a transaction with end user EVM account
|
|
56
11
|
*/
|
|
57
|
-
const signEvmTransactionWithEndUserAccount = (
|
|
12
|
+
const signEvmTransactionWithEndUserAccount = (userId, signEvmTransactionWithEndUserAccountBody, params, options) => {
|
|
58
13
|
return (0, cdpApiClient_js_1.cdpApiClient)({
|
|
59
|
-
url: `/v2/embedded-wallet-api/
|
|
14
|
+
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/sign/transaction`,
|
|
60
15
|
method: "POST",
|
|
61
16
|
headers: { "Content-Type": "application/json" },
|
|
62
17
|
data: signEvmTransactionWithEndUserAccountBody,
|
|
18
|
+
params,
|
|
63
19
|
}, options);
|
|
64
20
|
};
|
|
65
21
|
exports.signEvmTransactionWithEndUserAccount = signEvmTransactionWithEndUserAccount;
|
|
@@ -92,12 +48,13 @@ The transaction must be an [EIP-1559 dynamic fee transaction](https://github.com
|
|
|
92
48
|
- `accessList` *(Optional)*: The access list to use for the transaction.
|
|
93
49
|
* @summary Send a transaction with end user EVM account
|
|
94
50
|
*/
|
|
95
|
-
const sendEvmTransactionWithEndUserAccount = (
|
|
51
|
+
const sendEvmTransactionWithEndUserAccount = (userId, sendEvmTransactionWithEndUserAccountBody, params, options) => {
|
|
96
52
|
return (0, cdpApiClient_js_1.cdpApiClient)({
|
|
97
|
-
url: `/v2/embedded-wallet-api/
|
|
53
|
+
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/send/transaction`,
|
|
98
54
|
method: "POST",
|
|
99
55
|
headers: { "Content-Type": "application/json" },
|
|
100
56
|
data: sendEvmTransactionWithEndUserAccountBody,
|
|
57
|
+
params,
|
|
101
58
|
}, options);
|
|
102
59
|
};
|
|
103
60
|
exports.sendEvmTransactionWithEndUserAccount = sendEvmTransactionWithEndUserAccount;
|
|
@@ -106,12 +63,13 @@ exports.sendEvmTransactionWithEndUserAccount = sendEvmTransactionWithEndUserAcco
|
|
|
106
63
|
The `amount` field accepts human-readable amounts as decimal strings (e.g., "1.5", "25.50").
|
|
107
64
|
* @summary Send USDC on EVM
|
|
108
65
|
*/
|
|
109
|
-
const sendEvmAssetWithEndUserAccount = (
|
|
66
|
+
const sendEvmAssetWithEndUserAccount = (userId, address, asset, sendEvmAssetWithEndUserAccountBody, params, options) => {
|
|
110
67
|
return (0, cdpApiClient_js_1.cdpApiClient)({
|
|
111
|
-
url: `/v2/embedded-wallet-api/
|
|
68
|
+
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/${address}/send/${asset}`,
|
|
112
69
|
method: "POST",
|
|
113
70
|
headers: { "Content-Type": "application/json" },
|
|
114
71
|
data: sendEvmAssetWithEndUserAccountBody,
|
|
72
|
+
params,
|
|
115
73
|
}, options);
|
|
116
74
|
};
|
|
117
75
|
exports.sendEvmAssetWithEndUserAccount = sendEvmAssetWithEndUserAccount;
|
|
@@ -121,12 +79,13 @@ exports.sendEvmAssetWithEndUserAccount = sendEvmAssetWithEndUserAccount;
|
|
|
121
79
|
Per the specification, the message in the request body is prepended with `0x19 <0x45 (E)> <thereum Signed Message:\n" + len(message)>` before being signed.
|
|
122
80
|
* @summary Sign an EIP-191 message with end user EVM account
|
|
123
81
|
*/
|
|
124
|
-
const signEvmMessageWithEndUserAccount = (
|
|
82
|
+
const signEvmMessageWithEndUserAccount = (userId, signEvmMessageWithEndUserAccountBody, params, options) => {
|
|
125
83
|
return (0, cdpApiClient_js_1.cdpApiClient)({
|
|
126
|
-
url: `/v2/embedded-wallet-api/
|
|
84
|
+
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/sign/message`,
|
|
127
85
|
method: "POST",
|
|
128
86
|
headers: { "Content-Type": "application/json" },
|
|
129
87
|
data: signEvmMessageWithEndUserAccountBody,
|
|
88
|
+
params,
|
|
130
89
|
}, options);
|
|
131
90
|
};
|
|
132
91
|
exports.signEvmMessageWithEndUserAccount = signEvmMessageWithEndUserAccount;
|
|
@@ -134,12 +93,13 @@ exports.signEvmMessageWithEndUserAccount = signEvmMessageWithEndUserAccount;
|
|
|
134
93
|
* Signs [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed data with the given end user EVM account.
|
|
135
94
|
* @summary Sign EIP-712 typed data with end user EVM account
|
|
136
95
|
*/
|
|
137
|
-
const signEvmTypedDataWithEndUserAccount = (
|
|
96
|
+
const signEvmTypedDataWithEndUserAccount = (userId, signEvmTypedDataWithEndUserAccountBody, params, options) => {
|
|
138
97
|
return (0, cdpApiClient_js_1.cdpApiClient)({
|
|
139
|
-
url: `/v2/embedded-wallet-api/
|
|
98
|
+
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/sign/typed-data`,
|
|
140
99
|
method: "POST",
|
|
141
100
|
headers: { "Content-Type": "application/json" },
|
|
142
101
|
data: signEvmTypedDataWithEndUserAccountBody,
|
|
102
|
+
params,
|
|
143
103
|
}, options);
|
|
144
104
|
};
|
|
145
105
|
exports.signEvmTypedDataWithEndUserAccount = signEvmTypedDataWithEndUserAccount;
|
|
@@ -147,9 +107,9 @@ exports.signEvmTypedDataWithEndUserAccount = signEvmTypedDataWithEndUserAccount;
|
|
|
147
107
|
* Revokes all active delegations for the specified end user. This operation can be performed by the end user themselves or by a developer using their API key.
|
|
148
108
|
* @summary Revoke delegation for end user
|
|
149
109
|
*/
|
|
150
|
-
const revokeDelegationForEndUser = (
|
|
110
|
+
const revokeDelegationForEndUser = (userId, revokeDelegationForEndUserBody, options) => {
|
|
151
111
|
return (0, cdpApiClient_js_1.cdpApiClient)({
|
|
152
|
-
url: `/v2/embedded-wallet-api/
|
|
112
|
+
url: `/v2/embedded-wallet-api/end-users/${userId}/delegation`,
|
|
153
113
|
method: "DELETE",
|
|
154
114
|
headers: { "Content-Type": "application/json" },
|
|
155
115
|
data: revokeDelegationForEndUserBody,
|
|
@@ -168,12 +128,13 @@ This endpoint:
|
|
|
168
128
|
The delegation allows the EVM EOA to be used as a smart account, which enables batched transactions and gas sponsorship via paymaster.
|
|
169
129
|
* @summary Create EIP-7702 delegation for end user EVM account
|
|
170
130
|
*/
|
|
171
|
-
const createEvmEip7702DelegationWithEndUserAccount = (
|
|
131
|
+
const createEvmEip7702DelegationWithEndUserAccount = (userId, createEvmEip7702DelegationWithEndUserAccountBody, params, options) => {
|
|
172
132
|
return (0, cdpApiClient_js_1.cdpApiClient)({
|
|
173
|
-
url: `/v2/embedded-wallet-api/
|
|
133
|
+
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/eip7702/delegation`,
|
|
174
134
|
method: "POST",
|
|
175
135
|
headers: { "Content-Type": "application/json" },
|
|
176
136
|
data: createEvmEip7702DelegationWithEndUserAccountBody,
|
|
137
|
+
params,
|
|
177
138
|
}, options);
|
|
178
139
|
};
|
|
179
140
|
exports.createEvmEip7702DelegationWithEndUserAccount = createEvmEip7702DelegationWithEndUserAccount;
|
|
@@ -181,52 +142,28 @@ exports.createEvmEip7702DelegationWithEndUserAccount = createEvmEip7702Delegatio
|
|
|
181
142
|
* Prepares, signs, and sends a user operation for an end user's Smart Account.
|
|
182
143
|
* @summary Send a user operation for end user Smart Account
|
|
183
144
|
*/
|
|
184
|
-
const sendUserOperationWithEndUserAccount = (
|
|
145
|
+
const sendUserOperationWithEndUserAccount = (userId, address, sendUserOperationWithEndUserAccountBody, params, options) => {
|
|
185
146
|
return (0, cdpApiClient_js_1.cdpApiClient)({
|
|
186
|
-
url: `/v2/embedded-wallet-api/
|
|
147
|
+
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/smart-accounts/${address}/send`,
|
|
187
148
|
method: "POST",
|
|
188
149
|
headers: { "Content-Type": "application/json" },
|
|
189
150
|
data: sendUserOperationWithEndUserAccountBody,
|
|
151
|
+
params,
|
|
190
152
|
}, options);
|
|
191
153
|
};
|
|
192
154
|
exports.sendUserOperationWithEndUserAccount = sendUserOperationWithEndUserAccount;
|
|
193
|
-
/**
|
|
194
|
-
* Revokes an existing spend permission.
|
|
195
|
-
* @summary Revoke a spend permission
|
|
196
|
-
*/
|
|
197
|
-
const revokeSpendPermissionWithEndUserAccount = (projectId, userId, address, revokeSpendPermissionRequest, options) => {
|
|
198
|
-
return (0, cdpApiClient_js_1.cdpApiClient)({
|
|
199
|
-
url: `/v2/embedded-wallet-api/projects/${projectId}/end-users/${userId}/evm/smart-accounts/${address}/spend-permissions/revoke`,
|
|
200
|
-
method: "POST",
|
|
201
|
-
headers: { "Content-Type": "application/json" },
|
|
202
|
-
data: revokeSpendPermissionRequest,
|
|
203
|
-
}, options);
|
|
204
|
-
};
|
|
205
|
-
exports.revokeSpendPermissionWithEndUserAccount = revokeSpendPermissionWithEndUserAccount;
|
|
206
|
-
/**
|
|
207
|
-
* Signs an arbitrary 32 byte hash with the end user's given Solana account.
|
|
208
|
-
* @summary Sign a hash with end user Solana account
|
|
209
|
-
*/
|
|
210
|
-
const signSolanaHashWithEndUserAccount = (projectId, userId, signSolanaHashWithEndUserAccountBody, options) => {
|
|
211
|
-
return (0, cdpApiClient_js_1.cdpApiClient)({
|
|
212
|
-
url: `/v2/embedded-wallet-api/projects/${projectId}/end-users/${userId}/solana/sign`,
|
|
213
|
-
method: "POST",
|
|
214
|
-
headers: { "Content-Type": "application/json" },
|
|
215
|
-
data: signSolanaHashWithEndUserAccountBody,
|
|
216
|
-
}, options);
|
|
217
|
-
};
|
|
218
|
-
exports.signSolanaHashWithEndUserAccount = signSolanaHashWithEndUserAccount;
|
|
219
155
|
/**
|
|
220
156
|
* Signs an arbitrary Base64 encoded message with the given Solana account.
|
|
221
157
|
**WARNING:** Never sign a message that you didn't generate as it may put your funds at risk.
|
|
222
158
|
* @summary Sign a Base64 encoded message
|
|
223
159
|
*/
|
|
224
|
-
const signSolanaMessageWithEndUserAccount = (
|
|
160
|
+
const signSolanaMessageWithEndUserAccount = (userId, signSolanaMessageWithEndUserAccountBody, params, options) => {
|
|
225
161
|
return (0, cdpApiClient_js_1.cdpApiClient)({
|
|
226
|
-
url: `/v2/embedded-wallet-api/
|
|
162
|
+
url: `/v2/embedded-wallet-api/end-users/${userId}/solana/sign/message`,
|
|
227
163
|
method: "POST",
|
|
228
164
|
headers: { "Content-Type": "application/json" },
|
|
229
165
|
data: signSolanaMessageWithEndUserAccountBody,
|
|
166
|
+
params,
|
|
230
167
|
}, options);
|
|
231
168
|
};
|
|
232
169
|
exports.signSolanaMessageWithEndUserAccount = signSolanaMessageWithEndUserAccount;
|
|
@@ -240,12 +177,13 @@ The following transaction types are supported:
|
|
|
240
177
|
The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
|
|
241
178
|
* @summary Sign a transaction with end user Solana account
|
|
242
179
|
*/
|
|
243
|
-
const signSolanaTransactionWithEndUserAccount = (
|
|
180
|
+
const signSolanaTransactionWithEndUserAccount = (userId, signSolanaTransactionWithEndUserAccountBody, params, options) => {
|
|
244
181
|
return (0, cdpApiClient_js_1.cdpApiClient)({
|
|
245
|
-
url: `/v2/embedded-wallet-api/
|
|
182
|
+
url: `/v2/embedded-wallet-api/end-users/${userId}/solana/sign/transaction`,
|
|
246
183
|
method: "POST",
|
|
247
184
|
headers: { "Content-Type": "application/json" },
|
|
248
185
|
data: signSolanaTransactionWithEndUserAccountBody,
|
|
186
|
+
params,
|
|
249
187
|
}, options);
|
|
250
188
|
};
|
|
251
189
|
exports.signSolanaTransactionWithEndUserAccount = signSolanaTransactionWithEndUserAccount;
|
|
@@ -266,12 +204,13 @@ The following Solana networks are supported:
|
|
|
266
204
|
The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
|
|
267
205
|
* @summary Send a transaction with end user Solana account
|
|
268
206
|
*/
|
|
269
|
-
const sendSolanaTransactionWithEndUserAccount = (
|
|
207
|
+
const sendSolanaTransactionWithEndUserAccount = (userId, sendSolanaTransactionWithEndUserAccountBody, params, options) => {
|
|
270
208
|
return (0, cdpApiClient_js_1.cdpApiClient)({
|
|
271
|
-
url: `/v2/embedded-wallet-api/
|
|
209
|
+
url: `/v2/embedded-wallet-api/end-users/${userId}/solana/send/transaction`,
|
|
272
210
|
method: "POST",
|
|
273
211
|
headers: { "Content-Type": "application/json" },
|
|
274
212
|
data: sendSolanaTransactionWithEndUserAccountBody,
|
|
213
|
+
params,
|
|
275
214
|
}, options);
|
|
276
215
|
};
|
|
277
216
|
exports.sendSolanaTransactionWithEndUserAccount = sendSolanaTransactionWithEndUserAccount;
|
|
@@ -281,13 +220,14 @@ The `amount` field accepts human-readable amounts as decimal strings (e.g., "1.5
|
|
|
281
220
|
Use the optional `createRecipientAta` parameter to control whether the sender pays for creating the recipient's Associated Token Account if it doesn't exist.
|
|
282
221
|
* @summary Send USDC on Solana
|
|
283
222
|
*/
|
|
284
|
-
const sendSolanaAssetWithEndUserAccount = (
|
|
223
|
+
const sendSolanaAssetWithEndUserAccount = (userId, address, asset, sendSolanaAssetWithEndUserAccountBody, params, options) => {
|
|
285
224
|
return (0, cdpApiClient_js_1.cdpApiClient)({
|
|
286
|
-
url: `/v2/embedded-wallet-api/
|
|
225
|
+
url: `/v2/embedded-wallet-api/end-users/${userId}/solana/${address}/send/${asset}`,
|
|
287
226
|
method: "POST",
|
|
288
227
|
headers: { "Content-Type": "application/json" },
|
|
289
228
|
data: sendSolanaAssetWithEndUserAccountBody,
|
|
229
|
+
params,
|
|
290
230
|
}, options);
|
|
291
231
|
};
|
|
292
232
|
exports.sendSolanaAssetWithEndUserAccount = sendSolanaAssetWithEndUserAccount;
|
|
293
|
-
//# sourceMappingURL=embedded-wallets
|
|
233
|
+
//# sourceMappingURL=embedded-wallets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedded-wallets.js","sourceRoot":"","sources":["../../../../openapi-client/generated/embedded-wallets/embedded-wallets.ts"],"names":[],"mappings":";;;AA6CA,2DAAqD;AAIrD;;;;;;GAM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AAA,uCAAuC,2CAgBlD;AACF;;;;;;;;;;;;;;;;GAgBG;AACI,MAAM,uCAAuC,GAAG,CACrD,MAAc,EACd,2CAAwF,EACxF,MAAsD,EACtD,OAA0F,EAC1F,EAAE;IACF,OAAO,IAAA,8BAAY,EACjB;QACE,GAAG,EAAE,qCAAqC,MAAM,0BAA0B;QAC1E,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,2CAA2C;QACjD,MAAM;KACP,EACD,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,uCAAuC,2CAgBlD;AACF;;;;;GAKG;AACI,MAAM,iCAAiC,GAAG,CAC/C,MAAc,EACd,OAA0B,EAC1B,KAAa,EACb,qCAA4E,EAC5E,MAAgD,EAChD,OAAoF,EACpF,EAAE;IACF,OAAO,IAAA,8BAAY,EACjB;QACE,GAAG,EAAE,qCAAqC,MAAM,WAAW,OAAO,SAAS,KAAK,EAAE;QAClF,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,qCAAqC;QAC3C,MAAM;KACP,EACD,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,iCAAiC,qCAkB5C"}
|
|
@@ -35,12 +35,12 @@ exports.listWebhookSubscriptions = listWebhookSubscriptions;
|
|
|
35
35
|
- **No labels required** - maximum simplicity for transaction monitoring
|
|
36
36
|
|
|
37
37
|
**Payments Transfers Events** - Transfer lifecycle notifications:
|
|
38
|
-
- `payments.transfers.quoted`
|
|
39
|
-
- `payments.transfers.processing`
|
|
40
|
-
- `payments.transfers.completed`
|
|
41
|
-
- `payments.transfers.failed`
|
|
42
|
-
- `payments.transfers.travel_rule_incomplete`
|
|
43
|
-
- `payments.transfers.travel_rule_completed`
|
|
38
|
+
- `payments.transfers.quoted` - Transfer created and awaiting execution
|
|
39
|
+
- `payments.transfers.processing` - Transfer execution in progress
|
|
40
|
+
- `payments.transfers.completed` - Transfer completed successfully
|
|
41
|
+
- `payments.transfers.failed` - Transfer failed
|
|
42
|
+
- `payments.transfers.travel_rule_incomplete` - Travel rule information is missing
|
|
43
|
+
- `payments.transfers.travel_rule_completed` - Travel rule information has been provided and the transfer will proceed
|
|
44
44
|
- **No labels required** - enable the transfers webhook to monitor status transitions
|
|
45
45
|
|
|
46
46
|
**Wallet Events** - Wallet activity notifications:
|
|
@@ -49,10 +49,10 @@ __exportStar(require("./generated/policy-engine/policy-engine.js"), exports);
|
|
|
49
49
|
__exportStar(require("./generated/onramp/onramp.js"), exports);
|
|
50
50
|
__exportStar(require("./generated/onchain-data/onchain-data.js"), exports);
|
|
51
51
|
__exportStar(require("./generated/end-user-accounts/end-user-accounts.js"), exports);
|
|
52
|
-
__exportStar(require("./generated/embedded-wallets
|
|
52
|
+
__exportStar(require("./generated/embedded-wallets/embedded-wallets.js"), exports);
|
|
53
53
|
__exportStar(require("./generated/x402-facilitator/x402-facilitator.js"), exports);
|
|
54
54
|
const cdpApiClient_js_1 = require("./cdpApiClient.js");
|
|
55
|
-
const embeddedWallets = __importStar(require("./generated/embedded-wallets
|
|
55
|
+
const embeddedWallets = __importStar(require("./generated/embedded-wallets/embedded-wallets.js"));
|
|
56
56
|
const endUserAccounts = __importStar(require("./generated/end-user-accounts/end-user-accounts.js"));
|
|
57
57
|
const evm = __importStar(require("./generated/evm-accounts/evm-accounts.js"));
|
|
58
58
|
const evmSmartAccounts = __importStar(require("./generated/evm-smart-accounts/evm-smart-accounts.js"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../openapi-client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uFAAqE;AACrE,2EAAyD;AACzD,uFAAqE;AACrE,qEAAmD;AACnD,uFAAqE;AACrE,iFAA+D;AAC/D,6FAA2E;AAC3E,iEAA+C;AAC/C,6EAA2D;AAC3D,+DAA6C;AAC7C,2EAAyD;AACzD,qFAAmE;AACnE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../openapi-client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uFAAqE;AACrE,2EAAyD;AACzD,uFAAqE;AACrE,qEAAmD;AACnD,uFAAqE;AACrE,iFAA+D;AAC/D,6FAA2E;AAC3E,iEAA+C;AAC/C,6EAA2D;AAC3D,+DAA6C;AAC7C,2EAAyD;AACzD,qFAAmE;AACnE,mFAAiE;AACjE,mFAAiE;AAEjE,uDAA8C;AAC9C,kGAAoF;AACpF,oGAAsF;AACtF,8EAAgE;AAChE,uGAAyF;AACzF,6EAA+D;AAC/D,uGAAyF;AACzF,wEAA0D;AAC1D,sFAAwE;AACxE,qFAAuE;AACvE,uFAAyE;AACzE,gHAAkG;AAClG,2EAA6D;AAEhD,QAAA,gBAAgB,GAAG;IAC9B,GAAG,GAAG;IACN,GAAG,gBAAgB;IACnB,GAAG,QAAQ;IACX,GAAG,gBAAgB;IACnB,GAAG,QAAQ;IACX,GAAG,MAAM;IACT,GAAG,mBAAmB;IACtB,GAAG,OAAO;IACV,GAAG,WAAW;IACd,GAAG,QAAQ;IACX,GAAG,eAAe;IAClB,GAAG,eAAe;IAClB,SAAS,EAAT,2BAAS;CACV,CAAC;AAEW,QAAA,iBAAiB,GAAG;IAC/B,GAAG,GAAG;IACN,GAAG,gBAAgB;IACnB,GAAG,QAAQ;IACX,GAAG,gBAAgB;IACnB,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;CAC3C,CAAC;AAEW,QAAA,oBAAoB,GAAG;IAClC,GAAG,MAAM;IACT,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;CACjD,CAAC;AAEW,QAAA,sBAAsB,GAAG;IACpC,GAAG,QAAQ;CACZ,CAAC;AAGF,iEAA+C"}
|
package/_cjs/version.js
CHANGED
package/_esm/client/cdp.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Analytics } from "../analytics.js";
|
|
2
2
|
import { CdpOpenApiClient } from "../openapi-client/index.js";
|
|
3
3
|
import { version } from "../version.js";
|
|
4
|
-
import {
|
|
4
|
+
import { EndUserClient } from "./end-user/endUser.js";
|
|
5
5
|
import { EvmClient } from "./evm/evm.js";
|
|
6
6
|
import { PoliciesClient } from "./policies/policies.js";
|
|
7
7
|
import { SolanaClient } from "./solana/solana.js";
|
|
@@ -35,7 +35,6 @@ export class CdpClient {
|
|
|
35
35
|
* CDP_API_KEY_ID=your-api-key-id
|
|
36
36
|
* CDP_API_KEY_SECRET=your-api-key-secret
|
|
37
37
|
* CDP_WALLET_SECRET=your-wallet-secret
|
|
38
|
-
* CDP_PROJECT_ID=your-project-id
|
|
39
38
|
* ```
|
|
40
39
|
*
|
|
41
40
|
* Or passed as options to the constructor:
|
|
@@ -45,7 +44,6 @@ export class CdpClient {
|
|
|
45
44
|
* apiKeyId: "your-api-key-id",
|
|
46
45
|
* apiKeySecret: "your-api-key-secret",
|
|
47
46
|
* walletSecret: "your-wallet-secret",
|
|
48
|
-
* projectId: "your-project-id",
|
|
49
47
|
* });
|
|
50
48
|
* ```
|
|
51
49
|
*
|
|
@@ -67,7 +65,6 @@ We recommend using https://github.com/Schniz/fnm for managing your Node.js versi
|
|
|
67
65
|
const apiKeyId = options.apiKeyId ?? process.env.CDP_API_KEY_ID ?? process.env.CDP_API_KEY_NAME;
|
|
68
66
|
const apiKeySecret = options.apiKeySecret ?? process.env.CDP_API_KEY_SECRET;
|
|
69
67
|
const walletSecret = options.walletSecret ?? process.env.CDP_WALLET_SECRET;
|
|
70
|
-
const projectId = options.projectId ?? process.env.CDP_PROJECT_ID;
|
|
71
68
|
if (!apiKeyId || !apiKeySecret) {
|
|
72
69
|
throw new Error(`
|
|
73
70
|
\nMissing required CDP Secret API Key configuration parameters.
|
|
@@ -114,7 +111,7 @@ For more information, see: https://github.com/coinbase/cdp-sdk/blob/main/typescr
|
|
|
114
111
|
this.evm = new EvmClient();
|
|
115
112
|
this.solana = new SolanaClient();
|
|
116
113
|
this.policies = new PoliciesClient();
|
|
117
|
-
this.endUser = new
|
|
114
|
+
this.endUser = new EndUserClient();
|
|
118
115
|
this.webhooks = new WebhooksClient();
|
|
119
116
|
}
|
|
120
117
|
}
|
package/_esm/client/cdp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdp.js","sourceRoot":"","sources":["../../client/cdp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cdp.js","sourceRoot":"","sources":["../../client/cdp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAexD;;GAEG;AACH,MAAM,OAAO,SAAS;IACpB,4CAA4C;IACrC,GAAG,CAAY;IAEtB,+CAA+C;IACxC,MAAM,CAAe;IAE5B,iDAAiD;IAC1C,QAAQ,CAAiB;IAEhC,iDAAiD;IAC1C,OAAO,CAAgB;IAE9B,gDAAgD;IACzC,QAAQ,CAAiB;IAEhC;;;;;;;;;;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IAAI,CAAC,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -8,16 +8,7 @@ import { CdpOpenApiClient } from "../../openapi-client/index.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* The CDP end user client.
|
|
10
10
|
*/
|
|
11
|
-
export class
|
|
12
|
-
projectId;
|
|
13
|
-
/**
|
|
14
|
-
* Creates a new CDPEndUserClient.
|
|
15
|
-
*
|
|
16
|
-
* @param projectId - The CDP project ID. Required for delegation operations (signing, sending).
|
|
17
|
-
*/
|
|
18
|
-
constructor(projectId) {
|
|
19
|
-
this.projectId = projectId;
|
|
20
|
-
}
|
|
11
|
+
export class EndUserClient {
|
|
21
12
|
/**
|
|
22
13
|
* Creates an end user. An end user is an entity that can own CDP EVM accounts,
|
|
23
14
|
* EVM smart accounts, and/or Solana accounts.
|
|
@@ -55,7 +46,7 @@ export class CDPEndUserClient {
|
|
|
55
46
|
...options,
|
|
56
47
|
userId,
|
|
57
48
|
});
|
|
58
|
-
return toEndUserAccount(CdpOpenApiClient, { endUser
|
|
49
|
+
return toEndUserAccount(CdpOpenApiClient, { endUser });
|
|
59
50
|
}
|
|
60
51
|
/**
|
|
61
52
|
* Lists end users belonging to the developer's CDP Project.
|
|
@@ -121,7 +112,7 @@ export class CDPEndUserClient {
|
|
|
121
112
|
});
|
|
122
113
|
const { userId } = options;
|
|
123
114
|
const endUser = await CdpOpenApiClient.getEndUser(userId);
|
|
124
|
-
return toEndUserAccount(CdpOpenApiClient, { endUser
|
|
115
|
+
return toEndUserAccount(CdpOpenApiClient, { endUser });
|
|
125
116
|
}
|
|
126
117
|
/**
|
|
127
118
|
* Adds an EVM EOA (Externally Owned Account) to an existing end user. End users can have up to 10 EVM accounts.
|
|
@@ -221,34 +212,9 @@ export class CDPEndUserClient {
|
|
|
221
212
|
action: "revoke_delegation_for_end_user",
|
|
222
213
|
});
|
|
223
214
|
const { userId } = options;
|
|
224
|
-
await CdpOpenApiClient.revokeDelegationForEndUser(
|
|
215
|
+
await CdpOpenApiClient.revokeDelegationForEndUser(userId, {});
|
|
225
216
|
}
|
|
226
217
|
// ─── Delegated EVM Sign Methods ───
|
|
227
|
-
/**
|
|
228
|
-
* Signs an EVM hash on behalf of an end user using a delegation.
|
|
229
|
-
* The end user must have previously created a delegation granting signing permissions.
|
|
230
|
-
*
|
|
231
|
-
* @param options - The options for signing an EVM hash.
|
|
232
|
-
*
|
|
233
|
-
* @returns A promise that resolves to the signature.
|
|
234
|
-
*
|
|
235
|
-
* @example
|
|
236
|
-
* ```ts
|
|
237
|
-
* const result = await cdp.endUser.signEvmHash({
|
|
238
|
-
* userId: "user-123",
|
|
239
|
-
* hash: "0xabcdef...",
|
|
240
|
-
* address: "0x1234..."
|
|
241
|
-
* });
|
|
242
|
-
* console.log(result.signature);
|
|
243
|
-
* ```
|
|
244
|
-
*/
|
|
245
|
-
async signEvmHash(options) {
|
|
246
|
-
Analytics.trackAction({ action: "end_user_sign_evm_hash" });
|
|
247
|
-
return CdpOpenApiClient.signEvmHashWithEndUserAccount(this.requireProjectId(), options.userId, {
|
|
248
|
-
hash: options.hash,
|
|
249
|
-
address: options.address,
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
218
|
/**
|
|
253
219
|
* Signs an EVM transaction on behalf of an end user using a delegation.
|
|
254
220
|
*
|
|
@@ -268,7 +234,7 @@ export class CDPEndUserClient {
|
|
|
268
234
|
*/
|
|
269
235
|
async signEvmTransaction(options) {
|
|
270
236
|
Analytics.trackAction({ action: "end_user_sign_evm_transaction" });
|
|
271
|
-
return CdpOpenApiClient.signEvmTransactionWithEndUserAccount(
|
|
237
|
+
return CdpOpenApiClient.signEvmTransactionWithEndUserAccount(options.userId, {
|
|
272
238
|
address: options.address,
|
|
273
239
|
transaction: options.transaction,
|
|
274
240
|
});
|
|
@@ -292,7 +258,7 @@ export class CDPEndUserClient {
|
|
|
292
258
|
*/
|
|
293
259
|
async signEvmMessage(options) {
|
|
294
260
|
Analytics.trackAction({ action: "end_user_sign_evm_message" });
|
|
295
|
-
return CdpOpenApiClient.signEvmMessageWithEndUserAccount(
|
|
261
|
+
return CdpOpenApiClient.signEvmMessageWithEndUserAccount(options.userId, {
|
|
296
262
|
address: options.address,
|
|
297
263
|
message: options.message,
|
|
298
264
|
});
|
|
@@ -316,7 +282,7 @@ export class CDPEndUserClient {
|
|
|
316
282
|
*/
|
|
317
283
|
async signEvmTypedData(options) {
|
|
318
284
|
Analytics.trackAction({ action: "end_user_sign_evm_typed_data" });
|
|
319
|
-
return CdpOpenApiClient.signEvmTypedDataWithEndUserAccount(
|
|
285
|
+
return CdpOpenApiClient.signEvmTypedDataWithEndUserAccount(options.userId, {
|
|
320
286
|
address: options.address,
|
|
321
287
|
typedData: options.typedData,
|
|
322
288
|
});
|
|
@@ -342,7 +308,7 @@ export class CDPEndUserClient {
|
|
|
342
308
|
*/
|
|
343
309
|
async sendEvmTransaction(options) {
|
|
344
310
|
Analytics.trackAction({ action: "end_user_send_evm_transaction" });
|
|
345
|
-
return CdpOpenApiClient.sendEvmTransactionWithEndUserAccount(
|
|
311
|
+
return CdpOpenApiClient.sendEvmTransactionWithEndUserAccount(options.userId, {
|
|
346
312
|
address: options.address,
|
|
347
313
|
transaction: options.transaction,
|
|
348
314
|
network: options.network,
|
|
@@ -370,7 +336,7 @@ export class CDPEndUserClient {
|
|
|
370
336
|
async sendEvmAsset(options) {
|
|
371
337
|
Analytics.trackAction({ action: "end_user_send_evm_asset" });
|
|
372
338
|
const asset = options.asset ?? "usdc";
|
|
373
|
-
return CdpOpenApiClient.sendEvmAssetWithEndUserAccount(
|
|
339
|
+
return CdpOpenApiClient.sendEvmAssetWithEndUserAccount(options.userId, options.address, asset, {
|
|
374
340
|
to: options.to,
|
|
375
341
|
amount: options.amount,
|
|
376
342
|
network: options.network,
|
|
@@ -398,7 +364,7 @@ export class CDPEndUserClient {
|
|
|
398
364
|
*/
|
|
399
365
|
async sendUserOperation(options) {
|
|
400
366
|
Analytics.trackAction({ action: "end_user_send_user_operation" });
|
|
401
|
-
return CdpOpenApiClient.sendUserOperationWithEndUserAccount(
|
|
367
|
+
return CdpOpenApiClient.sendUserOperationWithEndUserAccount(options.userId, options.address, {
|
|
402
368
|
network: options.network,
|
|
403
369
|
calls: options.calls,
|
|
404
370
|
useCdpPaymaster: options.useCdpPaymaster,
|
|
@@ -426,37 +392,13 @@ export class CDPEndUserClient {
|
|
|
426
392
|
*/
|
|
427
393
|
async createEvmEip7702Delegation(options) {
|
|
428
394
|
Analytics.trackAction({ action: "end_user_create_evm_eip7702_delegation" });
|
|
429
|
-
return CdpOpenApiClient.createEvmEip7702DelegationWithEndUserAccount(
|
|
395
|
+
return CdpOpenApiClient.createEvmEip7702DelegationWithEndUserAccount(options.userId, {
|
|
430
396
|
address: options.address,
|
|
431
397
|
network: options.network,
|
|
432
398
|
enableSpendPermissions: options.enableSpendPermissions,
|
|
433
399
|
});
|
|
434
400
|
}
|
|
435
401
|
// ─── Delegated Solana Sign Methods ───
|
|
436
|
-
/**
|
|
437
|
-
* Signs a Solana hash on behalf of an end user using a delegation.
|
|
438
|
-
*
|
|
439
|
-
* @param options - The options for signing a Solana hash.
|
|
440
|
-
*
|
|
441
|
-
* @returns A promise that resolves to the signature.
|
|
442
|
-
*
|
|
443
|
-
* @example
|
|
444
|
-
* ```ts
|
|
445
|
-
* const result = await cdp.endUser.signSolanaHash({
|
|
446
|
-
* userId: "user-123",
|
|
447
|
-
* hash: "base64hash...",
|
|
448
|
-
* address: "So1ana..."
|
|
449
|
-
* });
|
|
450
|
-
* console.log(result.signature);
|
|
451
|
-
* ```
|
|
452
|
-
*/
|
|
453
|
-
async signSolanaHash(options) {
|
|
454
|
-
Analytics.trackAction({ action: "end_user_sign_solana_hash" });
|
|
455
|
-
return CdpOpenApiClient.signSolanaHashWithEndUserAccount(this.requireProjectId(), options.userId, {
|
|
456
|
-
hash: options.hash,
|
|
457
|
-
address: options.address,
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
402
|
/**
|
|
461
403
|
* Signs a Solana message on behalf of an end user using a delegation.
|
|
462
404
|
*
|
|
@@ -476,7 +418,7 @@ export class CDPEndUserClient {
|
|
|
476
418
|
*/
|
|
477
419
|
async signSolanaMessage(options) {
|
|
478
420
|
Analytics.trackAction({ action: "end_user_sign_solana_message" });
|
|
479
|
-
return CdpOpenApiClient.signSolanaMessageWithEndUserAccount(
|
|
421
|
+
return CdpOpenApiClient.signSolanaMessageWithEndUserAccount(options.userId, {
|
|
480
422
|
address: options.address,
|
|
481
423
|
message: options.message,
|
|
482
424
|
});
|
|
@@ -500,7 +442,7 @@ export class CDPEndUserClient {
|
|
|
500
442
|
*/
|
|
501
443
|
async signSolanaTransaction(options) {
|
|
502
444
|
Analytics.trackAction({ action: "end_user_sign_solana_transaction" });
|
|
503
|
-
return CdpOpenApiClient.signSolanaTransactionWithEndUserAccount(
|
|
445
|
+
return CdpOpenApiClient.signSolanaTransactionWithEndUserAccount(options.userId, {
|
|
504
446
|
address: options.address,
|
|
505
447
|
transaction: options.transaction,
|
|
506
448
|
});
|
|
@@ -526,7 +468,7 @@ export class CDPEndUserClient {
|
|
|
526
468
|
*/
|
|
527
469
|
async sendSolanaTransaction(options) {
|
|
528
470
|
Analytics.trackAction({ action: "end_user_send_solana_transaction" });
|
|
529
|
-
return CdpOpenApiClient.sendSolanaTransactionWithEndUserAccount(
|
|
471
|
+
return CdpOpenApiClient.sendSolanaTransactionWithEndUserAccount(options.userId, {
|
|
530
472
|
address: options.address,
|
|
531
473
|
transaction: options.transaction,
|
|
532
474
|
network: options.network,
|
|
@@ -554,7 +496,7 @@ export class CDPEndUserClient {
|
|
|
554
496
|
async sendSolanaAsset(options) {
|
|
555
497
|
Analytics.trackAction({ action: "end_user_send_solana_asset" });
|
|
556
498
|
const asset = options.asset ?? "usdc";
|
|
557
|
-
return CdpOpenApiClient.sendSolanaAssetWithEndUserAccount(
|
|
499
|
+
return CdpOpenApiClient.sendSolanaAssetWithEndUserAccount(options.userId, options.address, asset, {
|
|
558
500
|
to: options.to,
|
|
559
501
|
amount: options.amount,
|
|
560
502
|
network: options.network,
|
|
@@ -576,7 +518,7 @@ export class CDPEndUserClient {
|
|
|
576
518
|
const endUser = await CdpOpenApiClient.validateEndUserAccessToken({
|
|
577
519
|
accessToken,
|
|
578
520
|
});
|
|
579
|
-
return toEndUserAccount(CdpOpenApiClient, { endUser
|
|
521
|
+
return toEndUserAccount(CdpOpenApiClient, { endUser });
|
|
580
522
|
}
|
|
581
523
|
/**
|
|
582
524
|
* Imports an existing private key for an end user.
|
|
@@ -653,19 +595,7 @@ export class CDPEndUserClient {
|
|
|
653
595
|
encryptedPrivateKey: encryptedPrivateKey.toString("base64"),
|
|
654
596
|
keyType: options.keyType,
|
|
655
597
|
});
|
|
656
|
-
return toEndUserAccount(CdpOpenApiClient, { endUser
|
|
657
|
-
}
|
|
658
|
-
/**
|
|
659
|
-
* Returns the configured project ID or throws if not configured.
|
|
660
|
-
*
|
|
661
|
-
* @returns The project ID.
|
|
662
|
-
*/
|
|
663
|
-
requireProjectId() {
|
|
664
|
-
if (!this.projectId) {
|
|
665
|
-
throw new UserInputValidationError("Missing required project ID for delegation operation. " +
|
|
666
|
-
"Set the CDP_PROJECT_ID environment variable or pass projectId to the CdpClient constructor.");
|
|
667
|
-
}
|
|
668
|
-
return this.projectId;
|
|
598
|
+
return toEndUserAccount(CdpOpenApiClient, { endUser });
|
|
669
599
|
}
|
|
670
600
|
}
|
|
671
601
|
//# sourceMappingURL=endUser.js.map
|