@xylabs/sdk-js 2.5.3 → 2.5.6

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 (220) hide show
  1. package/dist/browser/Buffer.d.ts +2 -2
  2. package/dist/browser/Buffer.js +2 -2
  3. package/dist/browser/bufferPolyfill.d.ts +1 -1
  4. package/dist/browser/bufferPolyfill.js +10 -10
  5. package/dist/browser/index.d.ts +2 -2
  6. package/dist/browser/index.js +2 -2
  7. package/dist/browserIndex.d.ts +3 -3
  8. package/dist/browserIndex.js +3 -3
  9. package/dist/bundle/cjs5/browser/Buffer.d.ts +2 -2
  10. package/dist/bundle/cjs5/browser/bufferPolyfill.d.ts +1 -1
  11. package/dist/bundle/cjs5/browser/index.d.ts +2 -2
  12. package/dist/bundle/cjs5/browserIndex.d.ts +3 -3
  13. package/dist/bundle/cjs5/index.d.ts +4 -4
  14. package/dist/bundle/cjs5/index.js +245 -238
  15. package/dist/bundle/cjs5/index.js.map +1 -1
  16. package/dist/bundle/cjs5/node/Buffer.d.ts +2 -2
  17. package/dist/bundle/cjs5/node/bufferPolyfill.d.ts +1 -1
  18. package/dist/bundle/cjs5/node/index.d.ts +2 -2
  19. package/dist/bundle/cjs5/nodeIndex.d.ts +3 -3
  20. package/dist/bundle/cjs5/shared/ApiClient.d.ts +8 -8
  21. package/dist/bundle/cjs5/shared/ApiConfig.d.ts +7 -7
  22. package/dist/bundle/cjs5/shared/ApiEndpoint.d.ts +14 -14
  23. package/dist/bundle/cjs5/shared/ApiStage.d.ts +6 -6
  24. package/dist/bundle/cjs5/shared/BigNumber.d.ts +2 -2
  25. package/dist/bundle/cjs5/shared/EthAddress.d.ts +20 -20
  26. package/dist/bundle/cjs5/shared/Log.d.ts +17 -17
  27. package/dist/bundle/cjs5/shared/Override.d.ts +2 -2
  28. package/dist/bundle/cjs5/shared/assertEx.d.ts +11 -11
  29. package/dist/bundle/cjs5/shared/delay.d.ts +1 -1
  30. package/dist/bundle/cjs5/shared/ellipsize.d.ts +1 -1
  31. package/dist/bundle/cjs5/shared/exists.d.ts +9 -0
  32. package/dist/bundle/cjs5/shared/forget.d.ts +6 -6
  33. package/dist/bundle/cjs5/shared/getApiStage.d.ts +3 -3
  34. package/dist/bundle/cjs5/shared/index.d.ts +15 -15
  35. package/dist/bundle/cjs5/shared/padHex.d.ts +2 -2
  36. package/dist/bundle/esm2015/browser/Buffer.d.ts +2 -2
  37. package/dist/bundle/esm2015/browser/bufferPolyfill.d.ts +1 -1
  38. package/dist/bundle/esm2015/browser/index.d.ts +2 -2
  39. package/dist/bundle/esm2015/browserIndex.d.ts +3 -3
  40. package/dist/bundle/esm2015/index.d.ts +4 -4
  41. package/dist/bundle/esm2015/index.js +246 -238
  42. package/dist/bundle/esm2015/index.js.map +1 -1
  43. package/dist/bundle/esm2015/node/Buffer.d.ts +2 -2
  44. package/dist/bundle/esm2015/node/bufferPolyfill.d.ts +1 -1
  45. package/dist/bundle/esm2015/node/index.d.ts +2 -2
  46. package/dist/bundle/esm2015/nodeIndex.d.ts +3 -3
  47. package/dist/bundle/esm2015/shared/ApiClient.d.ts +8 -8
  48. package/dist/bundle/esm2015/shared/ApiConfig.d.ts +7 -7
  49. package/dist/bundle/esm2015/shared/ApiEndpoint.d.ts +14 -14
  50. package/dist/bundle/esm2015/shared/ApiStage.d.ts +6 -6
  51. package/dist/bundle/esm2015/shared/BigNumber.d.ts +2 -2
  52. package/dist/bundle/esm2015/shared/EthAddress.d.ts +20 -20
  53. package/dist/bundle/esm2015/shared/Log.d.ts +17 -17
  54. package/dist/bundle/esm2015/shared/Override.d.ts +2 -2
  55. package/dist/bundle/esm2015/shared/assertEx.d.ts +11 -11
  56. package/dist/bundle/esm2015/shared/delay.d.ts +1 -1
  57. package/dist/bundle/esm2015/shared/ellipsize.d.ts +1 -1
  58. package/dist/bundle/esm2015/shared/exists.d.ts +9 -0
  59. package/dist/bundle/esm2015/shared/forget.d.ts +6 -6
  60. package/dist/bundle/esm2015/shared/getApiStage.d.ts +3 -3
  61. package/dist/bundle/esm2015/shared/index.d.ts +15 -15
  62. package/dist/bundle/esm2015/shared/padHex.d.ts +2 -2
  63. package/dist/bundle/esm2017/browser/Buffer.d.ts +2 -2
  64. package/dist/bundle/esm2017/browser/bufferPolyfill.d.ts +1 -1
  65. package/dist/bundle/esm2017/browser/index.d.ts +2 -2
  66. package/dist/bundle/esm2017/browserIndex.d.ts +3 -3
  67. package/dist/bundle/esm2017/index.d.ts +4 -4
  68. package/dist/bundle/esm2017/index.js +246 -238
  69. package/dist/bundle/esm2017/index.js.map +1 -1
  70. package/dist/bundle/esm2017/node/Buffer.d.ts +2 -2
  71. package/dist/bundle/esm2017/node/bufferPolyfill.d.ts +1 -1
  72. package/dist/bundle/esm2017/node/index.d.ts +2 -2
  73. package/dist/bundle/esm2017/nodeIndex.d.ts +3 -3
  74. package/dist/bundle/esm2017/shared/ApiClient.d.ts +8 -8
  75. package/dist/bundle/esm2017/shared/ApiConfig.d.ts +7 -7
  76. package/dist/bundle/esm2017/shared/ApiEndpoint.d.ts +14 -14
  77. package/dist/bundle/esm2017/shared/ApiStage.d.ts +6 -6
  78. package/dist/bundle/esm2017/shared/BigNumber.d.ts +2 -2
  79. package/dist/bundle/esm2017/shared/EthAddress.d.ts +20 -20
  80. package/dist/bundle/esm2017/shared/Log.d.ts +17 -17
  81. package/dist/bundle/esm2017/shared/Override.d.ts +2 -2
  82. package/dist/bundle/esm2017/shared/assertEx.d.ts +11 -11
  83. package/dist/bundle/esm2017/shared/delay.d.ts +1 -1
  84. package/dist/bundle/esm2017/shared/ellipsize.d.ts +1 -1
  85. package/dist/bundle/esm2017/shared/exists.d.ts +9 -0
  86. package/dist/bundle/esm2017/shared/forget.d.ts +6 -6
  87. package/dist/bundle/esm2017/shared/getApiStage.d.ts +3 -3
  88. package/dist/bundle/esm2017/shared/index.d.ts +15 -15
  89. package/dist/bundle/esm2017/shared/padHex.d.ts +2 -2
  90. package/dist/bundle/esm5/browser/Buffer.d.ts +2 -2
  91. package/dist/bundle/esm5/browser/bufferPolyfill.d.ts +1 -1
  92. package/dist/bundle/esm5/browser/index.d.ts +2 -2
  93. package/dist/bundle/esm5/browserIndex.d.ts +3 -3
  94. package/dist/bundle/esm5/index.d.ts +4 -4
  95. package/dist/bundle/esm5/index.js +246 -238
  96. package/dist/bundle/esm5/index.js.map +1 -1
  97. package/dist/bundle/esm5/node/Buffer.d.ts +2 -2
  98. package/dist/bundle/esm5/node/bufferPolyfill.d.ts +1 -1
  99. package/dist/bundle/esm5/node/index.d.ts +2 -2
  100. package/dist/bundle/esm5/nodeIndex.d.ts +3 -3
  101. package/dist/bundle/esm5/shared/ApiClient.d.ts +8 -8
  102. package/dist/bundle/esm5/shared/ApiConfig.d.ts +7 -7
  103. package/dist/bundle/esm5/shared/ApiEndpoint.d.ts +14 -14
  104. package/dist/bundle/esm5/shared/ApiStage.d.ts +6 -6
  105. package/dist/bundle/esm5/shared/BigNumber.d.ts +2 -2
  106. package/dist/bundle/esm5/shared/EthAddress.d.ts +20 -20
  107. package/dist/bundle/esm5/shared/Log.d.ts +17 -17
  108. package/dist/bundle/esm5/shared/Override.d.ts +2 -2
  109. package/dist/bundle/esm5/shared/assertEx.d.ts +11 -11
  110. package/dist/bundle/esm5/shared/delay.d.ts +1 -1
  111. package/dist/bundle/esm5/shared/ellipsize.d.ts +1 -1
  112. package/dist/bundle/esm5/shared/exists.d.ts +9 -0
  113. package/dist/bundle/esm5/shared/forget.d.ts +6 -6
  114. package/dist/bundle/esm5/shared/getApiStage.d.ts +3 -3
  115. package/dist/bundle/esm5/shared/index.d.ts +15 -15
  116. package/dist/bundle/esm5/shared/padHex.d.ts +2 -2
  117. package/dist/bundle/node/browser/Buffer.d.ts +2 -2
  118. package/dist/bundle/node/browser/bufferPolyfill.d.ts +1 -1
  119. package/dist/bundle/node/browser/index.d.ts +2 -2
  120. package/dist/bundle/node/browserIndex.d.ts +3 -3
  121. package/dist/bundle/node/index.d.ts +4 -4
  122. package/dist/bundle/node/index.js +239 -239
  123. package/dist/bundle/node/index.js.map +1 -1
  124. package/dist/bundle/node/node/Buffer.d.ts +2 -2
  125. package/dist/bundle/node/node/bufferPolyfill.d.ts +1 -1
  126. package/dist/bundle/node/node/index.d.ts +2 -2
  127. package/dist/bundle/node/nodeIndex.d.ts +3 -3
  128. package/dist/bundle/node/shared/ApiClient.d.ts +8 -8
  129. package/dist/bundle/node/shared/ApiConfig.d.ts +7 -7
  130. package/dist/bundle/node/shared/ApiEndpoint.d.ts +14 -14
  131. package/dist/bundle/node/shared/ApiStage.d.ts +6 -6
  132. package/dist/bundle/node/shared/BigNumber.d.ts +2 -2
  133. package/dist/bundle/node/shared/EthAddress.d.ts +20 -20
  134. package/dist/bundle/node/shared/Log.d.ts +17 -17
  135. package/dist/bundle/node/shared/Override.d.ts +2 -2
  136. package/dist/bundle/node/shared/assertEx.d.ts +11 -11
  137. package/dist/bundle/node/shared/delay.d.ts +1 -1
  138. package/dist/bundle/node/shared/ellipsize.d.ts +1 -1
  139. package/dist/bundle/node/shared/exists.d.ts +9 -0
  140. package/dist/bundle/node/shared/forget.d.ts +6 -6
  141. package/dist/bundle/node/shared/getApiStage.d.ts +3 -3
  142. package/dist/bundle/node/shared/index.d.ts +15 -15
  143. package/dist/bundle/node/shared/padHex.d.ts +2 -2
  144. package/dist/bundle/node-esm/browser/Buffer.d.ts +2 -2
  145. package/dist/bundle/node-esm/browser/bufferPolyfill.d.ts +1 -1
  146. package/dist/bundle/node-esm/browser/index.d.ts +2 -2
  147. package/dist/bundle/node-esm/browserIndex.d.ts +3 -3
  148. package/dist/bundle/node-esm/index.d.ts +4 -4
  149. package/dist/bundle/node-esm/index.js +239 -239
  150. package/dist/bundle/node-esm/index.js.map +1 -1
  151. package/dist/bundle/node-esm/node/Buffer.d.ts +2 -2
  152. package/dist/bundle/node-esm/node/bufferPolyfill.d.ts +1 -1
  153. package/dist/bundle/node-esm/node/index.d.ts +2 -2
  154. package/dist/bundle/node-esm/nodeIndex.d.ts +3 -3
  155. package/dist/bundle/node-esm/shared/ApiClient.d.ts +8 -8
  156. package/dist/bundle/node-esm/shared/ApiConfig.d.ts +7 -7
  157. package/dist/bundle/node-esm/shared/ApiEndpoint.d.ts +14 -14
  158. package/dist/bundle/node-esm/shared/ApiStage.d.ts +6 -6
  159. package/dist/bundle/node-esm/shared/BigNumber.d.ts +2 -2
  160. package/dist/bundle/node-esm/shared/EthAddress.d.ts +20 -20
  161. package/dist/bundle/node-esm/shared/Log.d.ts +17 -17
  162. package/dist/bundle/node-esm/shared/Override.d.ts +2 -2
  163. package/dist/bundle/node-esm/shared/assertEx.d.ts +11 -11
  164. package/dist/bundle/node-esm/shared/delay.d.ts +1 -1
  165. package/dist/bundle/node-esm/shared/ellipsize.d.ts +1 -1
  166. package/dist/bundle/node-esm/shared/exists.d.ts +9 -0
  167. package/dist/bundle/node-esm/shared/forget.d.ts +6 -6
  168. package/dist/bundle/node-esm/shared/getApiStage.d.ts +3 -3
  169. package/dist/bundle/node-esm/shared/index.d.ts +15 -15
  170. package/dist/bundle/node-esm/shared/padHex.d.ts +2 -2
  171. package/dist/index.d.ts +4 -4
  172. package/dist/index.js +4 -4
  173. package/dist/node/Buffer.d.ts +2 -2
  174. package/dist/node/Buffer.js +2 -2
  175. package/dist/node/bufferPolyfill.d.ts +1 -1
  176. package/dist/node/bufferPolyfill.js +3 -3
  177. package/dist/node/index.d.ts +2 -2
  178. package/dist/node/index.js +2 -2
  179. package/dist/nodeIndex.d.ts +3 -3
  180. package/dist/nodeIndex.js +3 -3
  181. package/dist/shared/ApiClient.d.ts +8 -8
  182. package/dist/shared/ApiClient.js +8 -8
  183. package/dist/shared/ApiConfig.d.ts +7 -7
  184. package/dist/shared/ApiConfig.js +1 -1
  185. package/dist/shared/ApiEndpoint.d.ts +14 -14
  186. package/dist/shared/ApiEndpoint.js +48 -48
  187. package/dist/shared/ApiStage.d.ts +6 -6
  188. package/dist/shared/ApiStage.js +7 -7
  189. package/dist/shared/BigNumber.d.ts +2 -2
  190. package/dist/shared/BigNumber.js +2 -2
  191. package/dist/shared/EthAddress.d.ts +20 -20
  192. package/dist/shared/EthAddress.js +54 -54
  193. package/dist/shared/Log.d.ts +17 -17
  194. package/dist/shared/Log.js +59 -59
  195. package/dist/shared/Log.js.map +1 -1
  196. package/dist/shared/Override.d.ts +2 -2
  197. package/dist/shared/Override.js +1 -1
  198. package/dist/shared/assertEx.d.ts +11 -11
  199. package/dist/shared/assertEx.js +20 -20
  200. package/dist/shared/delay.d.ts +1 -1
  201. package/dist/shared/delay.js +3 -3
  202. package/dist/shared/ellipsize.d.ts +1 -1
  203. package/dist/shared/ellipsize.js +5 -5
  204. package/dist/shared/exists.d.ts +9 -0
  205. package/dist/shared/exists.js +12 -0
  206. package/dist/shared/exists.js.map +1 -0
  207. package/dist/shared/forget.d.ts +6 -6
  208. package/dist/shared/forget.js +36 -36
  209. package/dist/shared/getApiStage.d.ts +3 -3
  210. package/dist/shared/getApiStage.js +13 -13
  211. package/dist/shared/index.d.ts +15 -15
  212. package/dist/shared/index.js +12 -12
  213. package/dist/shared/padHex.d.ts +2 -2
  214. package/dist/shared/padHex.js +13 -13
  215. package/package.json +16 -16
  216. package/src/shared/Log.spec.ts +33 -0
  217. package/src/shared/Log.ts +2 -2
  218. package/src/shared/exists.spec.ts +28 -0
  219. package/src/shared/exists.ts +11 -0
  220. package/src/shared/forget.spec.ts +1 -1
