@coinbase/cdp-api-client 0.0.15 → 0.0.16

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/dist/esm/index.js CHANGED
@@ -1,11 +1,13 @@
1
- import { createEndUserEvmAccount as n, exportEndUserEvmAccount as r, getAuthenticatedEndUser as i, initiateAuthentication as a, logOutEndUser as o, refreshAccessToken as s, registerTemporaryWalletSecret as p, sendEvmTransactionWithEndUserAccount as m, signEvmHashWithEndUserAccount as c, signEvmMessageWithEndUserAccount as d, signEvmTransactionWithEndUserAccount as y, signEvmTypedDataWithEndUserAccount as E, verifyEmailAuthentication as u } from "./index2.js";
2
- import { AbiFunctionType as l, AbiInputType as S, AbiStateMutability as v, DeveloperJWTAuthenticationType as A, EmailAuthenticationType as O, ErrorType as g, EthValueCriterionOperator as h, EthValueCriterionType as R, EvmAddressCriterionOperator as C, EvmAddressCriterionType as P, EvmDataCriterionType as k, EvmDataParameterConditionListOperator as U, EvmDataParameterConditionOperator as w, EvmMessageCriterionType as N, EvmNetworkCriterionNetworksItem as f, EvmNetworkCriterionOperator as X, EvmNetworkCriterionType as D, EvmSwapsNetwork as M, EvmTypedAddressConditionOperator as W, EvmTypedNumericalConditionOperator as I, EvmUserOperationNetwork as V, EvmUserOperationStatus as b, FeeType as x, InitiateEmailAuthenticationNextStepType as B, InitiateEmailAuthenticationRequestType as F, KnownAbiType as K, ListEvmTokenBalancesNetwork as L, ListSolanaTokenBalancesNetwork as q, OnrampOrderFeeType as H, OnrampOrderStatus as G, OnrampPaymentLinkType as J, OnrampPaymentMethodTypeId as Q, PaymentMethodType as j, PaymentRailAction as z, PolicyScope as Y, PrepareUserOperationRuleAction as Z, PrepareUserOperationRuleOperation as _, QueryResultSchemaColumnsItemType as $, RefreshAccessTokenBodyGrantType as ee, SendEvmTransactionRuleAction as te, SendEvmTransactionRuleOperation as ne, SendEvmTransactionWithEndUserAccountBodyNetwork as re, SendUserOperationRuleAction as ie, SendUserOperationRuleOperation as ae, SignEvmHashRuleAction as oe, SignEvmHashRuleOperation as se, SignEvmMessageRuleAction as pe, SignEvmMessageRuleOperation as me, SignEvmTransactionRuleAction as ce, SignEvmTransactionRuleOperation as de, SignEvmTypedDataFieldCriterionType as ye, SignEvmTypedDataRuleAction as Ee, SignEvmTypedDataRuleOperation as ue, SignEvmTypedDataVerifyingContractCriterionOperator as Te, SignEvmTypedDataVerifyingContractCriterionType as le, SignSolTransactionRuleAction as Se, SignSolTransactionRuleOperation as ve, SolAddressCriterionOperator as Ae, SolAddressCriterionType as Oe, TransferSourceType as ge, TransferStatus as he, TransferTargetType as Re, X402PaymentPayloadNetwork as Ce, X402PaymentPayloadScheme as Pe, X402PaymentPayloadX402Version as ke, X402PaymentRequirementsNetwork as Ue, X402PaymentRequirementsScheme as we, X402SettleErrorReason as Ne, X402SupportedPaymentKindNetwork as fe, X402SupportedPaymentKindScheme as Xe, X402SupportedPaymentKindX402Version as De, X402VerifyInvalidReason as Me } from "./index3.js";
3
- import { configureCdpApiClient as Ie, setAuthManager as Ve } from "./index4.js";
1
+ import { createEndUserEvmAccount as r, exportEndUserEvmAccount as n, getAuthenticatedEndUser as i, initiateAuthentication as o, logOutEndUser as a, refreshAccessToken as p, registerTemporaryWalletSecret as s, sendEvmTransactionWithEndUserAccount as m, signEvmHashWithEndUserAccount as c, signEvmMessageWithEndUserAccount as y, signEvmTransactionWithEndUserAccount as E, signEvmTypedDataWithEndUserAccount as d, verifyEmailAuthentication as u } from "./index2.js";
2
+ import { AbiFunctionType as l, AbiInputType as A, AbiStateMutability as S, DeveloperJWTAuthenticationType as v, EmailAuthenticationType as O, ErrorType as g, EthValueCriterionOperator as h, EthValueCriterionType as R, EvmAddressCriterionOperator as C, EvmAddressCriterionType as P, EvmDataCriterionType as k, EvmDataParameterConditionListOperator as U, EvmDataParameterConditionOperator as w, EvmMessageCriterionType as f, EvmNetworkCriterionNetworksItem as N, EvmNetworkCriterionOperator as X, EvmNetworkCriterionType as D, EvmSwapsNetwork as I, EvmTypedAddressConditionOperator as M, EvmTypedNumericalConditionOperator as W, EvmUserOperationNetwork as V, EvmUserOperationStatus as x, FeeType as b, InitiateEmailAuthenticationNextStepType as B, InitiateEmailAuthenticationRequestType as F, KnownAbiType as H, ListEvmTokenBalancesNetwork as K, ListSolanaTokenBalancesNetwork as L, OnrampOrderFeeType as q, OnrampOrderStatus as G, OnrampPaymentLinkType as J, OnrampPaymentMethodTypeId as Q, PaymentMethodType as j, PaymentRailAction as z, PolicyScope as Y, PrepareUserOperationRuleAction as Z, PrepareUserOperationRuleOperation as _, QueryResultSchemaColumnsItemType as $, RefreshAccessTokenBodyGrantType as ee, SendEvmTransactionRuleAction as te, SendEvmTransactionRuleOperation as re, SendEvmTransactionWithEndUserAccountBodyNetwork as ne, SendUserOperationRuleAction as ie, SendUserOperationRuleOperation as oe, SignEvmHashRuleAction as ae, SignEvmHashRuleOperation as pe, SignEvmMessageRuleAction as se, SignEvmMessageRuleOperation as me, SignEvmTransactionRuleAction as ce, SignEvmTransactionRuleOperation as ye, SignEvmTypedDataFieldCriterionType as Ee, SignEvmTypedDataRuleAction as de, SignEvmTypedDataRuleOperation as ue, SignEvmTypedDataVerifyingContractCriterionOperator as Te, SignEvmTypedDataVerifyingContractCriterionType as le, SignSolTransactionRuleAction as Ae, SignSolTransactionRuleOperation as Se, SolAddressCriterionOperator as ve, SolAddressCriterionType as Oe, TransferSourceType as ge, TransferStatus as he, TransferTargetType as Re, X402PaymentPayloadNetwork as Ce, X402PaymentPayloadScheme as Pe, X402PaymentPayloadX402Version as ke, X402PaymentRequirementsNetwork as Ue, X402PaymentRequirementsScheme as we, X402SettleErrorReason as fe, X402SupportedPaymentKindNetwork as Ne, X402SupportedPaymentKindScheme as Xe, X402SupportedPaymentKindX402Version as De, X402VerifyInvalidReason as Ie } from "./index3.js";
3
+ import { configureCdpApiClient as We, setAuthManager as Ve } from "./index4.js";
4
+ import { APIError as be, HttpErrorType as Be, UnknownApiError as Fe, UnknownError as He, isOpenAPIError as Ke } from "./index5.js";
4
5
  export {
6
+ be as APIError,
5
7
  l as AbiFunctionType,
6
- S as AbiInputType,
7
- v as AbiStateMutability,
8
- A as DeveloperJWTAuthenticationType,
8
+ A as AbiInputType,
9
+ S as AbiStateMutability,
10
+ v as DeveloperJWTAuthenticationType,
9
11
  O as EmailAuthenticationType,
10
12
  g as ErrorType,
11
13
  h as EthValueCriterionOperator,
@@ -15,22 +17,23 @@ export {
15
17
  k as EvmDataCriterionType,
16
18
  U as EvmDataParameterConditionListOperator,
17
19
  w as EvmDataParameterConditionOperator,
18
- N as EvmMessageCriterionType,
19
- f as EvmNetworkCriterionNetworksItem,
20
+ f as EvmMessageCriterionType,
21
+ N as EvmNetworkCriterionNetworksItem,
20
22
  X as EvmNetworkCriterionOperator,
21
23
  D as EvmNetworkCriterionType,
22
- M as EvmSwapsNetwork,
23
- W as EvmTypedAddressConditionOperator,
24
- I as EvmTypedNumericalConditionOperator,
24
+ I as EvmSwapsNetwork,
25
+ M as EvmTypedAddressConditionOperator,
26
+ W as EvmTypedNumericalConditionOperator,
25
27
  V as EvmUserOperationNetwork,
26
- b as EvmUserOperationStatus,
27
- x as FeeType,
28
+ x as EvmUserOperationStatus,
29
+ b as FeeType,
30
+ Be as HttpErrorType,
28
31
  B as InitiateEmailAuthenticationNextStepType,
29
32
  F as InitiateEmailAuthenticationRequestType,
30
- K as KnownAbiType,
31
- L as ListEvmTokenBalancesNetwork,
32
- q as ListSolanaTokenBalancesNetwork,
33
- H as OnrampOrderFeeType,
33
+ H as KnownAbiType,
34
+ K as ListEvmTokenBalancesNetwork,
35
+ L as ListSolanaTokenBalancesNetwork,
36
+ q as OnrampOrderFeeType,
34
37
  G as OnrampOrderStatus,
35
38
  J as OnrampPaymentLinkType,
36
39
  Q as OnrampPaymentMethodTypeId,
@@ -42,51 +45,54 @@ export {
42
45
  $ as QueryResultSchemaColumnsItemType,
43
46
  ee as RefreshAccessTokenBodyGrantType,
44
47
  te as SendEvmTransactionRuleAction,
45
- ne as SendEvmTransactionRuleOperation,
46
- re as SendEvmTransactionWithEndUserAccountBodyNetwork,
48
+ re as SendEvmTransactionRuleOperation,
49
+ ne as SendEvmTransactionWithEndUserAccountBodyNetwork,
47
50
  ie as SendUserOperationRuleAction,
48
- ae as SendUserOperationRuleOperation,
49
- oe as SignEvmHashRuleAction,
50
- se as SignEvmHashRuleOperation,
51
- pe as SignEvmMessageRuleAction,
51
+ oe as SendUserOperationRuleOperation,
52
+ ae as SignEvmHashRuleAction,
53
+ pe as SignEvmHashRuleOperation,
54
+ se as SignEvmMessageRuleAction,
52
55
  me as SignEvmMessageRuleOperation,
53
56
  ce as SignEvmTransactionRuleAction,
54
- de as SignEvmTransactionRuleOperation,
55
- ye as SignEvmTypedDataFieldCriterionType,
56
- Ee as SignEvmTypedDataRuleAction,
57
+ ye as SignEvmTransactionRuleOperation,
58
+ Ee as SignEvmTypedDataFieldCriterionType,
59
+ de as SignEvmTypedDataRuleAction,
57
60
  ue as SignEvmTypedDataRuleOperation,
58
61
  Te as SignEvmTypedDataVerifyingContractCriterionOperator,
59
62
  le as SignEvmTypedDataVerifyingContractCriterionType,
60
- Se as SignSolTransactionRuleAction,
61
- ve as SignSolTransactionRuleOperation,
62
- Ae as SolAddressCriterionOperator,
63
+ Ae as SignSolTransactionRuleAction,
64
+ Se as SignSolTransactionRuleOperation,
65
+ ve as SolAddressCriterionOperator,
63
66
  Oe as SolAddressCriterionType,
64
67
  ge as TransferSourceType,
65
68
  he as TransferStatus,
66
69
  Re as TransferTargetType,
70
+ Fe as UnknownApiError,
71
+ He as UnknownError,
67
72
  Ce as X402PaymentPayloadNetwork,
68
73
  Pe as X402PaymentPayloadScheme,
69
74
  ke as X402PaymentPayloadX402Version,
70
75
  Ue as X402PaymentRequirementsNetwork,
71
76
  we as X402PaymentRequirementsScheme,
72
- Ne as X402SettleErrorReason,
73
- fe as X402SupportedPaymentKindNetwork,
77
+ fe as X402SettleErrorReason,
78
+ Ne as X402SupportedPaymentKindNetwork,
74
79
  Xe as X402SupportedPaymentKindScheme,
75
80
  De as X402SupportedPaymentKindX402Version,
76
- Me as X402VerifyInvalidReason,
77
- Ie as configureCdpApiClient,
78
- n as createEndUserEvmAccount,
79
- r as exportEndUserEvmAccount,
81
+ Ie as X402VerifyInvalidReason,
82
+ We as configureCdpApiClient,
83
+ r as createEndUserEvmAccount,
84
+ n as exportEndUserEvmAccount,
80
85
  i as getAuthenticatedEndUser,
81
- a as initiateAuthentication,
82
- o as logOutEndUser,
83
- s as refreshAccessToken,
84
- p as registerTemporaryWalletSecret,
86
+ o as initiateAuthentication,
87
+ Ke as isOpenAPIError,
88
+ a as logOutEndUser,
89
+ p as refreshAccessToken,
90
+ s as registerTemporaryWalletSecret,
85
91
  m as sendEvmTransactionWithEndUserAccount,
86
92
  Ve as setAuthManager,
87
93
  c as signEvmHashWithEndUserAccount,
88
- d as signEvmMessageWithEndUserAccount,
89
- y as signEvmTransactionWithEndUserAccount,
90
- E as signEvmTypedDataWithEndUserAccount,
94
+ y as signEvmMessageWithEndUserAccount,
95
+ E as signEvmTransactionWithEndUserAccount,
96
+ d as signEvmTypedDataWithEndUserAccount,
91
97
  u as verifyEmailAuthentication
92
98
  };
@@ -1,6 +1,6 @@
1
1
  import c from "axios";
2
- import { ERROR_DOCS_PAGE_URL as i } from "./index5.js";
3
- import { UnknownApiError as w, HttpErrorType as n, isOpenAPIError as m, APIError as u, UnknownError as f } from "./index6.js";
2
+ import { ERROR_DOCS_PAGE_URL as i } from "./index6.js";
3
+ import { UnknownApiError as w, HttpErrorType as n, isOpenAPIError as m, APIError as u, UnknownError as f } from "./index5.js";
4
4
  let a = c.create({
5
5
  baseURL: "https://api.cdp.coinbase.com/platform"
6
6
  }), d = null;
@@ -1,4 +1,76 @@
1
- const o = "https://docs.cdp.coinbase.com/api-v2/docs/errors";
1
+ const u = {
2
+ unexpected_error: "unexpected_error",
3
+ unauthorized: "unauthorized",
4
+ not_found: "not_found",
5
+ bad_gateway: "bad_gateway",
6
+ service_unavailable: "service_unavailable",
7
+ unknown: "unknown"
8
+ };
9
+ class a extends Error {
10
+ statusCode;
11
+ errorType;
12
+ errorMessage;
13
+ correlationId;
14
+ errorLink;
15
+ /**
16
+ * Constructor for the APIError class
17
+ *
18
+ * @param statusCode - The HTTP status code
19
+ * @param errorType - The type of error
20
+ * @param errorMessage - The error message
21
+ * @param correlationId - The correlation ID
22
+ * @param errorLink - URL to documentation about this error
23
+ * @param cause - The cause of the error
24
+ */
25
+ constructor(e, o, t, n, s, i) {
26
+ super(t, { cause: i }), this.name = "APIError", this.statusCode = e, this.errorType = o, this.errorMessage = t, n !== void 0 && (this.correlationId = n), s !== void 0 && (this.errorLink = s);
27
+ }
28
+ /**
29
+ * Convert the error to a JSON object, excluding undefined properties
30
+ *
31
+ * @returns The error as a JSON object
32
+ */
33
+ toJSON() {
34
+ return {
35
+ name: this.name,
36
+ statusCode: this.statusCode,
37
+ errorType: this.errorType,
38
+ errorMessage: this.errorMessage,
39
+ ...this.correlationId && { correlationId: this.correlationId },
40
+ ...this.errorLink && { errorLink: this.errorLink }
41
+ };
42
+ }
43
+ }
44
+ class d extends a {
45
+ /**
46
+ * Constructor for the UnknownApiError class
47
+ *
48
+ * @param errorType - The type of error
49
+ * @param errorMessage - The error message
50
+ * @param cause - The cause of the error
51
+ */
52
+ constructor(e, o, t) {
53
+ super(0, e, o, void 0, void 0, t), this.name = "UnknownApiError";
54
+ }
55
+ }
56
+ class c extends Error {
57
+ /**
58
+ * Constructor for the UnknownError class
59
+ *
60
+ * @param message - The error message
61
+ * @param cause - The cause of the error
62
+ */
63
+ constructor(e, o) {
64
+ super(e, { cause: o }), this.name = "UnknownError";
65
+ }
66
+ }
67
+ function p(r) {
68
+ return r !== null && typeof r == "object" && "errorType" in r && typeof r.errorType == "string" && "errorMessage" in r && typeof r.errorMessage == "string";
69
+ }
2
70
  export {
3
- o as ERROR_DOCS_PAGE_URL
71
+ a as APIError,
72
+ u as HttpErrorType,
73
+ d as UnknownApiError,
74
+ c as UnknownError,
75
+ p as isOpenAPIError
4
76
  };
@@ -1,76 +1,4 @@
1
- const u = {
2
- unexpected_error: "unexpected_error",
3
- unauthorized: "unauthorized",
4
- not_found: "not_found",
5
- bad_gateway: "bad_gateway",
6
- service_unavailable: "service_unavailable",
7
- unknown: "unknown"
8
- };
9
- class a extends Error {
10
- statusCode;
11
- errorType;
12
- errorMessage;
13
- correlationId;
14
- errorLink;
15
- /**
16
- * Constructor for the APIError class
17
- *
18
- * @param statusCode - The HTTP status code
19
- * @param errorType - The type of error
20
- * @param errorMessage - The error message
21
- * @param correlationId - The correlation ID
22
- * @param errorLink - URL to documentation about this error
23
- * @param cause - The cause of the error
24
- */
25
- constructor(e, o, t, n, s, i) {
26
- super(t, { cause: i }), this.name = "APIError", this.statusCode = e, this.errorType = o, this.errorMessage = t, n !== void 0 && (this.correlationId = n), s !== void 0 && (this.errorLink = s);
27
- }
28
- /**
29
- * Convert the error to a JSON object, excluding undefined properties
30
- *
31
- * @returns The error as a JSON object
32
- */
33
- toJSON() {
34
- return {
35
- name: this.name,
36
- statusCode: this.statusCode,
37
- errorType: this.errorType,
38
- errorMessage: this.errorMessage,
39
- ...this.correlationId && { correlationId: this.correlationId },
40
- ...this.errorLink && { errorLink: this.errorLink }
41
- };
42
- }
43
- }
44
- class d extends a {
45
- /**
46
- * Constructor for the UnknownApiError class
47
- *
48
- * @param errorType - The type of error
49
- * @param errorMessage - The error message
50
- * @param cause - The cause of the error
51
- */
52
- constructor(e, o, t) {
53
- super(0, e, o, void 0, void 0, t), this.name = "UnknownApiError";
54
- }
55
- }
56
- class c extends Error {
57
- /**
58
- * Constructor for the UnknownError class
59
- *
60
- * @param message - The error message
61
- * @param cause - The cause of the error
62
- */
63
- constructor(e, o) {
64
- super(e, { cause: o }), this.name = "UnknownError";
65
- }
66
- }
67
- function p(r) {
68
- return r !== null && typeof r == "object" && "errorType" in r && typeof r.errorType == "string" && "errorMessage" in r && typeof r.errorMessage == "string";
69
- }
1
+ const o = "https://docs.cdp.coinbase.com/api-v2/docs/errors";
70
2
  export {
71
- a as APIError,
72
- u as HttpErrorType,
73
- d as UnknownApiError,
74
- c as UnknownError,
75
- p as isOpenAPIError
3
+ o as ERROR_DOCS_PAGE_URL
76
4
  };
@@ -60,6 +60,25 @@ export declare interface AccountTokenAddressesResponse {
60
60
 
61
61
  export declare type AlreadyExistsErrorResponse = Error_2;
62
62
 
63
+ export declare class APIError extends Error {
64
+ statusCode: number;
65
+ errorType: APIErrorType;
66
+ errorMessage: string;
67
+ correlationId?: string;
68
+ errorLink?: string;
69
+ constructor(statusCode: number, errorType: APIErrorType, errorMessage: string, correlationId?: string, errorLink?: string, cause?: Error);
70
+ toJSON(): {
71
+ errorLink?: string | undefined;
72
+ correlationId?: string | undefined;
73
+ name: string;
74
+ statusCode: number;
75
+ errorType: APIErrorType;
76
+ errorMessage: string;
77
+ };
78
+ }
79
+
80
+ export declare type APIErrorType = ErrorType | HttpErrorType;
81
+
63
82
  export declare type AuthenticationMethod = EmailAuthentication | DeveloperJWTAuthentication;
64
83
 
65
84
  export declare type AuthenticationMethods = AuthenticationMethod[];
@@ -528,6 +547,17 @@ export declare type GetSwapPriceResponseAllOf = {
528
547
 
529
548
  export declare type GetSwapPriceResponseWrapper = GetSwapPriceResponse | SwapUnavailableResponse;
530
549
 
550
+ export declare const HttpErrorType: {
551
+ readonly unexpected_error: "unexpected_error";
552
+ readonly unauthorized: "unauthorized";
553
+ readonly not_found: "not_found";
554
+ readonly bad_gateway: "bad_gateway";
555
+ readonly service_unavailable: "service_unavailable";
556
+ readonly unknown: "unknown";
557
+ };
558
+
559
+ export declare type HttpErrorType = (typeof HttpErrorType)[keyof typeof HttpErrorType];
560
+
531
561
  export declare type IdempotencyErrorResponse = Error_2;
532
562
 
533
563
  export declare type IdempotencyKeyParameter = string;
@@ -568,6 +598,8 @@ export declare interface InitiateEmailAuthenticationResponse {
568
598
 
569
599
  export declare type InternalServerErrorResponse = Error_2;
570
600
 
601
+ export declare function isOpenAPIError(obj: unknown): obj is Error_2;
602
+
571
603
  export declare type KnownAbiType = (typeof KnownAbiType)[keyof typeof KnownAbiType];
572
604
 
573
605
  export declare const KnownAbiType: {
@@ -1264,6 +1296,14 @@ export declare const TransferTargetType: {
1264
1296
 
1265
1297
  export declare type UnauthorizedErrorResponse = Error_2;
1266
1298
 
1299
+ export declare class UnknownApiError extends APIError {
1300
+ constructor(errorType: APIErrorType, errorMessage: string, cause?: Error);
1301
+ }
1302
+
1303
+ export declare class UnknownError extends Error {
1304
+ constructor(message: string, cause?: Error);
1305
+ }
1306
+
1267
1307
  export declare interface UserOperationReceipt {
1268
1308
  revert?: UserOperationReceiptRevert;
1269
1309
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-api-client",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist/**",