@coinbase/cdp-sdk 1.7.0 → 1.8.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.
Files changed (158) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +222 -1
  3. package/_cjs/accounts/evm/toEvmServerAccount.js +4 -2
  4. package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
  5. package/_cjs/accounts/solana/toSolanaAccount.js +1 -0
  6. package/_cjs/accounts/solana/toSolanaAccount.js.map +1 -1
  7. package/_cjs/analytics.js +68 -8
  8. package/_cjs/analytics.js.map +1 -1
  9. package/_cjs/client/cdp.js +9 -3
  10. package/_cjs/client/cdp.js.map +1 -1
  11. package/_cjs/client/evm/evm.js +133 -15
  12. package/_cjs/client/evm/evm.js.map +1 -1
  13. package/_cjs/client/policies/index.js +6 -0
  14. package/_cjs/client/policies/index.js.map +1 -0
  15. package/_cjs/client/policies/policies.js +232 -0
  16. package/_cjs/client/policies/policies.js.map +1 -0
  17. package/_cjs/client/policies/policies.types.js +3 -0
  18. package/_cjs/client/policies/policies.types.js.map +1 -0
  19. package/_cjs/client/solana/solana.js +76 -19
  20. package/_cjs/client/solana/solana.js.map +1 -1
  21. package/_cjs/index.js +4 -1
  22. package/_cjs/index.js.map +1 -1
  23. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  24. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.js +27 -1
  25. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -1
  26. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.msw.js +56 -1
  27. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -1
  28. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +3 -1
  29. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
  30. package/_cjs/openapi-client/generated/index.msw.js +1 -1
  31. package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
  32. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js +14 -1
  33. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -1
  34. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js +42 -1
  35. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
  36. package/_cjs/openapi-client/index.js +6 -1
  37. package/_cjs/openapi-client/index.js.map +1 -1
  38. package/_cjs/policies/schema.js +186 -0
  39. package/_cjs/policies/schema.js.map +1 -0
  40. package/_cjs/policies/types.js +3 -0
  41. package/_cjs/policies/types.js.map +1 -0
  42. package/_cjs/version.js +1 -1
  43. package/_esm/accounts/evm/toEvmServerAccount.js +4 -2
  44. package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
  45. package/_esm/accounts/solana/toSolanaAccount.js +1 -0
  46. package/_esm/accounts/solana/toSolanaAccount.js.map +1 -1
  47. package/_esm/analytics.js +68 -7
  48. package/_esm/analytics.js.map +1 -1
  49. package/_esm/client/cdp.js +10 -4
  50. package/_esm/client/cdp.js.map +1 -1
  51. package/_esm/client/evm/evm.js +133 -15
  52. package/_esm/client/evm/evm.js.map +1 -1
  53. package/_esm/client/policies/index.js +2 -0
  54. package/_esm/client/policies/index.js.map +1 -0
  55. package/_esm/client/policies/policies.js +228 -0
  56. package/_esm/client/policies/policies.js.map +1 -0
  57. package/_esm/client/policies/policies.types.js +2 -0
  58. package/_esm/client/policies/policies.types.js.map +1 -0
  59. package/_esm/client/solana/solana.js +76 -19
  60. package/_esm/client/solana/solana.js.map +1 -1
  61. package/_esm/index.js +1 -0
  62. package/_esm/index.js.map +1 -1
  63. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  64. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js +24 -0
  65. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -1
  66. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js +51 -0
  67. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -1
  68. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +3 -1
  69. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
  70. package/_esm/openapi-client/generated/index.msw.js +1 -1
  71. package/_esm/openapi-client/generated/index.msw.js.map +1 -1
  72. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js +12 -0
  73. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -1
  74. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js +39 -0
  75. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
  76. package/_esm/openapi-client/index.js +5 -0
  77. package/_esm/openapi-client/index.js.map +1 -1
  78. package/_esm/policies/schema.js +183 -0
  79. package/_esm/policies/schema.js.map +1 -0
  80. package/_esm/policies/types.js +2 -0
  81. package/_esm/policies/types.js.map +1 -0
  82. package/_esm/version.js +1 -1
  83. package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
  84. package/_types/accounts/evm/types.d.ts +6 -3
  85. package/_types/accounts/evm/types.d.ts.map +1 -1
  86. package/_types/accounts/solana/toSolanaAccount.d.ts.map +1 -1
  87. package/_types/actions/evm/transfer/types.d.ts +1 -2
  88. package/_types/actions/evm/transfer/types.d.ts.map +1 -1
  89. package/_types/analytics.d.ts +14 -5
  90. package/_types/analytics.d.ts.map +1 -1
  91. package/_types/client/cdp.d.ts +3 -0
  92. package/_types/client/cdp.d.ts.map +1 -1
  93. package/_types/client/evm/evm.d.ts +89 -1
  94. package/_types/client/evm/evm.d.ts.map +1 -1
  95. package/_types/client/evm/evm.types.d.ts +33 -3
  96. package/_types/client/evm/evm.types.d.ts.map +1 -1
  97. package/_types/client/policies/index.d.ts +2 -0
  98. package/_types/client/policies/index.d.ts.map +1 -0
  99. package/_types/client/policies/policies.d.ts +216 -0
  100. package/_types/client/policies/policies.d.ts.map +1 -0
  101. package/_types/client/policies/policies.types.d.ts +96 -0
  102. package/_types/client/policies/policies.types.d.ts.map +1 -0
  103. package/_types/client/solana/solana.d.ts +43 -1
  104. package/_types/client/solana/solana.d.ts.map +1 -1
  105. package/_types/client/solana/solana.types.d.ts +14 -2
  106. package/_types/client/solana/solana.types.d.ts.map +1 -1
  107. package/_types/index.d.ts +2 -0
  108. package/_types/index.d.ts.map +1 -1
  109. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +81 -0
  110. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
  111. package/_types/openapi-client/generated/evm-accounts/evm-accounts.d.ts +13 -1
  112. package/_types/openapi-client/generated/evm-accounts/evm-accounts.d.ts.map +1 -1
  113. package/_types/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts +5 -1
  114. package/_types/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts.map +1 -1
  115. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +3 -1
  116. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts.map +1 -1
  117. package/_types/openapi-client/generated/index.msw.d.ts +1 -1
  118. package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
  119. package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts +7 -1
  120. package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts.map +1 -1
  121. package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts +2 -0
  122. package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts.map +1 -1
  123. package/_types/openapi-client/index.d.ts +18 -0
  124. package/_types/openapi-client/index.d.ts.map +1 -1
  125. package/_types/policies/schema.d.ts +922 -0
  126. package/_types/policies/schema.d.ts.map +1 -0
  127. package/_types/policies/types.d.ts +19 -0
  128. package/_types/policies/types.d.ts.map +1 -0
  129. package/_types/types/misc.d.ts +39 -0
  130. package/_types/types/misc.d.ts.map +1 -1
  131. package/_types/version.d.ts +1 -1
  132. package/accounts/evm/toEvmServerAccount.ts +6 -3
  133. package/accounts/evm/types.ts +6 -8
  134. package/accounts/solana/toSolanaAccount.ts +1 -0
  135. package/actions/evm/transfer/types.ts +1 -1
  136. package/analytics.ts +84 -11
  137. package/client/cdp.ts +11 -4
  138. package/client/evm/evm.ts +159 -17
  139. package/client/evm/evm.types.ts +38 -1
  140. package/client/policies/index.ts +1 -0
  141. package/client/policies/policies.ts +246 -0
  142. package/client/policies/policies.types.ts +109 -0
  143. package/client/solana/solana.ts +94 -20
  144. package/client/solana/solana.types.ts +16 -1
  145. package/index.ts +7 -0
  146. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +86 -0
  147. package/openapi-client/generated/evm-accounts/evm-accounts.msw.ts +102 -0
  148. package/openapi-client/generated/evm-accounts/evm-accounts.ts +43 -0
  149. package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +3 -1
  150. package/openapi-client/generated/index.msw.ts +1 -1
  151. package/openapi-client/generated/solana-accounts/solana-accounts.msw.ts +75 -0
  152. package/openapi-client/generated/solana-accounts/solana-accounts.ts +23 -0
  153. package/openapi-client/index.ts +6 -0
  154. package/package.json +3 -2
  155. package/policies/schema.ts +266 -0
  156. package/policies/types.ts +19 -0
  157. package/types/misc.ts +41 -0
  158. package/version.ts +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../policies/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,oBAAoB,yCAAuC,CAAC;AACzE;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,sBAAsB,6BAA2B,CAAC;AAC/D;;;GAGG;AACH,MA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YAE/E;;;;eAIG;;YAEH;;;;eAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA6GH;;;WAGG;;QAEH;;;WAGG;;QAEH;;;WAGG;;YAjHH,kFAAkF;;YAElF;;;eAGG;;YAEH;;;;eAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8KH,CAAC;AACH;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { PolicyScope, Rule } from "./schema.js";
