@airgap/coinlib-core 0.13.45-beta.2 → 0.13.45-beta.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 (218) hide show
  1. package/actions/Action.js +30 -83
  2. package/actions/Action.js.map +1 -1
  3. package/actions/LinkedAction.js +18 -82
  4. package/actions/LinkedAction.js.map +1 -1
  5. package/actions/RepeatableAction.js +20 -83
  6. package/actions/RepeatableAction.js.map +1 -1
  7. package/actions/SimpleAction.js +12 -74
  8. package/actions/SimpleAction.js.map +1 -1
  9. package/actions/StateMachine.js +16 -17
  10. package/actions/StateMachine.js.map +1 -1
  11. package/data/KeyPair.d.ts +0 -1
  12. package/data/Lazy.js +15 -64
  13. package/data/Lazy.js.map +1 -1
  14. package/data/RPCBody.js +3 -6
  15. package/data/RPCBody.js.map +1 -1
  16. package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.d.ts +12 -12
  17. package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.js +88 -130
  18. package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.js.map +1 -1
  19. package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.d.ts +3 -3
  20. package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.js +57 -61
  21. package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.js.map +1 -1
  22. package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.js +96 -96
  23. package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.js.map +1 -1
  24. package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.js +1 -2
  25. package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.js.map +1 -1
  26. package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.js +8 -10
  27. package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.js.map +1 -1
  28. package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.js +22 -28
  29. package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.js.map +1 -1
  30. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.js +9 -10
  31. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.js.map +1 -1
  32. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.js +10 -11
  33. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.js.map +1 -1
  34. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.js +7 -8
  35. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.js.map +1 -1
  36. package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.d.ts +3 -3
  37. package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.js +61 -63
  38. package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.js.map +1 -1
  39. package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.d.ts +4 -4
  40. package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.js +61 -63
  41. package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.js.map +1 -1
  42. package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.d.ts +1 -1
  43. package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.js +2 -3
  44. package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.js.map +1 -1
  45. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.js +111 -111
  46. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.js.map +1 -1
  47. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.js +15 -15
  48. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.js.map +1 -1
  49. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.d.ts +1 -1
  50. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.js +47 -76
  51. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.js.map +1 -1
  52. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.d.ts +1 -1
  53. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.js +46 -61
  54. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.js.map +1 -1
  55. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.js +61 -106
  56. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.js.map +1 -1
  57. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/interface.d.ts +1 -1
  58. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.d.ts +6 -6
  59. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.js +95 -100
  60. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.js.map +1 -1
  61. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.js +33 -33
  62. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.js.map +1 -1
  63. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.js +9 -9
  64. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.js.map +1 -1
  65. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.d.ts +1 -1
  66. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.js +46 -75
  67. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.js.map +1 -1
  68. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.d.ts +1 -1
  69. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.js +45 -70
  70. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.js.map +1 -1
  71. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.js +41 -41
  72. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.js.map +1 -1
  73. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.js +4 -4
  74. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.js.map +1 -1
  75. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.d.ts +2 -2
  76. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.js +58 -63
  77. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.js.map +1 -1
  78. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.js +30 -33
  79. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.js.map +1 -1
  80. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.js +18 -20
  81. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.js.map +1 -1
  82. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.d.ts +1 -1
  83. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.js +5 -12
  84. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.js.map +1 -1
  85. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.js +13 -13
  86. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.js.map +1 -1
  87. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.js +1 -1
  88. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.js.map +1 -1
  89. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.d.ts +78 -78
  90. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.js +2 -2
  91. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.js.map +1 -1
  92. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.d.ts +45 -45
  93. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.js +75 -76
  94. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.js.map +1 -1
  95. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.js +115 -178
  96. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.js.map +1 -1
  97. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.d.ts +1 -1
  98. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.js +6 -9
  99. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.js.map +1 -1
  100. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.js +78 -83
  101. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.js.map +1 -1
  102. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.js +27 -36
  103. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.js.map +1 -1
  104. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.d.ts +1 -1
  105. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.js +25 -26
  106. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.js.map +1 -1
  107. package/dependencies/src/cosmjs/index.d.ts +14 -230
  108. package/dependencies/src/cosmjs/index.js +373 -480
  109. package/dependencies/src/cosmjs/index.js.map +1 -1
  110. package/dependencies/src/eciesjs-0.3.9/src/index.d.ts +0 -1
  111. package/dependencies/src/eciesjs-0.3.9/src/index.js +15 -19
  112. package/dependencies/src/eciesjs-0.3.9/src/index.js.map +1 -1
  113. package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.d.ts +0 -1
  114. package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.js +37 -28
  115. package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.js.map +1 -1
  116. package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.d.ts +0 -1
  117. package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.js +38 -30
  118. package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.js.map +1 -1
  119. package/dependencies/src/eciesjs-0.3.9/src/utils.d.ts +0 -1
  120. package/dependencies/src/eciesjs-0.3.9/src/utils.js +33 -24
  121. package/dependencies/src/eciesjs-0.3.9/src/utils.js.map +1 -1
  122. package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.js +42 -34
  123. package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.js.map +1 -1
  124. package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.js +6 -10
  125. package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.js.map +1 -1
  126. package/errors/coinlib-error.js +16 -37
  127. package/errors/coinlib-error.js.map +1 -1
  128. package/errors/index.d.ts +2 -2
  129. package/errors/index.js +89 -148
  130. package/errors/index.js.map +1 -1
  131. package/index.js +19 -19
  132. package/index.js.map +1 -1
  133. package/interfaces/IAirGapSignedTransaction.d.ts +1 -1
  134. package/interfaces/IAirGapTransaction.js +3 -3
  135. package/interfaces/IAirGapTransaction.js.map +1 -1
  136. package/networks.js +9 -9
  137. package/networks.js.map +1 -1
  138. package/package.json +1 -1
  139. package/protocols/BlockExplorerProtocol.js +7 -54
  140. package/protocols/BlockExplorerProtocol.js.map +1 -1
  141. package/protocols/CryptoClient.js +19 -78
  142. package/protocols/CryptoClient.js.map +1 -1
  143. package/protocols/Ed25519CryptoClient.js +30 -98
  144. package/protocols/Ed25519CryptoClient.js.map +1 -1
  145. package/protocols/ICoinSubProtocol.js +1 -1
  146. package/protocols/ICoinSubProtocol.js.map +1 -1
  147. package/protocols/NonExtendedProtocol.js +26 -29
  148. package/protocols/NonExtendedProtocol.js.map +1 -1
  149. package/protocols/Secp256k1CryptoClient.js +9 -73
  150. package/protocols/Secp256k1CryptoClient.js.map +1 -1
  151. package/protocols/Sr25519CryptoClient.js +12 -76
  152. package/protocols/Sr25519CryptoClient.js.map +1 -1
  153. package/utils/AES.js +81 -132
  154. package/utils/AES.js.map +1 -1
  155. package/utils/ErrorWithData.js +5 -23
  156. package/utils/ErrorWithData.js.map +1 -1
  157. package/utils/Network.js +1 -1
  158. package/utils/Network.js.map +1 -1
  159. package/utils/ProtocolBlockExplorer.js +3 -4
  160. package/utils/ProtocolBlockExplorer.js.map +1 -1
  161. package/utils/ProtocolNetwork.js +11 -16
  162. package/utils/ProtocolNetwork.js.map +1 -1
  163. package/utils/ProtocolSymbols.d.ts +1 -1
  164. package/utils/ProtocolSymbols.js +6 -6
  165. package/utils/ProtocolSymbols.js.map +1 -1
  166. package/utils/array.js +14 -15
  167. package/utils/array.js.map +1 -1
  168. package/utils/assert.js +8 -12
  169. package/utils/assert.js.map +1 -1
  170. package/utils/base64Check.d.ts +0 -1
  171. package/utils/base64Check.js +15 -15
  172. package/utils/base64Check.js.map +1 -1
  173. package/utils/blake2b.js +11 -14
  174. package/utils/blake2b.js.map +1 -1
  175. package/utils/buffer.d.ts +0 -1
  176. package/utils/buffer.js +1 -1
  177. package/utils/buffer.js.map +1 -1
  178. package/utils/cache.js +38 -87
  179. package/utils/cache.js.map +1 -1
  180. package/utils/error.js +2 -3
  181. package/utils/error.js.map +1 -1
  182. package/utils/hex.d.ts +1 -2
  183. package/utils/hex.js +31 -38
  184. package/utils/hex.js.map +1 -1
  185. package/utils/interfaces.js +3 -4
  186. package/utils/interfaces.js.map +1 -1
  187. package/utils/object.js +5 -7
  188. package/utils/object.js.map +1 -1
  189. package/utils/padStart.js +1 -2
  190. package/utils/padStart.js.map +1 -1
  191. package/utils/remote-data/HttpRemoteData.js +24 -107
  192. package/utils/remote-data/HttpRemoteData.js.map +1 -1
  193. package/utils/remote-data/IpfsRemoteData.js +32 -116
  194. package/utils/remote-data/IpfsRemoteData.js.map +1 -1
  195. package/utils/remote-data/RemoteData.d.ts +0 -1
  196. package/utils/remote-data/RemoteData.js +3 -4
  197. package/utils/remote-data/RemoteData.js.map +1 -1
  198. package/utils/remote-data/RemoteDataFactory.d.ts +2 -2
  199. package/utils/remote-data/RemoteDataFactory.js +13 -20
  200. package/utils/remote-data/RemoteDataFactory.js.map +1 -1
  201. package/utils/remote-data/Sha256RemoteData.d.ts +0 -1
  202. package/utils/remote-data/Sha256RemoteData.js +44 -117
  203. package/utils/remote-data/Sha256RemoteData.js.map +1 -1
  204. package/utils/string.js +8 -9
  205. package/utils/string.js.map +1 -1
  206. package/utils/type.js +3 -4
  207. package/utils/type.js.map +1 -1
  208. package/utils/xxhash.d.ts +0 -1
  209. package/utils/xxhash.js +9 -11
  210. package/utils/xxhash.js.map +1 -1
  211. package/wallet/AirGapCoinWallet.js +64 -183
  212. package/wallet/AirGapCoinWallet.js.map +1 -1
  213. package/wallet/AirGapMarketWallet.js +88 -201
  214. package/wallet/AirGapMarketWallet.js.map +1 -1
  215. package/wallet/AirGapNFTWallet.js +48 -165
  216. package/wallet/AirGapNFTWallet.js.map +1 -1
  217. package/wallet/AirGapWallet.js +58 -145
  218. package/wallet/AirGapWallet.js.map +1 -1
