@coinbase/cdp-sdk 1.3.0 → 1.3.2
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 +55 -1
- package/_cjs/analytics.js +17 -41
- package/_cjs/analytics.js.map +1 -1
- package/_cjs/client/cdp.js +5 -1
- package/_cjs/client/cdp.js.map +1 -1
- package/_cjs/index.js +0 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/analytics.js +16 -39
- package/_esm/analytics.js.map +1 -1
- package/_esm/client/cdp.js +6 -2
- package/_esm/client/cdp.js.map +1 -1
- package/_esm/index.js +0 -1
- package/_esm/index.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/analytics.d.ts +10 -16
- package/_types/analytics.d.ts.map +1 -1
- package/_types/client/cdp.d.ts.map +1 -1
- package/_types/index.d.ts +0 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/analytics.ts +19 -44
- package/client/cdp.ts +6 -2
- package/index.ts +0 -2
- package/package.json +2 -3
- package/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# CDP SDK Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#76](https://github.com/coinbase/cdp-sdk/pull/76) [`24463f0`](https://github.com/coinbase/cdp-sdk/commit/24463f0e5a3c4463a287cc5305bcc0d07f4f9654) Thanks [@0xRAG](https://github.com/0xRAG)! - Fix circular dependency when importing @coinbase/cdp-sdk
|
|
8
|
+
|
|
9
|
+
## 1.3.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- This patch contains a README update to accomodate the new home for CDP SDK examples.
|
|
14
|
+
|
|
3
15
|
## 1.3.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
## Table of Contents
|
|
4
4
|
|
|
5
5
|
- [CDP SDK](#cdp-sdk)
|
|
6
|
+
- [Documentation](#documentation)
|
|
6
7
|
- [Installation](#installation)
|
|
7
8
|
- [API Keys](#api-keys)
|
|
8
9
|
- [Usage](#usage)
|
|
@@ -11,14 +12,25 @@
|
|
|
11
12
|
- [License](#license)
|
|
12
13
|
- [Support](#support)
|
|
13
14
|
- [Security](#security)
|
|
15
|
+
- [FAQ](#faq)
|
|
14
16
|
|
|
15
17
|
> [!TIP]
|
|
18
|
+
>
|
|
16
19
|
> If you're looking to contribute to the SDK, please see the [Contributing Guide](https://github.com/coinbase/cdp-sdk/blob/main/typescript/CONTRIBUTING.md).
|
|
17
20
|
|
|
18
21
|
## CDP SDK
|
|
19
22
|
|
|
20
23
|
This module contains the TypeScript CDP SDK, which is a library that provides a client for interacting with the [Coinbase Developer Platform (CDP)](https://docs.cdp.coinbase.com/). It includes a CDP Client for interacting with EVM and Solana APIs to create accounts and send transactions, as well as authentication tools for interacting directly with the CDP APIs.
|
|
21
24
|
|
|
25
|
+
## Documentation
|
|
26
|
+
|
|
27
|
+
CDP SDK has [auto-generated docs for the Typescript SDK](https://coinbase.github.io/cdp-sdk/typescript).
|
|
28
|
+
|
|
29
|
+
Further documentation is also available on the CDP docs website:
|
|
30
|
+
|
|
31
|
+
- [Wallet API v2](https://docs.cdp.coinbase.com/wallet-api-v2/docs/welcome)
|
|
32
|
+
- [API Reference](https://docs.cdp.coinbase.com/api-v2/docs/welcome)
|
|
33
|
+
|
|
22
34
|
## Installation
|
|
23
35
|
|
|
24
36
|
```bash
|
|
@@ -211,7 +223,7 @@ console.log(`Transaction confirmed! Explorer link: https://sepolia.basescan.org/
|
|
|
211
223
|
|
|
212
224
|
#### Solana
|
|
213
225
|
|
|
214
|
-
For Solana, we recommend using the `@solana/web3.js` library to send transactions. See the [examples](https://github.com/coinbase/cdp-sdk/tree/main/typescript/
|
|
226
|
+
For Solana, we recommend using the `@solana/web3.js` library to send transactions. See the [examples](https://github.com/coinbase/cdp-sdk/tree/main/examples/typescript/solana/signAndSendTransaction.ts).
|
|
215
227
|
|
|
216
228
|
### EVM Smart Accounts
|
|
217
229
|
|
|
@@ -286,3 +298,45 @@ For feature requests, feedback, or questions, please reach out to us in the **#c
|
|
|
286
298
|
## Security
|
|
287
299
|
|
|
288
300
|
If you discover a security vulnerability within this SDK, please see our [Security Policy](https://github.com/coinbase/cdp-sdk/tree/main/SECURITY.md) for disclosure information.
|
|
301
|
+
|
|
302
|
+
## FAQ
|
|
303
|
+
|
|
304
|
+
Common errors and their solutions.
|
|
305
|
+
|
|
306
|
+
### AggregateError [ETIMEDOUT]
|
|
307
|
+
|
|
308
|
+
This is an issue in Node.js itself: https://github.com/nodejs/node/issues/54359. While [the fix](https://github.com/nodejs/node/pull/56738) is implemented, the workaround is to set the environment variable:
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
export NODE_OPTIONS="--network-family-autoselection-attempt-timeout=500"
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Error [ERR_REQUIRE_ESM]: require() of ES modules is not supported.
|
|
315
|
+
|
|
316
|
+
Use Node v20.19.0 or higher. CDP SDK depends on [jose](https://github.com/panva/jose) v6, which ships only ESM. Jose supports CJS style imports in Node.js versions where the require(esm) feature is enabled by default (^20.19.0 || ^22.12.0 || >= 23.0.0). [See here for more info](https://github.com/panva/jose?tab=readme-ov-file#user-content-fn-cjs-705c79d785ca9bc0f9ec1e8ce0825c74).
|
|
317
|
+
|
|
318
|
+
### Jest encountered an unexpected token
|
|
319
|
+
|
|
320
|
+
If you're using Jest and see an error like this:
|
|
321
|
+
|
|
322
|
+
```
|
|
323
|
+
Details:
|
|
324
|
+
|
|
325
|
+
/Users/.../node_modules/jose/dist/webapi/index.js:1
|
|
326
|
+
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export { compactDecrypt } from './jwe/compact/decrypt.js';
|
|
327
|
+
^^^^^^
|
|
328
|
+
|
|
329
|
+
SyntaxError: Unexpected token 'export'
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Add a file called `jest.setup.ts` next to your `jest.config` file with the following content:
|
|
333
|
+
|
|
334
|
+
```typescript
|
|
335
|
+
jest.mock("jose", () => {});
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Then, add the following line to your `jest.config` file:
|
|
339
|
+
|
|
340
|
+
```typescript
|
|
341
|
+
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
|
|
342
|
+
```
|
package/_cjs/analytics.js
CHANGED
|
@@ -3,32 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.AnalyticsConfig = void 0;
|
|
7
6
|
exports.sendEvent = sendEvent;
|
|
7
|
+
exports.wrapClassWithErrorTracking = wrapClassWithErrorTracking;
|
|
8
8
|
const md5_1 = __importDefault(require("md5"));
|
|
9
|
-
const cdp_js_1 = require("./client/cdp.js");
|
|
10
|
-
const evm_js_1 = require("./client/evm/evm.js");
|
|
11
|
-
const solana_js_1 = require("./client/solana/solana.js");
|
|
12
9
|
// This is a public client id for the analytics service
|
|
13
10
|
const publicClientId = "54f2ee2fb3d2b901a829940d70fbfc13";
|
|
14
|
-
/**
|
|
15
|
-
* AnalyticsConfig singleton class for holding the API key ID
|
|
16
|
-
*/
|
|
17
|
-
class AnalyticsConfig {
|
|
18
|
-
/**
|
|
19
|
-
* The API key ID
|
|
20
|
-
*/
|
|
21
|
-
static apiKeyId;
|
|
22
|
-
/**
|
|
23
|
-
* Sets the API key ID
|
|
24
|
-
*
|
|
25
|
-
* @param apiKeyId - The API key ID
|
|
26
|
-
*/
|
|
27
|
-
static set(apiKeyId) {
|
|
28
|
-
AnalyticsConfig.apiKeyId = apiKeyId;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.AnalyticsConfig = AnalyticsConfig;
|
|
32
11
|
/**
|
|
33
12
|
* Sends an analytics event to the default endpoint
|
|
34
13
|
*
|
|
@@ -38,7 +17,7 @@ exports.AnalyticsConfig = AnalyticsConfig;
|
|
|
38
17
|
async function sendEvent(event) {
|
|
39
18
|
const timestamp = Date.now();
|
|
40
19
|
const enhancedEvent = {
|
|
41
|
-
user_id:
|
|
20
|
+
user_id: event.apiKeyId,
|
|
42
21
|
event_type: event.name,
|
|
43
22
|
platform: "server",
|
|
44
23
|
timestamp,
|
|
@@ -73,13 +52,14 @@ async function sendEvent(event) {
|
|
|
73
52
|
* Wraps all methods of a class with error tracking.
|
|
74
53
|
*
|
|
75
54
|
* @param ClassToWrap - The class whose prototype methods should be wrapped.
|
|
55
|
+
* @param apiKeyId - The API key ID to use for the error tracking.
|
|
76
56
|
*/
|
|
77
57
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
78
|
-
function wrapClassWithErrorTracking(ClassToWrap) {
|
|
79
|
-
const
|
|
80
|
-
for (const
|
|
81
|
-
const originalMethod = ClassToWrap.prototype[
|
|
82
|
-
ClassToWrap.prototype[
|
|
58
|
+
function wrapClassWithErrorTracking(ClassToWrap, apiKeyId) {
|
|
59
|
+
const methods = Object.getOwnPropertyNames(ClassToWrap.prototype).filter(name => name !== "constructor" && typeof ClassToWrap.prototype[name] === "function");
|
|
60
|
+
for (const method of methods) {
|
|
61
|
+
const originalMethod = ClassToWrap.prototype[method];
|
|
62
|
+
ClassToWrap.prototype[method] = async function (...args) {
|
|
83
63
|
try {
|
|
84
64
|
return await originalMethod.apply(this, args);
|
|
85
65
|
}
|
|
@@ -88,22 +68,18 @@ function wrapClassWithErrorTracking(ClassToWrap) {
|
|
|
88
68
|
return;
|
|
89
69
|
}
|
|
90
70
|
const { message, stack } = error;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
71
|
+
sendEvent({
|
|
72
|
+
apiKeyId,
|
|
73
|
+
method,
|
|
74
|
+
message,
|
|
75
|
+
stack,
|
|
76
|
+
name: "error",
|
|
77
|
+
}).catch(() => {
|
|
78
|
+
// ignore error
|
|
79
|
+
});
|
|
101
80
|
throw error;
|
|
102
81
|
}
|
|
103
82
|
};
|
|
104
83
|
}
|
|
105
84
|
}
|
|
106
|
-
wrapClassWithErrorTracking(cdp_js_1.CdpClient);
|
|
107
|
-
wrapClassWithErrorTracking(evm_js_1.EvmClient);
|
|
108
|
-
wrapClassWithErrorTracking(solana_js_1.SolanaClient);
|
|
109
85
|
//# sourceMappingURL=analytics.js.map
|
package/_cjs/analytics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../analytics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../analytics.ts"],"names":[],"mappings":";;;;;AAqCA,8BAuCC;AASD,gEA+BC;AApHD,8CAAsB;AA4BtB,uDAAuD;AACvD,MAAM,cAAc,GAAG,kCAAkC,CAAC;AAE1D;;;;;GAKG;AACI,KAAK,UAAU,SAAS,CAAC,KAAgB;IAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,MAAM,aAAa,GAAG;QACpB,OAAO,EAAE,KAAK,CAAC,QAAQ;QACvB,UAAU,EAAE,KAAK,CAAC,IAAI;QACtB,QAAQ,EAAE,QAAQ;QAClB,SAAS;QACT,gBAAgB,EAAE;YAChB,YAAY,EAAE,SAAS;YACvB,gBAAgB,EAAE,YAAY;YAC9B,GAAG,KAAK;SACT;KACF,CAAC;IAEF,MAAM,MAAM,GAAG,CAAC,aAAa,CAAC,CAAC;IAC/B,MAAM,oBAAoB,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,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Y,KAAK,CAAC,EAAE,CAAC;oBAC9B,OAAO;gBACT,CAAC;gBAED,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;gBAEjC,SAAS,CAAC;oBACR,QAAQ;oBACR,MAAM;oBACN,OAAO;oBACP,KAAK;oBACL,IAAI,EAAE,OAAO;iBACd,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;oBACZ,eAAe;gBACjB,CAAC,CAAC,CAAC;gBAEH,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/_cjs/client/cdp.js
CHANGED
|
@@ -92,7 +92,11 @@ For more information, see: https://github.com/coinbase/cdp-sdk/blob/main/typescr
|
|
|
92
92
|
source: "sdk",
|
|
93
93
|
sourceVersion: version_js_1.version,
|
|
94
94
|
});
|
|
95
|
-
|
|
95
|
+
if (process.env.DISABLE_CDP_ERROR_REPORTING !== "true") {
|
|
96
|
+
(0, analytics_js_1.wrapClassWithErrorTracking)(CdpClient, apiKeyId);
|
|
97
|
+
(0, analytics_js_1.wrapClassWithErrorTracking)(evm_js_1.EvmClient, apiKeyId);
|
|
98
|
+
(0, analytics_js_1.wrapClassWithErrorTracking)(solana_js_1.SolanaClient, apiKeyId);
|
|
99
|
+
}
|
|
96
100
|
this.evm = new evm_js_1.EvmClient();
|
|
97
101
|
this.solana = new solana_js_1.SolanaClient();
|
|
98
102
|
}
|
package/_cjs/client/cdp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdp.js","sourceRoot":"","sources":["../../client/cdp.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"cdp.js","sourceRoot":"","sources":["../../client/cdp.ts"],"names":[],"mappings":";;;AAAA,kDAA6D;AAC7D,yDAA8D;AAC9D,8CAAwC;AACxC,yCAAyC;AACzC,kDAAkD;AAelD;;GAEG;AACH,MAAa,SAAS;IACpB,4CAA4C;IACrC,GAAG,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
3
3
|
exports.CdpClient = void 0;
|
|
4
|
-
require("./analytics.js");
|
|
5
4
|
var cdp_js_1 = require("./client/cdp.js");
|
|
6
5
|
Object.defineProperty(exports, "CdpClient", { enumerable: true, get: function () { return cdp_js_1.CdpClient; } });
|
|
7
6
|
//# sourceMappingURL=index.js.map
|
package/_cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,0CAA4C;AAAnC,mGAAA,SAAS,OAAA"}
|
package/_cjs/version.js
CHANGED
package/_esm/analytics.js
CHANGED
|
@@ -1,26 +1,6 @@
|
|
|
1
1
|
import md5 from "md5";
|
|
2
|
-
import { CdpClient } from "./client/cdp.js";
|
|
3
|
-
import { EvmClient } from "./client/evm/evm.js";
|
|
4
|
-
import { SolanaClient } from "./client/solana/solana.js";
|
|
5
2
|
// This is a public client id for the analytics service
|
|
6
3
|
const publicClientId = "54f2ee2fb3d2b901a829940d70fbfc13";
|
|
7
|
-
/**
|
|
8
|
-
* AnalyticsConfig singleton class for holding the API key ID
|
|
9
|
-
*/
|
|
10
|
-
export class AnalyticsConfig {
|
|
11
|
-
/**
|
|
12
|
-
* The API key ID
|
|
13
|
-
*/
|
|
14
|
-
static apiKeyId;
|
|
15
|
-
/**
|
|
16
|
-
* Sets the API key ID
|
|
17
|
-
*
|
|
18
|
-
* @param apiKeyId - The API key ID
|
|
19
|
-
*/
|
|
20
|
-
static set(apiKeyId) {
|
|
21
|
-
AnalyticsConfig.apiKeyId = apiKeyId;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
4
|
/**
|
|
25
5
|
* Sends an analytics event to the default endpoint
|
|
26
6
|
*
|
|
@@ -30,7 +10,7 @@ export class AnalyticsConfig {
|
|
|
30
10
|
export async function sendEvent(event) {
|
|
31
11
|
const timestamp = Date.now();
|
|
32
12
|
const enhancedEvent = {
|
|
33
|
-
user_id:
|
|
13
|
+
user_id: event.apiKeyId,
|
|
34
14
|
event_type: event.name,
|
|
35
15
|
platform: "server",
|
|
36
16
|
timestamp,
|
|
@@ -65,13 +45,14 @@ export async function sendEvent(event) {
|
|
|
65
45
|
* Wraps all methods of a class with error tracking.
|
|
66
46
|
*
|
|
67
47
|
* @param ClassToWrap - The class whose prototype methods should be wrapped.
|
|
48
|
+
* @param apiKeyId - The API key ID to use for the error tracking.
|
|
68
49
|
*/
|
|
69
50
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
-
function wrapClassWithErrorTracking(ClassToWrap) {
|
|
71
|
-
const
|
|
72
|
-
for (const
|
|
73
|
-
const originalMethod = ClassToWrap.prototype[
|
|
74
|
-
ClassToWrap.prototype[
|
|
51
|
+
export function wrapClassWithErrorTracking(ClassToWrap, apiKeyId) {
|
|
52
|
+
const methods = Object.getOwnPropertyNames(ClassToWrap.prototype).filter(name => name !== "constructor" && typeof ClassToWrap.prototype[name] === "function");
|
|
53
|
+
for (const method of methods) {
|
|
54
|
+
const originalMethod = ClassToWrap.prototype[method];
|
|
55
|
+
ClassToWrap.prototype[method] = async function (...args) {
|
|
75
56
|
try {
|
|
76
57
|
return await originalMethod.apply(this, args);
|
|
77
58
|
}
|
|
@@ -80,22 +61,18 @@ function wrapClassWithErrorTracking(ClassToWrap) {
|
|
|
80
61
|
return;
|
|
81
62
|
}
|
|
82
63
|
const { message, stack } = error;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
64
|
+
sendEvent({
|
|
65
|
+
apiKeyId,
|
|
66
|
+
method,
|
|
67
|
+
message,
|
|
68
|
+
stack,
|
|
69
|
+
name: "error",
|
|
70
|
+
}).catch(() => {
|
|
71
|
+
// ignore error
|
|
72
|
+
});
|
|
93
73
|
throw error;
|
|
94
74
|
}
|
|
95
75
|
};
|
|
96
76
|
}
|
|
97
77
|
}
|
|
98
|
-
wrapClassWithErrorTracking(CdpClient);
|
|
99
|
-
wrapClassWithErrorTracking(EvmClient);
|
|
100
|
-
wrapClassWithErrorTracking(SolanaClient);
|
|
101
78
|
//# sourceMappingURL=analytics.js.map
|
package/_esm/analytics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../analytics.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../analytics.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AA4BtB,uDAAuD;AACvD,MAAM,cAAc,GAAG,kCAAkC,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,KAAgB;IAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,MAAM,aAAa,GAAG;QACpB,OAAO,EAAE,KAAK,CAAC,QAAQ;QACvB,UAAU,EAAE,KAAK,CAAC,IAAI;QACtB,QAAQ,EAAE,QAAQ;QAClB,SAAS;QACT,gBAAgB,EAAE;YAChB,YAAY,EAAE,SAAS;YACvB,gBAAgB,EAAE,YAAY;YAC9B,GAAG,KAAK;SACT;KACF,CAAC;IAEF,MAAM,MAAM,GAAG,CAAC,aAAa,CAAC,CAAC;IAC/B,MAAM,oBAAoB,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACpD,MAAM,UAAU,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC;IAExC,MAAM,QAAQ,GAAG,GAAG,CAAC,oBAAoB,GAAG,UAAU,CAAC,CAAC;IAExD,MAAM,oBAAoB,GAAG;QAC3B,MAAM,EAAE,cAAc;QACtB,CAAC,EAAE,oBAAoB;QACvB,QAA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AAC,KAAK,CAAC,GAAG,EAAE;oBACZ,eAAe;gBACjB,CAAC,CAAC,CAAC;gBAEH,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/_esm/client/cdp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { wrapClassWithErrorTracking } 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";
|
|
@@ -89,7 +89,11 @@ For more information, see: https://github.com/coinbase/cdp-sdk/blob/main/typescr
|
|
|
89
89
|
source: "sdk",
|
|
90
90
|
sourceVersion: version,
|
|
91
91
|
});
|
|
92
|
-
|
|
92
|
+
if (process.env.DISABLE_CDP_ERROR_REPORTING !== "true") {
|
|
93
|
+
wrapClassWithErrorTracking(CdpClient, apiKeyId);
|
|
94
|
+
wrapClassWithErrorTracking(EvmClient, apiKeyId);
|
|
95
|
+
wrapClassWithErrorTracking(SolanaClient, apiKeyId);
|
|
96
|
+
}
|
|
93
97
|
this.evm = new EvmClient();
|
|
94
98
|
this.solana = new SolanaClient();
|
|
95
99
|
}
|
package/_esm/client/cdp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdp.js","sourceRoot":"","sources":["../../client/cdp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cdp.js","sourceRoot":"","sources":["../../client/cdp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAA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
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"}
|
package/_esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = "1.3.
|
|
1
|
+
export const version = "1.3.2";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/_types/analytics.d.ts
CHANGED
|
@@ -19,22 +19,9 @@ type ErrorEventData = {
|
|
|
19
19
|
*/
|
|
20
20
|
name: "error";
|
|
21
21
|
};
|
|
22
|
-
type EventData = ErrorEventData
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*/
|
|
26
|
-
export declare class AnalyticsConfig {
|
|
27
|
-
/**
|
|
28
|
-
* The API key ID
|
|
29
|
-
*/
|
|
30
|
-
static apiKeyId: string;
|
|
31
|
-
/**
|
|
32
|
-
* Sets the API key ID
|
|
33
|
-
*
|
|
34
|
-
* @param apiKeyId - The API key ID
|
|
35
|
-
*/
|
|
36
|
-
static set(apiKeyId: string): void;
|
|
37
|
-
}
|
|
22
|
+
type EventData = ErrorEventData & {
|
|
23
|
+
apiKeyId: string;
|
|
24
|
+
};
|
|
38
25
|
/**
|
|
39
26
|
* Sends an analytics event to the default endpoint
|
|
40
27
|
*
|
|
@@ -42,5 +29,12 @@ export declare class AnalyticsConfig {
|
|
|
42
29
|
* @returns Promise that resolves when the event is sent
|
|
43
30
|
*/
|
|
44
31
|
export declare function sendEvent(event: EventData): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Wraps all methods of a class with error tracking.
|
|
34
|
+
*
|
|
35
|
+
* @param ClassToWrap - The class whose prototype methods should be wrapped.
|
|
36
|
+
* @param apiKeyId - The API key ID to use for the error tracking.
|
|
37
|
+
*/
|
|
38
|
+
export declare function wrapClassWithErrorTracking(ClassToWrap: any, apiKeyId: string): void;
|
|
45
39
|
export {};
|
|
46
40
|
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../analytics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../analytics.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,KAAK,cAAc,GAAG;IACpB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,KAAK,SAAS,GAAG,cAAc,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAKF;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAuC/D;AAED;;;;;GAKG;AAEH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CA+BnF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdp.d.ts","sourceRoot":"","sources":["../../client/cdp.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,UAAU,gBAAgB;IACxB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yBAAyB;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,SAAS;IACpB,4CAA4C;IACrC,GAAG,EAAE,SAAS,CAAC;IAEtB,+CAA+C;IACxC,MAAM,EAAE,YAAY,CAAC;IAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;gBACS,OAAO,GAAE,gBAAqB;
|
|
1
|
+
{"version":3,"file":"cdp.d.ts","sourceRoot":"","sources":["../../client/cdp.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,UAAU,gBAAgB;IACxB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yBAAyB;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,SAAS;IACpB,4CAA4C;IACrC,GAAG,EAAE,SAAS,CAAC;IAEtB,+CAA+C;IACxC,MAAM,EAAE,YAAY,CAAC;IAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;gBACS,OAAO,GAAE,gBAAqB;CAuD3C"}
|
package/_types/index.d.ts
CHANGED
package/_types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
|
package/_types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "1.3.
|
|
1
|
+
export declare const version = "1.3.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/analytics.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import md5 from "md5";
|
|
2
2
|
|
|
3
|
-
import { CdpClient } from "./client/cdp.js";
|
|
4
|
-
import { EvmClient } from "./client/evm/evm.js";
|
|
5
|
-
import { SolanaClient } from "./client/solana/solana.js";
|
|
6
|
-
|
|
7
3
|
/**
|
|
8
4
|
* The data in an error event
|
|
9
5
|
*/
|
|
@@ -26,30 +22,13 @@ type ErrorEventData = {
|
|
|
26
22
|
name: "error";
|
|
27
23
|
};
|
|
28
24
|
|
|
29
|
-
type EventData = ErrorEventData
|
|
25
|
+
type EventData = ErrorEventData & {
|
|
26
|
+
apiKeyId: string;
|
|
27
|
+
};
|
|
30
28
|
|
|
31
29
|
// This is a public client id for the analytics service
|
|
32
30
|
const publicClientId = "54f2ee2fb3d2b901a829940d70fbfc13";
|
|
33
31
|
|
|
34
|
-
/**
|
|
35
|
-
* AnalyticsConfig singleton class for holding the API key ID
|
|
36
|
-
*/
|
|
37
|
-
export class AnalyticsConfig {
|
|
38
|
-
/**
|
|
39
|
-
* The API key ID
|
|
40
|
-
*/
|
|
41
|
-
public static apiKeyId: string;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Sets the API key ID
|
|
45
|
-
*
|
|
46
|
-
* @param apiKeyId - The API key ID
|
|
47
|
-
*/
|
|
48
|
-
public static set(apiKeyId: string): void {
|
|
49
|
-
AnalyticsConfig.apiKeyId = apiKeyId;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
32
|
/**
|
|
54
33
|
* Sends an analytics event to the default endpoint
|
|
55
34
|
*
|
|
@@ -60,7 +39,7 @@ export async function sendEvent(event: EventData): Promise<void> {
|
|
|
60
39
|
const timestamp = Date.now();
|
|
61
40
|
|
|
62
41
|
const enhancedEvent = {
|
|
63
|
-
user_id:
|
|
42
|
+
user_id: event.apiKeyId,
|
|
64
43
|
event_type: event.name,
|
|
65
44
|
platform: "server",
|
|
66
45
|
timestamp,
|
|
@@ -101,16 +80,17 @@ export async function sendEvent(event: EventData): Promise<void> {
|
|
|
101
80
|
* Wraps all methods of a class with error tracking.
|
|
102
81
|
*
|
|
103
82
|
* @param ClassToWrap - The class whose prototype methods should be wrapped.
|
|
83
|
+
* @param apiKeyId - The API key ID to use for the error tracking.
|
|
104
84
|
*/
|
|
105
85
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
106
|
-
function wrapClassWithErrorTracking(ClassToWrap: any): void {
|
|
107
|
-
const
|
|
86
|
+
export function wrapClassWithErrorTracking(ClassToWrap: any, apiKeyId: string): void {
|
|
87
|
+
const methods = Object.getOwnPropertyNames(ClassToWrap.prototype).filter(
|
|
108
88
|
name => name !== "constructor" && typeof ClassToWrap.prototype[name] === "function",
|
|
109
89
|
);
|
|
110
90
|
|
|
111
|
-
for (const
|
|
112
|
-
const originalMethod = ClassToWrap.prototype[
|
|
113
|
-
ClassToWrap.prototype[
|
|
91
|
+
for (const method of methods) {
|
|
92
|
+
const originalMethod = ClassToWrap.prototype[method];
|
|
93
|
+
ClassToWrap.prototype[method] = async function (...args: unknown[]) {
|
|
114
94
|
try {
|
|
115
95
|
return await originalMethod.apply(this, args);
|
|
116
96
|
} catch (error) {
|
|
@@ -120,23 +100,18 @@ function wrapClassWithErrorTracking(ClassToWrap: any): void {
|
|
|
120
100
|
|
|
121
101
|
const { message, stack } = error;
|
|
122
102
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
103
|
+
sendEvent({
|
|
104
|
+
apiKeyId,
|
|
105
|
+
method,
|
|
106
|
+
message,
|
|
107
|
+
stack,
|
|
108
|
+
name: "error",
|
|
109
|
+
}).catch(() => {
|
|
110
|
+
// ignore error
|
|
111
|
+
});
|
|
133
112
|
|
|
134
113
|
throw error;
|
|
135
114
|
}
|
|
136
115
|
};
|
|
137
116
|
}
|
|
138
117
|
}
|
|
139
|
-
|
|
140
|
-
wrapClassWithErrorTracking(CdpClient);
|
|
141
|
-
wrapClassWithErrorTracking(EvmClient);
|
|
142
|
-
wrapClassWithErrorTracking(SolanaClient);
|
package/client/cdp.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { wrapClassWithErrorTracking } 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";
|
|
@@ -108,7 +108,11 @@ For more information, see: https://github.com/coinbase/cdp-sdk/blob/main/typescr
|
|
|
108
108
|
sourceVersion: version,
|
|
109
109
|
});
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
if (process.env.DISABLE_CDP_ERROR_REPORTING !== "true") {
|
|
112
|
+
wrapClassWithErrorTracking(CdpClient, apiKeyId);
|
|
113
|
+
wrapClassWithErrorTracking(EvmClient, apiKeyId);
|
|
114
|
+
wrapClassWithErrorTracking(SolanaClient, apiKeyId);
|
|
115
|
+
}
|
|
112
116
|
|
|
113
117
|
this.evm = new EvmClient();
|
|
114
118
|
this.solana = new SolanaClient();
|
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cdp-sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "SDK for interacting with the Coinbase Developer Platform Wallet API",
|
|
5
5
|
"main": "./_cjs/index.js",
|
|
6
6
|
"module": "./_esm/index.js",
|
|
@@ -30,8 +30,7 @@
|
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"files": [
|
|
32
32
|
"*",
|
|
33
|
-
"!**/*.test.ts"
|
|
34
|
-
"!examples"
|
|
33
|
+
"!**/*.test.ts"
|
|
35
34
|
],
|
|
36
35
|
"keywords": [
|
|
37
36
|
"coinbase",
|
package/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "1.3.
|
|
1
|
+
export const version = "1.3.2";
|