snaptrade-typescript-sdk 9.0.3 → 9.0.5

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/common.d.ts CHANGED
@@ -18,11 +18,11 @@ export declare const assertParamExists: (functionName: string, paramName: string
18
18
  */
19
19
  export declare const setApiKeyToObject: ({ object, key, type, keyParamName, configuration, prefix }: {
20
20
  object: any;
21
- key?: string;
22
- type?: "Cookie";
21
+ key?: string | undefined;
22
+ type?: "Cookie" | undefined;
23
23
  keyParamName: string;
24
- configuration?: Configuration;
25
- prefix?: string;
24
+ configuration?: Configuration | undefined;
25
+ prefix?: string | undefined;
26
26
  }) => Promise<void>;
27
27
  /**
28
28
  *
@@ -23,7 +23,7 @@ class Configuration {
23
23
  if (param.clientId !== undefined)
24
24
  this.apiKey["clientId"] = param.clientId;
25
25
  if (param.signature !== undefined)
26
- this.apiKey["Signature"] = param.signature;
26
+ this.apiKey["signature"] = param.signature;
27
27
  if (param.timestamp !== undefined)
28
28
  this.apiKey["timestamp"] = param.timestamp;
29
29
  }
@@ -32,7 +32,7 @@ class Configuration {
32
32
  this.accessToken = param.accessToken;
33
33
  this.basePath = param.basePath;
34
34
  this.baseOptions = (_a = param.baseOptions) !== null && _a !== void 0 ? _a : {};
35
- this.userAgent = param.userAgent === undefined ? "Konfig/9.0.3/typescript" : param.userAgent;
35
+ this.userAgent = param.userAgent === undefined ? "Konfig/9.0.5/typescript" : param.userAgent;
36
36
  this.formDataCtor = param.formDataCtor;
37
37
  }
38
38
  /**
package/dist/error.d.ts CHANGED
@@ -34,11 +34,11 @@ export declare class SnaptradeError extends Error {
34
34
  toJSON(): {
35
35
  name: string;
36
36
  message: string;
37
- method: string;
38
- url: string;
39
- code: string;
40
- status: number;
41
- statusText: string;
37
+ method: string | undefined;
38
+ url: string | undefined;
39
+ code: string | undefined;
40
+ status: number | undefined;
41
+ statusText: string | undefined;
42
42
  responseBody: unknown;
43
43
  };
44
44
  }
package/dist/error.js CHANGED
@@ -25,14 +25,14 @@ exports.parseIfJson = exports.readableStreamToString = exports.SnaptradeError =
25
25
  */
26
26
  class SnaptradeError extends Error {
27
27
  constructor(axiosError, responseBody) {
28
- var _a, _b, _c;
28
+ var _a, _b, _c, _d, _e;
29
29
  super(axiosError.message);
30
30
  this.name = "SnaptradeError";
31
31
  this.code = axiosError.code;
32
- this.method = (_a = axiosError.config.method) === null || _a === void 0 ? void 0 : _a.toUpperCase();
33
- this.url = axiosError.config.url;
34
- this.status = (_b = axiosError.response) === null || _b === void 0 ? void 0 : _b.status;
35
- this.statusText = (_c = axiosError.response) === null || _c === void 0 ? void 0 : _c.statusText;
32
+ this.method = (_b = (_a = axiosError.config) === null || _a === void 0 ? void 0 : _a.method) === null || _b === void 0 ? void 0 : _b.toUpperCase();
33
+ this.url = (_c = axiosError.config) === null || _c === void 0 ? void 0 : _c.url;
34
+ this.status = (_d = axiosError.response) === null || _d === void 0 ? void 0 : _d.status;
35
+ this.statusText = (_e = axiosError.response) === null || _e === void 0 ? void 0 : _e.statusText;
36
36
  this.responseBody = responseBody;
37
37
  }
38
38
  toJSON() {
@@ -112,3 +112,4 @@ export * from './universal-symbol';
112
112
  export * from './user-error-log';
113
113
  export * from './user-idand-secret';
114
114
  export * from './user-settings';
115
+ export * from './validated-trade-body';
@@ -128,3 +128,4 @@ __exportStar(require("./universal-symbol"), exports);
128
128
  __exportStar(require("./user-error-log"), exports);
129
129
  __exportStar(require("./user-idand-secret"), exports);
130
130
  __exportStar(require("./user-settings"), exports);
131
+ __exportStar(require("./validated-trade-body"), exports);
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Validated Trade Form
3
+ * @export
4
+ * @interface ValidatedTradeBody
5
+ */
6
+ export interface ValidatedTradeBody {
7
+ /**
8
+ * Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status PENDING as we will not wait to check on the status before responding to the request
9
+ * @type {boolean}
10
+ * @memberof ValidatedTradeBody
11
+ */
12
+ 'wait_to_confirm'?: boolean | null;
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -31,7 +31,7 @@ function computeHmacSha256(message, key) {
31
31
  const msgBuffer = encoder.encode(message);
32
32
  const cryptoKey = yield window.crypto.subtle.importKey("raw", keyBuffer, { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
33
33
  const signature = yield window.crypto.subtle.sign("HMAC", cryptoKey, msgBuffer);
34
- const byteArray = new Uint8Array(signature);
34
+ const byteArray = Array.from(new Uint8Array(signature));
35
35
  // Convert byte array to base64
36
36
  const base64 = btoa(String.fromCharCode.apply(null, byteArray));
37
37
  return base64;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snaptrade-typescript-sdk",
3
- "version": "9.0.3",
3
+ "version": "9.0.5",
4
4
  "description": "Client for SnapTrade",
5
5
  "author": "Konfig",
6
6
  "engines": {
@@ -8,8 +8,10 @@
8
8
  },
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "https://github.com/passiv/snaptrade-sdks/tree/master/sdks/typescript"
11
+ "url": "https://github.com/passiv/snaptrade-sdks.git",
12
+ "directory": "sdks/typescript"
12
13
  },
14
+ "homepage": "https://github.com/passiv/snaptrade-sdks/tree/HEAD/sdks/typescript#readme",
13
15
  "keywords": [
14
16
  "axios",
15
17
  "typescript",
@@ -36,6 +38,7 @@
36
38
  "@babel/traverse": "^7.23.2"
37
39
  },
38
40
  "devDependencies": {
41
+ "@jest/types": "^29.6.3",
39
42
  "@types/jest": "^29.2.4",
40
43
  "@types/node": "^18",
41
44
  "jest": "^29.3.1",