@coinbase/cdp-sdk 0.0.0 → 1.0.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.
Files changed (87) hide show
  1. package/README.md +165 -0
  2. package/dist/accounts/evm/toEvmServerAccount.d.ts +19 -0
  3. package/dist/accounts/evm/toEvmServerAccount.js +42 -0
  4. package/dist/accounts/evm/toEvmSmartAccount.d.ts +24 -0
  5. package/dist/accounts/evm/toEvmSmartAccount.js +24 -0
  6. package/dist/accounts/types.d.ts +45 -0
  7. package/dist/accounts/types.js +2 -0
  8. package/dist/actions/evm/sendUserOperation.d.ts +95 -0
  9. package/dist/actions/evm/sendUserOperation.js +87 -0
  10. package/dist/actions/evm/waitForUserOperation.d.ts +63 -0
  11. package/dist/actions/evm/waitForUserOperation.js +60 -0
  12. package/dist/analytics.d.ts +30 -0
  13. package/dist/analytics.js +89 -0
  14. package/dist/auth/errors.d.ts +45 -0
  15. package/dist/auth/errors.js +62 -0
  16. package/dist/auth/hooks/axios/index.d.ts +1 -0
  17. package/dist/auth/hooks/axios/index.js +17 -0
  18. package/dist/auth/hooks/axios/withAuth.d.ts +37 -0
  19. package/dist/auth/hooks/axios/withAuth.js +73 -0
  20. package/dist/auth/index.d.ts +4 -0
  21. package/dist/auth/index.js +43 -0
  22. package/dist/auth/utils/http.d.ts +60 -0
  23. package/dist/auth/utils/http.js +72 -0
  24. package/dist/auth/utils/index.d.ts +2 -0
  25. package/dist/auth/utils/index.js +18 -0
  26. package/dist/auth/utils/jwt.d.ts +88 -0
  27. package/dist/auth/utils/jwt.js +235 -0
  28. package/dist/client/cdp.d.ts +43 -0
  29. package/dist/client/cdp.js +40 -0
  30. package/dist/client/evm/evm.d.ts +387 -0
  31. package/dist/client/evm/evm.js +520 -0
  32. package/dist/client/evm/evm.types.d.ts +254 -0
  33. package/dist/client/evm/evm.types.js +2 -0
  34. package/dist/client/evm/index.d.ts +1 -0
  35. package/dist/client/evm/index.js +5 -0
  36. package/dist/client/solana/index.d.ts +1 -0
  37. package/dist/client/solana/index.js +5 -0
  38. package/dist/client/solana/solana.d.ts +168 -0
  39. package/dist/client/solana/solana.js +207 -0
  40. package/dist/client/solana/solana.types.d.ts +94 -0
  41. package/dist/client/solana/solana.types.js +2 -0
  42. package/dist/constants.d.ts +4 -0
  43. package/dist/constants.js +7 -0
  44. package/dist/errors.d.ts +11 -0
  45. package/dist/errors.js +21 -0
  46. package/dist/index.d.ts +3 -0
  47. package/dist/index.js +6 -0
  48. package/dist/openapi-client/cdpApiClient.d.ts +50 -0
  49. package/dist/openapi-client/cdpApiClient.js +146 -0
  50. package/dist/openapi-client/errors.d.ts +53 -0
  51. package/dist/openapi-client/errors.js +70 -0
  52. package/dist/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +345 -0
  53. package/dist/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +54 -0
  54. package/dist/openapi-client/generated/evm-accounts/evm-accounts.d.ts +62 -0
  55. package/dist/openapi-client/generated/evm-accounts/evm-accounts.js +85 -0
  56. package/dist/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts +17 -0
  57. package/dist/openapi-client/generated/evm-accounts/evm-accounts.msw.js +113 -0
  58. package/dist/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +48 -0
  59. package/dist/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +66 -0
  60. package/dist/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts +15 -0
  61. package/dist/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +99 -0
  62. package/dist/openapi-client/generated/faucets/faucets.d.ts +48 -0
  63. package/dist/openapi-client/generated/faucets/faucets.js +51 -0
  64. package/dist/openapi-client/generated/faucets/faucets.msw.d.ts +7 -0
  65. package/dist/openapi-client/generated/faucets/faucets.msw.js +43 -0
  66. package/dist/openapi-client/generated/index.msw.d.ts +4 -0
  67. package/dist/openapi-client/generated/index.msw.js +20 -0
  68. package/dist/openapi-client/generated/solana-accounts/solana-accounts.d.ts +61 -0
  69. package/dist/openapi-client/generated/solana-accounts/solana-accounts.js +79 -0
  70. package/dist/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts +15 -0
  71. package/dist/openapi-client/generated/solana-accounts/solana-accounts.msw.js +99 -0
  72. package/dist/openapi-client/index.d.ts +55 -0
  73. package/dist/openapi-client/index.js +65 -0
  74. package/dist/types/calls.d.ts +13 -0
  75. package/dist/types/calls.js +4 -0
  76. package/dist/types/contract.d.ts +30 -0
  77. package/dist/types/contract.js +4 -0
  78. package/dist/types/misc.d.ts +3 -0
  79. package/dist/types/misc.js +3 -0
  80. package/dist/types/multicall.d.ts +9 -0
  81. package/dist/types/multicall.js +2 -0
  82. package/dist/types/utils.d.ts +196 -0
  83. package/dist/types/utils.js +4 -0
  84. package/dist/utils/wait.d.ts +28 -0
  85. package/dist/utils/wait.js +34 -0
  86. package/package.json +72 -5
  87. package/index.js +0 -1