2
+ /**
3
+ * A single Policy that can be used to govern the behavior of projects and accounts.
4
+ */
5
+ export type Policy = {
6
+ /** The unique identifier for the policy. */
7
+ id: string;
8
+ /** An optional human-readable description of the policy. */
9
+ description?: string;
10
+ /** The scope of the policy. Only one project-level policy can exist at any time. */
11
+ scope: PolicyScope;
12
+ /** A list of rules that comprise the policy. */
13
+ rules: Rule[];
14
+ /** The ISO 8601 timestamp at which the Policy was created. */
15
+ createdAt: string;
16
+ /** The ISO 8601 timestamp at which the Policy was last updated. */
17
+ updatedAt: string;
18
+ };
19
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../policies/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oFAAoF;IACpF,KAAK,EAAE,WAAW,CAAC;IACnB,gDAAgD;IAChD,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
@@ -38,4 +38,43 @@ export type TransactionRequestEIP1559 = {
38
38
  /** (Ignored) The transaction type is always `eip1559`. */
39
39
  type?: "eip1559" | undefined;
40
40
  };
41
+ /**
42
+ * The domain of the EIP-712 typed data.
43
+ */
44
+ export interface EIP712Domain {
45
+ /** The name of the DApp or protocol. */
46
+ name?: string;
47
+ /** The version of the DApp or protocol. */
48
+ version?: string;
49
+ /** The chain ID of the EVM network. */
50
+ chainId?: number;
51
+ /** The 0x-prefixed EVM address of the verifying smart contract. */
52
+ verifyingContract?: string;
53
+ /** The optional 32-byte 0x-prefixed hex salt for domain separation. */
54
+ salt?: string;
55
+ }
56
+ /**
57
+ * A mapping of struct names to an array of type objects (name + type).
58
+ * Each key corresponds to a type name (e.g., "`EIP712Domain`", "`PermitTransferFrom`").
59
+ */
60
+ export interface EIP712Types {
61
+ [key: string]: unknown;
62
+ }
63
+ /**
64
+ * The message to sign. The structure of this message must match the `primaryType` struct in the `types` object.
65
+ */
66
+ export type EIP712MessageMessage = {
67
+ [key: string]: unknown;
68
+ };
69
+ /**
70
+ * The message to sign using EIP-712.
71
+ */
72
+ export interface EIP712Message {
73
+ domain: EIP712Domain;
74
+ types: EIP712Types;
75
+ /** The primary type of the message. This is the name of the struct in the `types` object that is the root of the message. */
76
+ primaryType: string;
77
+ /** The message to sign. The structure of this message must match the `primaryType` struct in the `types` object. */
78
+ message: EIP712MessageMessage;
79
+ }
41
80
  //# sourceMappingURL=misc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../types/misc.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG,GAAG,KAAK,MAAM,EAAE,CAAC;AAChC,MAAM,MAAM,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;AACjC,MAAM,MAAM,OAAO,GAAG,KAAK,MAAM,EAAE,CAAC;AAEpC,MAAM,MAAM,UAAU,GAAG,SAAS;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C;IACrB,KAAK,EAAE,WAAW,CAAC;IACnB,6HAA6H;IAC7H,WAAW,EAAE,MAAM,CAAC;IACpB,oHAAoH;IACpH,OAAO,EAAE,oBAAoB,CAAC;CAC/B"}