@@ -1,55 +1,55 @@
1
- import { assertEx } from './assertEx';
2
- import { BigNumber } from './BigNumber';
3
- import { ellipsize } from './ellipsize';
4
- import { padHex } from './padHex';
5
- export const isEthAddress = (obj) => (obj === null || obj === void 0 ? void 0 : obj.type) === EthAddress.type;
6
- export class EthAddress {
7
- constructor(address) {
8
- this.type = EthAddress.type;
9
- this.address = address;
10
- }
11
- equals(address) {
12
- if (address) {
13
- let inAddress;
14
- if (typeof address === 'string') {
15
- inAddress = assertEx(EthAddress.fromString(address), 'Bad Address');
16
- }
17
- else {
18
- inAddress = address;
19
- }
20
- return this.address.eq(inAddress.address);
21
- }
22
- return false;
23
- }
24
- static fromString(value, base = 16) {
25
- if (value) {
26
- const bn = new BigNumber(value.startsWith('0x') ? value.substring(2) : value, base);
27
- return new EthAddress(bn);
28
- }
29
- }
30
- static parse(value, base) {
31
- if (typeof value === 'string') {
32
- return this.fromString(value, base);
33
- }
34
- }
35
- toBigNumber() {
36
- return this.address;
37
- }
38
- toString() {
39
- return `0x${this.toHex()}`;
40
- }
41
- toLowerCaseString() {
42
- return this.toString().toLowerCase();
43
- }
44
- toJSON() {
45
- return `0x${this.toHex()}`;
46
- }
47
- toHex() {
48
- return padHex(this.address.toString(16), 20);
49
- }
50
- toShortString(length = 2) {
51
- return `0x${ellipsize(this.toHex(), length)}`;
52
- }
53
- }
54
- EthAddress.type = 'EthAddress';
1
+ import { assertEx } from './assertEx';
2
+ import { BigNumber } from './BigNumber';
3
+ import { ellipsize } from './ellipsize';
4
+ import { padHex } from './padHex';
5
+ export const isEthAddress = (obj) => (obj === null || obj === void 0 ? void 0 : obj.type) === EthAddress.type;
6
+ export class EthAddress {
7
+ constructor(address) {
8
+ this.type = EthAddress.type;
9
+ this.address = address;
10
+ }
11
+ equals(address) {
12
+ if (address) {
13
+ let inAddress;
14
+ if (typeof address === 'string') {
15
+ inAddress = assertEx(EthAddress.fromString(address), 'Bad Address');
16
+ }
17
+ else {
18
+ inAddress = address;
19
+ }
20
+ return this.address.eq(inAddress.address);
21
+ }
22
+ return false;
23
+ }
24
+ static fromString(value, base = 16) {
25
+ if (value) {
26
+ const bn = new BigNumber(value.startsWith('0x') ? value.substring(2) : value, base);
27
+ return new EthAddress(bn);
28
+ }
29
+ }
30
+ static parse(value, base) {
31
+ if (typeof value === 'string') {
32
+ return this.fromString(value, base);
33
+ }
34
+ }
35
+ toBigNumber() {
36
+ return this.address;
37
+ }
38
+ toString() {
39
+ return `0x${this.toHex()}`;
40
+ }
41
+ toLowerCaseString() {
42
+ return this.toString().toLowerCase();
43
+ }
44
+ toJSON() {
45
+ return `0x${this.toHex()}`;
46
+ }
47
+ toHex() {
48
+ return padHex(this.address.toString(16), 20);
49
+ }
50
+ toShortString(length = 2) {
51
+ return `0x${ellipsize(this.toHex(), length)}`;
52
+ }
53
+ }
54
+ EthAddress.type = 'EthAddress';
55
55
  //# sourceMappingURL=EthAddress.js.map