@@ -31,71 +31,79 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
31
31
  }) : function(o, v) {
32
32
  o["default"] = v;
33
33
  });
34
- var __importStar = (this && this.__importStar) || function (mod) {
35
- if (mod && mod.__esModule) return mod;
36
- var result = {};
37
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
38
- __setModuleDefault(result, mod);
39
- return result;
40
- };
34
+ var __importStar = (this && this.__importStar) || (function () {
35
+ var ownKeys = function(o) {
36
+ ownKeys = Object.getOwnPropertyNames || function (o) {
37
+ var ar = [];
38
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
39
+ return ar;
40
+ };
41
+ return ownKeys(o);
42
+ };
43
+ return function (mod) {
44
+ if (mod && mod.__esModule) return mod;
45
+ var result = {};
46
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
47
+ __setModuleDefault(result, mod);
48
+ return result;
49
+ };
50
+ })();
41
51
  Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.derivePathFromSeed = exports.derivePathFromKey = exports.getKeyPair = exports.deriveChild = exports.getMasterKeyFromSeed = void 0;
43
- var nacl = __importStar(require("../../tweetnacl-1.0.1/nacl"));
44
- var naclAuth = __importStar(require("../../tweetnacl-auth-1.0.1/nacl-auth"));
45
- var index_1 = require("../../bip32-path-0.4.2/index");
46
- var ED25519_CURVE = Buffer.from('ed25519 seed');
47
- var HARDENED_OFFSET = 0x80000000;
52
+ exports.getMasterKeyFromSeed = getMasterKeyFromSeed;
53
+ exports.deriveChild = deriveChild;
54
+ exports.getKeyPair = getKeyPair;
55
+ exports.derivePathFromKey = derivePathFromKey;
56
+ exports.derivePathFromSeed = derivePathFromSeed;
57
+ const nacl = __importStar(require("../../tweetnacl-1.0.1/nacl"));
58
+ const naclAuth = __importStar(require("../../tweetnacl-auth-1.0.1/nacl-auth"));
59
+ const index_1 = require("../../bip32-path-0.4.2/index");
60
+ const ED25519_CURVE = Buffer.from('ed25519 seed');
61
+ const HARDENED_OFFSET = 0x80000000;
48
62
  function getMasterKeyFromSeed(seed) {
49
- var I = naclAuth.full(seed, ED25519_CURVE);
50
- var IL = I.slice(0, 32);
51
- var IR = I.slice(32);
63
+ const I = naclAuth.full(seed, ED25519_CURVE);
64
+ const IL = I.slice(0, 32);
65
+ const IR = I.slice(32);
52
66
  return {
53
67
  privateKey: IL,
54
68
  chainCode: IR
55
69
  };
56
70
  }