@@ -1,2 +1,2 @@
1
- export declare const version = "1.7.0";
1
+ export declare const version = "1.8.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -18,7 +18,7 @@ import type { EvmServerAccount } from "./types.js";
18
18
  import type { SendTransactionOptions } from "../../actions/evm/sendTransaction.js";
19
19
  import type { TransferResult } from "../../actions/evm/transfer/types.js";
20
20
  import type { CdpOpenApiClientType, EvmAccount } from "../../openapi-client/index.js";
21
- import type { Address, Hash } from "../../types/misc.js";
21
+ import type { Address, EIP712Message, Hash } from "../../types/misc.js";
22
22
 
23
23
  /**
24
24
  * Options for converting a pre-existing EvmAccount to a EvmServerAccount.
@@ -64,9 +64,11 @@ export function toEvmServerAccount(
64
64
  return result.signedTransaction as Hex;
65
65
  },
66
66
 
67
- async signTypedData() {
68
- throw new Error("Not implemented");
67
+ async signTypedData(message: EIP712Message) {
68
+ const result = await apiClient.signEvmTypedData(options.account.address, message);
69
+ return result.signature as Hex;
69
70
  },
71
+
70
72
  async transfer(transferArgs): Promise<TransferResult> {
71
73
  return transfer(apiClient, account, transferArgs, accountTransferStrategy);
72
74
  },
@@ -94,6 +96,7 @@ export function toEvmServerAccount(
94
96
  },
95
97
  name: options.account.name,
96
98
  type: "evm-server",
99
+ policies: options.account.policies,
97
100
  };
98
101
 
99
102
  return account;
@@ -1,9 +1,10 @@
1
- import { SignableMessage, TransactionSerializable, TypedData, TypedDataDefinition } from "viem";
1
+ import { SignableMessage, TransactionSerializable } from "viem";
2
2
 
3
3
  import { Prettify } from "../../types/utils.js";
4
4
 
5
5
  import type { AccountActions, SmartAccountActions } from "../../actions/evm/types.js";
6
- import type { Hash, Hex, Address } from "../../types/misc.js";
6
+ import type { EIP712Message } from "../../openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js";
7
+ import type { Address, Hash, Hex } from "../../types/misc.js";
7
8
 
8
9
  /**
9
10
  * Base type for any Ethereum account with signing capabilities.
@@ -19,12 +20,9 @@ export type EvmAccount = {
19
20
  /** Signs a transaction and returns the signed transaction as a hex string. */
