@coinbase/cdp-sdk 1.42.0 → 1.43.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.
- package/CHANGELOG.md +12 -0
- package/README.md +38 -0
- package/_cjs/actions/evm/transfer/utils.js +1 -1
- package/_cjs/actions/evm/transfer/utils.js.map +1 -1
- package/_cjs/auth/utils/http.js +2 -1
- package/_cjs/auth/utils/http.js.map +1 -1
- package/_cjs/client/end-user/endUser.js +82 -0
- package/_cjs/client/end-user/endUser.js.map +1 -1
- package/_cjs/client/solana/solana.js +3 -3
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +30 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/end-user-accounts/end-user-accounts.js +16 -1
- package/_cjs/openapi-client/generated/end-user-accounts/end-user-accounts.js.map +1 -1
- package/_cjs/openapi-client/generated/onramp/onramp.js +3 -1
- package/_cjs/openapi-client/generated/onramp/onramp.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/actions/evm/transfer/utils.js +1 -1
- package/_esm/actions/evm/transfer/utils.js.map +1 -1
- package/_esm/auth/utils/http.js +2 -1
- package/_esm/auth/utils/http.js.map +1 -1
- package/_esm/client/end-user/endUser.js +80 -1
- package/_esm/client/end-user/endUser.js.map +1 -1
- package/_esm/client/solana/solana.js +3 -3
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +29 -0
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/end-user-accounts/end-user-accounts.js +14 -0
- package/_esm/openapi-client/generated/end-user-accounts/end-user-accounts.js.map +1 -1
- package/_esm/openapi-client/generated/onramp/onramp.js +3 -1
- package/_esm/openapi-client/generated/onramp/onramp.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/auth/utils/http.d.ts.map +1 -1
- package/_types/client/end-user/endUser.d.ts +31 -1
- package/_types/client/end-user/endUser.d.ts.map +1 -1
- package/_types/client/end-user/endUser.types.d.ts +31 -1
- package/_types/client/end-user/endUser.types.d.ts.map +1 -1
- package/_types/client/solana/solana.d.ts +3 -3
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +56 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/end-user-accounts/end-user-accounts.d.ts +9 -1
- package/_types/openapi-client/generated/end-user-accounts/end-user-accounts.d.ts.map +1 -1
- package/_types/openapi-client/generated/onramp/onramp.d.ts +3 -1
- package/_types/openapi-client/generated/onramp/onramp.d.ts.map +1 -1
- package/_types/openapi-client/index.d.ts +1 -0
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/actions/evm/transfer/utils.ts +1 -1
- package/auth/utils/http.ts +2 -1
- package/client/end-user/endUser.ts +93 -1
- package/client/end-user/endUser.types.ts +37 -1
- package/client/solana/solana.ts +3 -3
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +82 -1
- package/openapi-client/generated/end-user-accounts/end-user-accounts.ts +22 -0
- package/openapi-client/generated/onchain-data/onchain-data.ts +1 -1
- package/openapi-client/generated/onramp/onramp.ts +3 -1
- package/package.json +1 -1
- package/version.ts +1 -1
|
@@ -122,6 +122,14 @@ export type MFAMethodsTotp = {
|
|
|
122
122
|
enrolledAt: string;
|
|
123
123
|
};
|
|
124
124
|
|
|
125
|
+
/**
|
|
126
|
+
* An object containing information about the end user's SMS MFA enrollment.
|
|
127
|
+
*/
|
|
128
|
+
export type MFAMethodsSms = {
|
|
129
|
+
/** The date and time when the method was enrolled, in ISO 8601 format. */
|
|
130
|
+
enrolledAt: string;
|
|
131
|
+
};
|
|
132
|
+
|
|
125
133
|
/**
|
|
126
134
|
* Information about the end user's MFA enrollments.
|
|
127
135
|
|
|
@@ -131,6 +139,8 @@ export interface MFAMethods {
|
|
|
131
139
|
enrollmentPromptedAt?: string;
|
|
132
140
|
/** An object containing information about the end user's TOTP enrollment. */
|
|
133
141
|
totp?: MFAMethodsTotp;
|
|
142
|
+
/** An object containing information about the end user's SMS MFA enrollment. */
|
|
143
|
+
sms?: MFAMethodsSms;
|
|
134
144
|
}
|
|
135
145
|
|
|
136
146
|
/**
|
|
@@ -260,6 +270,8 @@ export const ErrorType = {
|
|
|
260
270
|
mfa_flow_expired: "mfa_flow_expired",
|
|
261
271
|
mfa_required: "mfa_required",
|
|
262
272
|
mfa_not_enrolled: "mfa_not_enrolled",
|
|
273
|
+
mfa_multiple_methods_available: "mfa_multiple_methods_available",
|
|
274
|
+
mfa_invalid_method: "mfa_invalid_method",
|
|
263
275
|
} as const;
|
|
264
276
|
|
|
265
277
|
/**
|
|
@@ -3228,6 +3240,8 @@ export const X402SettleErrorReason = {
|
|
|
3228
3240
|
invalid_payment_requirements: "invalid_payment_requirements",
|
|
3229
3241
|
invalid_payload: "invalid_payload",
|
|
3230
3242
|
invalid_exact_evm_payload_authorization_value: "invalid_exact_evm_payload_authorization_value",
|
|
3243
|
+
invalid_exact_evm_payload_authorization_value_too_low:
|
|
3244
|
+
"invalid_exact_evm_payload_authorization_value_too_low",
|
|
3231
3245
|
invalid_exact_evm_payload_authorization_valid_after:
|
|
3232
3246
|
"invalid_exact_evm_payload_authorization_valid_after",
|
|
3233
3247
|
invalid_exact_evm_payload_authorization_valid_before:
|
|
@@ -3238,7 +3252,47 @@ export const X402SettleErrorReason = {
|
|
|
3238
3252
|
"invalid_exact_evm_payload_authorization_from_address_kyt",
|
|
3239
3253
|
invalid_exact_evm_payload_authorization_to_address_kyt:
|
|
3240
3254
|
"invalid_exact_evm_payload_authorization_to_address_kyt",
|
|
3255
|
+
invalid_exact_evm_payload_signature: "invalid_exact_evm_payload_signature",
|
|
3241
3256
|
invalid_exact_evm_payload_signature_address: "invalid_exact_evm_payload_signature_address",
|
|
3257
|
+
invalid_exact_svm_payload_transaction: "invalid_exact_svm_payload_transaction",
|
|
3258
|
+
invalid_exact_svm_payload_transaction_amount_mismatch:
|
|
3259
|
+
"invalid_exact_svm_payload_transaction_amount_mismatch",
|
|
3260
|
+
invalid_exact_svm_payload_transaction_create_ata_instruction:
|
|
3261
|
+
"invalid_exact_svm_payload_transaction_create_ata_instruction",
|
|
3262
|
+
invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee:
|
|
3263
|
+
"invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee",
|
|
3264
|
+
invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset:
|
|
3265
|
+
"invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset",
|
|
3266
|
+
invalid_exact_svm_payload_transaction_instructions:
|
|
3267
|
+
"invalid_exact_svm_payload_transaction_instructions",
|
|
3268
|
+
invalid_exact_svm_payload_transaction_instructions_length:
|
|
3269
|
+
"invalid_exact_svm_payload_transaction_instructions_length",
|
|
3270
|
+
invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction:
|
|
3271
|
+
"invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction",
|
|
3272
|
+
invalid_exact_svm_payload_transaction_instructions_compute_price_instruction:
|
|
3273
|
+
"invalid_exact_svm_payload_transaction_instructions_compute_price_instruction",
|
|
3274
|
+
invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high:
|
|
3275
|
+
"invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high",
|
|
3276
|
+
invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked:
|
|
3277
|
+
"invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked",
|
|
3278
|
+
invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked:
|
|
3279
|
+
"invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked",
|
|
3280
|
+
invalid_exact_svm_payload_transaction_not_a_transfer_instruction:
|
|
3281
|
+
"invalid_exact_svm_payload_transaction_not_a_transfer_instruction",
|
|
3282
|
+
invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata:
|
|
3283
|
+
"invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata",
|
|
3284
|
+
invalid_exact_svm_payload_transaction_receiver_ata_not_found:
|
|
3285
|
+
"invalid_exact_svm_payload_transaction_receiver_ata_not_found",
|
|
3286
|
+
invalid_exact_svm_payload_transaction_sender_ata_not_found:
|
|
3287
|
+
"invalid_exact_svm_payload_transaction_sender_ata_not_found",
|
|
3288
|
+
invalid_exact_svm_payload_transaction_simulation_failed:
|
|
3289
|
+
"invalid_exact_svm_payload_transaction_simulation_failed",
|
|
3290
|
+
invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata:
|
|
3291
|
+
"invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata",
|
|
3292
|
+
invalid_exact_svm_payload_transaction_fee_payer_included_in_instruction_accounts:
|
|
3293
|
+
"invalid_exact_svm_payload_transaction_fee_payer_included_in_instruction_accounts",
|
|
3294
|
+
invalid_exact_svm_payload_transaction_fee_payer_transferring_funds:
|
|
3295
|
+
"invalid_exact_svm_payload_transaction_fee_payer_transferring_funds",
|
|
3242
3296
|
settle_exact_evm_transaction_confirmation_timed_out:
|
|
3243
3297
|
"settle_exact_evm_transaction_confirmation_timed_out",
|
|
3244
3298
|
settle_exact_node_failure: "settle_exact_node_failure",
|
|
@@ -3688,6 +3742,31 @@ export type ValidateEndUserAccessTokenBody = {
|
|
|
3688
3742
|
accessToken: string;
|
|
3689
3743
|
};
|
|
3690
3744
|
|
|
3745
|
+
/**
|
|
3746
|
+
* The type of key being imported. Determines what type of account will be associated for the end user.
|
|
3747
|
+
*/
|
|
3748
|
+
export type ImportEndUserBodyKeyType =
|
|
3749
|
+
(typeof ImportEndUserBodyKeyType)[keyof typeof ImportEndUserBodyKeyType];
|
|
3750
|
+
|
|
3751
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
3752
|
+
export const ImportEndUserBodyKeyType = {
|
|
3753
|
+
evm: "evm",
|
|
3754
|
+
solana: "solana",
|
|
3755
|
+
} as const;
|
|
3756
|
+
|
|
3757
|
+
export type ImportEndUserBody = {
|
|
3758
|
+
/**
|
|
3759
|
+
* A stable, unique identifier for the end user. The `userId` must be unique across all end users in the developer's CDP Project. It must be between 1 and 100 characters long and can only contain alphanumeric characters and hyphens.
|
|
3760
|
+
* @pattern ^[a-zA-Z0-9-]{1,100}$
|
|
3761
|
+
*/
|
|
3762
|
+
userId: string;
|
|
3763
|
+
authenticationMethods: AuthenticationMethods;
|
|
3764
|
+
/** The base64-encoded, encrypted private key to import. The private key must be encrypted using the CDP SDK's encryption scheme. This is a 32-byte raw private key. */
|
|
3765
|
+
encryptedPrivateKey: string;
|
|
3766
|
+
/** The type of key being imported. Determines what type of account will be associated for the end user. */
|
|
3767
|
+
keyType: ImportEndUserBodyKeyType;
|
|
3768
|
+
};
|
|
3769
|
+
|
|
3691
3770
|
export type ListEvmAccountsParams = {
|
|
3692
3771
|
/**
|
|
3693
3772
|
* The number of resources to return per page.
|
|
@@ -4373,8 +4452,10 @@ Use the [Onramp Buy Options API](https://docs.cdp.coinbase.com/api-reference/res
|
|
|
4373
4452
|
destinationNetwork: string;
|
|
4374
4453
|
/** The address the purchased crypto will be sent to. */
|
|
4375
4454
|
destinationAddress: string;
|
|
4376
|
-
/** A string representing the amount of fiat the user wishes to pay in exchange for crypto. */
|
|
4455
|
+
/** A string representing the amount of fiat the user wishes to pay in exchange for crypto. When using this parameter, the returned quote will be inclusive of fees i.e. the user will pay this exact amount of the payment currency. */
|
|
4377
4456
|
paymentAmount?: string;
|
|
4457
|
+
/** A string representing the amount of crypto the user wishes to purchase. When using this parameter, the returned quote will be exclusive of fees i.e. the user will receive this exact amount of the purchase currency. */
|
|
4458
|
+
purchaseAmount?: string;
|
|
4378
4459
|
/** The fiat currency to be converted to crypto. */
|
|
4379
4460
|
paymentCurrency?: string;
|
|
4380
4461
|
paymentMethod?: OnrampQuotePaymentMethodTypeId;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import type {
|
|
9
9
|
CreateEndUserBody,
|
|
10
10
|
EndUser,
|
|
11
|
+
ImportEndUserBody,
|
|
11
12
|
ListEndUsers200,
|
|
12
13
|
ListEndUsersParams,
|
|
13
14
|
ValidateEndUserAccessTokenBody,
|
|
@@ -76,9 +77,30 @@ This API is intended to be used by the developer's own backend, and is authentic
|
|
|
76
77
|
export const getEndUser = (userId: string, options?: SecondParameter<typeof cdpApiClient>) => {
|
|
77
78
|
return cdpApiClient<EndUser>({ url: `/v2/end-users/${userId}`, method: "GET" }, options);
|
|
78
79
|
};
|
|
80
|
+
/**
|
|
81
|
+
* Imports an existing private key for an end user into the developer's CDP Project. The private key must be encrypted using the CDP SDK's encryption scheme before being sent to this endpoint. This API should be called from the [CDP SDK](https://github.com/coinbase/cdp-sdk) to ensure that the associated private key is properly encrypted.
|
|
82
|
+
|
|
83
|
+
This endpoint allows developers to import existing keys for their end users, supporting both EVM and Solana key types. The end user must have at least one authentication method configured.
|
|
84
|
+
* @summary Import a private key for an end user
|
|
85
|
+
*/
|
|
86
|
+
export const importEndUser = (
|
|
87
|
+
importEndUserBody: ImportEndUserBody,
|
|
88
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
89
|
+
) => {
|
|
90
|
+
return cdpApiClient<EndUser>(
|
|
91
|
+
{
|
|
92
|
+
url: `/v2/end-users/import`,
|
|
93
|
+
method: "POST",
|
|
94
|
+
headers: { "Content-Type": "application/json" },
|
|
95
|
+
data: importEndUserBody,
|
|
96
|
+
},
|
|
97
|
+
options,
|
|
98
|
+
);
|
|
99
|
+
};
|
|
79
100
|
export type CreateEndUserResult = NonNullable<Awaited<ReturnType<typeof createEndUser>>>;
|
|
80
101
|
export type ListEndUsersResult = NonNullable<Awaited<ReturnType<typeof listEndUsers>>>;
|
|
81
102
|
export type ValidateEndUserAccessTokenResult = NonNullable<
|
|
82
103
|
Awaited<ReturnType<typeof validateEndUserAccessToken>>
|
|
83
104
|
>;
|
|
84
105
|
export type GetEndUserResult = NonNullable<Awaited<ReturnType<typeof getEndUser>>>;
|
|
106
|
+
export type ImportEndUserResult = NonNullable<Awaited<ReturnType<typeof importEndUser>>>;
|
|
@@ -17,7 +17,7 @@ import { cdpApiClient } from "../../cdpApiClient.js";
|
|
|
17
17
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Retrieve all ERC-20 token contract addresses that an account has ever received tokens from.
|
|
20
|
+
* Retrieve all ERC-20 token contract addresses that an account has ever received tokens from.
|
|
21
21
|
Analyzes transaction history to discover token interactions.
|
|
22
22
|
|
|
23
23
|
* @summary List token addresses for account
|
|
@@ -62,13 +62,15 @@ export const getOnrampOrderById = (
|
|
|
62
62
|
|
|
63
63
|
**Returns**: Basic single-use onramp URL. The `quote` object will not be included in the response.
|
|
64
64
|
### 2. One-Click Onramp URL
|
|
65
|
-
**Required**: Basic parameters + `paymentAmount
|
|
65
|
+
**Required**: Basic parameters + (`paymentAmount` OR `purchaseAmount`), `paymentCurrency`
|
|
66
66
|
|
|
67
67
|
**Returns**: One-click onramp URL for streamlined checkout. The `quote` object will not be included in the response.
|
|
68
68
|
### 3. One-Click Onramp URL with Quote
|
|
69
69
|
**Required**: One-Click Onramp parameters + `paymentMethod`, `country`, `subdivision`
|
|
70
70
|
|
|
71
71
|
**Returns**: Complete pricing quote and one-click onramp URL. Both `session` and `quote` objects will be included in the response.
|
|
72
|
+
|
|
73
|
+
**Note**: Only one of `paymentAmount` or `purchaseAmount` should be provided, not both. Providing both will result in an error. When `paymentAmount` is provided, the quote shows how much crypto the user will receive for the specified fiat amount (fee-inclusive). When `purchaseAmount` is provided, the quote shows how much fiat the user needs to pay for the specified crypto amount (fee-exclusive).
|
|
72
74
|
* @summary Create an onramp session
|
|
73
75
|
*/
|
|
74
76
|
export const createOnrampSession = (
|
package/package.json
CHANGED
package/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "1.
|
|
1
|
+
export const version = "1.43.1";
|