@coinbase-sample/prime-sdk-ts 0.6.1 → 0.6.3

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 (64) hide show
  1. package/README.md +207 -67
  2. package/dist/activities/index.js +21 -39
  3. package/dist/addressBooks/index.js +18 -5
  4. package/dist/allocations/index.js +19 -18
  5. package/dist/balances/index.js +23 -17
  6. package/dist/client-manual.js +84 -0
  7. package/dist/client-modular.js +57 -0
  8. package/dist/client-only.js +31 -0
  9. package/dist/{client.js → clients/client.js} +12 -2
  10. package/dist/clients/clientWithServices.js +323 -0
  11. package/dist/{types/client.d.ts → clients/clientWithServicesTypes.js} +3 -6
  12. package/dist/clients/index.js +28 -0
  13. package/dist/clients/types.js +2 -0
  14. package/dist/constants.js +1 -1
  15. package/dist/financing/index.js +16 -3
  16. package/dist/futures/index.js +4 -4
  17. package/dist/index.js +27 -18
  18. package/dist/invoices/index.js +16 -12
  19. package/dist/onchainAddressBook/index.js +4 -4
  20. package/dist/orders/index.js +38 -58
  21. package/dist/positions/index.js +21 -6
  22. package/dist/products/index.js +16 -3
  23. package/dist/services.js +75 -0
  24. package/dist/shared/envUtils.js +66 -0
  25. package/dist/shared/paginatedResponse.js +3 -0
  26. package/dist/staking/index.js +5 -5
  27. package/dist/transactions/index.js +26 -17
  28. package/dist/types/activities/index.d.ts +2 -3
  29. package/dist/types/addressBooks/index.d.ts +2 -3
  30. package/dist/types/allocations/index.d.ts +2 -3
  31. package/dist/types/assets/index.d.ts +2 -3
  32. package/dist/types/balances/index.d.ts +2 -3
  33. package/dist/types/client-manual.d.ts +58 -0
  34. package/dist/types/client-modular.d.ts +39 -0
  35. package/dist/types/client-only.d.ts +18 -0
  36. package/dist/types/clients/client.d.ts +27 -0
  37. package/dist/types/clients/clientWithServices.d.ts +229 -0
  38. package/dist/types/clients/clientWithServicesTypes.d.ts +115 -0
  39. package/dist/types/clients/index.d.ts +19 -0
  40. package/dist/types/clients/types.d.ts +48 -0
  41. package/dist/types/commission/index.d.ts +2 -3
  42. package/dist/types/constants.d.ts +1 -1
  43. package/dist/types/financing/index.d.ts +2 -3
  44. package/dist/types/futures/index.d.ts +2 -3
  45. package/dist/types/index.d.ts +2 -1
  46. package/dist/types/invoices/index.d.ts +2 -3
  47. package/dist/types/onchainAddressBook/index.d.ts +2 -3
  48. package/dist/types/orders/index.d.ts +2 -3
  49. package/dist/types/paymentMethods/index.d.ts +2 -3
  50. package/dist/types/portfolios/index.d.ts +2 -3
  51. package/dist/types/positions/index.d.ts +2 -3
  52. package/dist/types/products/index.d.ts +2 -3
  53. package/dist/types/services.d.ts +39 -0
  54. package/dist/types/shared/envUtils.d.ts +36 -0
  55. package/dist/types/shared/paginatedResponse.d.ts +5 -4
  56. package/dist/types/staking/index.d.ts +2 -3
  57. package/dist/types/transactions/index.d.ts +2 -3
  58. package/dist/types/types.d.ts +37 -0
  59. package/dist/types/users/index.d.ts +2 -3
  60. package/dist/types/wallets/index.d.ts +2 -3
  61. package/dist/types.js +39 -0
  62. package/dist/users/index.js +21 -6
  63. package/dist/wallets/index.js +24 -12
  64. package/package.json +32 -1
package/dist/types.js ADDED
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
29
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.CoinbaseError = exports.CoinbaseClientException = exports.Method = exports.CoinbaseClient = void 0;
33
+ __exportStar(require("./model/enums/"), exports);
34
+ // Export client configuration types
35
+ var clients_1 = require("./clients");
36
+ Object.defineProperty(exports, "CoinbaseClient", { enumerable: true, get: function () { return clients_1.CoinbaseClient; } });
37
+ Object.defineProperty(exports, "Method", { enumerable: true, get: function () { return clients_1.Method; } });
38
+ Object.defineProperty(exports, "CoinbaseClientException", { enumerable: true, get: function () { return clients_1.CoinbaseClientException; } });
39
+ Object.defineProperty(exports, "CoinbaseError", { enumerable: true, get: function () { return clients_1.CoinbaseError; } });
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
11
22
  Object.defineProperty(exports, "__esModule", { value: true });
12
23
  exports.UsersService = void 0;
13
24
  const paginatedResponse_1 = require("../shared/paginatedResponse");
@@ -17,10 +28,12 @@ class UsersService {
17
28
  }