@@ -1,17 +1,17 @@
1
- interface LogConfig {
2
- commitHash?: string;
3
- devMode?: boolean;
4
- rollbarToken?: string;
5
- payload?: Record<string, unknown>;
6
- }
7
- declare class Log {
8
- private rollbar?;
9
- private devMode?;
10
- constructor(config: LogConfig);
11
- error(...params: any[]): void;
12
- warn(...params: any[]): void;
13
- info(...params: any[]): void;
14
- debug(...params: any[]): void;
15
- log(...params: any[]): void;
16
- }
17
- export { Log };
1
+ interface LogConfig {
2
+ commitHash?: string;
3
+ devMode?: boolean;
4
+ rollbarToken?: string;
5
+ payload?: Record<string, unknown>;
6
+ }
7
+ declare class Log {
8
+ private rollbar?;
9
+ private devMode?;
10
+ constructor(config: LogConfig);
11
+ error(...params: any[]): void;
12
+ warn(...params: any[]): void;
13
+ info(...params: any[]): void;
14
+ debug(...params: any[]): void;
15
+ log(...params: any[]): void;
16
+ }
17
+ export { Log };
@@ -1,60 +1,60 @@
1
- import Rollbar from 'rollbar';
2
- class Log {
3
- constructor(config) {
4
- var _a;
5
- this.devMode = (_a = config.devMode) !== null && _a !== void 0 ? _a : false;
6
- if (config.rollbarToken) {
7
- this.rollbar = new Rollbar({
8
- accessToken: config.rollbarToken,
9
- captureUncaught: true,
10
- captureUnhandledRejections: true,
11
- codeVersion: config.commitHash,
12
- code_version: config.commitHash,
13
- payload: Object.assign({ client: {
14
- javascript: {
15
- code_version: config.commitHash,
16
- guess_uncaught_frames: true,
17
- source_map_enabled: true,
18
- },
19
- }, codeVersion: config.commitHash, code_version: config.commitHash, environment: this.devMode ? 'development' : 'production' }, config.payload),
20
- sendConfig: true,
21
- });
22
- }
23
- }
24
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
- error(...params) {
26
- var _a;
27
- console.error(params);
28
- if (this.devMode) {
29
- (_a = this.rollbar) === null || _a === void 0 ? void 0 : _a.error(params);
30
- }
31
- }
32
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
- warn(...params) {
34
- var _a;
35
- console.warn(params);
36
- if (this.devMode) {
37
- (_a = this.rollbar) === null || _a === void 0 ? void 0 : _a.warn(params);
38
- }
39
- }
40
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
- info(...params) {
42
- if (this.devMode) {
43
- console.info(params);
44
- }
45
- }
46
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
- debug(...params) {
48
- if (this.devMode) {
49
- console.debug(params);
50
- }
51
- }
52
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
- log(...params) {
54
- if (this.devMode) {
55
- console.log(params);
56
- }
57
- }
58
- }
59
- export { Log };
1
+ import Rollbar from 'rollbar';
2
+ class Log {
3
+ constructor(config) {
4
+ var _a;
5
+ this.devMode = (_a = config.devMode) !== null && _a !== void 0 ? _a : false;
6
+ if (config.rollbarToken) {
7
+ this.rollbar = new Rollbar({
8
+ accessToken: config.rollbarToken,
9
+ captureUncaught: true,
10
+ captureUnhandledRejections: true,
11
+ codeVersion: config.commitHash,
12
+ code_version: config.commitHash,
13
+ payload: Object.assign({ client: {
14
+ javascript: {
15
+ code_version: config.commitHash,
16
+ guess_uncaught_frames: true,
17
+ source_map_enabled: true,
18
+ },
19
+ }, codeVersion: config.commitHash, code_version: config.commitHash, environment: this.devMode ? 'development' : 'production' }, config.payload),
20
+ sendConfig: true,
21
+ });
22
+ }
23
+ }
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
+ error(...params) {
26
+ var _a;
27
+ console.error(params);
28
+ if (!this.devMode) {
29
+ (_a = this.rollbar) === null || _a === void 0 ? void 0 : _a.error(params);
30
+ }
31
+ }
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+ warn(...params) {
34
+ var _a;
35
+ console.warn(params);
36
+ if (!this.devMode) {
37
+ (_a = this.rollbar) === null || _a === void 0 ? void 0 : _a.warn(params);
38
+ }
39
+ }
40
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
+ info(...params) {
42
+ if (this.devMode) {
43
+ console.info(params);
44
+ }
45
+ }
46
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
+ debug(...params) {
48
+ if (this.devMode) {
49
+ console.debug(params);
50
+ }
51
+ }
52
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
+ log(...params) {
54
+ if (this.devMode) {
55
+ console.log(params);
56
+ }
57
+ }
58
+ }
59
+ export { Log };
60
60
  //# sourceMappingURL=Log.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Log.js","sourceRoot":"","sources":["../../src/shared/Log.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAS7B,MAAM,GAAG;IAIP,YAAY,MAAiB;;QAC3B,IAAI,CAAC,OAAO,GAAG,MAAA,MAAM,CAAC,OAAO,mCAAI,KAAK,CAAA;QAEtC,IAAI,MAAM,CAAC,YAAY,EAAE;YACvB,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC;gBACzB,WAAW,EAAE,MAAM,CAAC,YAAY;gBAChC,eAAe,EAAE,IAAI;gBACrB,0BAA0B,EAAE,IAAI;gBAChC,WAAW,EAAE,MAAM,CAAC,UAAU;gBAC9B,YAAY,EAAE,MAAM,CAAC,UAAU;gBAC/B,OAAO,kBACL,MAAM,EAAE;wBACN,UAAU,EAAE;4BACV,YAAY,EAAE,MAAM,CAAC,UAAU;4BAC/B,qBAAqB,EAAE,IAAI;4BAC3B,kBAAkB,EAAE,IAAI;yBACzB;qBACF,EACD,WAAW,EAAE,MAAM,CAAC,UAAU,EAC9B,YAAY,EAAE,MAAM,CAAC,UAAU,EAC/B,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CA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AC;IAED,8DAA8D;IACvD,KAAK,CAAC,GAAG,MAAa;QAC3B,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;SACtB;IACH,CAAC;IAED,8DAA8D;IACvD,GAAG,CAAC,GAAG,MAAa;QACzB,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;SACpB;IACH,CAAC;CACF;AAED,OAAO,EAAE,GAAG,EAAE,CAAA"}