20
21
  signTransaction: (transaction: TransactionSerializable) => Promise<Hex>;
21
22
  /** Signs a typed data and returns the signature as a hex string. */
22
- signTypedData: <
23
- const typedData extends TypedData | Record<string, unknown>,
24
- primaryType extends keyof typedData | "EIP712Domain" = keyof typedData,
25
- >(
26
- parameters: TypedDataDefinition<typedData, primaryType>,
27
- ) => Promise<Hex>;
23
+ signTypedData: (message: EIP712Message) => Promise<Hex>;
24
+ /** A list of Policy ID's that apply to the account. */
25
+ policies?: string[];
28
26
  };
29
27
 
30
28
  /**
@@ -53,6 +53,7 @@ export function toSolanaAccount(
53
53
  address: account.address,
54
54
  });
55
55
  },
56
+ policies: options.account.policies,
56
57
  };
57
58
 
58
59
  return account;
@@ -25,7 +25,7 @@ export type Network = SendEvmTransactionBodyNetwork | EvmUserOperationNetwork;
25
25
  /**
26
26
  * The options for the transfer.
27
27
  */
28
- type TransferOptions = {
28
+ export type TransferOptions = {
29
29
  /** The account to transfer the token to. */
30
30
  to: EvmAccount | Address;
31
31
  /**
package/analytics.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import md5 from "md5";
2
2
 
3
+ import { APIError } from "./openapi-client/errors.js";
4
+
3
5
  /**
4
6
  * The data in an error event
5
7
  */
@@ -22,24 +24,33 @@ type ErrorEventData = {
22
24
  name: "error";
23
25
  };
24
26
 
25
- type EventData = ErrorEventData & {
26
- apiKeyId: string;
27
- };
27
+ type EventData = ErrorEventData;
28
28
 
29
29
  // This is a public client id for the analytics service
30
30
  const publicClientId = "54f2ee2fb3d2b901a829940d70fbfc13";
31
31
 
32
+ export const Analytics = {
33
+ identifier: "", // set in cdp.ts
34
+ wrapClassWithErrorTracking,
35
+ wrapObjectMethodsWithErrorTracking,
36
+ sendEvent,
37
+ };
38
+
32
39
  /**
33
40
  * Sends an analytics event to the default endpoint
34
41
  *
35
42
  * @param event - The event data containing event-specific fields
36
43
  * @returns Promise that resolves when the event is sent
37
44
  */
38
- export async function sendEvent(event: EventData): Promise<void> {
45
+ async function sendEvent(event: EventData): Promise<void> {
46
+ if (process.env.DISABLE_CDP_ERROR_REPORTING === "true") {
47
+ return;
48
+ }
49
+
39
50
  const timestamp = Date.now();
40
51
 
41
52
  const enhancedEvent = {
42
- user_id: event.apiKeyId,
53
+ user_id: Analytics.identifier,
43
54
  event_type: event.name,
44
55
  platform: "server",
45
56
  timestamp,
@@ -80,10 +91,13 @@ export async function sendEvent(event: EventData): Promise<void> {
80
91
  * Wraps all methods of a class with error tracking.
81
92
  *
82
93
  * @param ClassToWrap - The class whose prototype methods should be wrapped.
83
- * @param apiKeyId - The API key ID to use for the error tracking.
84
94
  */
85
95
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
86
- export function wrapClassWithErrorTracking(ClassToWrap: any, apiKeyId: string): void {
96
+ function wrapClassWithErrorTracking(ClassToWrap: any): void {
97
+ if (process.env.DISABLE_CDP_ERROR_REPORTING === "true") {
98
+ return;
99
+ }
100
+
87
101
  const methods = Object.getOwnPropertyNames(ClassToWrap.prototype).filter(
88
102
  name => name !== "constructor" && typeof ClassToWrap.prototype[name] === "function",
89
103
  );
@@ -94,14 +108,13 @@ export function wrapClassWithErrorTracking(ClassToWrap: any, apiKeyId: string):
94
108
  try {
95
109
  return await originalMethod.apply(this, args);
96
110
  } catch (error) {
97
- if (!(error instanceof Error)) {
98
- return;
111
+ if (!shouldTrackError(error)) {
112
+ throw error;
99
113
  }
100
114
 
101
- const { message, stack } = error;
115
+ const { message, stack } = error as Error;
102
116
 
103
117
  sendEvent({
104
- apiKeyId,
105
118
  method,
106
119
  message,
107
120
  stack,
@@ -115,3 +128,63 @@ export function wrapClassWithErrorTracking(ClassToWrap: any, apiKeyId: string):
115
128
  };
116
129
  }
117
130
  }
131
+
132
+ /**
133
+ * Wraps all methods of an object with error tracking.
134
+ *
135
+ * @param object - The object whose methods should be wrapped.
136
+ */
137
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
138
+ function wrapObjectMethodsWithErrorTracking(object: any): void {
139
+ if (process.env.DISABLE_CDP_ERROR_REPORTING === "true") {
140
+ return;
141
+ }
142
+
143
+ const methods = Object.getOwnPropertyNames(object).filter(
144
+ name => name !== "constructor" && typeof object[name] === "function",
145
+ );
146
+
147
+ for (const method of methods) {
148
+ const originalMethod = object[method];
149
+ object[method] = async function (...args: unknown[]) {
150
+ try {
151
+ return await originalMethod.apply(this, args);
152
+ } catch (error) {
153
+ if (!shouldTrackError(error)) {
154
+ throw error;
155
+ }
156
+
157
+ const { message, stack } = error as Error;
158
+
159
+ sendEvent({
160
+ method,
161
+ message,
162
+ stack,
163
+ name: "error",
164
+ }).catch(() => {
165
+ // ignore error
166
+ });
167
+
168
+ throw error;
169
+ }
170
+ };
171
+ }
172
+ }
173
+
174
+ /**
175
+ * Filters out non-errors and API errors
176
+ *
177
+ * @param error - The error to check.
178
+ * @returns True if the error should be tracked, false otherwise.
179
+ */
180
+ function shouldTrackError(error: unknown): boolean {
181
+ if (!(error instanceof Error)) {
182
+ return false;
183
+ }
184
+
185
+ if (error instanceof APIError) {
186
+ return false;
187
+ }
188
+
189
+ return true;
190
+ }
package/client/cdp.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { wrapClassWithErrorTracking } from "../analytics.js";
1
+ import { Analytics } from "../analytics.js";
2
2
  import { CdpOpenApiClient } from "../openapi-client/index.js";
3
3
  import { version } from "../version.js";
4
4
  import { EvmClient } from "./evm/evm.js";
5
+ import { PoliciesClient } from "./policies/policies.js";
5
6
  import { SolanaClient } from "./solana/solana.js";
6
7
 
7
8
  interface CdpClientOptions {
@@ -27,6 +28,9 @@ export class CdpClient {
27
28
  /** Namespace containing all Solana methods. */
28
29
  public solana: SolanaClient;
29
30
 
31
+ /** Namespace containing all Policies methods. */
32
+ public policies: PoliciesClient;
33
+
30
34
  /**
31
35
  * The CdpClient is the main class for interacting with the CDP API.
32
36
  *
@@ -109,12 +113,15 @@ For more information, see: https://github.com/coinbase/cdp-sdk/blob/main/typescr
109
113
  });
110
114
 
111
115
  if (process.env.DISABLE_CDP_ERROR_REPORTING !== "true") {
112
- wrapClassWithErrorTracking(CdpClient, apiKeyId);
113
- wrapClassWithErrorTracking(EvmClient, apiKeyId);
114
- wrapClassWithErrorTracking(SolanaClient, apiKeyId);
116
+ Analytics.identifier = apiKeyId;
117
+ Analytics.wrapClassWithErrorTracking(CdpClient);
118
+ Analytics.wrapClassWithErrorTracking(EvmClient);
119
+ Analytics.wrapClassWithErrorTracking(SolanaClient);
120
+ Analytics.wrapClassWithErrorTracking(PoliciesClient);
115
121
  }
116
122
 
117
123
  this.evm = new EvmClient();
118
124
  this.solana = new SolanaClient();
125
+ this.policies = new PoliciesClient();
119
126
  }
120
127
  }
package/client/evm/evm.ts CHANGED
@@ -21,6 +21,8 @@ import {
21
21
  ListSmartAccountResult,
22
22
  ListSmartAccountsOptions,
23
23
  GetOrCreateServerAccountOptions,
24
+ SignTypedDataOptions,
25
+ UpdateEvmAccountOptions,
24
26
  } from "./evm.types.js";
25
27
  import { toEvmServerAccount } from "../../accounts/evm/toEvmServerAccount.js";
26
28
  import { toEvmSmartAccount } from "../../accounts/evm/toEvmSmartAccount.js";
@@ -45,6 +47,7 @@ import {
45
47
  waitForUserOperation,
46
48
  WaitForUserOperationReturnType,
47
49
  } from "../../actions/evm/waitForUserOperation.js";
50
+ import { Analytics } from "../../analytics.js";
48
51
  import { APIError } from "../../openapi-client/errors.js";
49
52
  import { CdpOpenApiClient } from "../../openapi-client/index.js";
50
53
  import { Hex } from "../../types/misc.js";
@@ -93,16 +96,20 @@ export class EvmClient implements EvmClientInterface {
93
96
  * ```
94
97
  */
95
98
  async createAccount(options: CreateServerAccountOptions = {}): Promise<ServerAccount> {
96
- const account = await CdpOpenApiClient.createEvmAccount(
99
+ const openApiAccount = await CdpOpenApiClient.createEvmAccount(
97
100
  {
98
101
  name: options.name,
99
102
  },
100
103
  options.idempotencyKey,
101
104
  );
102
105
 
103
- return toEvmServerAccount(CdpOpenApiClient, {
104
- account,
106
+ const account = toEvmServerAccount(CdpOpenApiClient, {
107
+ account: openApiAccount,
105
108
  });
109
+
110
+ Analytics.wrapObjectMethodsWithErrorTracking(account);
111
+
112
+ return account;
106
113
  }
107
114
 
108
115
  /**
@@ -151,17 +158,21 @@ export class EvmClient implements EvmClientInterface {
151
158
  * ```
152
159
  */
153
160
  async createSmartAccount(options: CreateSmartAccountOptions): Promise<SmartAccount> {
154
- const smartAccount = await CdpOpenApiClient.createEvmSmartAccount(
161
+ const openApiSmartAccount = await CdpOpenApiClient.createEvmSmartAccount(
155
162
  {
156
163
  owners: [options.owner.address],
157
164
  },
158
165
  options.idempotencyKey,
159
166
  );
160
167
 
161
- return toEvmSmartAccount(CdpOpenApiClient, {
162
- smartAccount,
168
+ const smartAccount = toEvmSmartAccount(CdpOpenApiClient, {
169
+ smartAccount: openApiSmartAccount,
163
170
  owner: options.owner,
164
171
  });
172
+
173
+ Analytics.wrapObjectMethodsWithErrorTracking(smartAccount);
174
+
175
+ return smartAccount;
165
176
  }
166
177
 
167
178
  /**
@@ -190,7 +201,7 @@ export class EvmClient implements EvmClientInterface {
190
201
  * ```
191
202
  */
192
203
  async getAccount(options: GetServerAccountOptions): Promise<ServerAccount> {
193
- const account = await (() => {
204
+ const openApiAccount = await (() => {
194
205
  if (options.address) {
195
206
  return CdpOpenApiClient.getEvmAccount(options.address);
196
207
  }
@@ -202,9 +213,13 @@ export class EvmClient implements EvmClientInterface {
202
213
  throw new Error("Either address or name must be provided");
203
214
  })();
204
215
 
205
- return toEvmServerAccount(CdpOpenApiClient, {
206
- account,
216
+ const account = toEvmServerAccount(CdpOpenApiClient, {
217
+ account: openApiAccount,
207
218
  });
219
+
220
+ Analytics.wrapObjectMethodsWithErrorTracking(account);
221
+
222
+ return account;
208
223
  }
209
224
 
210
225
  /**
@@ -227,12 +242,16 @@ export class EvmClient implements EvmClientInterface {
227
242
  * ```
228
243
  */
229
244
  async getSmartAccount(options: GetSmartAccountOptions): Promise<SmartAccount> {
230
- const smartAccount = await CdpOpenApiClient.getEvmSmartAccount(options.address);
245
+ const openApiSmartAccount = await CdpOpenApiClient.getEvmSmartAccount(options.address);
231
246
 
232
- return toEvmSmartAccount(CdpOpenApiClient, {
233
- smartAccount,
247
+ const smartAccount = toEvmSmartAccount(CdpOpenApiClient, {
248
+ smartAccount: openApiSmartAccount,
234
249
  owner: options.owner,
235
250
  });
251
+
252
+ Analytics.wrapObjectMethodsWithErrorTracking(smartAccount);
253
+
254
+ return smartAccount;
236
255
  }
237
256
 
238
257
  /**
@@ -328,11 +347,15 @@ export class EvmClient implements EvmClientInterface {
328
347
  });
329
348
 
330
349
  return {
331
- accounts: ethAccounts.accounts.map(account =>
332
- toEvmServerAccount(CdpOpenApiClient, {
333
- account: account,
334
- }),
335
- ),
350
+ accounts: ethAccounts.accounts.map(account => {
351
+ const evmAccount = toEvmServerAccount(CdpOpenApiClient, {
352
+ account,
353
+ });
354
+
355
+ Analytics.wrapObjectMethodsWithErrorTracking(evmAccount);
356
+
357
+ return evmAccount;
358
+ }),
336
359
  nextPageToken: ethAccounts.nextPageToken,
337
360
  };
338
361
  }
@@ -647,6 +670,68 @@ export class EvmClient implements EvmClientInterface {
647
670
  };
648
671
  }
649
672
 
673
+ /**
674
+ * Signs an EIP-712 message.
675
+ *
676
+ * @param {SignTypedDataOptions} options - Parameters for signing the EIP-712 message.
677
+ * @returns A promise that resolves to the signature.
678
+ *
679
+ * @example
680
+ * ```ts
681
+ * const signature = await cdp.evm.signTypedData({
682
+ * address: account.address,
683
+ * domain: {
684
+ * name: "Permit2",
685
+ * chainId: 1,
686
+ * verifyingContract: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
687
+ * },
688
+ * types: {
689
+ * EIP712Domain: [
690
+ * { name: "name", type: "string" },
691
+ * { name: "chainId", type: "uint256" },
692
+ * { name: "verifyingContract", type: "address" },
693
+ * ],
694
+ * PermitTransferFrom: [
695
+ * { name: "permitted", type: "TokenPermissions" },
696
+ * { name: "spender", type: "address" },
697
+ * { name: "nonce", type: "uint256" },
698
+ * { name: "deadline", type: "uint256" },
699
+ * ],
700
+ * TokenPermissions: [
701
+ * { name: "token", type: "address" },
702
+ * { name: "amount", type: "uint256" },
703
+ * ],
704
+ * },
705
+ * primaryType: "PermitTransferFrom",
706
+ * message: {
707
+ * permitted: {
708
+ * token: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
709
+ * amount: "1000000",
710
+ * },
711
+ * spender: "0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf",
712
+ * nonce: "0",
713
+ * deadline: "1717123200",
714
+ * },
715
+ * });
716
+ * ```
717
+ */
718
+ async signTypedData(options: SignTypedDataOptions): Promise<SignatureResult> {
719
+ const signature = await CdpOpenApiClient.signEvmTypedData(
720
+ options.address,
721
+ {
722
+ domain: options.domain,
723
+ types: options.types,
724
+ primaryType: options.primaryType,
725
+ message: options.message,
726
+ },
727
+ options.idempotencyKey,
728
+ );
729
+
730
+ return {
731
+ signature: signature.signature as Hex,
732
+ };
733
+ }
734
+
650
735
  /**
651
736
  * Signs an EVM transaction.
652
737
  *
@@ -691,6 +776,63 @@ export class EvmClient implements EvmClientInterface {
691
776
  };
692
777
  }
693
778
 
779
+ /**
780
+ * Updates a CDP EVM account.
781
+ *
782
+ * @param {UpdateEvmAccountOptions} [options] - Optional parameters for creating the account.
783
+ * @param {string} options.address - The address of the account to update
784
+ * @param {UpdateEvmAccountBody} options.update - An object containing account fields to update.
785
+ * @param {string} [options.update.name] - The new name for the account.
786
+ * @param {string} [options.update.accountPolicy] - The ID of a Policy to apply to the account.
787
+ * @param {string} [options.idempotencyKey] - An idempotency key.
788
+ *
789
+ * @returns A promise that resolves to the updated account.
790
+ *
791
+ * @example **With a name**
792
+ * ```ts
793
+ * const account = await cdp.evm.updateAccount({ address: "0x...", update: { name: "New Name" } });
794
+ * ```
795
+ *
796
+ * @example **With an account policy**
797
+ * ```ts
798
+ * const account = await cdp.evm.updateAccount({ address: "0x...", update: { accountPolicy: "73bcaeeb-d7af-4615-b064-42b5fe83a31e" } });
799
+ * ```
800
+ *
801
+ * @example **With an idempotency key**
802
+ * ```ts
803
+ * const idempotencyKey = uuidv4();
804
+ *
805
+ * // First call
806
+ * await cdp.evm.updateAccount({
807
+ * address: "0x...",
808
+ * update: { accountPolicy: "73bcaeeb-d7af-4615-b064-42b5fe83a31e" },
809
+ * idempotencyKey,
810
+ * });
811
+ *
812
+ * // Second call with the same idempotency key will not update
813
+ * await cdp.evm.updateAccount({
814
+ * address: '0x...',
815
+ * update: { name: "" },
816
+ * idempotencyKey,
817
+ * });
818
+ * ```
819
+ */
820
+ async updateAccount(options: UpdateEvmAccountOptions): Promise<ServerAccount> {
821
+ const openApiAccount = await CdpOpenApiClient.updateEvmAccount(
822
+ options.address,
823
+ options.update,
824
+ options.idempotencyKey,
825
+ );
826
+
827
+ const account = toEvmServerAccount(CdpOpenApiClient, {
828
+ account: openApiAccount,
829
+ });
830
+
831
+ Analytics.wrapObjectMethodsWithErrorTracking(account);
832
+
833
+ return account;
834
+ }
835
+
694
836
  /**
695
837
  * Waits for a user operation to complete or fail.
696
838
  *