@coinbase/cdp-sdk 1.13.0 → 1.15.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 +22 -0
- package/README.md +41 -1
- package/_cjs/accounts/evm/toEvmServerAccount.js +5 -0
- package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_cjs/actions/evm/listTokenBalances.js +1 -1
- package/_cjs/actions/evm/listTokenBalances.js.map +1 -1
- package/_cjs/analytics.js +1 -1
- package/_cjs/analytics.js.map +1 -1
- package/_cjs/client/evm/evm.js +102 -2
- package/_cjs/client/evm/evm.js.map +1 -1
- package/_cjs/client/solana/solana.js +43 -0
- package/_cjs/client/solana/solana.js.map +1 -1
- package/_cjs/openapi-client/cdpApiClient.js +15 -2
- package/_cjs/openapi-client/cdpApiClient.js.map +1 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +1 -0
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.js +27 -1
- package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.msw.js +32 -1
- package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +9 -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 +23 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/faucets/faucets.js +1 -1
- package/_cjs/openapi-client/generated/index.msw.js +4 -4
- package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js +27 -1
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -1
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js +32 -1
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
- package/_cjs/utils/export.js +84 -0
- package/_cjs/utils/export.js.map +1 -0
- package/_cjs/version.js +1 -1
- package/_esm/accounts/evm/toEvmServerAccount.js +6 -1
- package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_esm/actions/evm/listTokenBalances.js +1 -1
- package/_esm/actions/evm/listTokenBalances.js.map +1 -1
- package/_esm/analytics.js +2 -2
- package/_esm/analytics.js.map +1 -1
- package/_esm/client/evm/evm.js +103 -3
- package/_esm/client/evm/evm.js.map +1 -1
- package/_esm/client/solana/solana.js +43 -0
- package/_esm/client/solana/solana.js.map +1 -1
- package/_esm/openapi-client/cdpApiClient.js +15 -2
- package/_esm/openapi-client/cdpApiClient.js.map +1 -1
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +1 -0
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js +24 -0
- package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -1
- package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js +27 -0
- package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -1
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +7 -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 +20 -0
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
- package/_esm/openapi-client/generated/faucets/faucets.js +1 -1
- package/_esm/openapi-client/generated/index.msw.js +4 -4
- package/_esm/openapi-client/generated/index.msw.js.map +1 -1
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js +24 -0
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -1
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js +27 -0
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
- package/_esm/utils/export.js +75 -0
- package/_esm/utils/export.js.map +1 -0
- package/_esm/version.js +1 -1
- package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
- package/_types/actions/evm/listTokenBalances.d.ts +1 -1
- package/_types/client/cdp.d.ts +1 -2
- package/_types/client/cdp.d.ts.map +1 -1
- package/_types/client/evm/evm.d.ts +53 -4
- package/_types/client/evm/evm.d.ts.map +1 -1
- package/_types/client/evm/evm.types.d.ts +27 -2
- package/_types/client/evm/evm.types.d.ts.map +1 -1
- package/_types/client/solana/solana.d.ts +26 -1
- package/_types/client/solana/solana.d.ts.map +1 -1
- package/_types/client/solana/solana.types.d.ts +13 -1
- package/_types/client/solana/solana.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 +44 -4
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-accounts/evm-accounts.d.ts +13 -1
- package/_types/openapi-client/generated/evm-accounts/evm-accounts.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts +5 -1
- package/_types/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +6 -0
- 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 +2 -0
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/faucets/faucets.d.ts +1 -1
- package/_types/openapi-client/generated/index.msw.d.ts +4 -4
- package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts +13 -1
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts.map +1 -1
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts +5 -1
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts.map +1 -1
- package/_types/openapi-client/index.d.ts +10 -0
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/utils/export.d.ts +30 -0
- package/_types/utils/export.d.ts.map +1 -0
- package/_types/version.d.ts +1 -1
- package/accounts/evm/toEvmServerAccount.ts +6 -1
- package/actions/evm/listTokenBalances.ts +2 -2
- package/analytics.ts +2 -2
- package/client/cdp.ts +1 -1
- package/client/evm/evm.ts +140 -26
- package/client/evm/evm.types.ts +33 -1
- package/client/solana/solana.ts +61 -0
- package/client/solana/solana.types.ts +15 -0
- package/openapi-client/cdpApiClient.ts +17 -2
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +52 -4
- package/openapi-client/generated/evm-accounts/evm-accounts.msw.ts +61 -0
- package/openapi-client/generated/evm-accounts/evm-accounts.ts +46 -0
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.ts +38 -0
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +16 -0
- package/openapi-client/generated/faucets/faucets.ts +1 -1
- package/openapi-client/generated/index.msw.ts +4 -4
- package/openapi-client/generated/solana-accounts/solana-accounts.msw.ts +61 -0
- package/openapi-client/generated/solana-accounts/solana-accounts.ts +48 -0
- package/package.json +1 -1
- package/utils/export.ts +89 -0
- package/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../openapi-client/index.ts"],"names":[],"mappings":"AAAA,cAAc,sDAAsD,CAAC;AACrE,cAAc,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C,2HAA+D,EAAC,4BAAiD;4BAAk4B,eAAkB,EAAC,mHAAuD,EAAC,4BAAiD;wBAAijB,eAAkB,EAAC,2GAA+C,EAAC,4BAAiD;CAP7vH,CAAC;AAEF,eAAO,MAAM,sBAAsB;mBAhCvB,0FAA8B,EAAC,4BACf;mBAIrB,iGAAoC,EAAC,4BAE1B;oBAoBjB,gBAAgB,EAAC,4BAEJ;mBAQiJ,gBAAgB,EAAC,4BAA+C;mBAAwU,gBAAmB,EAAC,iGAAqC,EAAC,4BAAiD;CAHjpB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,OAAO,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a new RSA key pair with 4096-bit private key.
|
|
3
|
+
* - Private key in PKCS1 DER format
|
|
4
|
+
* - Public key in PKIX/SPKI DER format
|
|
5
|
+
*
|
|
6
|
+
* @returns A promise that resolves to the generated key pair, or rejects with an error.
|
|
7
|
+
*/
|
|
8
|
+
export declare const generateExportEncryptionKeyPair: () => Promise<{
|
|
9
|
+
publicKey: string;
|
|
10
|
+
privateKey: string;
|
|
11
|
+
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Decrypts a ciphertext using RSA-OAEP-SHA256.
|
|
14
|
+
* - Parses PKCS1 private key
|
|
15
|
+
* - Uses RSA-OAEP-SHA256 for decryption
|
|
16
|
+
* - Returns hex-encoded result
|
|
17
|
+
*
|
|
18
|
+
* @param b64PrivateKey - The base64-encoded private key in PKCS1 DER format.
|
|
19
|
+
* @param b64Cipher - The base64-encoded ciphertext.
|
|
20
|
+
* @returns The decrypted key hex string, or throws an error if decryption fails.
|
|
21
|
+
*/
|
|
22
|
+
export declare const decryptWithPrivateKey: (b64PrivateKey: string, b64Cipher: string) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Format a private key to a base58 string for easy import into Solana wallet apps.
|
|
25
|
+
*
|
|
26
|
+
* @param privateKey - The private key as a hex string
|
|
27
|
+
* @returns The formatted private key as a base58 string
|
|
28
|
+
*/
|
|
29
|
+
export declare const formatSolanaPrivateKey: (privateKey: string) => string;
|
|
30
|
+
//# sourceMappingURL=export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../utils/export.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B;eAE7B,MAAM;gBACL,MAAM;EA0BrB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,GAAI,eAAe,MAAM,EAAE,WAAW,MAAM,KAAG,MAsBhF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,YAAY,MAAM,KAAG,MAK3D,CAAC"}
|
package/_types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "1.
|
|
1
|
+
export declare const version = "1.15.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TransactionSerializable, serializeTransaction } from "viem";
|
|
1
|
+
import { type TransactionSerializable, getTypesForEIP712Domain, serializeTransaction } from "viem";
|
|
2
2
|
|
|
3
3
|
import { FundOptions, fund } from "../../actions/evm/fund/fund.js";
|
|
4
4
|
import { Quote } from "../../actions/evm/fund/Quote.js";
|
|
@@ -84,6 +84,11 @@ export function toEvmServerAccount(
|
|
|
84
84
|
},
|
|
85
85
|
|
|
86
86
|
async signTypedData(message: EIP712Message) {
|
|
87
|
+
if (!message.types.EIP712Domain) {
|
|
88
|
+
message.types.EIP712Domain = getTypesForEIP712Domain({
|
|
89
|
+
domain: message.domain,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
87
92
|
const result = await apiClient.signEvmTypedData(options.account.address, message);
|
|
88
93
|
return result.signature as Hex;
|
|
89
94
|
},
|
|
@@ -32,7 +32,7 @@ export interface EvmTokenAmount {
|
|
|
32
32
|
/** The amount of the token in the smallest indivisible unit of the token. */
|
|
33
33
|
amount: bigint;
|
|
34
34
|
/** The number of decimals in the token. */
|
|
35
|
-
decimals:
|
|
35
|
+
decimals: number;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* An EVM token balance.
|
|
@@ -95,7 +95,7 @@ export async function listTokenBalances(
|
|
|
95
95
|
},
|
|
96
96
|
amount: {
|
|
97
97
|
amount: BigInt(balance.amount.amount),
|
|
98
|
-
decimals:
|
|
98
|
+
decimals: balance.amount.decimals,
|
|
99
99
|
},
|
|
100
100
|
};
|
|
101
101
|
});
|
package/analytics.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import md5 from "md5";
|
|
2
2
|
|
|
3
|
-
import { APIError } from "./openapi-client/errors.js";
|
|
3
|
+
import { APIError, HttpErrorType } from "./openapi-client/errors.js";
|
|
4
4
|
import { version } from "./version.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -184,7 +184,7 @@ function shouldTrackError(error: unknown): boolean {
|
|
|
184
184
|
return false;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
if (error instanceof APIError) {
|
|
187
|
+
if (error instanceof APIError && error.errorType !== HttpErrorType.unexpected_error) {
|
|
188
188
|
return false;
|
|
189
189
|
}
|
|
190
190
|
|
package/client/cdp.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { EvmClient } from "./evm/evm.js";
|
|
|
5
5
|
import { PoliciesClient } from "./policies/policies.js";
|
|
6
6
|
import { SolanaClient } from "./solana/solana.js";
|
|
7
7
|
|
|
8
|
-
interface CdpClientOptions {
|
|
8
|
+
export interface CdpClientOptions {
|
|
9
9
|
/** The API key ID. */
|
|
10
10
|
apiKeyId?: string;
|
|
11
11
|
/** The API key secret. */
|
package/client/evm/evm.ts
CHANGED
|
@@ -1,50 +1,52 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { constants, publicEncrypt } from "crypto";
|
|
2
2
|
|
|
3
3
|
import { Address } from "viem";
|
|
4
4
|
|
|
5
5
|
import { ImportEvmAccountPublicRSAKey } from "./constants.js";
|
|
6
6
|
import {
|
|
7
7
|
CreateServerAccountOptions,
|
|
8
|
-
GetServerAccountOptions,
|
|
9
|
-
ListServerAccountsOptions,
|
|
10
8
|
CreateSmartAccountOptions,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
SignatureResult,
|
|
14
|
-
SignMessageOptions,
|
|
15
|
-
SignTransactionOptions,
|
|
16
|
-
GetSmartAccountOptions,
|
|
17
|
-
SmartAccount,
|
|
18
|
-
ServerAccount,
|
|
9
|
+
CreateSwapQuoteOptions,
|
|
10
|
+
CreateSwapQuoteResult,
|
|
19
11
|
EvmClientInterface,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
ExportServerAccountOptions,
|
|
13
|
+
GetOrCreateServerAccountOptions,
|
|
14
|
+
GetOrCreateSmartAccountOptions,
|
|
15
|
+
GetServerAccountOptions,
|
|
16
|
+
GetSmartAccountOptions,
|
|
17
|
+
GetSwapPriceOptions,
|
|
18
|
+
GetSwapPriceResult,
|
|
23
19
|
GetUserOperationOptions,
|
|
20
|
+
ImportServerAccountOptions,
|
|
21
|
+
ListServerAccountResult,
|
|
22
|
+
ListServerAccountsOptions,
|
|
24
23
|
ListSmartAccountResult,
|
|
25
24
|
ListSmartAccountsOptions,
|
|
26
|
-
|
|
25
|
+
PrepareUserOperationOptions,
|
|
26
|
+
ServerAccount,
|
|
27
|
+
SignatureResult,
|
|
28
|
+
SignHashOptions,
|
|
29
|
+
SignMessageOptions,
|
|
30
|
+
SignTransactionOptions,
|
|
27
31
|
SignTypedDataOptions,
|
|
28
|
-
|
|
29
|
-
ImportServerAccountOptions,
|
|
30
|
-
GetSwapPriceOptions,
|
|
31
|
-
CreateSwapQuoteOptions,
|
|
32
|
-
GetSwapPriceResult,
|
|
33
|
-
CreateSwapQuoteResult,
|
|
32
|
+
SmartAccount,
|
|
34
33
|
SwapUnavailableResult,
|
|
34
|
+
UpdateEvmAccountOptions,
|
|
35
|
+
UserOperation,
|
|
36
|
+
WaitForUserOperationOptions,
|
|
35
37
|
} from "./evm.types.js";
|
|
36
38
|
import { toEvmServerAccount } from "../../accounts/evm/toEvmServerAccount.js";
|
|
37
39
|
import { toEvmSmartAccount } from "../../accounts/evm/toEvmSmartAccount.js";
|
|
38
40
|
import { getUserOperation } from "../../actions/evm/getUserOperation.js";
|
|
39
41
|
import {
|
|
40
42
|
listTokenBalances,
|
|
41
|
-
ListTokenBalancesResult,
|
|
42
43
|
ListTokenBalancesOptions,
|
|
44
|
+
ListTokenBalancesResult,
|
|
43
45
|
} from "../../actions/evm/listTokenBalances.js";
|
|
44
46
|
import {
|
|
47
|
+
requestFaucet,
|
|
45
48
|
RequestFaucetOptions,
|
|
46
49
|
RequestFaucetResult,
|
|
47
|
-
requestFaucet,
|
|
48
50
|
} from "../../actions/evm/requestFaucet.js";
|
|
49
51
|
import { sendTransaction } from "../../actions/evm/sendTransaction.js";
|
|
50
52
|
import {
|
|
@@ -62,10 +64,11 @@ import { Analytics } from "../../analytics.js";
|
|
|
62
64
|
import { APIError } from "../../openapi-client/errors.js";
|
|
63
65
|
import { CdpOpenApiClient } from "../../openapi-client/index.js";
|
|
64
66
|
import { Hex } from "../../types/misc.js";
|
|
67
|
+
import { decryptWithPrivateKey, generateExportEncryptionKeyPair } from "../../utils/export.js";
|
|
65
68
|
|
|
66
69
|
import type {
|
|
67
|
-
TransactionResult,
|
|
68
70
|
SendTransactionOptions,
|
|
71
|
+
TransactionResult,
|
|
69
72
|
} from "../../actions/evm/sendTransaction.js";
|
|
70
73
|
|
|
71
74
|
/**
|
|
@@ -212,6 +215,61 @@ export class EvmClient implements EvmClientInterface {
|
|
|
212
215
|
}
|
|
213
216
|
}
|
|
214
217
|
|
|
218
|
+
/**
|
|
219
|
+
* Exports a CDP EVM account's private key.
|
|
220
|
+
* It is important to store the private key in a secure place after it's exported.
|
|
221
|
+
*
|
|
222
|
+
* @param {ExportServerAccountOptions} options - Parameters for exporting the account.
|
|
223
|
+
* @param {string} [options.address] - The address of the account to export.
|
|
224
|
+
* @param {string} [options.name] - The name of the account to export.
|
|
225
|
+
* @param {string} [options.idempotencyKey] - An idempotency key.
|
|
226
|
+
*
|
|
227
|
+
* @returns A promise that resolves to the exported account’s 32-byte private key as a hex string, without the "0x" prefix.
|
|
228
|
+
*
|
|
229
|
+
* @example **With an address**
|
|
230
|
+
* ```ts
|
|
231
|
+
* const privateKey = await cdp.evm.exportAccount({
|
|
232
|
+
* address: "0x1234567890123456789012345678901234567890",
|
|
233
|
+
* });
|
|
234
|
+
* ```
|
|
235
|
+
*
|
|
236
|
+
* @example **With a name**
|
|
237
|
+
* ```ts
|
|
238
|
+
* const privateKey = await cdp.evm.exportAccount({
|
|
239
|
+
* name: "MyAccount",
|
|
240
|
+
* });
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
async exportAccount(options: ExportServerAccountOptions): Promise<string> {
|
|
244
|
+
const { publicKey, privateKey } = await generateExportEncryptionKeyPair();
|
|
245
|
+
|
|
246
|
+
const { encryptedPrivateKey } = await (async () => {
|
|
247
|
+
if (options.address) {
|
|
248
|
+
return CdpOpenApiClient.exportEvmAccount(
|
|
249
|
+
options.address,
|
|
250
|
+
{
|
|
251
|
+
exportEncryptionKey: publicKey,
|
|
252
|
+
},
|
|
253
|
+
options.idempotencyKey,
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (options.name) {
|
|
258
|
+
return CdpOpenApiClient.exportEvmAccountByName(
|
|
259
|
+
options.name,
|
|
260
|
+
{
|
|
261
|
+
exportEncryptionKey: publicKey,
|
|
262
|
+
},
|
|
263
|
+
options.idempotencyKey,
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
throw new Error("Either address or name must be provided");
|
|
268
|
+
})();
|
|
269
|
+
|
|
270
|
+
return decryptWithPrivateKey(privateKey, encryptedPrivateKey);
|
|
271
|
+
}
|
|
272
|
+
|
|
215
273
|
/**
|
|
216
274
|
* Creates a new CDP EVM smart account.
|
|
217
275
|
*
|
|
@@ -261,6 +319,7 @@ export class EvmClient implements EvmClientInterface {
|
|
|
261
319
|
const openApiSmartAccount = await CdpOpenApiClient.createEvmSmartAccount(
|
|
262
320
|
{
|
|
263
321
|
owners: [options.owner.address],
|
|
322
|
+
name: options.name,
|
|
264
323
|
},
|
|
265
324
|
options.idempotencyKey,
|
|
266
325
|
);
|
|
@@ -326,7 +385,10 @@ export class EvmClient implements EvmClientInterface {
|
|
|
326
385
|
* Gets a CDP EVM smart account.
|
|
327
386
|
*
|
|
328
387
|
* @param {GetSmartAccountOptions} options - Parameters for getting the smart account.
|
|
329
|
-
*
|
|
388
|
+
* Either `address` or `name` must be provided.
|
|
389
|
+
* If both are provided, lookup will be done by `address` and `name` will be ignored.
|
|
390
|
+
* @param {string} [options.address] - The address of the smart account to get.
|
|
391
|
+
* @param {string} [options.name] - The name of the smart account to get.
|
|
330
392
|
* @param {Account} options.owner - The owner of the smart account.
|
|
331
393
|
* You must pass the signing-capable owner of the smart account so that the returned smart account
|
|
332
394
|
* can be functional.
|
|
@@ -342,7 +404,14 @@ export class EvmClient implements EvmClientInterface {
|
|
|
342
404
|
* ```
|
|
343
405
|
*/
|
|
344
406
|
async getSmartAccount(options: GetSmartAccountOptions): Promise<SmartAccount> {
|
|
345
|
-
const openApiSmartAccount = await
|
|
407
|
+
const openApiSmartAccount = await (async () => {
|
|
408
|
+
if (options.address) {
|
|
409
|
+
return CdpOpenApiClient.getEvmSmartAccount(options.address);
|
|
410
|
+
} else if (options.name) {
|
|
411
|
+
return CdpOpenApiClient.getEvmSmartAccountByName(options.name);
|
|
412
|
+
}
|
|
413
|
+
throw new Error("Either address or name must be provided");
|
|
414
|
+
})();
|
|
346
415
|
|
|
347
416
|
const smartAccount = toEvmSmartAccount(CdpOpenApiClient, {
|
|
348
417
|
smartAccount: openApiSmartAccount,
|
|
@@ -395,6 +464,51 @@ export class EvmClient implements EvmClientInterface {
|
|
|
395
464
|
}
|
|
396
465
|
}
|
|
397
466
|
|
|
467
|
+
/**
|
|
468
|
+
* Gets a CDP EVM smart account, or creates one if it doesn't exist.
|
|
469
|
+
* This method first attempts to retrieve an existing smart account with the given parameters.
|
|
470
|
+
* If no account exists, it creates a new one with the specified owner.
|
|
471
|
+
*
|
|
472
|
+
* @param {GetOrCreateSmartAccountOptions} options - Configuration options for getting or creating the smart account.
|
|
473
|
+
* @param {string} [options.name] - The name of the smart account to get or create.
|
|
474
|
+
* @param {Account} options.owner - The owner of the smart account.
|
|
475
|
+
*
|
|
476
|
+
* @returns {Promise<SmartAccount>} A promise that resolves to the retrieved or newly created smart account.
|
|
477
|
+
*
|
|
478
|
+
* @example
|
|
479
|
+
* ```ts
|
|
480
|
+
* const smartAccount = await cdp.evm.getOrCreateSmartAccount({
|
|
481
|
+
* name: "MySmartAccount",
|
|
482
|
+
* owner: account,
|
|
483
|
+
* });
|
|
484
|
+
* ```
|
|
485
|
+
*/
|
|
486
|
+
async getOrCreateSmartAccount(options: GetOrCreateSmartAccountOptions): Promise<SmartAccount> {
|
|
487
|
+
try {
|
|
488
|
+
const account = await this.getSmartAccount(options);
|
|
489
|
+
return account;
|
|
490
|
+
} catch (error) {
|
|
491
|
+
// If it failed because the account doesn't exist, create it
|
|
492
|
+
const doesAccountNotExist = error instanceof APIError && error.statusCode === 404;
|
|
493
|
+
if (doesAccountNotExist) {
|
|
494
|
+
try {
|
|
495
|
+
const account = await this.createSmartAccount(options);
|
|
496
|
+
return account;
|
|
497
|
+
} catch (error) {
|
|
498
|
+
// If it failed because the account already exists, throw an error
|
|
499
|
+
const doesAccountAlreadyExist = error instanceof APIError && error.statusCode === 409;
|
|
500
|
+
if (doesAccountAlreadyExist) {
|
|
501
|
+
const account = await this.getSmartAccount(options);
|
|
502
|
+
return account;
|
|
503
|
+
}
|
|
504
|
+
throw error;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
throw error;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
398
512
|
/**
|
|
399
513
|
* Gets the price for a swap between two tokens on an EVM network.
|
|
400
514
|
*
|
package/client/evm/evm.types.ts
CHANGED
|
@@ -36,9 +36,12 @@ export type EvmClientInterface = Omit<
|
|
|
36
36
|
| "createEvmAccount" // mapped to createAccount
|
|
37
37
|
| "createEvmSmartAccount" // mapped to createSmartAccount
|
|
38
38
|
| "importEvmAccount" // mapped to importAccount
|
|
39
|
+
| "exportEvmAccount" // mapped to exportAccount
|
|
40
|
+
| "exportEvmAccountByName" // mapped to exportAccount
|
|
39
41
|
| "getEvmAccount" // mapped to getAccount
|
|
40
42
|
| "getEvmAccountByName" // mapped to getAccount
|
|
41
43
|
| "getEvmSmartAccount" // mapped to getSmartAccount
|
|
44
|
+
| "getEvmSmartAccountByName" // mapped to getSmartAccount
|
|
42
45
|
| "getEvmSwapPrice" // mapped to getSwapPrice
|
|
43
46
|
| "createEvmSwapQuote" // mapped to createSwapQuote
|
|
44
47
|
| "getUserOperation"
|
|
@@ -56,10 +59,13 @@ export type EvmClientInterface = Omit<
|
|
|
56
59
|
| "sendEvmTransaction" // mapped to sendTransaction
|
|
57
60
|
| "signEvmTypedData" // mapped to signTypedData
|
|
58
61
|
| "updateEvmAccount" // mapped to updateAccount
|
|
62
|
+
| "exportEvmAccount"
|
|
63
|
+
| "exportEvmAccountByName"
|
|
59
64
|
> & {
|
|
60
65
|
createAccount: (options: CreateServerAccountOptions) => Promise<ServerAccount>;
|
|
61
66
|
createSmartAccount: (options: CreateSmartAccountOptions) => Promise<SmartAccount>;
|
|
62
67
|
importAccount: (options: ImportServerAccountOptions) => Promise<ServerAccount>;
|
|
68
|
+
exportAccount: (options: ExportServerAccountOptions) => Promise<string>;
|
|
63
69
|
getAccount: (options: GetServerAccountOptions) => Promise<ServerAccount>;
|
|
64
70
|
getSmartAccount: (options: GetSmartAccountOptions) => Promise<SmartAccount>;
|
|
65
71
|
getSwapPrice: (
|
|
@@ -321,6 +327,18 @@ export interface ImportServerAccountOptions {
|
|
|
321
327
|
privateKey: Hex;
|
|
322
328
|
}
|
|
323
329
|
|
|
330
|
+
/**
|
|
331
|
+
* Options for exporting an EVM server account.
|
|
332
|
+
*/
|
|
333
|
+
export interface ExportServerAccountOptions {
|
|
334
|
+
/** The address of the account. */
|
|
335
|
+
address?: Address;
|
|
336
|
+
/** The name of the account. */
|
|
337
|
+
name?: string;
|
|
338
|
+
/** The idempotency key. */
|
|
339
|
+
idempotencyKey?: string;
|
|
340
|
+
}
|
|
341
|
+
|
|
324
342
|
/**
|
|
325
343
|
* Options for getting an EVM account.
|
|
326
344
|
*/
|
|
@@ -336,9 +354,11 @@ export interface GetServerAccountOptions {
|
|
|
336
354
|
*/
|
|
337
355
|
export interface GetSmartAccountOptions {
|
|
338
356
|
/** The address of the account. */
|
|
339
|
-
address
|
|
357
|
+
address?: Address;
|
|
340
358
|
/** The owner of the account. */
|
|
341
359
|
owner: Account;
|
|
360
|
+
/** The name of the account. */
|
|
361
|
+
name?: string;
|
|
342
362
|
}
|
|
343
363
|
|
|
344
364
|
/**
|
|
@@ -349,6 +369,16 @@ export interface GetOrCreateServerAccountOptions {
|
|
|
349
369
|
name: string;
|
|
350
370
|
}
|
|
351
371
|
|
|
372
|
+
/**
|
|
373
|
+
* Options for getting an EVM account, or creating one if it doesn't exist.
|
|
374
|
+
*/
|
|
375
|
+
export interface GetOrCreateSmartAccountOptions {
|
|
376
|
+
/** The name of the account. */
|
|
377
|
+
name: string;
|
|
378
|
+
/** The owner of the account. */
|
|
379
|
+
owner: Account;
|
|
380
|
+
}
|
|
381
|
+
|
|
352
382
|
/**
|
|
353
383
|
* Options for listing EVM accounts.
|
|
354
384
|
*/
|
|
@@ -426,6 +456,8 @@ export interface CreateSmartAccountOptions {
|
|
|
426
456
|
owner: Account;
|
|
427
457
|
/** The idempotency key. */
|
|
428
458
|
idempotencyKey?: string;
|
|
459
|
+
/** The name of the account. */
|
|
460
|
+
name?: string;
|
|
429
461
|
}
|
|
430
462
|
|
|
431
463
|
/**
|
package/client/solana/solana.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CreateAccountOptions,
|
|
3
|
+
ExportAccountOptions,
|
|
3
4
|
GetAccountOptions,
|
|
4
5
|
GetOrCreateAccountOptions,
|
|
5
6
|
ListAccountsOptions,
|
|
@@ -19,6 +20,11 @@ import { signTransaction } from "../../actions/solana/signTransaction.js";
|
|
|
19
20
|
import { Analytics } from "../../analytics.js";
|
|
20
21
|
import { APIError } from "../../openapi-client/errors.js";
|
|
21
22
|
import { CdpOpenApiClient } from "../../openapi-client/index.js";
|
|
23
|
+
import {
|
|
24
|
+
decryptWithPrivateKey,
|
|
25
|
+
formatSolanaPrivateKey,
|
|
26
|
+
generateExportEncryptionKeyPair,
|
|
27
|
+
} from "../../utils/export.js";
|
|
22
28
|
|
|
23
29
|
/**
|
|
24
30
|
* The namespace containing all Solana methods.
|
|
@@ -72,6 +78,61 @@ export class SolanaClient implements SolanaClientInterface {
|
|
|
72
78
|
return account;
|
|
73
79
|
}
|
|
74
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Exports a CDP Solana account's private key.
|
|
83
|
+
* It is important to store the private key in a secure place after it's exported.
|
|
84
|
+
*
|
|
85
|
+
* @param {ExportAccountOptions} options - Parameters for exporting the Solana account.
|
|
86
|
+
* @param {string} [options.address] - The address of the account.
|
|
87
|
+
* @param {string} [options.name] - The name of the account.
|
|
88
|
+
*
|
|
89
|
+
* @returns A promise that resolves to the exported account's full 64-byte private key as a base58 encoded string.
|
|
90
|
+
*
|
|
91
|
+
* @example **With an address**
|
|
92
|
+
* ```ts
|
|
93
|
+
* const privateKey = await cdp.solana.exportAccount({
|
|
94
|
+
* address: "1234567890123456789012345678901234567890",
|
|
95
|
+
* });
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @example **With a name**
|
|
99
|
+
* ```ts
|
|
100
|
+
* const privateKey = await cdp.solana.exportAccount({
|
|
101
|
+
* name: "MyAccount",
|
|
102
|
+
* });
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
async exportAccount(options: ExportAccountOptions): Promise<string> {
|
|
106
|
+
const { publicKey, privateKey } = await generateExportEncryptionKeyPair();
|
|
107
|
+
|
|
108
|
+
const { encryptedPrivateKey } = await (async () => {
|
|
109
|
+
if (options.address) {
|
|
110
|
+
return CdpOpenApiClient.exportSolanaAccount(
|
|
111
|
+
options.address,
|
|
112
|
+
{
|
|
113
|
+
exportEncryptionKey: publicKey,
|
|
114
|
+
},
|
|
115
|
+
options.idempotencyKey,
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (options.name) {
|
|
120
|
+
return CdpOpenApiClient.exportSolanaAccountByName(
|
|
121
|
+
options.name,
|
|
122
|
+
{
|
|
123
|
+
exportEncryptionKey: publicKey,
|
|
124
|
+
},
|
|
125
|
+
options.idempotencyKey,
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
throw new Error("Either address or name must be provided");
|
|
130
|
+
})();
|
|
131
|
+
|
|
132
|
+
const decryptedPrivateKey = decryptWithPrivateKey(privateKey, encryptedPrivateKey);
|
|
133
|
+
return formatSolanaPrivateKey(decryptedPrivateKey);
|
|
134
|
+
}
|
|
135
|
+
|
|
75
136
|
/**
|
|
76
137
|
* Gets a Solana account by its address.
|
|
77
138
|
*
|
|
@@ -15,8 +15,11 @@ export type SolanaClientInterface = Omit<
|
|
|
15
15
|
| "signSolanaMessage" // mapped to signMessage
|
|
16
16
|
| "signSolanaTransaction" // mapped to signTransaction
|
|
17
17
|
| "updateSolanaAccount" // mapped to updateAccount
|
|
18
|
+
| "exportSolanaAccount" // mapped to exportAccount
|
|
19
|
+
| "exportSolanaAccountByName" // mapped to exportAccount
|
|
18
20
|
> & {
|
|
19
21
|
createAccount: (options: CreateAccountOptions) => Promise<Account>;
|
|
22
|
+
exportAccount: (options: ExportAccountOptions) => Promise<string>;
|
|
20
23
|
getAccount: (options: GetAccountOptions) => Promise<Account>;
|
|
21
24
|
getOrCreateAccount: (options: GetOrCreateAccountOptions) => Promise<Account>;
|
|
22
25
|
updateAccount: (options: UpdateSolanaAccountOptions) => Promise<Account>;
|
|
@@ -46,6 +49,18 @@ export interface CreateAccountOptions {
|
|
|
46
49
|
idempotencyKey?: string;
|
|
47
50
|
}
|
|
48
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Options for exporting a Solana account.
|
|
54
|
+
*/
|
|
55
|
+
export interface ExportAccountOptions {
|
|
56
|
+
/** The address of the account. */
|
|
57
|
+
address?: string;
|
|
58
|
+
/** The name of the account. */
|
|
59
|
+
name?: string;
|
|
60
|
+
/** The idempotency key. */
|
|
61
|
+
idempotencyKey?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
49
64
|
/**
|
|
50
65
|
* Options for getting a Solana account.
|
|
51
66
|
*/
|
|
@@ -180,15 +180,30 @@ export const cdpApiClient = async <T>(
|
|
|
180
180
|
`${ERROR_DOCS_PAGE_URL}`,
|
|
181
181
|
error.cause,
|
|
182
182
|
);
|
|
183
|
-
default:
|
|
183
|
+
default: {
|
|
184
|
+
let errorText = "";
|
|
185
|
+
|
|
186
|
+
if (error.response.data) {
|
|
187
|
+
try {
|
|
188
|
+
errorText = JSON.stringify(error.response.data);
|
|
189
|
+
} catch {
|
|
190
|
+
errorText = String(error.response.data);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const errorMessage = errorText
|
|
195
|
+
? `An unexpected error occurred: ${errorText}`
|
|
196
|
+
: "An unexpected error occurred.";
|
|
197
|
+
|
|
184
198
|
throw new APIError(
|
|
185
199
|
statusCode,
|
|
186
200
|
HttpErrorType.unexpected_error,
|
|
187
|
-
|
|
201
|
+
errorMessage,
|
|
188
202
|
undefined,
|
|
189
203
|
`${ERROR_DOCS_PAGE_URL}`,
|
|
190
204
|
error.cause,
|
|
191
205
|
);
|
|
206
|
+
}
|
|
192
207
|
}
|
|
193
208
|
}
|
|
194
209
|
}
|
|
@@ -1258,8 +1258,8 @@ Account names must be unique across all EVM accounts in the developer's CDP Proj
|
|
|
1258
1258
|
*/
|
|
1259
1259
|
name?: string;
|
|
1260
1260
|
/**
|
|
1261
|
-
* The ID of the account-level policy to apply to the account.
|
|
1262
|
-
* @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
|
|
1261
|
+
* The ID of the account-level policy to apply to the account, or an empty string to unset attached policy.
|
|
1262
|
+
* @pattern (^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)|(^$)
|
|
1263
1263
|
*/
|
|
1264
1264
|
accountPolicy?: string;
|
|
1265
1265
|
};
|
|
@@ -1344,6 +1344,13 @@ export type ListEvmSmartAccounts200 = ListEvmSmartAccounts200AllOf & ListRespons
|
|
|
1344
1344
|
export type CreateEvmSmartAccountBody = {
|
|
1345
1345
|
/** 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. */
|
|
1346
1346
|
owners: string[];
|
|
1347
|
+
/**
|
|
1348
|
+
* An optional name for the account.
|
|
1349
|
+
Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
|
|
1350
|
+
Account names must be unique across all EVM accounts in the developer's CDP Project.
|
|
1351
|
+
* @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
|
|
1352
|
+
*/
|
|
1353
|
+
name?: string;
|
|
1347
1354
|
};
|
|
1348
1355
|
|
|
1349
1356
|
export type ImportEvmAccountBody = {
|
|
@@ -1358,6 +1365,26 @@ Account names must be unique across all EVM accounts in the developer's CDP Proj
|
|
|
1358
1365
|
name?: string;
|
|
1359
1366
|
};
|
|
1360
1367
|
|
|
1368
|
+
export type ExportEvmAccountBody = {
|
|
1369
|
+
/** The base64-encoded, public part of the RSA key in DER format used to encrypt the account private key. */
|
|
1370
|
+
exportEncryptionKey: string;
|
|
1371
|
+
};
|
|
1372
|
+
|
|
1373
|
+
export type ExportEvmAccount200 = {
|
|
1374
|
+
/** The base64-encoded, encrypted private key of the EVM account which is a 32 byte raw private key. The private key is encrypted in transport using the exportEncryptionKey in the request. */
|
|
1375
|
+
encryptedPrivateKey: string;
|
|
1376
|
+
};
|
|
1377
|
+
|
|
1378
|
+
export type ExportEvmAccountByNameBody = {
|
|
1379
|
+
/** The base64-encoded, public part of the RSA key in DER format used to encrypt the account private key. */
|
|
1380
|
+
exportEncryptionKey: string;
|
|
1381
|
+
};
|
|
1382
|
+
|
|
1383
|
+
export type ExportEvmAccountByName200 = {
|
|
1384
|
+
/** The base64-encoded, encrypted private key of the EVM account which is a 32 byte raw private key. The private key is encrypted in transport using the exportEncryptionKey in the request. */
|
|
1385
|
+
encryptedPrivateKey: string;
|
|
1386
|
+
};
|
|
1387
|
+
|
|
1361
1388
|
/**
|
|
1362
1389
|
* The network to prepare the user operation for.
|
|
1363
1390
|
*/
|
|
@@ -1463,6 +1490,7 @@ export type RequestEvmFaucetBodyNetwork =
|
|
|
1463
1490
|
export const RequestEvmFaucetBodyNetwork = {
|
|
1464
1491
|
"base-sepolia": "base-sepolia",
|
|
1465
1492
|
"ethereum-sepolia": "ethereum-sepolia",
|
|
1493
|
+
"ethereum-hoodi": "ethereum-hoodi",
|
|
1466
1494
|
} as const;
|
|
1467
1495
|
|
|
1468
1496
|
/**
|
|
@@ -1604,12 +1632,32 @@ Account names must be unique across all Solana accounts in the developer's CDP P
|
|
|
1604
1632
|
*/
|
|
1605
1633
|
name?: string;
|
|
1606
1634
|
/**
|
|
1607
|
-
* The ID of the account-level policy to apply to the account.
|
|
1608
|
-
* @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
|
|
1635
|
+
* The ID of the account-level policy to apply to the account, or an empty string to unset attached policy.
|
|
1636
|
+
* @pattern (^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)|(^$)
|
|
1609
1637
|
*/
|
|
1610
1638
|
accountPolicy?: string;
|
|
1611
1639
|
};
|
|
1612
1640
|
|
|
1641
|
+
export type ExportSolanaAccountBody = {
|
|
1642
|
+
/** The base64-encoded, public part of the RSA key in DER format used to encrypt the account private key. */
|
|
1643
|
+
exportEncryptionKey: string;
|
|
1644
|
+
};
|
|
1645
|
+
|
|
1646
|
+
export type ExportSolanaAccount200 = {
|
|
1647
|
+
/** The base64-encoded, encrypted private key of the Solana account which is a 32 byte raw private key. The private key is encrypted in transport using the exportEncryptionKey in the request. */
|
|
1648
|
+
encryptedPrivateKey: string;
|
|
1649
|
+
};
|
|
1650
|
+
|
|
1651
|
+
export type ExportSolanaAccountByNameBody = {
|
|
1652
|
+
/** The base64-encoded, public part of the RSA key in DER format used to encrypt the account private key. */
|
|
1653
|
+
exportEncryptionKey: string;
|
|
1654
|
+
};
|
|
1655
|
+
|
|
1656
|
+
export type ExportSolanaAccountByName200 = {
|
|
1657
|
+
/** The base64-encoded, encrypted private key of the Solana account which is a 32 byte raw private key. The private key is encrypted in transport using the exportEncryptionKey in the request. */
|
|
1658
|
+
encryptedPrivateKey: string;
|
|
1659
|
+
};
|
|
1660
|
+
|
|
1613
1661
|
export type SignSolanaTransactionBody = {
|
|
1614
1662
|
/** The base64 encoded transaction to sign. */
|
|
1615
1663
|
transaction: string;
|