@@ -0,0 +1,345 @@
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
+ export interface EvmAccount {
9
+ /**
10
+ * The 0x-prefixed, checksum EVM address.
11
+ * @pattern ^0x[0-9a-fA-F]{40}$
12
+ */
13
+ address: string;
14
+ /**
15
+ * An optional name for the account.
16
+ Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
17
+ Account names are guaranteed to be unique across all EVM accounts in the developer's CDP Project.
18
+ * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
19
+ */
20
+ name?: string;
21
+ }
22
+ export interface ListResponse {
23
+ /** The token for the next page of items, if any. */
24
+ nextPageToken?: string;
25
+ }
26
+ /**
27
+ * The code that indicates the type of error that occurred. These error codes can be used to determine how to handle the error.
28
+ */
29
+ export type ErrorType = typeof ErrorType[keyof typeof ErrorType];
30
+ export declare const ErrorType: {
31
+ readonly already_exists: "already_exists";
32
+ readonly faucet_limit_exceeded: "faucet_limit_exceeded";
33
+ readonly forbidden: "forbidden";
34
+ readonly idempotency_error: "idempotency_error";
35
+ readonly internal_server_error: "internal_server_error";
36
+ readonly invalid_request: "invalid_request";
37
+ readonly invalid_signature: "invalid_signature";
38
+ readonly malformed_transaction: "malformed_transaction";
39
+ readonly not_found: "not_found";
40
+ readonly rate_limit_exceeded: "rate_limit_exceeded";
41
+ readonly request_canceled: "request_canceled";
42
+ readonly timed_out: "timed_out";
43
+ readonly unauthorized: "unauthorized";
44
+ };
45
+ /**
46
+ * An error response including the code for the type of error and a human-readable message describing the error.
47
+ */
48
+ export interface Error {
49
+ errorType: ErrorType;
50
+ /** The error message. */
51
+ errorMessage: string;
52
+ /** A unique identifier for the request that generated the error. This can be used to help debug issues with the API. */
53
+ correlationId?: string;
54
+ /** A link to the corresponding error documentation. */
55
+ errorLink?: string;
56
+ }
57
+ export interface EvmSmartAccount {
58
+ /**
59
+ * The 0x-prefixed, checksum address of the Smart Account.
60
+ * @pattern ^0x[0-9a-fA-F]{40}$
61
+ */
62
+ address: string;
63
+ /** Today, only a single owner can be set for a Smart Account, but this is an array to allow having multiple owners in the future. The address is a 0x-prefixed, checksum address. */
64
+ owners: string[];
65
+ /**
66
+ * An optional name for the account.
67
+ Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
68
+ Account names are guaranteed to be unique across all Smart Accounts in the developer's CDP Project.
69
+ * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
70
+ */
71
+ name?: string;
72
+ }
73
+ export interface EvmCall {
74
+ /**
75
+ * The address the call is directed to.
76
+ * @pattern ^0x[0-9a-fA-F]{40}$
77
+ */
78
+ to: string;
79
+ /** The amount of ETH to send with the call, in wei. */
80
+ value: string;
81
+ /**
82
+ * The call data to send. This is the hex-encoded data of the function call consisting of the method selector and the function arguments.
83
+ * @pattern ^0x[0-9a-fA-F]*$
84
+ */
85
+ data: string;
86
+ }
87
+ /**
88
+ * The network the user operation is for.
89
+ */
90
+ export type EvmUserOperationNetwork = typeof EvmUserOperationNetwork[keyof typeof EvmUserOperationNetwork];
91
+ export declare const EvmUserOperationNetwork: {
92
+ readonly 'base-sepolia': "base-sepolia";
93
+ readonly base: "base";
94
+ };
95
+ /**
96
+ * The status of the user operation.
97
+ */
98
+ export type EvmUserOperationStatus = typeof EvmUserOperationStatus[keyof typeof EvmUserOperationStatus];
99
+ export declare const EvmUserOperationStatus: {
100
+ readonly pending: "pending";
101
+ readonly signed: "signed";
102
+ readonly broadcast: "broadcast";
103
+ readonly complete: "complete";
104
+ readonly failed: "failed";
105
+ };
106
+ export interface EvmUserOperation {
107
+ /** The network the user operation is for. */
108
+ network: EvmUserOperationNetwork;
109
+ /**
110
+ * The hash of the user operation. This is not the transaction hash, as a transaction consists of multiple user operations. The user operation hash is the hash of this particular user operation which gets signed by the owner of the Smart Account.
111
+ * @pattern ^0x[0-9a-fA-F]{64}$
112
+ */
113
+ userOpHash: string;
114
+ /** The list of calls in the user operation. */
115
+ calls: EvmCall[];
116
+ /** The status of the user operation. */
117
+ status: EvmUserOperationStatus;
118
+ /**
119
+ * The hash of the transaction that included this particular user operation. This gets set after the user operation is broadcasted and the transaction is included in a block.
120
+ * @pattern ^0x[0-9a-fA-F]{64}$|^$
121
+ */
122
+ transactionHash?: string;
123
+ }
124
+ export interface SolanaAccount {
125
+ /**
126
+ * The base58 encoded Solana address.
127
+ * @pattern ^[1-9A-HJ-NP-Za-km-z]{32,44}$
128
+ */
129
+ address: string;
130
+ /**
131
+ * An optional name for the account.
132
+ Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
133
+ Account names are guaranteed to be unique across all Solana accounts in the developer's CDP Project.
134
+ * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
135
+ */
136
+ name?: string;
137
+ }
138
+ /**
139
+ * Internal server error.
140
+ */
141
+ export type InternalServerErrorResponse = Error;
142
+ /**
143
+ * Idempotency key conflict.
144
+ */
145
+ export type IdempotencyErrorResponse = Error;
146
+ /**
147
+ * The resource already exists.
148
+ */
149
+ export type AlreadyExistsErrorResponse = Error;
150
+ /**
151
+ * A JWT signed using your Wallet Secret, encoded in base64. Refer to the
152
+ [Generate a Wallet Token](https://docs.cdp.coinbase.com/api-v2/docs/authentication#3-generate-a-wallet-token)
153
+ section of our Authentication docs for more details on how to generate your Wallet Token.
154
+
155
+ */
156
+ export type XWalletAuthParameter = string;
157
+ /**
158
+ * An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
159
+ When included, duplicate requests with the same key will return identical responses.
160
+ Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-v2/docs/idempotency) for more information on using idempotency keys.
161
+
162
+ */
163
+ export type IdempotencyKeyParameter = string;
164
+ export type ListEvmAccountsParams = {
165
+ /**
166
+ * The number of accounts to return per page.
167
+ */
168
+ pageSize?: number;
169
+ /**
170
+ * The token for the next page of accounts, if any.
171
+ */
172
+ pageToken?: string;
173
+ };
174
+ export type ListEvmAccounts200AllOf = {
175
+ /** The list of EVM accounts. */
176
+ accounts: EvmAccount[];
177
+ };
178
+ export type ListEvmAccounts200 = ListEvmAccounts200AllOf & ListResponse;
179
+ export type CreateEvmAccountBody = {
180
+ /**
181
+ * An optional name for the account.
182
+ Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
183
+ Account names must be unique across all EVM accounts in the developer's CDP Project.
184
+ * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
185
+ */
186
+ name?: string;
187
+ };
188
+ export type SignEvmTransactionBody = {
189
+ /** The RLP-encoded transaction to sign, as a 0x-prefixed hex string. */
190
+ transaction: string;
191
+ };
192
+ export type SignEvmTransaction200 = {
193
+ /** The RLP-encoded signed transaction, as a 0x-prefixed hex string. */
194
+ signedTransaction: string;
195
+ };
196
+ export type SignEvmHashBody = {
197
+ /** The arbitrary 32 byte hash to sign. */
198
+ hash: string;
199
+ };
200
+ export type SignEvmHash200 = {
201
+ /** The signature of the hash, as a 0x-prefixed hex string. */
202
+ signature: string;
203
+ };
204
+ export type SignEvmMessageBody = {
205
+ /** The message to sign. */
206
+ message: string;
207
+ };
208
+ export type SignEvmMessage200 = {
209
+ /** The signature of the message, as a 0x-prefixed hex string. */
210
+ signature: string;
211
+ };
212
+ export type ListEvmSmartAccountsParams = {
213
+ /**
214
+ * The number of accounts to return per page.
215
+ */
216
+ pageSize?: number;
217
+ /**
218
+ * The token for the next page of accounts, if any.
219
+ */
220
+ pageToken?: string;
221
+ };
222
+ export type ListEvmSmartAccounts200AllOf = {
223
+ /** The list of Smart Accounts. */
224
+ accounts: EvmSmartAccount[];
225
+ };
226
+ export type ListEvmSmartAccounts200 = ListEvmSmartAccounts200AllOf & ListResponse;
227
+ export type CreateEvmSmartAccountBody = {
228
+ /** Today, only a single owner can be set for a Smart Account, but this is an array to allow setting multiple owners in the future. */
229
+ owners: string[];
230
+ };
231
+ /**
232
+ * The network to prepare the user operation for.
233
+ */
234
+ export type PrepareUserOperationBodyNetwork = typeof PrepareUserOperationBodyNetwork[keyof typeof PrepareUserOperationBodyNetwork];
235
+ export declare const PrepareUserOperationBodyNetwork: {
236
+ readonly 'base-sepolia': "base-sepolia";
237
+ readonly base: "base";
238
+ };
239
+ export type PrepareUserOperationBody = {
240
+ /** The network to prepare the user operation for. */
241
+ network: PrepareUserOperationBodyNetwork;
242
+ /** The list of calls to make from the Smart Account. */
243
+ calls: EvmCall[];
244
+ /** The URL of the paymaster to use for the user operation. */
245
+ paymasterUrl?: string;
246
+ };
247
+ export type SendUserOperationBody = {
248
+ /** The hex-encoded signature of the user operation. */
249
+ signature: string;
250
+ };
251
+ /**
252
+ * The network to request funds from.
253
+ */
254
+ export type RequestEvmFaucetBodyNetwork = typeof RequestEvmFaucetBodyNetwork[keyof typeof RequestEvmFaucetBodyNetwork];
255
+ export declare const RequestEvmFaucetBodyNetwork: {
256
+ readonly 'base-sepolia': "base-sepolia";
257
+ readonly 'ethereum-sepolia': "ethereum-sepolia";
258
+ };
259
+ /**
260
+ * The token to request funds for.
261
+ */
262
+ export type RequestEvmFaucetBodyToken = typeof RequestEvmFaucetBodyToken[keyof typeof RequestEvmFaucetBodyToken];
263
+ export declare const RequestEvmFaucetBodyToken: {
264
+ readonly eth: "eth";
265
+ readonly usdc: "usdc";
266
+ readonly eurc: "eurc";
267
+ readonly cbbtc: "cbbtc";
268
+ };
269
+ export type RequestEvmFaucetBody = {
270
+ /** The network to request funds from. */
271
+ network: RequestEvmFaucetBodyNetwork;
272
+ /**
273
+ * The address to request funds to, which is a 0x-prefixed hexadecimal string.
274
+ * @pattern ^0x[0-9a-fA-F]{40}$
275
+ */
276
+ address: string;
277
+ /** The token to request funds for. */
278
+ token: RequestEvmFaucetBodyToken;
279
+ };
280
+ export type RequestEvmFaucet200 = {
281
+ /** The hash of the transaction that requested the funds.
282
+ **Note:** In rare cases, when gas conditions are unusually high, the transaction may not confirm, and the system may issue a replacement transaction to complete the faucet request. In these rare cases, the `transactionHash` will be out of sync with the actual faucet transaction that was confirmed onchain. */
283
+ transactionHash: string;
284
+ };
285
+ export type ListSolanaAccountsParams = {
286
+ /**
287
+ * The number of accounts to return per page.
288
+ */
289
+ pageSize?: number;
290
+ /**
291
+ * The token for the next page of accounts, if any.
292
+ */
293
+ pageToken?: string;
294
+ };
295
+ export type ListSolanaAccounts200AllOf = {
296
+ /** The list of Solana accounts. */
297
+ accounts: SolanaAccount[];
298
+ };
299
+ export type ListSolanaAccounts200 = ListSolanaAccounts200AllOf & ListResponse;
300
+ export type CreateSolanaAccountBody = {
301
+ /**
302
+ * An optional name for the account.
303
+ Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
304
+ Account names must be unique across all Solana accounts in the developer's CDP Project.
305
+ * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
306
+ */
307
+ name?: string;
308
+ };
309
+ export type SignSolanaTransactionBody = {
310
+ /** The base64 encoded transaction to sign. */
311
+ transaction: string;
312
+ };
313
+ export type SignSolanaTransaction200 = {
314
+ /** The base64 encoded signed transaction. */
315
+ signedTransaction: string;
316
+ };
317
+ export type SignSolanaMessageBody = {
318
+ /** The arbitrary message to sign. */
319
+ message: string;
320
+ };
321
+ export type SignSolanaMessage200 = {
322
+ /** The signature of the message, as a base58 encoded string. */
323
+ signature: string;
324
+ };
325
+ /**
326
+ * The token to request funds for.
327
+ */
328
+ export type RequestSolanaFaucetBodyToken = typeof RequestSolanaFaucetBodyToken[keyof typeof RequestSolanaFaucetBodyToken];
329
+ export declare const RequestSolanaFaucetBodyToken: {
330
+ readonly sol: "sol";
331
+ readonly usdc: "usdc";
332
+ };
333
+ export type RequestSolanaFaucetBody = {
334
+ /**
335
+ * The address to request funds to, which is a base58-encoded string.
336
+ * @pattern ^[1-9A-HJ-NP-Za-km-z]{32,44}$
337
+ */
338
+ address: string;
339
+ /** The token to request funds for. */
340
+ token: RequestSolanaFaucetBodyToken;
341
+ };
342
+ export type RequestSolanaFaucet200 = {
343
+ /** The signature identifying the transaction that requested the funds. */
344
+ transactionSignature: string;
345
+ };
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RequestSolanaFaucetBodyToken = exports.RequestEvmFaucetBodyToken = exports.RequestEvmFaucetBodyNetwork = exports.PrepareUserOperationBodyNetwork = exports.EvmUserOperationStatus = exports.EvmUserOperationNetwork = exports.ErrorType = void 0;
4
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
5
+ exports.ErrorType = {
6
+ already_exists: 'already_exists',
7
+ faucet_limit_exceeded: 'faucet_limit_exceeded',
8
+ forbidden: 'forbidden',
9
+ idempotency_error: 'idempotency_error',
10
+ internal_server_error: 'internal_server_error',
11
+ invalid_request: 'invalid_request',
12
+ invalid_signature: 'invalid_signature',
13
+ malformed_transaction: 'malformed_transaction',
14
+ not_found: 'not_found',
15
+ rate_limit_exceeded: 'rate_limit_exceeded',
16
+ request_canceled: 'request_canceled',
17
+ timed_out: 'timed_out',
18
+ unauthorized: 'unauthorized',
19
+ };
20
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
21
+ exports.EvmUserOperationNetwork = {
22
+ 'base-sepolia': 'base-sepolia',
23
+ base: 'base',
24
+ };
25
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
26
+ exports.EvmUserOperationStatus = {
27
+ pending: 'pending',
28
+ signed: 'signed',
29
+ broadcast: 'broadcast',
30
+ complete: 'complete',
31
+ failed: 'failed',
32
+ };
33
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
34
+ exports.PrepareUserOperationBodyNetwork = {
35
+ 'base-sepolia': 'base-sepolia',
36
+ base: 'base',
37
+ };
38
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
39
+ exports.RequestEvmFaucetBodyNetwork = {
40
+ 'base-sepolia': 'base-sepolia',
41
+ 'ethereum-sepolia': 'ethereum-sepolia',
42
+ };
43
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
44
+ exports.RequestEvmFaucetBodyToken = {
45
+ eth: 'eth',
46
+ usdc: 'usdc',
47
+ eurc: 'eurc',
48
+ cbbtc: 'cbbtc',
49
+ };
50
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
51
+ exports.RequestSolanaFaucetBodyToken = {
52
+ sol: 'sol',
53
+ usdc: 'usdc',
54
+ };
@@ -0,0 +1,62 @@
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 { CreateEvmAccountBody, EvmAccount, ListEvmAccounts200, ListEvmAccountsParams, SignEvmHash200, SignEvmHashBody, SignEvmMessage200, SignEvmMessageBody, SignEvmTransaction200, SignEvmTransactionBody } from '../coinbaseDeveloperPlatformAPIs.schemas';
9
+ import { cdpApiClient } from '../../cdpApiClient';
10
+ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
11
+ /**
12
+ * Lists the EVM accounts belonging to the developer's CDP Project.
13
+ The response is paginated, and by default, returns 20 accounts per page.
14
+ * @summary List EVM accounts
15
+ */
16
+ export declare const listEvmAccounts: (params?: ListEvmAccountsParams, options?: SecondParameter<typeof cdpApiClient>) => Promise<ListEvmAccounts200>;
17
+ /**
18
+ * Creates a new EVM account.
19
+ * @summary Create an EVM account
20
+ */
21
+ export declare const createEvmAccount: (createEvmAccountBody?: CreateEvmAccountBody, options?: SecondParameter<typeof cdpApiClient>) => Promise<EvmAccount>;
22
+ /**
23
+ * Gets an EVM account by its address.
24
+ * @summary Get an EVM account by address
25
+ */
26
+ export declare const getEvmAccount: (address: string, options?: SecondParameter<typeof cdpApiClient>) => Promise<EvmAccount>;
27
+ /**
28
+ * Gets an EVM account by its name.
29
+ * @summary Get an EVM account by name
30
+ */
31
+ export declare const getEvmAccountByName: (name: string, options?: SecondParameter<typeof cdpApiClient>) => Promise<EvmAccount>;
32
+ /**
33
+ * Signs a transaction with the given EVM account.
34
+ The transaction should be serialized as a hex string using [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/).
35
+
36
+ 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.
37
+ * @summary Sign a transaction
38
+ */
39
+ export declare const signEvmTransaction: (address: string, signEvmTransactionBody: SignEvmTransactionBody, options?: SecondParameter<typeof cdpApiClient>) => Promise<SignEvmTransaction200>;
40
+ /**
41
+ * Signs an arbitrary 32 byte hash with the given EVM account.
42
+
43
+
44
+ **WARNING: This API will likely be deprecated in the future.** It is recommended not to depend on it. Never sign a hash that you didn't generate, as it can be an arbitrary transaction. For example, it might send all of your funds to an attacker.
45
+ * @summary Sign a hash
46
+ */
47
+ export declare const signEvmHash: (address: string, signEvmHashBody: SignEvmHashBody, options?: SecondParameter<typeof cdpApiClient>) => Promise<SignEvmHash200>;
48
+ /**
49
+ * Signs an [EIP-191](https://eips.ethereum.org/EIPS/eip-191) message with the given EVM account.
50
+
51
+ Per the specification, the message in the request body is prepended with `0x19 <0x45 (E)> <thereum Signed Message:\n" + len(message)>` before being signed.
52
+ * @summary Sign an EIP-191 message
53
+ */
54
+ export declare const signEvmMessage: (address: string, signEvmMessageBody: SignEvmMessageBody, options?: SecondParameter<typeof cdpApiClient>) => Promise<SignEvmMessage200>;
55
+ export type ListEvmAccountsResult = NonNullable<Awaited<ReturnType<typeof listEvmAccounts>>>;
56
+ export type CreateEvmAccountResult = NonNullable<Awaited<ReturnType<typeof createEvmAccount>>>;
57
+ export type GetEvmAccountResult = NonNullable<Awaited<ReturnType<typeof getEvmAccount>>>;
58
+ export type GetEvmAccountByNameResult = NonNullable<Awaited<ReturnType<typeof getEvmAccountByName>>>;
59
+ export type SignEvmTransactionResult = NonNullable<Awaited<ReturnType<typeof signEvmTransaction>>>;
60
+ export type SignEvmHashResult = NonNullable<Awaited<ReturnType<typeof signEvmHash>>>;
61
+ export type SignEvmMessageResult = NonNullable<Awaited<ReturnType<typeof signEvmMessage>>>;
62
+ export {};
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.signEvmMessage = exports.signEvmHash = exports.signEvmTransaction = exports.getEvmAccountByName = exports.getEvmAccount = exports.createEvmAccount = exports.listEvmAccounts = void 0;
4
+ const cdpApiClient_1 = require("../../cdpApiClient");
5
+ /**
6
+ * Lists the EVM accounts belonging to the developer's CDP Project.
7
+ The response is paginated, and by default, returns 20 accounts per page.
8
+ * @summary List EVM accounts
9
+ */
10
+ const listEvmAccounts = (params, options) => {
11
+ return (0, cdpApiClient_1.cdpApiClient)({ url: `/v2/evm/accounts`, method: 'GET',
12
+ params
13
+ }, options);
14
+ };
15
+ exports.listEvmAccounts = listEvmAccounts;
16
+ /**
17
+ * Creates a new EVM account.
18
+ * @summary Create an EVM account
19
+ */
20
+ const createEvmAccount = (createEvmAccountBody, options) => {
21
+ return (0, cdpApiClient_1.cdpApiClient)({ url: `/v2/evm/accounts`, method: 'POST',
22
+ headers: { 'Content-Type': 'application/json', },
23
+ data: createEvmAccountBody
24
+ }, options);
25
+ };
26
+ exports.createEvmAccount = createEvmAccount;
27
+ /**
28
+ * Gets an EVM account by its address.
29
+ * @summary Get an EVM account by address
30
+ */
31
+ const getEvmAccount = (address, options) => {
32
+ return (0, cdpApiClient_1.cdpApiClient)({ url: `/v2/evm/accounts/${address}`, method: 'GET'
33
+ }, options);
34
+ };
35
+ exports.getEvmAccount = getEvmAccount;
36
+ /**
37
+ * Gets an EVM account by its name.
38
+ * @summary Get an EVM account by name
39
+ */
40
+ const getEvmAccountByName = (name, options) => {
41
+ return (0, cdpApiClient_1.cdpApiClient)({ url: `/v2/evm/accounts/by-name/${name}`, method: 'GET'
42
+ }, options);
43
+ };
44
+ exports.getEvmAccountByName = getEvmAccountByName;
45
+ /**
46
+ * Signs a transaction with the given EVM account.
47
+ The transaction should be serialized as a hex string using [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/).
48
+
49
+ 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.
50
+ * @summary Sign a transaction
51
+ */
52
+ const signEvmTransaction = (address, signEvmTransactionBody, options) => {
53
+ return (0, cdpApiClient_1.cdpApiClient)({ url: `/v2/evm/accounts/${address}/sign/transaction`, method: 'POST',
54
+ headers: { 'Content-Type': 'application/json', },
55
+ data: signEvmTransactionBody
56
+ }, options);
57
+ };
58
+ exports.signEvmTransaction = signEvmTransaction;
59
+ /**
60
+ * Signs an arbitrary 32 byte hash with the given EVM account.
61
+
62
+
63
+ **WARNING: This API will likely be deprecated in the future.** It is recommended not to depend on it. Never sign a hash that you didn't generate, as it can be an arbitrary transaction. For example, it might send all of your funds to an attacker.
64
+ * @summary Sign a hash
65
+ */
66
+ const signEvmHash = (address, signEvmHashBody, options) => {
67
+ return (0, cdpApiClient_1.cdpApiClient)({ url: `/v2/evm/accounts/${address}/sign`, method: 'POST',
68
+ headers: { 'Content-Type': 'application/json', },
69
+ data: signEvmHashBody
70
+ }, options);
71
+ };
72
+ exports.signEvmHash = signEvmHash;
73
+ /**
74
+ * Signs an [EIP-191](https://eips.ethereum.org/EIPS/eip-191) message with the given EVM account.
75
+
76
+ Per the specification, the message in the request body is prepended with `0x19 <0x45 (E)> <thereum Signed Message:\n" + len(message)>` before being signed.
77
+ * @summary Sign an EIP-191 message
78
+ */
79
+ const signEvmMessage = (address, signEvmMessageBody, options) => {
80
+ return (0, cdpApiClient_1.cdpApiClient)({ url: `/v2/evm/accounts/${address}/sign/message`, method: 'POST',
81
+ headers: { 'Content-Type': 'application/json', },
82
+ data: signEvmMessageBody
83
+ }, options);
84
+ };
85
+ exports.signEvmMessage = signEvmMessage;
@@ -0,0 +1,17 @@
1
+ import { http } from 'msw';
2
+ import type { EvmAccount, ListEvmAccounts200, SignEvmHash200, SignEvmMessage200, SignEvmTransaction200 } from '../coinbaseDeveloperPlatformAPIs.schemas';
3
+ export declare const getListEvmAccountsResponseMock: () => ListEvmAccounts200;
4
+ export declare const getCreateEvmAccountResponseMock: (overrideResponse?: Partial<EvmAccount>) => EvmAccount;
5
+ export declare const getGetEvmAccountResponseMock: (overrideResponse?: Partial<EvmAccount>) => EvmAccount;
6
+ export declare const getGetEvmAccountByNameResponseMock: (overrideResponse?: Partial<EvmAccount>) => EvmAccount;
7
+ export declare const getSignEvmTransactionResponseMock: (overrideResponse?: Partial<SignEvmTransaction200>) => SignEvmTransaction200;
8
+ export declare const getSignEvmHashResponseMock: (overrideResponse?: Partial<SignEvmHash200>) => SignEvmHash200;
9
+ export declare const getSignEvmMessageResponseMock: (overrideResponse?: Partial<SignEvmMessage200>) => SignEvmMessage200;
10
+ export declare const getListEvmAccountsMockHandler: (overrideResponse?: ListEvmAccounts200 | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<ListEvmAccounts200> | ListEvmAccounts200)) => import("msw").HttpHandler;
11
+ export declare const getCreateEvmAccountMockHandler: (overrideResponse?: EvmAccount | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<EvmAccount> | EvmAccount)) => import("msw").HttpHandler;
12
+ export declare const getGetEvmAccountMockHandler: (overrideResponse?: EvmAccount | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<EvmAccount> | EvmAccount)) => import("msw").HttpHandler;
13
+ export declare const getGetEvmAccountByNameMockHandler: (overrideResponse?: EvmAccount | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<EvmAccount> | EvmAccount)) => import("msw").HttpHandler;
14
+ export declare const getSignEvmTransactionMockHandler: (overrideResponse?: SignEvmTransaction200 | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<SignEvmTransaction200> | SignEvmTransaction200)) => import("msw").HttpHandler;
15
+ export declare const getSignEvmHashMockHandler: (overrideResponse?: SignEvmHash200 | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<SignEvmHash200> | SignEvmHash200)) => import("msw").HttpHandler;
16
+ export declare const getSignEvmMessageMockHandler: (overrideResponse?: SignEvmMessage200 | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<SignEvmMessage200> | SignEvmMessage200)) => import("msw").HttpHandler;
17
+ export declare const getEvmAccountsMock: () => import("msw").HttpHandler[];