@@ -1,2 +1,2 @@
1
- declare type Override<T1, T2> = Omit<T1, keyof T2> & T2;
2
- export type { Override };
1
+ declare type Override<T1, T2> = Omit<T1, keyof T2> & T2;
2
+ export type { Override };
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=Override.js.map
@@ -1,11 +1,11 @@
1
- /**
2
- *
3
- * Intended for simple null/undefiend checks for variables
4
- *
5
- * @param expr - Expression to be evaluated for truthiness
6
- * @param message - Message in Error if expression is false
7
- * @throws AssertExError
8
- * @returns Value of expression
9
- */
10
- declare const assertEx: <T>(expr?: T | null | undefined, message?: string | undefined) => T;
11
- export { assertEx };
1
+ /**
2
+ *
3
+ * Intended for simple null/undefiend checks for variables
4
+ *
5
+ * @param expr - Expression to be evaluated for truthiness
6
+ * @param message - Message in Error if expression is false
7
+ * @throws AssertExError
8
+ * @returns Value of expression
9
+ */
10
+ declare const assertEx: <T>(expr?: T | null | undefined, message?: string) => T;
11
+ export { assertEx };
@@ -1,21 +1,21 @@
1
- /**
2
- * Error object thrown by assertEx
3
- */
4
- class AssertExError extends Error {
5
- }
6
- /**
7
- *
8
- * Intended for simple null/undefiend checks for variables
9
- *
10
- * @param expr - Expression to be evaluated for truthiness
11
- * @param message - Message in Error if expression is false
12
- * @throws AssertExError
13
- * @returns Value of expression
14
- */
15
- const assertEx = (expr, message) => {
16
- if (expr)
17
- return expr;
18
- throw new AssertExError(message);
19
- };
20
- export { assertEx };
1
+ /**
2
+ * Error object thrown by assertEx
3
+ */
4
+ class AssertExError extends Error {
5
+ }
6
+ /**
7
+ *
8
+ * Intended for simple null/undefiend checks for variables
9
+ *
10
+ * @param expr - Expression to be evaluated for truthiness
11
+ * @param message - Message in Error if expression is false
12
+ * @throws AssertExError
13
+ * @returns Value of expression
14
+ */
15
+ const assertEx = (expr, message) => {
16
+ if (expr)
17
+ return expr;
18
+ throw new AssertExError(message);
19
+ };
20
+ export { assertEx };
21
21
  //# sourceMappingURL=assertEx.js.map