57
- exports.getMasterKeyFromSeed = getMasterKeyFromSeed;
58
- function deriveChild(_a, index) {
59
- var privateKey = _a.privateKey, chainCode = _a.chainCode;
71
+ function deriveChild({ privateKey, chainCode }, index) {
60
72
  if (index < HARDENED_OFFSET) {
61
- throw new Error("Child index #".concat(index, " is not supported"));
73
+ throw new Error(`Child index #${index} is not supported`);
62
74
  }
63
- var indexBuffer = Buffer.allocUnsafe(4);
75
+ const indexBuffer = Buffer.allocUnsafe(4);
64
76
  indexBuffer.writeUInt32BE(index, 0);
65
- var data = Buffer.concat([
77
+ const data = Buffer.concat([
66
78
  Buffer.alloc(1, 0),
67
79
  Buffer.from(privateKey),
68
80
  Buffer.from(indexBuffer)
69
81
  ]);
70
- var I = naclAuth.full(data, Buffer.from(chainCode));
71
- var IL = I.slice(0, 32);
72
- var IR = I.slice(32);
82
+ const I = naclAuth.full(data, Buffer.from(chainCode));
83
+ const IL = I.slice(0, 32);
84
+ const IR = I.slice(32);
73
85
  return {
74
86
  privateKey: IL,
75
87
  chainCode: IR
76
88
  };
77
89
  }
78
- exports.deriveChild = deriveChild;
79
90
  function getKeyPair(privateKey) {
80
91
  return nacl.sign.keyPair.fromSeed(privateKey);
81
92
  }
82
- exports.getKeyPair = getKeyPair;
83
93
  function derivePathFromKey(path, key) {
84
- var segments = path === '' ? [] : (0, index_1.fromString)(path).toPathArray();
85
- segments.forEach(function (segment, i) {
94
+ const segments = path === '' ? [] : (0, index_1.fromString)(path).toPathArray();
95
+ segments.forEach((segment, i) => {
86
96
  if (segment < HARDENED_OFFSET) {
87
- throw new Error("Segment #".concat(i + 1, " is not hardened"));
97
+ throw new Error(`Segment #${i + 1} is not hardened`);
88
98
  }
89
99
  });
90
- return segments.reduce(function (parentKey, segment) { return deriveChild(parentKey, segment); }, key);
100
+ return segments.reduce((parentKey, segment) => deriveChild(parentKey, segment), key);
91
101
  }
92
- exports.derivePathFromKey = derivePathFromKey;
93
102
  function derivePathFromSeed(path, seed) {
94
103
  if (!['m', 'm/'].includes(path.slice(0, 2))) {
95
104
  throw new Error('Invalid path');
96
105
  }
97
- var masterKey = getMasterKeyFromSeed(seed);
106
+ const masterKey = getMasterKeyFromSeed(seed);
98
107
  return derivePathFromKey(path.slice(2), masterKey);
99
108
  }
100
- exports.derivePathFromSeed = derivePathFromSeed;
101
109
  //# sourceMappingURL=hd-key.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hd-key.js","sourceRoot":"","sources":["../../../../../src/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+DAAkD;AAClD,6EAAgE;AAChE,sDAAyD;AAEzD,IAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;AACjD,IAAM,eAAe,GAAG,UAAU,CAAA;AAElC,SAAgB,oBAAoB,CAAE,IAAI;IACxC,IAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAA;IAC5C,IAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IACzB,IAAM,EAAE,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E,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAA,kBAAU,EAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAA;IAClE,QAAQ,CAAC,OAAO,CAAC,UAAC,OAAO,EAAE,CAAC;QAC1B,IAAI,OAAO,GAAG,eAAe,EAAE;YAC7B,MAAM,IAAI,KAAK,CAAC,mBAAY,CAAC,GAAG,CAAC,qBAAkB,CAAC,CAAA;SACrD;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,QAAQ,CAAC,MAAM,CAAC,UAAC,SAAS,EAAE,OAAO,IAAK,OAAA,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,EAA/B,CAA+B,EAAE,GAAG,CAAC,CAAA;AACtF,CAAC;AATD,8CASC;AAED,SAAgB,kBAAkB,CAAE,IAAI,EAAE,IAAI;IAC5C,IAAI,CAAE,CAAC,GAAG,EAAE,IAAI,CAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;QACpD,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAA;KAChC;IACD,IAAM,SAAS,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAA;IAC5C,OAAO,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAA;AACpD,CAAC;AAND,gDAMC"}
1
+ {"version":3,"file":"hd-key.js","sourceRoot":"","sources":["../../../../../src/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASH,oDAQC;AAED,kCAoBC;AAED,gCAEC;AAED,8CASC;AAED,gDAMC;AA5DD,iEAAkD;AAClD,+EAAgE;AAChE,wDAAyD;AAEzD,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA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,SAAgB,UAAU,CAAE,UAAU;IACpC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;AAC/C,CAAC;AAED,SAAgB,iBAAiB,CAAE,IAAI,EAAE,GAAG;IAC1C,MAAM,QAAQ,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAA,kBAAU,EAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAA;IAClE,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE;QAC9B,IAAI,OAAO,GAAG,eAAe,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;QACtD,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,CAAA;AACtF,CAAC;AAED,SAAgB,kBAAkB,CAAE,IAAI,EAAE,IAAI;IAC5C,IAAI,CAAE,CAAC,GAAG,EAAE,IAAI,CAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAA;IACjC,CAAC;IACD,MAAM,SAAS,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAA;IAC5C,OAAO,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAA;AACpD,CAAC"}
@@ -16,22 +16,18 @@
16
16
  * PERFORMANCE OF THIS SOFTWARE.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.getHDWalletAccounts = exports.generateWalletUsingDerivationPath = exports.generateHDWallet = void 0;
20
- var hd_key_1 = require("./hd-key");
19
+ exports.generateHDWallet = generateHDWallet;
20
+ exports.generateWalletUsingDerivationPath = generateWalletUsingDerivationPath;
21
+ exports.getHDWalletAccounts = getHDWalletAccounts;
22
+ const hd_key_1 = require("./hd-key");
21
23
  function generateHDWallet(seed) {
22
24
  return (0, hd_key_1.derivePathFromSeed)('m/44h/457h', seed);
23
25
  }
24
- exports.generateHDWallet = generateHDWallet;
25
- function generateWalletUsingDerivationPath(seed, derivationPath) {
26
- if (derivationPath === void 0) { derivationPath = 'm/44h/457h/0h/0h/0h'; }
26
+ function generateWalletUsingDerivationPath(seed, derivationPath = 'm/44h/457h/0h/0h/0h') {
27
27
  return (0, hd_key_1.getKeyPair)((0, hd_key_1.derivePathFromSeed)(derivationPath, seed).privateKey);
28
28
  }
29
- exports.generateWalletUsingDerivationPath = generateWalletUsingDerivationPath;
30
29
  function getHDWalletAccounts(wallet, accountCount) {
31
30
  return new Array(accountCount).fill()
32
- .map(function (_, idx) {
33
- return (0, hd_key_1.getKeyPair)((0, hd_key_1.derivePathFromKey)("".concat(idx, "h/0h/0h"), wallet).privateKey);
34
- });
31
+ .map((_, idx) => (0, hd_key_1.getKeyPair)((0, hd_key_1.derivePathFromKey)(`${idx}h/0h/0h`, wallet).privateKey));
35
32
  }
36
- exports.getHDWalletAccounts = getHDWalletAccounts;
37
33
  //# sourceMappingURL=hd-wallet.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hd-wallet.js","sourceRoot":"","sources":["../../../../../src/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,mCAA4E;AAE5E,SAAgB,gBAAgB,CAAE,IAAI;IACpC,OAAO,IAAA,2BAAkB,EAAC,YAAY,EAAE,IAAI,CAAC,CAAA;AAC/C,CAAC;AAFD,4CAEC;AAED,SAAgB,iCAAiC,CAAE,IAAI,EAAE,cAAsC;IAAtC,+BAAA,EAAA,sCAAsC;IAC7F,OAAO,IAAA,mBAAU,EAAC,IAAA,2BAAkB,EAAC,cAAc,EAAE,IAAI,CAAC,CAAC,UAAU,CAAC,CAAA;AACxE,CAAC;AAFD,8EAEC;AAED,SAAgB,mBAAmB,CAAE,MAAM,EAAE,YAAY;IACvD,OAAQ,IAAI,KAAK,CAAC,YAAY,CAAS,CAAC,IAAI,EAAE;SAC3C,GAAG,CAAC,UAAC,CAAC,EAAE,GAAG;QACV,OAAA,IAAA,mBAAU,EAAC,IAAA,0BAAiB,EAAC,UAAG,GAAG,YAAS,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC;IAAjE,CAAiE,CAAC,CAAA;AACxE,CAAC;AAJD,kDAIC"}
1
+ {"version":3,"file":"hd-wallet.js","sourceRoot":"","sources":["../../../../../src/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAIH,4CAEC;AAED,8EAEC;AAED,kDAIC;AAdD,qCAA4E;AAE5E,SAAgB,gBAAgB,CAAE,IAAI;IACpC,OAAO,IAAA,2BAAkB,EAAC,YAAY,EAAE,IAAI,CAAC,CAAA;AAC/C,CAAC;AAED,SAAgB,iCAAiC,CAAE,IAAI,EAAE,cAAc,GAAG,qBAAqB;IAC7F,OAAO,IAAA,mBAAU,EAAC,IAAA,2BAAkB,EAAC,cAAc,EAAE,IAAI,CAAC,CAAC,UAAU,CAAC,CAAA;AACxE,CAAC;AAED,SAAgB,mBAAmB,CAAE,MAAM,EAAE,YAAY;IACvD,OAAQ,IAAI,KAAK,CAAC,YAAY,CAAS,CAAC,IAAI,EAAE;SAC3C,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CACd,IAAA,mBAAU,EAAC,IAAA,0BAAiB,EAAC,GAAG,GAAG,SAAS,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC,CAAA;AACxE,CAAC"}
@@ -1,19 +1,4 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.CoinlibAssertionError = exports.CoinlibError = exports.Domain = void 0;
19
4
  var Domain;
@@ -37,30 +22,24 @@ var Domain;
37
22
  Domain["OPTIMISM"] = "OPTIMISM";
38
23
  Domain["MINA"] = "MINA";
39
24
  Domain["STELLAR"] = "STELLAR";
40
- })(Domain = exports.Domain || (exports.Domain = {}));
41
- var CoinlibError = /** @class */ (function (_super) {
42
- __extends(CoinlibError, _super);
43
- function CoinlibError(domain, code, description) {
44
- var _this = _super.call(this, description ? "".concat(domain, "(").concat(code, "): ").concat(description) : "".concat(domain, "(").concat(code, ")")) || this;
45
- _this.domain = domain;
46
- _this.code = code;
47
- _this.description = description;
48
- return _this;
25
+ })(Domain || (exports.Domain = Domain = {}));
26
+ class CoinlibError extends Error {
27
+ constructor(domain, code, description) {
28
+ super(description ? `${domain}(${code}): ${description}` : `${domain}(${code})`);
29
+ this.domain = domain;
30
+ this.code = code;
31
+ this.description = description;
49
32
  }
50
- return CoinlibError;
51
- }(Error));
33
+ }
52
34
  exports.CoinlibError = CoinlibError;
53
- var CoinlibAssertionError = /** @class */ (function (_super) {
54
- __extends(CoinlibAssertionError, _super);
55
- function CoinlibAssertionError(domain, code, expected, actual) {
56
- var _this = _super.call(this, "".concat(domain, "(").concat(code, "): expected ").concat(expected, " but got ").concat(actual, ".")) || this;
57
- _this.domain = domain;
58
- _this.code = code;
59
- _this.expected = expected;
60
- _this.actual = actual;
61
- return _this;
35
+ class CoinlibAssertionError extends Error {
36
+ constructor(domain, code, expected, actual) {
37
+ super(`${domain}(${code}): expected ${expected} but got ${actual}.`);
38
+ this.domain = domain;
39
+ this.code = code;
40
+ this.expected = expected;
41
+ this.actual = actual;
62
42
  }
63
- return CoinlibAssertionError;
64
- }(Error));
43
+ }
65
44
  exports.CoinlibAssertionError = CoinlibAssertionError;
66
45
  //# sourceMappingURL=coinlib-error.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"coinlib-error.js","sourceRoot":"","sources":["../../src/errors/coinlib-error.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAY,MAoBX;AApBD,WAAY,MAAM;IAChB,mCAAyB,CAAA;IACzB,uCAA6B,CAAA;IAC7B,2BAAiB,CAAA;IACjB,6BAAmB,CAAA;IACnB,+BAAqB,CAAA;IACrB,yBAAe,CAAA;IACf,2BAAiB,CAAA;IACjB,iCAAuB,CAAA;IACvB,iCAAuB,CAAA;IACvB,qCAA2B,CAAA;IAC3B,yBAAe,CAAA;IACf,6BAAmB,CAAA;IACnB,yBAAe,CAAA;IACf,6BAAmB,CAAA;IACnB,qBAAW,CAAA;IACX,2BAAiB,CAAA;IACjB,+BAAqB,CAAA;IACrB,uBAAa,CAAA;IACb,6BAAmB,CAAA;AACrB,CAAC,EApBW,MAAM,GAAN,cAAM,KAAN,cAAM,QAoBjB;AAED;IAAkC,gCAAK;IACrC,sBACS,MAAc,EACd,IAAY,EACZ,WAAoB;QAH7B,YAKE,kBAAM,WAAW,CAAC,CAAC,CAAC,UAAG,MAAM,cAAI,IAAI,gBAAM,WAAW,CAAE,CAAC,CAAC,CAAC,UAAG,MAAM,cAAI,IAAI,MAAG,CAAC,SACjF;QALQ,YAAM,GAAN,MAAM,CAAQ;QACd,UAAI,GA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AI,GAAG,CAAC,CAAA;QAJzE,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QACZ,gBAAW,GAAX,WAAW,CAAS;IAG7B,CAAC;CACF;AARD,oCAQC;AAED,MAAa,qBAAsB,SAAQ,KAAK;IAC9C,YACS,MAAc,EACd,IAAY,EACZ,QAAgB,EAChB,MAAM;QAEb,KAAK,CAAC,GAAG,MAAM,IAAI,IAAI,eAAe,QAAQ,YAAY,MAAM,GAAG,CAAC,CAAA;QAL7D,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QACZ,aAAQ,GAAR,QAAQ,CAAQ;QAChB,WAAM,GAAN,MAAM,CAAA;IAGf,CAAC;CACF;AATD,sDASC"}
package/errors/index.d.ts CHANGED
@@ -70,8 +70,8 @@ export declare class BalanceError extends CoinlibError {
70
70
  constructor(domain: Domain, description?: string);
71
71
  }
72
72
  export declare class TransactionError extends CoinlibError {
73
- data?: unknown;
74
- constructor(domain: Domain, description?: string, data?: unknown);
73
+ data?: unknown | undefined;
74
+ constructor(domain: Domain, description?: string, data?: unknown | undefined);
75
75
  }
76
76
  /**
77
77
  * Gets thrown if an accessed object property is undefined
package/errors/index.js CHANGED
@@ -1,22 +1,7 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.InvalidString = exports.InvalidHexString = exports.InvalidPayloadError = exports.InvalidSchemaType = exports.InvalidSchema = exports.TypeNotSupported = exports.ProtocolVersionMismatch = exports.ProtocolNotSupported = exports.SerializerVersionMismatch = exports.SerializerError = exports.InvalidValueError = exports.NotImplementedError = exports.OperationFailedError = exports.PropertyUndefinedError = exports.TransactionError = exports.BalanceError = exports.NotFoundError = exports.UnsupportedError = exports.ConditionViolationError = exports.NetworkError = exports.ProtocolErrorType = exports.SerializerErrorType = void 0;
19
- var coinlib_error_1 = require("./coinlib-error");
4
+ const coinlib_error_1 = require("./coinlib-error");
20
5
  var SerializerErrorType;
21
6
  (function (SerializerErrorType) {
22
7
  SerializerErrorType["SERIALIZER_VERSION_MISMATCH"] = "SERIALIZER_VERSION_MISMATCH";
@@ -36,7 +21,7 @@ var SerializerErrorType;
36
21
  SerializerErrorType["PAYLOAD_TYPE_NOT_SUPPORTED"] = "PAYLOAD_TYPE_NOT_SUPPORTED";
37
22
  SerializerErrorType["PROPERTY_IS_EMPTY"] = "PROPERTY_IS_EMPTY";
38
23
  SerializerErrorType["PROPERTY_INVALID"] = "PROPERTY_INVALID";
39
- })(SerializerErrorType = exports.SerializerErrorType || (exports.SerializerErrorType = {}));
24
+ })(SerializerErrorType || (exports.SerializerErrorType = SerializerErrorType = {}));
40
25
  var ProtocolErrorType;
41
26
  (function (ProtocolErrorType) {
42
27
  ProtocolErrorType["NETWORK"] = "NETWORK";
@@ -49,233 +34,189 @@ var ProtocolErrorType;
49
34
  ProtocolErrorType["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED";
50
35
  ProtocolErrorType["INVALID_VALUE"] = "INVALID_VALUE";
51
36
  ProtocolErrorType["TRANSACTION_FAILED"] = "TRANSACTION_FAILED";
52
- })(ProtocolErrorType = exports.ProtocolErrorType || (exports.ProtocolErrorType = {}));
37
+ })(ProtocolErrorType || (exports.ProtocolErrorType = ProtocolErrorType = {}));
53
38
  /**
54
39
  * Gets thrown if an error occurs when making a network request
55
40
  * Partial<AxiosError> is either an AxiosError or an AxiosResponse,
56
41
  * as we sometimes want to throw an Error even though we get a 200 response
57
42
  * from the API (as in case of internal operation errors for Tezos).
58
43
  */
59
- var NetworkError = /** @class */ (function (_super) {
60
- __extends(NetworkError, _super);
61
- function NetworkError(domain, error, description) {
62
- var _this = this;
63
- var _a, _b, _c, _d, _e;
64
- _this = _super.call(this, domain, ProtocolErrorType.NETWORK) || this;
65
- _this.data = description !== null && description !== void 0 ? description : (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
66
- _this.status = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.status;
67
- _this.url = (_c = error.config) === null || _c === void 0 ? void 0 : _c.url;
68
- _this.method = (_d = error.config) === null || _d === void 0 ? void 0 : _d.method;
69
- _this.requestBody = (_e = error.config) === null || _e === void 0 ? void 0 : _e.data;
70
- return _this;
44
+ class NetworkError extends coinlib_error_1.CoinlibError {
45
+ constructor(domain, error, description) {
46
+ super(domain, ProtocolErrorType.NETWORK);
47
+ this.data = description ?? error.response?.data;
48
+ this.status = error?.response?.status;
49
+ this.url = error.config?.url;
50
+ this.method = error.config?.method;
51
+ this.requestBody = error.config?.data;
71
52
  }
72
- return NetworkError;
73
- }(coinlib_error_1.CoinlibError));
53
+ }
74
54
  exports.NetworkError = NetworkError;
75
55
  /**
76
56
  * Gets thrown if a value ist expected to fulfill a certain condition such as having a certain length, but the condition is not satisfied
77
57
  */
78
- var ConditionViolationError = /** @class */ (function (_super) {
79
- __extends(ConditionViolationError, _super);
80
- function ConditionViolationError(domain, description) {
81
- return _super.call(this, domain, ProtocolErrorType.CONDITION_VIOLATION, description) || this;
58
+ class ConditionViolationError extends coinlib_error_1.CoinlibError {
59
+ constructor(domain, description) {
60
+ super(domain, ProtocolErrorType.CONDITION_VIOLATION, description);
82
61
  }
83
- return ConditionViolationError;
84
- }(coinlib_error_1.CoinlibError));
62
+ }
85
63
  exports.ConditionViolationError = ConditionViolationError;
86
64
  /**
87
65
  * Gets thrown if a variable assumes a value for which an operation is not supported
88
66
  */
89
- var UnsupportedError = /** @class */ (function (_super) {
90
- __extends(UnsupportedError, _super);
91
- function UnsupportedError(domain, description) {
92
- return _super.call(this, domain, ProtocolErrorType.UNSUPPORTED, description) || this;
67
+ class UnsupportedError extends coinlib_error_1.CoinlibError {
68
+ constructor(domain, description) {
69
+ super(domain, ProtocolErrorType.UNSUPPORTED, description);
93
70
  }
94
- return UnsupportedError;
95
- }(coinlib_error_1.CoinlibError));
71
+ }
96
72
  exports.UnsupportedError = UnsupportedError;
97
73
  /**
98
74
  * Gets thrown if a variable is unexpectedly undefined
99
75
  */
100
- var NotFoundError = /** @class */ (function (_super) {
101
- __extends(NotFoundError, _super);
102
- function NotFoundError(domain, description) {
103
- return _super.call(this, domain, ProtocolErrorType.NOT_FOUND, description) || this;
76
+ class NotFoundError extends coinlib_error_1.CoinlibError {
77
+ constructor(domain, description) {
78
+ super(domain, ProtocolErrorType.NOT_FOUND, description);
104
79
  }
105
- return NotFoundError;
106
- }(coinlib_error_1.CoinlibError));
80
+ }
107
81
  exports.NotFoundError = NotFoundError;
108
82
  /**
109
83
  * Gets thrown if an account has an insufficient balance to perform a certain kind of operation
110
84
  */
111
- var BalanceError = /** @class */ (function (_super) {
112
- __extends(BalanceError, _super);
113
- function BalanceError(domain, description) {
114
- return _super.call(this, domain, ProtocolErrorType.BALANCE, description) || this;
85
+ class BalanceError extends coinlib_error_1.CoinlibError {
86
+ constructor(domain, description) {
87
+ super(domain, ProtocolErrorType.BALANCE, description);
115
88
  }
116
- return BalanceError;
117
- }(coinlib_error_1.CoinlibError));
89
+ }
118
90
  exports.BalanceError = BalanceError;
119
- var TransactionError = /** @class */ (function (_super) {
120
- __extends(TransactionError, _super);
121
- function TransactionError(domain, description, data) {
122
- var _this = _super.call(this, domain, ProtocolErrorType.TRANSACTION_FAILED, description) || this;
123
- _this.data = data;
124
- return _this;
91
+ class TransactionError extends coinlib_error_1.CoinlibError {
92
+ constructor(domain, description, data) {
93
+ super(domain, ProtocolErrorType.TRANSACTION_FAILED, description);
94
+ this.data = data;
125
95
  }
126
- return TransactionError;
127
- }(coinlib_error_1.CoinlibError));
96
+ }
128
97
  exports.TransactionError = TransactionError;
129
98
  /**
130
99
  * Gets thrown if an accessed object property is undefined
131
100
  */
132
- var PropertyUndefinedError = /** @class */ (function (_super) {
133
- __extends(PropertyUndefinedError, _super);
134
- function PropertyUndefinedError(domain, description) {
135
- return _super.call(this, domain, ProtocolErrorType.PROPERTY_UNDEFINED, description) || this;
101
+ class PropertyUndefinedError extends coinlib_error_1.CoinlibError {
102
+ constructor(domain, description) {
103
+ super(domain, ProtocolErrorType.PROPERTY_UNDEFINED, description);
136
104
  }
137
- return PropertyUndefinedError;
138
- }(coinlib_error_1.CoinlibError));
105
+ }
139
106
  exports.PropertyUndefinedError = PropertyUndefinedError;
140
107
  /**
141
108
  * Gets thrown if an internal method fails
142
109
  */
143
- var OperationFailedError = /** @class */ (function (_super) {
144
- __extends(OperationFailedError, _super);
145
- function OperationFailedError(domain, description) {
146
- return _super.call(this, domain, ProtocolErrorType.OPERATION_FAILED, description) || this;
110
+ class OperationFailedError extends coinlib_error_1.CoinlibError {
111
+ constructor(domain, description) {
112
+ super(domain, ProtocolErrorType.OPERATION_FAILED, description);
147
113
  }
148
- return OperationFailedError;
149
- }(coinlib_error_1.CoinlibError));
114
+ }
150
115
  exports.OperationFailedError = OperationFailedError;
151
116
  /**
152
117
  * Gets thrown if a method is executed which is not implemented
153
118
  */
154
- var NotImplementedError = /** @class */ (function (_super) {
155
- __extends(NotImplementedError, _super);
156
- function NotImplementedError(domain, description) {
157
- return _super.call(this, domain, ProtocolErrorType.NOT_IMPLEMENTED, description) || this;
119
+ class NotImplementedError extends coinlib_error_1.CoinlibError {
120
+ constructor(domain, description) {
121
+ super(domain, ProtocolErrorType.NOT_IMPLEMENTED, description);
158
122
  }
159
- return NotImplementedError;
160
- }(coinlib_error_1.CoinlibError));
123
+ }
161
124
  exports.NotImplementedError = NotImplementedError;
162
125
  /**
163
126
  * Gets thrown if a variable has a value which cannot be handled
164
127
  */
165
- var InvalidValueError = /** @class */ (function (_super) {
166
- __extends(InvalidValueError, _super);
167
- function InvalidValueError(domain, description) {
168
- return _super.call(this, domain, ProtocolErrorType.INVALID_VALUE, description) || this;
128
+ class InvalidValueError extends coinlib_error_1.CoinlibError {
129
+ constructor(domain, description) {
130
+ super(domain, ProtocolErrorType.INVALID_VALUE, description);
169
131
  }
170
- return InvalidValueError;
171
- }(coinlib_error_1.CoinlibError));
132
+ }
172
133
  exports.InvalidValueError = InvalidValueError;
173
- var SerializerError = /** @class */ (function (_super) {
174
- __extends(SerializerError, _super);
175
- function SerializerError(code, description) {
176
- return _super.call(this, coinlib_error_1.Domain.SERIALIZER, code, description) || this;
134
+ class SerializerError extends coinlib_error_1.CoinlibError {
135
+ constructor(code, description) {
136
+ super(coinlib_error_1.Domain.SERIALIZER, code, description);
177
137
  }
178
- return SerializerError;
179
- }(coinlib_error_1.CoinlibError));
138
+ }
180
139
  exports.SerializerError = SerializerError;
181
140
  // tslint:disable:max-classes-per-file
182
141
  /**
183
142
  * Gets thrown if the serializer version does not match
184
143
  */
185
- var SerializerVersionMismatch = /** @class */ (function (_super) {
186
- __extends(SerializerVersionMismatch, _super);
187
- function SerializerVersionMismatch(description) {
188
- return _super.call(this, SerializerErrorType.SERIALIZER_VERSION_MISMATCH, description) || this;
144
+ class SerializerVersionMismatch extends SerializerError {
145
+ constructor(description) {
146
+ super(SerializerErrorType.SERIALIZER_VERSION_MISMATCH, description);
189
147
  }
190
- return SerializerVersionMismatch;
191
- }(SerializerError));
148
+ }
192
149
  exports.SerializerVersionMismatch = SerializerVersionMismatch;
193
150
  /**
194
151
  * Gets thrown if the serializer cannot handle the specified coin/protocol
195
152
  */
196
- var ProtocolNotSupported = /** @class */ (function (_super) {
197
- __extends(ProtocolNotSupported, _super);
198
- function ProtocolNotSupported(description) {
199
- return _super.call(this, SerializerErrorType.PROTOCOL_NOT_SUPPORTED, description) || this;
153
+ class ProtocolNotSupported extends SerializerError {
154
+ constructor(description) {
155
+ super(SerializerErrorType.PROTOCOL_NOT_SUPPORTED, description);
200
156
  }
201
- return ProtocolNotSupported;
202
- }(SerializerError));
157
+ }
203
158
  exports.ProtocolNotSupported = ProtocolNotSupported;
204
159
  /**
205
160
  * Gets thrown if the serializer CAN handle the specified coin/protocol, but not in this version
206
161
  */
207
- var ProtocolVersionMismatch = /** @class */ (function (_super) {
208
- __extends(ProtocolVersionMismatch, _super);
209
- function ProtocolVersionMismatch(description) {
210
- return _super.call(this, SerializerErrorType.PROTOCOL_VERSION_MISMATCH, description) || this;
162
+ class ProtocolVersionMismatch extends SerializerError {
163
+ constructor(description) {
164
+ super(SerializerErrorType.PROTOCOL_VERSION_MISMATCH, description);
211
165
  }
212
- return ProtocolVersionMismatch;
213
- }(SerializerError));
166
+ }
214
167
  exports.ProtocolVersionMismatch = ProtocolVersionMismatch;
215
168
  /**
216
169
  * Gets thrown if the specified Type is not supported
217
170
  */
218
- var TypeNotSupported = /** @class */ (function (_super) {
219
- __extends(TypeNotSupported, _super);
220
- function TypeNotSupported(description) {
221
- return _super.call(this, SerializerErrorType.TYPE_NOT_SUPPORTED, description) || this;
171
+ class TypeNotSupported extends SerializerError {
172
+ constructor(description) {
173
+ super(SerializerErrorType.TYPE_NOT_SUPPORTED, description);
222
174
  }
223
- return TypeNotSupported;
224
- }(SerializerError));
175
+ }
225
176
  exports.TypeNotSupported = TypeNotSupported;
226
177
  /**
227
178
  * Gets thrown if the schema in the serializer is invalid
228
179
  */
229
- var InvalidSchema = /** @class */ (function (_super) {
230
- __extends(InvalidSchema, _super);
231
- function InvalidSchema(description) {
232
- return _super.call(this, SerializerErrorType.INVALID_SCHEMA, description) || this;
180
+ class InvalidSchema extends SerializerError {
181
+ constructor(description) {
182
+ super(SerializerErrorType.INVALID_SCHEMA, description);
233
183
  }
234
- return InvalidSchema;
235
- }(SerializerError));
184
+ }
236
185
  exports.InvalidSchema = InvalidSchema;
237
186
  /**
238
187
  * Gets thrown if the 2 types provided are not compatible
239
188
  */
240
- var InvalidSchemaType = /** @class */ (function (_super) {
241
- __extends(InvalidSchemaType, _super);
242
- function InvalidSchemaType(description) {
243
- return _super.call(this, SerializerErrorType.INVALID_SCHEMA_TYPE, description) || this;
189
+ class InvalidSchemaType extends SerializerError {
190
+ constructor(description) {
191
+ super(SerializerErrorType.INVALID_SCHEMA_TYPE, description);
244
192
  }
245
- return InvalidSchemaType;
246
- }(SerializerError));
193
+ }
247
194
  exports.InvalidSchemaType = InvalidSchemaType;
248
195
  /**
249
196
  * Gets thrown if the payload that is being decoded does not match the schema
250
197
  */
251
- var InvalidPayloadError = /** @class */ (function (_super) {
252
- __extends(InvalidPayloadError, _super);
253
- function InvalidPayloadError(description) {
254
- return _super.call(this, SerializerErrorType.INVALID_PAYLOAD, description) || this;
198
+ class InvalidPayloadError extends SerializerError {
199
+ constructor(description) {
200
+ super(SerializerErrorType.INVALID_PAYLOAD, description);
255
201
  }
256
- return InvalidPayloadError;
257
- }(SerializerError));
202
+ }
258
203
  exports.InvalidPayloadError = InvalidPayloadError;
259
204
  /**
260
205
  * Gets thrown if the string is not a valid hex string
261
206
  */
262
- var InvalidHexString = /** @class */ (function (_super) {
263
- __extends(InvalidHexString, _super);
264
- function InvalidHexString(description) {
265
- return _super.call(this, SerializerErrorType.INVALID_HEX_STRING, description) || this;
207
+ class InvalidHexString extends SerializerError {
208
+ constructor(description) {
209
+ super(SerializerErrorType.INVALID_HEX_STRING, description);
266
210
  }
267
- return InvalidHexString;
268
- }(SerializerError));
211
+ }
269
212
  exports.InvalidHexString = InvalidHexString;
270
213
  /**
271
214
  * Gets thrown if the string starts with "0x". This causes problems with RLP
272
215
  */
273
- var InvalidString = /** @class */ (function (_super) {
274
- __extends(InvalidString, _super);
275
- function InvalidString(description) {
276
- return _super.call(this, SerializerErrorType.INVALID_STRING, description) || this;
216
+ class InvalidString extends SerializerError {
217
+ constructor(description) {
218
+ super(SerializerErrorType.INVALID_STRING, description);
277
219
  }
278
- return InvalidString;
279
- }(SerializerError));
220
+ }
280
221
  exports.InvalidString = InvalidString;
281
222
  //# sourceMappingURL=index.js.map