18
29
  listUsers(request, options) {
19
30
  return __awaiter(this, void 0, void 0, function* () {
20
- const queryParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
31
+ const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
32
+ const { limit, cursor, sortDirection, entityId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "entityId"]);
33
+ const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
21
34
  const response = yield this.client.request({
22
- url: `entities/${request.entityId}/users`,
23
- queryParams,
35
+ url: `entities/${entityId}/users`,
36
+ queryParams: finalQueryParams,
24
37
  callOptions: options,
25
38
  });
26
39
  const responseData = response.data;
@@ -30,10 +43,12 @@ class UsersService {
30
43
  }
31
44
  listPortfolioUsers(request, options) {
32
45
  return __awaiter(this, void 0, void 0, function* () {
33
- const queryParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
46
+ const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
47
+ const { limit, cursor, sortDirection, portfolioId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "portfolioId"]);
48
+ const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
34
49
  const response = yield this.client.request({
35
- url: `portfolios/${request.portfolioId}/users`,
36
- queryParams,
50
+ url: `portfolios/${portfolioId}/users`,
51
+ queryParams: finalQueryParams,
37
52
  callOptions: options,
38
53
  });
39
54
  const responseData = response.data;
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
11
22
  Object.defineProperty(exports, "__esModule", { value: true });
12
23
  exports.WalletsService = void 0;
13
24
  /**
@@ -25,7 +36,7 @@ exports.WalletsService = void 0;
25
36
  * See the License for the specific language governing permissions and
26
37
  * limitations under the License.
27
38
  */
28
- const core_ts_1 = require("@coinbase-sample/core-ts");
39
+ const clients_1 = require("../clients");
29
40
  const paginatedResponse_1 = require("../shared/paginatedResponse");
30
41
  class WalletsService {
31
42
  constructor(client) {
@@ -33,10 +44,12 @@ class WalletsService {
33
44
  }
34
45
  listWallets(request, options) {
35
46
  return __awaiter(this, void 0, void 0, function* () {
36
- const queryParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
47
+ const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
48
+ const { limit, cursor, portfolioId } = request, queryParams = __rest(request, ["limit", "cursor", "portfolioId"]);
49
+ const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
37
50
  const response = yield this.client.request({
38
- url: `portfolios/${request.portfolioId}/wallets`,
39
- queryParams,
51
+ url: `portfolios/${portfolioId}/wallets`,
52
+ queryParams: finalQueryParams,
40
53
  callOptions: options,
41
54
  });
42
55
  const responseData = response.data;
@@ -75,13 +88,12 @@ class WalletsService {
75
88
  }
76
89
  listWalletAddresses(request, options) {
77
90
  return __awaiter(this, void 0, void 0, function* () {
78
- const queryParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
79
- if (request.networkId) {
80
- queryParams.networkId = request.networkId;
81
- }
91
+ const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
92
+ const { limit, cursor, portfolioId, walletId } = request, queryParams = __rest(request, ["limit", "cursor", "portfolioId", "walletId"]);
93
+ const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
82
94
  const response = yield this.client.request({
83
- url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/addresses`,
84
- queryParams,
95
+ url: `portfolios/${portfolioId}/wallets/${walletId}/addresses`,
96
+ queryParams: finalQueryParams,
85
97
  callOptions: options,
86
98
  });
87
99
  const responseData = response.data;
@@ -96,7 +108,7 @@ class WalletsService {
96
108
  const response = yield this.client.request({
97
109
  url: `portfolios/${request.portfolioId}/wallets`,
98
110
  bodyParams,
99
- method: core_ts_1.Method.POST,
111
+ method: clients_1.Method.POST,
100
112
  callOptions: options,
101
113
  });
102
114
  return response.data;
@@ -110,7 +122,7 @@ class WalletsService {
110
122
  const response = yield this.client.request({
111
123
  url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/addresses`,
112
124
  bodyParams,
113
- method: core_ts_1.Method.POST,
125
+ method: clients_1.Method.POST,
114
126
  callOptions: options,
115
127
  });
116
128
  return response.data;
package/package.json CHANGED
@@ -1,8 +1,39 @@
1
1
  {
2
2
  "name": "@coinbase-sample/prime-sdk-ts",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/types/index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/types/index.d.ts",
9
+ "import": "./dist/index.js",
10
+ "require": "./dist/index.js"
11
+ },
12
+ "./manual": {
13
+ "types": "./dist/types/client-manual.d.ts",
14
+ "import": "./dist/client-manual.js",
15
+ "require": "./dist/client-manual.js"
16
+ },
17
+ "./modular": {
18
+ "types": "./dist/types/client-modular.d.ts",
19
+ "import": "./dist/client-modular.js",
20
+ "require": "./dist/client-modular.js"
21
+ },
22
+ "./services": {
23
+ "types": "./dist/types/services.d.ts",
24
+ "import": "./dist/services.js",
25
+ "require": "./dist/services.js"
26
+ },
27
+ "./client": {
28
+ "types": "./dist/types/client-only.d.ts",
29
+ "import": "./dist/client-only.js",
30
+ "require": "./dist/client-only.js"
31
+ },
32
+ "./types": {
33
+ "types": "./dist/types/types.d.ts"
34
+ },
35
+ "./package.json": "./package.json"
36
+ },
6
37
  "scripts": {
7
38
  "test": "echo \"Error: no test specified\" && exit 1",
8
39
  "build": "tsc",