@@ -1 +1 @@
1
- export declare const delay: (ms: number) => Promise<unknown>;
1
+ export declare const delay: (ms: number) => Promise<unknown>;
@@ -1,4 +1,4 @@
1
- export const delay = (ms) => {
2
- return new Promise((resolve) => setTimeout(resolve, ms));
3
- };
1
+ export const delay = (ms) => {
2
+ return new Promise((resolve) => setTimeout(resolve, ms));
3
+ };
4
4
  //# sourceMappingURL=delay.js.map
@@ -1 +1 @@
1
- export declare const ellipsize: (value: string, length?: number) => string;
1
+ export declare const ellipsize: (value: string, length?: number) => string;
@@ -1,6 +1,6 @@
1
- export const ellipsize = (value, length = 2) => {
2
- const part1 = value.slice(0, length);
3
- const part2 = value.slice(value.length - length, value.length);
4
- return `${part1}...${part2}`;
5
- };
1
+ export const ellipsize = (value, length = 2) => {
2
+ const part1 = value.slice(0, length);
3
+ const part2 = value.slice(value.length - length, value.length);
4
+ return `${part1}...${part2}`;
5
+ };
6
6
  //# sourceMappingURL=ellipsize.js.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Used to type narrow an object which is possibly undefined. Works well
3
+ * with functional Array methods. For example:
4
+ * @example
5
+ * const payloads: XyoPayload[] = boundWitness._payloads?.filter(exists) || []
6
+ * @param x The object which is potentially undefined
7
+ * @returns True if the object is defined, false otherwise
8
+ */
9
+ export declare const exists: <T>(x: T | null | undefined) => x is T;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Used to type narrow an object which is possibly undefined. Works well
3
+ * with functional Array methods. For example:
4
+ * @example
5
+ * const payloads: XyoPayload[] = boundWitness._payloads?.filter(exists) || []
6
+ * @param x The object which is potentially undefined
7
+ * @returns True if the object is defined, false otherwise
8
+ */
9
+ export const exists = (x) => {
10
+ return !!x;
11
+ };
12
+ //# sourceMappingURL=exists.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exists.js","sourceRoot":"","sources":["../../src/shared/exists.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAI,CAAuB,EAAU,EAAE;IAC3D,OAAO,CAAC,CAAC,CAAC,CAAA;AACZ,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
- interface ForgetTimeoutConfig {
2
- delay: number;
3
- cancel: () => void;
4
- }
5
- export declare const forget: (promise: Promise<unknown>, timeout?: ForgetTimeoutConfig | undefined) => void;
6
- export {};
1
+ interface ForgetTimeoutConfig {
2
+ delay: number;
3
+ cancel: () => void;
4
+ }
5
+ export declare const forget: (promise: Promise<unknown>, timeout?: ForgetTimeoutConfig) => void;
6
+ export {};
@@ -1,37 +1,37 @@
1
- import { __awaiter } from "tslib";
2
- import { delay } from './delay';
3
- //used to explicitly launch an async funtion (or Promise) with awaiting it
4
- export const forget = (promise, timeout) => {
5
- let completed = false;
6
- const promiseWrapper = () => __awaiter(void 0, void 0, void 0, function* () {
7
- yield promise
8
- .then(() => {
9
- completed = true;
10
- })
11
- .catch(() => {
12
- completed = true;
13
- });
14
- });
15
- const promises = [promiseWrapper()];
16
- //if there is a timeout, add it to the race
17
- if (timeout) {
18
- const timeoutFunc = () => __awaiter(void 0, void 0, void 0, function* () {
19
- var _a;
20
- yield delay(timeout.delay);
21
- if (!completed) {
22
- console.log(`forget promise timeout out after ${timeout.delay}ms [Cancelling]`);
23
- (_a = timeout.cancel) === null || _a === void 0 ? void 0 : _a.call(timeout);
24
- }
25
- });
26
- promises.push(timeoutFunc());
27
- }
28
- const all = Promise.race(promises);
29
- all
30
- .then(() => {
31
- return;
32
- })
33
- .catch(() => {
34
- return;
35
- });
36
- };
1
+ import { __awaiter } from "tslib";
2
+ import { delay } from './delay';
3
+ //used to explicitly launch an async funtion (or Promise) with awaiting it
4
+ export const forget = (promise, timeout) => {
5
+ let completed = false;
6
+ const promiseWrapper = () => __awaiter(void 0, void 0, void 0, function* () {
7
+ yield promise
8
+ .then(() => {
9
+ completed = true;
10
+ })
11
+ .catch(() => {
12
+ completed = true;
13
+ });
14
+ });
15
+ const promises = [promiseWrapper()];
16
+ //if there is a timeout, add it to the race
17
+ if (timeout) {
18
+ const timeoutFunc = () => __awaiter(void 0, void 0, void 0, function* () {
19
+ var _a;
20
+ yield delay(timeout.delay);
21
+ if (!completed) {
22
+ console.log(`forget promise timeout out after ${timeout.delay}ms [Cancelling]`);
23
+ (_a = timeout.cancel) === null || _a === void 0 ? void 0 : _a.call(timeout);
24
+ }
25
+ });
26
+ promises.push(timeoutFunc());
27
+ }
28
+ const all = Promise.race(promises);
29
+ all
30
+ .then(() => {
31
+ return;
32
+ })
33
+ .catch(() => {
34
+ return;
35
+ });
36
+ };
37
37
  //# sourceMappingURL=forget.js.map
@@ -1,3 +1,3 @@
1
- import { ApiStage } from './ApiStage';
2
- declare const getApiStage: (hostname: string) => ApiStage;
3
- export { getApiStage };
1
+ import { ApiStage } from './ApiStage';
2
+ declare const getApiStage: (hostname: string) => ApiStage;
3
+ export { getApiStage };
@@ -1,14 +1,14 @@
1
- import { ApiStage } from './ApiStage';
2
- const getApiStage = (hostname) => {
3
- if (hostname.startsWith('localhost')) {
4
- return ApiStage.Local;
5
- }
6
- else if (hostname.startsWith('beta.')) {
7
- return ApiStage.Beta;
8
- }
9
- else {
10
- return ApiStage.Prod;
11
- }
12
- };
13
- export { getApiStage };
1
+ import { ApiStage } from './ApiStage';
2
+ const getApiStage = (hostname) => {
3
+ if (hostname.startsWith('localhost')) {
4
+ return ApiStage.Local;
5
+ }
6
+ else if (hostname.startsWith('beta.')) {
7
+ return ApiStage.Beta;
8
+ }
9
+ else {
10
+ return ApiStage.Prod;
11
+ }
12
+ };
13
+ export { getApiStage };
14
14
  //# sourceMappingURL=getApiStage.js.map
@@ -1,15 +1,15 @@
1
- import { ApiClient } from './ApiClient';
2
- import { ApiConfig } from './ApiConfig';
3
- import { ApiEndpoint } from './ApiEndpoint';
4
- import { ApiStage } from './ApiStage';
5
- import { assertEx } from './assertEx';
6
- import { BigNumber } from './BigNumber';
7
- import { delay } from './delay';
8
- import { EthAddress, isEthAddress } from './EthAddress';
9
- import { getApiStage } from './getApiStage';
10
- import { Log } from './Log';
11
- import { Override } from './Override';
12
- export * from './ellipsize';
13
- export * from './forget';
14
- export { ApiClient, ApiEndpoint, ApiStage, assertEx, BigNumber, delay, EthAddress, getApiStage, isEthAddress, Log };
15
- export type { ApiConfig, Override };
1
+ import { ApiClient } from './ApiClient';
2
+ import { ApiConfig } from './ApiConfig';
3
+ import { ApiEndpoint } from './ApiEndpoint';
4
+ import { ApiStage } from './ApiStage';
5
+ import { assertEx } from './assertEx';
6
+ import { BigNumber } from './BigNumber';
7
+ import { delay } from './delay';
8
+ import { EthAddress, isEthAddress } from './EthAddress';
9
+ import { getApiStage } from './getApiStage';
10
+ import { Log } from './Log';
11
+ import { Override } from './Override';
12
+ export * from './ellipsize';
13
+ export * from './forget';
14
+ export { ApiClient, ApiEndpoint, ApiStage, assertEx, BigNumber, delay, EthAddress, getApiStage, isEthAddress, Log };
15
+ export type { ApiConfig, Override };
@@ -1,13 +1,13 @@
1
- import { ApiClient } from './ApiClient';
2
- import { ApiEndpoint } from './ApiEndpoint';
3
- import { ApiStage } from './ApiStage';
4
- import { assertEx } from './assertEx';
5
- import { BigNumber } from './BigNumber';
6
- import { delay } from './delay';
7
- import { EthAddress, isEthAddress } from './EthAddress';
8
- import { getApiStage } from './getApiStage';
9
- import { Log } from './Log';
10
- export * from './ellipsize';
11
- export * from './forget';
12
- export { ApiClient, ApiEndpoint, ApiStage, assertEx, BigNumber, delay, EthAddress, getApiStage, isEthAddress, Log };
1
+ import { ApiClient } from './ApiClient';
2
+ import { ApiEndpoint } from './ApiEndpoint';
3
+ import { ApiStage } from './ApiStage';
4
+ import { assertEx } from './assertEx';
5
+ import { BigNumber } from './BigNumber';
6
+ import { delay } from './delay';
7
+ import { EthAddress, isEthAddress } from './EthAddress';
8
+ import { getApiStage } from './getApiStage';
9
+ import { Log } from './Log';
10
+ export * from './ellipsize';
11
+ export * from './forget';
12
+ export { ApiClient, ApiEndpoint, ApiStage, assertEx, BigNumber, delay, EthAddress, getApiStage, isEthAddress, Log };
13
13
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- declare const padHex: (hex: string, byteCount?: number | undefined) => string;
2
- export { padHex };
1
+ declare const padHex: (hex: string, byteCount?: number) => string;
2
+ export { padHex };
@@ -1,14 +1,14 @@
1
- const padHex = (hex, byteCount) => {
2
- let result = hex;
3
- if (hex.length % 2 !== 0) {
4
- result = `0${hex}`;
5
- }
6
- if (byteCount) {
7
- while (result.length / 2 < byteCount) {
8
- result = `00${result}`;
9
- }
10
- }
11
- return result;
12
- };
13
- export { padHex };
1
+ const padHex = (hex, byteCount) => {
2
+ let result = hex;
3
+ if (hex.length % 2 !== 0) {
4
+ result = `0${hex}`;
5
+ }
6
+ if (byteCount) {
7
+ while (result.length / 2 < byteCount) {
8
+ result = `00${result}`;
9
+ }
10
+ }
11
+ return result;
12
+ };
13
+ export { padHex };
14
14
  //# sourceMappingURL=padHex.js.map