@metamask/utils 6.2.0 → 7.0.0

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 (170) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/dist/cjs/assert.js +116 -0
  3. package/dist/cjs/assert.js.map +1 -0
  4. package/dist/cjs/base64.js +32 -0
  5. package/dist/cjs/base64.js.map +1 -0
  6. package/dist/cjs/bytes.js +255 -0
  7. package/dist/cjs/bytes.js.map +1 -0
  8. package/dist/cjs/checksum.js +17 -0
  9. package/dist/cjs/checksum.js.map +1 -0
  10. package/dist/cjs/coercers.js +96 -0
  11. package/dist/cjs/coercers.js.map +1 -0
  12. package/dist/cjs/collections.js +157 -0
  13. package/dist/cjs/collections.js.map +1 -0
  14. package/dist/cjs/encryption-types.js +6 -0
  15. package/dist/cjs/encryption-types.js.map +1 -0
  16. package/dist/cjs/hex.js +107 -0
  17. package/dist/cjs/hex.js.map +1 -0
  18. package/dist/cjs/index.js +36 -0
  19. package/dist/cjs/index.js.map +1 -0
  20. package/dist/cjs/json.js +263 -0
  21. package/dist/cjs/json.js.map +1 -0
  22. package/dist/cjs/keyring.js +6 -0
  23. package/dist/cjs/keyring.js.map +1 -0
  24. package/dist/cjs/logging.js +33 -0
  25. package/dist/cjs/logging.js.map +1 -0
  26. package/dist/cjs/misc.js +111 -0
  27. package/dist/cjs/misc.js.map +1 -0
  28. package/dist/cjs/number.js +52 -0
  29. package/dist/cjs/number.js.map +1 -0
  30. package/dist/cjs/opaque.js +8 -0
  31. package/dist/cjs/opaque.js.map +1 -0
  32. package/dist/cjs/time.js +63 -0
  33. package/dist/cjs/time.js.map +1 -0
  34. package/dist/cjs/transaction-types.js +6 -0
  35. package/dist/cjs/transaction-types.js.map +1 -0
  36. package/dist/cjs/versions.js +79 -0
  37. package/dist/cjs/versions.js.map +1 -0
  38. package/dist/{assert.js → esm/assert.js} +30 -35
  39. package/dist/esm/assert.js.map +1 -0
  40. package/dist/{base64.js → esm/base64.js} +10 -16
  41. package/dist/esm/base64.js.map +1 -0
  42. package/dist/{bytes.js → esm/bytes.js} +50 -93
  43. package/dist/esm/bytes.js.map +1 -0
  44. package/dist/esm/checksum.js +7 -0
  45. package/dist/esm/checksum.js.map +1 -0
  46. package/dist/{coercers.js → esm/coercers.js} +43 -52
  47. package/dist/esm/coercers.js.map +1 -0
  48. package/dist/esm/collections.js +140 -0
  49. package/dist/esm/collections.js.map +1 -0
  50. package/dist/esm/encryption-types.js +3 -0
  51. package/dist/esm/encryption-types.js.map +1 -0
  52. package/dist/esm/hex.js +108 -0
  53. package/dist/esm/hex.js.map +1 -0
  54. package/dist/{index.d.ts → esm/index.js} +2 -0
  55. package/dist/esm/index.js.map +1 -0
  56. package/dist/esm/json.js +301 -0
  57. package/dist/esm/json.js.map +1 -0
  58. package/dist/esm/keyring.js +3 -0
  59. package/dist/esm/keyring.js.map +1 -0
  60. package/dist/{logging.js → esm/logging.js} +5 -14
  61. package/dist/esm/logging.js.map +1 -0
  62. package/dist/{misc.js → esm/misc.js} +37 -42
  63. package/dist/esm/misc.js.map +1 -0
  64. package/dist/{number.js → esm/number.js} +18 -28
  65. package/dist/esm/number.js.map +1 -0
  66. package/dist/esm/opaque.js +5 -0
  67. package/dist/esm/opaque.js.map +1 -0
  68. package/dist/esm/package.json +1 -0
  69. package/dist/esm/time.js +53 -0
  70. package/dist/esm/time.js.map +1 -0
  71. package/dist/esm/transaction-types.js +3 -0
  72. package/dist/esm/transaction-types.js.map +1 -0
  73. package/dist/esm/versions.js +78 -0
  74. package/dist/esm/versions.js.map +1 -0
  75. package/dist/{assert.d.ts → types/assert.d.ts} +3 -2
  76. package/dist/types/assert.d.ts.map +1 -0
  77. package/dist/{base64.d.ts → types/base64.d.ts} +3 -2
  78. package/dist/types/base64.d.ts.map +1 -0
  79. package/dist/{bytes.d.ts → types/bytes.d.ts} +2 -1
  80. package/dist/types/bytes.d.ts.map +1 -0
  81. package/dist/{checksum.d.ts → types/checksum.d.ts} +1 -0
  82. package/dist/types/checksum.d.ts.map +1 -0
  83. package/dist/{coercers.d.ts → types/coercers.d.ts} +3 -2
  84. package/dist/types/coercers.d.ts.map +1 -0
  85. package/dist/{collections.d.ts → types/collections.d.ts} +1 -0
  86. package/dist/types/collections.d.ts.map +1 -0
  87. package/dist/{encryption-types.d.ts → types/encryption-types.d.ts} +1 -0
  88. package/dist/types/encryption-types.d.ts.map +1 -0
  89. package/dist/{hex.d.ts → types/hex.d.ts} +2 -1
  90. package/dist/types/hex.d.ts.map +1 -0
  91. package/dist/types/hex.test-d.d.ts +2 -0
  92. package/dist/types/hex.test-d.d.ts.map +1 -0
  93. package/dist/types/index.d.ts +18 -0
  94. package/dist/types/index.d.ts.map +1 -0
  95. package/dist/{json.d.ts → types/json.d.ts} +3 -2
  96. package/dist/types/json.d.ts.map +1 -0
  97. package/dist/types/json.test-d.d.ts +2 -0
  98. package/dist/types/json.test-d.d.ts.map +1 -0
  99. package/dist/{keyring.d.ts → types/keyring.d.ts} +3 -2
  100. package/dist/types/keyring.d.ts.map +1 -0
  101. package/dist/{logging.d.ts → types/logging.d.ts} +2 -1
  102. package/dist/types/logging.d.ts.map +1 -0
  103. package/dist/{misc.d.ts → types/misc.d.ts} +13 -0
  104. package/dist/types/misc.d.ts.map +1 -0
  105. package/dist/types/misc.test-d.d.ts +2 -0
  106. package/dist/types/misc.test-d.d.ts.map +1 -0
  107. package/dist/{number.d.ts → types/number.d.ts} +1 -0
  108. package/dist/types/number.d.ts.map +1 -0
  109. package/dist/{opaque.d.ts → types/opaque.d.ts} +1 -0
  110. package/dist/types/opaque.d.ts.map +1 -0
  111. package/dist/{time.d.ts → types/time.d.ts} +1 -0
  112. package/dist/types/time.d.ts.map +1 -0
  113. package/dist/{transaction-types.d.ts → types/transaction-types.d.ts} +3 -2
  114. package/dist/types/transaction-types.d.ts.map +1 -0
  115. package/dist/{versions.d.ts → types/versions.d.ts} +3 -2
  116. package/dist/types/versions.d.ts.map +1 -0
  117. package/package.json +40 -20
  118. package/dist/__fixtures__/bytes.d.ts +0 -25
  119. package/dist/__fixtures__/bytes.js +0 -234
  120. package/dist/__fixtures__/bytes.js.map +0 -1
  121. package/dist/__fixtures__/coercions.d.ts +0 -5
  122. package/dist/__fixtures__/coercions.js +0 -22
  123. package/dist/__fixtures__/coercions.js.map +0 -1
  124. package/dist/__fixtures__/index.d.ts +0 -4
  125. package/dist/__fixtures__/index.js +0 -21
  126. package/dist/__fixtures__/index.js.map +0 -1
  127. package/dist/__fixtures__/json.d.ts +0 -1226
  128. package/dist/__fixtures__/json.js +0 -1491
  129. package/dist/__fixtures__/json.js.map +0 -1
  130. package/dist/__fixtures__/numbers.d.ts +0 -5
  131. package/dist/__fixtures__/numbers.js +0 -56
  132. package/dist/__fixtures__/numbers.js.map +0 -1
  133. package/dist/assert.js.map +0 -1
  134. package/dist/base64.js.map +0 -1
  135. package/dist/bytes.js.map +0 -1
  136. package/dist/checksum.js +0 -7
  137. package/dist/checksum.js.map +0 -1
  138. package/dist/coercers.js.map +0 -1
  139. package/dist/collections.js +0 -109
  140. package/dist/collections.js.map +0 -1
  141. package/dist/encryption-types.js +0 -3
  142. package/dist/encryption-types.js.map +0 -1
  143. package/dist/hex.js +0 -134
  144. package/dist/hex.js.map +0 -1
  145. package/dist/hex.test-d.d.ts +0 -1
  146. package/dist/hex.test-d.js +0 -16
  147. package/dist/hex.test-d.js.map +0 -1
  148. package/dist/index.js +0 -34
  149. package/dist/index.js.map +0 -1
  150. package/dist/json.js +0 -346
  151. package/dist/json.js.map +0 -1
  152. package/dist/json.test-d.d.ts +0 -1
  153. package/dist/json.test-d.js +0 -62
  154. package/dist/json.test-d.js.map +0 -1
  155. package/dist/keyring.js +0 -3
  156. package/dist/keyring.js.map +0 -1
  157. package/dist/logging.js.map +0 -1
  158. package/dist/misc.js.map +0 -1
  159. package/dist/misc.test-d.d.ts +0 -1
  160. package/dist/misc.test-d.js +0 -97
  161. package/dist/misc.test-d.js.map +0 -1
  162. package/dist/number.js.map +0 -1
  163. package/dist/opaque.js +0 -3
  164. package/dist/opaque.js.map +0 -1
  165. package/dist/time.js +0 -67
  166. package/dist/time.js.map +0 -1
  167. package/dist/transaction-types.js +0 -3
  168. package/dist/transaction-types.js.map +0 -1
  169. package/dist/versions.js +0 -95
  170. package/dist/versions.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/__fixtures__/json.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IAC3B,KAAK,EAAE;QACL,IAAI;QACJ,EAAE,CAAC,EAAE,CAAC,EAAE;QACR,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC;QACd,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;KACzC;IACD,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;CACrE,CAAC;AAEW,QAAA,8BAA8B,GAAG;IAC5C,KAAK,EAAE;QACL;YACE,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,QAAQ;SACjB;QACD;YACE,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE;gBACN,GAAG,EAAE,KAAK;aACX;SACF;QACD;YACE,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,CAAC,KAAK,CAAC;SAChB;KACF;IACD,OAAO,EAAE;QACP,EAAE;QACF,EAAE;QACF,IAAI;QACJ,KAAK;QACL,IAAI;QACJ,SAAS;QACT,CAAC;QACD,KAAK;QACL;YACE,EAAE,EAAE,CAAC;YACL,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,QAAQ;SACjB;QACD;YACE,O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AAmB;QAC1B,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,GAAG;KACV;IACD;QACE,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,oBAAoB,CAAC,KAAK,EAAE,EAAE;QAC/C,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,CAAC;KACR;IACD;QACE,KAAK,EAAE;YACL,IAAI,GAAG;gBACL,MAAM,IAAI,KAAK,EAAE,CAAC;YACpB,CAAC;SACF;QACD,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,CAAC;KACR;IACD;QACE,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,CAAC;KACR;IACD;QACE,KAAK,EAAE,+BAA+B;QACtC,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,CAAC;KACR;IACD;QACE,KAAK,EAAE,iCAAiC;QACxC,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,CAAC;KACR;IACD;QACE,KAAK,EAAE,gCAAgC;QACvC,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,CAAC;KACR;IACD;QACE,KAAK,EAAE,kCAAkC;QACzC,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,CAAC;KACR;CACF,CAAC","sourcesContent":["export const JSON_FIXTURES = {\n valid: [\n null,\n { a: 1 },\n ['a', 2, null],\n [{ a: null, b: 2, c: [{ foo: 'bar' }] }],\n ],\n invalid: [undefined, Symbol('bar'), () => 'foo', [{ a: undefined }]],\n};\n\nexport const JSON_RPC_NOTIFICATION_FIXTURES = {\n valid: [\n {\n jsonrpc: '2.0',\n method: 'notify',\n },\n {\n jsonrpc: '2.0',\n method: 'notify',\n params: {\n foo: 'bar',\n },\n },\n {\n jsonrpc: '2.0',\n method: 'notify',\n params: ['foo'],\n },\n ],\n invalid: [\n {},\n [],\n true,\n false,\n null,\n undefined,\n 1,\n 'foo',\n {\n id: 1,\n jsonrpc: '2.0',\n method: 'notify',\n },\n {\n jsonrpc: '1.0',\n method: 'notify',\n },\n {\n jsonrpc: 2.0,\n method: 'notify',\n },\n {\n jsonrpc: '2.0',\n method: {},\n },\n {\n jsonrpc: '2.0',\n method: [],\n },\n {\n jsonrpc: '2.0',\n method: true,\n },\n {\n jsonrpc: '2.0',\n method: false,\n },\n {\n jsonrpc: '2.0',\n method: null,\n },\n {\n jsonrpc: '2.0',\n method: undefined,\n },\n {\n jsonrpc: '2.0',\n method: 1,\n },\n {\n jsonrpc: '2.0',\n method: 'notify',\n params: true,\n },\n {\n jsonrpc: '2.0',\n method: 'notify',\n params: false,\n },\n {\n jsonrpc: '2.0',\n method: 'notify',\n params: null,\n },\n {\n jsonrpc: '2.0',\n method: 'notify',\n params: 1,\n },\n {\n jsonrpc: '2.0',\n method: 'notify',\n params: '',\n },\n ],\n};\n\nexport const JSON_RPC_REQUEST_FIXTURES = {\n valid: [\n {\n jsonrpc: '2.0',\n method: 'notify',\n id: 1,\n },\n {\n jsonrpc: '2.0',\n method: 'notify',\n id: '1',\n params: {\n foo: 'bar',\n },\n },\n {\n jsonrpc: '2.0',\n method: 'notify',\n id: 'foo',\n params: ['foo'],\n },\n {\n jsonrpc: '2.0',\n method: 'notify',\n id: null,\n },\n ],\n invalid: [\n {},\n [],\n true,\n false,\n null,\n undefined,\n 1,\n 'foo',\n {\n id: 1,\n jsonrpc: '1.0',\n method: 'notify',\n },\n {\n id: 1,\n jsonrpc: 2.0,\n method: 'notify',\n },\n {\n id: 1,\n jsonrpc: '2.0',\n method: {},\n },\n {\n id: 1,\n jsonrpc: '2.0',\n method: [],\n },\n {\n id: 1,\n jsonrpc: '2.0',\n method: true,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n method: false,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n method: null,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n method: undefined,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n method: 1,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n method: 'notify',\n params: true,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n method: 'notify',\n params: false,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n method: 'notify',\n params: null,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n method: 'notify',\n params: 1,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n method: 'notify',\n params: '',\n },\n ],\n};\n\nexport const JSON_RPC_SUCCESS_FIXTURES = {\n valid: [\n {\n id: 1,\n jsonrpc: '2.0',\n result: 'foo',\n },\n {\n id: '1',\n jsonrpc: '2.0',\n result: {\n foo: 'bar',\n },\n },\n {\n id: 'foo',\n jsonrpc: '2.0',\n result: null,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n result: [\n {\n foo: 'bar',\n },\n ],\n },\n ],\n invalid: [\n {},\n [],\n true,\n false,\n null,\n undefined,\n 1,\n 'foo',\n {\n jsonrpc: '2.0',\n result: 'foo',\n },\n {\n id: 1,\n result: 'foo',\n },\n {\n id: 1,\n jsonrpc: '2.0',\n },\n {\n id: 1,\n jsonrpc: '1.0',\n result: 'foo',\n },\n {\n id: 1,\n jsonrpc: 2.0,\n result: 'foo',\n },\n {\n id: 1,\n jsonrpc: '2.0',\n result: undefined,\n },\n {\n id: {},\n jsonrpc: '2.0',\n result: 'foo',\n },\n {\n id: [],\n jsonrpc: '2.0',\n result: 'foo',\n },\n {\n id: true,\n jsonrpc: '2.0',\n result: 'foo',\n },\n {\n id: false,\n jsonrpc: '2.0',\n result: 'foo',\n },\n {\n id: undefined,\n jsonrpc: '2.0',\n result: 'foo',\n },\n ],\n};\n\nexport const JSON_RPC_FAILURE_FIXTURES = {\n valid: [\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: '1',\n jsonrpc: '2.0',\n error: {\n code: -32001,\n message: 'Internal error',\n data: {\n foo: 'bar',\n },\n },\n },\n {\n id: 'foo',\n jsonrpc: '2.0',\n error: {\n code: -32002,\n message: 'Internal error',\n data: ['foo'],\n stack: 'bar',\n },\n },\n {\n id: 'foo',\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: 'Internal error',\n data: 'foo',\n },\n },\n {\n id: 'foo',\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: 'Internal error',\n data: 1,\n },\n },\n ],\n invalid: [\n {},\n [],\n true,\n false,\n null,\n undefined,\n 1,\n 'foo',\n {\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n },\n {\n id: {},\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: [],\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: true,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: false,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: undefined,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '1.0',\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: 2.0,\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: {},\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: [],\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: true,\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: false,\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: null,\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: undefined,\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: [],\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {},\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: true,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: false,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: null,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: undefined,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: 'foo',\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: 1,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: {},\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: [],\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: true,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: false,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: null,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: undefined,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: 'foo',\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: {},\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: [],\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: true,\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: false,\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: null,\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: undefined,\n },\n },\n ],\n};\n\nexport const JSON_RPC_ERROR_FIXTURES = {\n valid: JSON_RPC_FAILURE_FIXTURES.valid.map((fixture) => fixture.error),\n invalid: [\n {},\n [],\n true,\n false,\n null,\n undefined,\n 1,\n 'foo',\n {\n code: {},\n message: 'Internal error',\n },\n {\n code: [],\n message: 'Internal error',\n },\n {\n code: true,\n message: 'Internal error',\n },\n {\n code: false,\n message: 'Internal error',\n },\n {\n code: null,\n message: 'Internal error',\n },\n {\n code: undefined,\n message: 'Internal error',\n },\n {\n code: 'foo',\n message: 'Internal error',\n },\n {\n code: -32000,\n message: {},\n },\n {\n code: -32000,\n message: [],\n },\n {\n code: -32000,\n message: true,\n },\n {\n code: -32000,\n message: false,\n },\n {\n code: -32000,\n message: null,\n },\n {\n code: -32000,\n message: undefined,\n },\n {\n code: -32000.5,\n message: undefined,\n },\n ],\n};\n\nexport const JSON_RPC_RESPONSE_FIXTURES = {\n valid: [\n ...JSON_RPC_SUCCESS_FIXTURES.valid,\n ...JSON_RPC_FAILURE_FIXTURES.valid,\n ],\n invalid: [\n ...JSON_RPC_SUCCESS_FIXTURES.invalid,\n ...JSON_RPC_FAILURE_FIXTURES.invalid,\n ],\n};\n\nexport const JSON_RPC_PENDING_RESPONSE_FIXTURES = {\n valid: [\n ...JSON_RPC_SUCCESS_FIXTURES.valid,\n ...JSON_RPC_FAILURE_FIXTURES.valid,\n {\n id: 1,\n jsonrpc: '2.0',\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: undefined,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n result: undefined,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n result: undefined,\n error: undefined,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n result: {\n foo: 'bar',\n },\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n ],\n invalid: [\n {},\n [],\n true,\n false,\n null,\n undefined,\n 1,\n 'foo',\n {\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: {},\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: [],\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: true,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: false,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: undefined,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '1.0',\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: 2.0,\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: {},\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: [],\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: true,\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: false,\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: null,\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: undefined,\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: [],\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {},\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: true,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: false,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: null,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: 'foo',\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: 1,\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: {},\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: [],\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: true,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: false,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: null,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: undefined,\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: 'foo',\n message: 'Internal error',\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: {},\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: [],\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: true,\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: false,\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: null,\n },\n },\n {\n id: 1,\n jsonrpc: '2.0',\n error: {\n code: -32000,\n message: undefined,\n },\n },\n ],\n};\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport const CHARACTER_MAP = {\n '\"': '\\\\\"',\n '\\\\': '\\\\\\\\',\n '\\x00': '\\\\u0000',\n '\\x01': '\\\\u0001',\n '\\x02': '\\\\u0002',\n '\\x03': '\\\\u0003',\n '\\x04': '\\\\u0004',\n '\\x05': '\\\\u0005',\n '\\x06': '\\\\u0006',\n '\\x07': '\\\\u0007',\n '\\x08': '\\\\b',\n '\\x09': '\\\\t',\n '\\x0A': '\\\\n',\n '\\x0B': '\\\\u000b',\n '\\x0C': '\\\\f',\n '\\x0D': '\\\\r',\n '\\x0E': '\\\\u000e',\n '\\x0F': '\\\\u000f',\n '\\x10': '\\\\u0010',\n '\\x11': '\\\\u0011',\n '\\x12': '\\\\u0012',\n '\\x13': '\\\\u0013',\n '\\x14': '\\\\u0014',\n '\\x15': '\\\\u0015',\n '\\x16': '\\\\u0016',\n '\\x17': '\\\\u0017',\n '\\x18': '\\\\u0018',\n '\\x19': '\\\\u0019',\n '\\x1A': '\\\\u001a',\n '\\x1B': '\\\\u001b',\n '\\x1C': '\\\\u001c',\n '\\x1D': '\\\\u001d',\n '\\x1E': '\\\\u001e',\n '\\x1F': '\\\\u001f',\n};\n/* eslint-enable @typescript-eslint/naming-convention */\n\nconst DIRECT_CIRCULAR_REFERENCE_ARRAY: unknown[] = [];\nDIRECT_CIRCULAR_REFERENCE_ARRAY.push(DIRECT_CIRCULAR_REFERENCE_ARRAY);\n\nconst INDIRECT_CIRCULAR_REFERENCE_ARRAY: unknown[] = [];\nINDIRECT_CIRCULAR_REFERENCE_ARRAY.push([[INDIRECT_CIRCULAR_REFERENCE_ARRAY]]);\n\nconst DIRECT_CIRCULAR_REFERENCE_OBJECT: Record<string, unknown> = {};\nDIRECT_CIRCULAR_REFERENCE_OBJECT.prop = DIRECT_CIRCULAR_REFERENCE_OBJECT;\n\nconst INDIRECT_CIRCULAR_REFERENCE_OBJECT: Record<string, unknown> = {\n p1: {\n p2: {\n get p3() {\n return INDIRECT_CIRCULAR_REFERENCE_OBJECT;\n },\n },\n },\n};\n\nconst TO_JSON_CIRCULAR_REFERENCE = {\n toJSON() {\n return {};\n },\n};\n\nconst CIRCULAR_REFERENCE = { prop: TO_JSON_CIRCULAR_REFERENCE };\nTO_JSON_CIRCULAR_REFERENCE.toJSON = function () {\n return CIRCULAR_REFERENCE;\n};\n\nconst DUPLICATE_DATE = new Date();\nconst DUPLICATE_OBJECT = {\n value: 'foo',\n};\n\nconst DUPLICATE_REFERENCE = {\n a: DUPLICATE_DATE,\n b: DUPLICATE_DATE,\n c: DUPLICATE_DATE,\n testOne: DUPLICATE_OBJECT,\n testTwo: DUPLICATE_OBJECT,\n testThree: {\n nestedObjectTest: {\n multipleTimes: {\n valueOne: DUPLICATE_OBJECT,\n valueTwo: DUPLICATE_OBJECT,\n valueThree: DUPLICATE_OBJECT,\n valueFour: DUPLICATE_OBJECT,\n valueFive: DUPLICATE_DATE,\n valueSix: {},\n },\n },\n },\n testFour: {},\n testFive: {\n something: null,\n somethingElse: null,\n anotherValue: null,\n somethingAgain: DUPLICATE_OBJECT,\n anotherOne: {\n nested: {\n multipleTimes: {\n valueOne: DUPLICATE_OBJECT,\n },\n },\n },\n },\n};\n\nconst REVOKED_ARRAY_PROXY = Proxy.revocable([], {});\nREVOKED_ARRAY_PROXY.revoke();\n\nconst REVOKED_OBJECT_PROXY = Proxy.revocable({}, {});\nREVOKED_OBJECT_PROXY.revoke();\n\nexport const JSON_VALIDATION_FIXTURES = [\n {\n value: {\n a: 'bc',\n },\n valid: true,\n size: 10,\n },\n {\n value: {\n a: 1234,\n },\n valid: true,\n size: 10,\n },\n {\n value: {\n a: 'bcšečf',\n },\n valid: true,\n size: 16,\n },\n {\n value: [\n -5e-11, 5e-9, 0.000000000001, -0.00000000009, 100000.00000008, -100.88888,\n 0.333, 1000000000000,\n ],\n valid: true,\n size: 73,\n },\n {\n value: {\n data: {\n account: {\n /* eslint-disable @typescript-eslint/naming-convention */\n __typename: 'Account',\n registrations: [\n {\n __typename: 'Registration',\n domain: {\n __typename: 'Domain',\n isMigrated: true,\n labelName: 'mycrypto',\n labelhash:\n '0x9a781ca0d227debc3ee76d547c960b0803a6c9f58c6d3b4722f12ede7e6ef7c9',\n name: 'mycrypto.eth',\n parent: { __typename: 'Domain', name: 'eth' },\n },\n expiryDate: '1754111315',\n },\n ],\n /* eslint-enable @typescript-eslint/naming-convention */\n },\n moreComplexity: {\n numbers: [\n -5e-11, 5e-9, 0.000000000001, -0.00000000009, 100000.00000008,\n -100.88888, 0.333, 1000000000000,\n ],\n moreNestedObjects: {\n nestedAgain: {\n nestedAgain: {\n andAgain: {\n andAgain: {\n value: true,\n again: {\n value: false,\n },\n },\n },\n },\n },\n },\n differentEncodings: {\n ascii:\n '!\"#$%&\\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~',\n utf8: 'šđćčžЀЂЇЄЖФћΣΩδλ',\n mixed: 'ABCDEFGHIJ KLMNOPQRST UVWXYZšđćč žЀЂЇЄЖФћΣΩδλ',\n specialCharacters: '\"\\\\\\n\\r\\t',\n stringWithSpecialEscapedCharacters:\n \"this\\nis\\nsome\\\"'string\\r\\nwith\\tspecial\\\\escaped\\tcharacters'\",\n },\n specialObjectsTypesAndValues: {\n t: [true, true, true],\n f: [false, false, false],\n nulls: [null, null, null],\n undef: null,\n mixed: [\n null,\n null,\n null,\n null,\n null,\n true,\n null,\n false,\n null,\n null,\n ],\n inObject: {\n valueOne: null,\n valueTwo: null,\n t: true,\n f: false,\n },\n dates: {\n someDate: new Date(),\n someOther: new Date(2022, 0, 2, 15, 4, 5),\n invalidDate: new Date('bad-date-format'),\n },\n },\n },\n },\n },\n valid: true,\n size: 1288,\n },\n {\n value: {\n dates: {\n someDate: new Date(),\n someOther: new Date(2022, 0, 2, 15, 4, 5),\n invalidDate: new Date('bad-date-format'),\n },\n },\n valid: true,\n size: 107,\n },\n {\n value: ['foo', 'bar', null, ['foo', 'bar', null]],\n valid: true,\n size: 37,\n },\n {\n value: null,\n valid: true,\n size: 4,\n },\n {\n value: true,\n valid: true,\n size: 4,\n },\n {\n value: false,\n valid: true,\n size: 5,\n },\n {\n value: 'str',\n valid: true,\n size: 5,\n },\n {\n value: 123,\n valid: true,\n size: 3,\n },\n\n {\n value: {\n a: undefined,\n },\n valid: false,\n size: 0,\n },\n {\n value: {\n levelOne: {\n levelTwo: {\n levelThree: {\n levelFour: {\n levelFive: () => {\n return 'anything';\n },\n },\n },\n },\n },\n },\n valid: false,\n size: 0,\n },\n {\n value: {\n mySymbol: Symbol('MySymbol'),\n },\n valid: false,\n size: 0,\n },\n {\n value: [\n function () {\n return 'whatever';\n },\n ],\n valid: false,\n size: 0,\n },\n\n // These tests are taken from ECMA TC39 (test262) test scenarios used for\n // testing the `JSON.stringify` function.\n // https://github.com/tc39/test262/tree/main/test/built-ins/JSON/stringify\n /* eslint-disable no-new-wrappers */\n {\n value: new Boolean(true),\n valid: true,\n size: 4,\n },\n {\n value: { key: new Boolean(false) },\n valid: true,\n size: 13,\n },\n {\n value: new Boolean(false),\n valid: true,\n size: 5,\n },\n {\n value: new Number(3.14),\n valid: true,\n size: 4,\n },\n {\n value: new String('str'),\n valid: true,\n size: 5,\n },\n /* eslint-enable no-new-wrappers */\n {\n value: -0,\n valid: true,\n size: 1,\n },\n {\n value: ['-0', 0, -0],\n valid: true,\n size: 10,\n },\n {\n value: { key: -0 },\n valid: true,\n size: 9,\n },\n {\n value: Infinity,\n valid: false,\n size: 0,\n },\n {\n value: { key: -Infinity },\n valid: false,\n size: 0,\n },\n {\n value: CHARACTER_MAP,\n valid: true,\n size: 593,\n },\n {\n value: Object.keys(CHARACTER_MAP).join(''),\n valid: true,\n size: 178,\n },\n {\n value: Object.keys(CHARACTER_MAP).reverse().join(''),\n valid: true,\n size: 178,\n },\n {\n value: Object.values(CHARACTER_MAP).join(''),\n valid: true,\n size: 214,\n },\n {\n value: Object.values(CHARACTER_MAP).reverse().join(''),\n valid: true,\n size: 214,\n },\n {\n value: {\n toJSON: null,\n },\n valid: true,\n size: 15,\n },\n {\n value: { toJSON: false },\n valid: true,\n size: 16,\n },\n {\n value: { toJSON: [] },\n valid: true,\n size: 13,\n },\n {\n value: DUPLICATE_REFERENCE,\n valid: true,\n size: 552,\n },\n {\n value: { a: { b: REVOKED_OBJECT_PROXY.proxy } },\n valid: false,\n size: 0,\n },\n {\n value: {\n get key() {\n throw new Error();\n },\n },\n valid: false,\n size: 0,\n },\n {\n value: undefined,\n valid: false,\n size: 0,\n },\n {\n value: DIRECT_CIRCULAR_REFERENCE_ARRAY,\n valid: false,\n size: 0,\n },\n {\n value: INDIRECT_CIRCULAR_REFERENCE_ARRAY,\n valid: false,\n size: 0,\n },\n {\n value: DIRECT_CIRCULAR_REFERENCE_OBJECT,\n valid: false,\n size: 0,\n },\n {\n value: INDIRECT_CIRCULAR_REFERENCE_OBJECT,\n valid: false,\n size: 0,\n },\n];\n"]}
@@ -1,5 +0,0 @@
1
- export declare const NUMBER_VALUES: {
2
- number: number;
3
- bigint: bigint;
4
- hexadecimal: string;
5
- }[];
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NUMBER_VALUES = void 0;
4
- exports.NUMBER_VALUES = [
5
- {
6
- number: 0,
7
- bigint: BigInt(0),
8
- hexadecimal: '0x0',
9
- },
10
- {
11
- number: 1,
12
- bigint: BigInt(1),
13
- hexadecimal: '0x1',
14
- },
15
- {
16
- number: 16,
17
- bigint: BigInt(16),
18
- hexadecimal: '0x10',
19
- },
20
- {
21
- number: 255,
22
- bigint: BigInt(255),
23
- hexadecimal: '0xff',
24
- },
25
- {
26
- number: 256,
27
- bigint: BigInt(256),
28
- hexadecimal: '0x100',
29
- },
30
- {
31
- number: 65535,
32
- bigint: BigInt(65535),
33
- hexadecimal: '0xffff',
34
- },
35
- {
36
- number: 65536,
37
- bigint: BigInt(65536),
38
- hexadecimal: '0x10000',
39
- },
40
- {
41
- number: 4294967295,
42
- bigint: BigInt(4294967295),
43
- hexadecimal: '0xffffffff',
44
- },
45
- {
46
- number: 4294967296,
47
- bigint: BigInt(4294967296),
48
- hexadecimal: '0x100000000',
49
- },
50
- {
51
- number: 9007199254740991,
52
- bigint: BigInt(9007199254740991),
53
- hexadecimal: '0x1fffffffffffff',
54
- },
55
- ];
56
- //# sourceMappingURL=numbers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"numbers.js","sourceRoot":"","sources":["../../src/__fixtures__/numbers.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IAC3B;QACE,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QACjB,WAAW,EAAE,KAAK;KACnB;IACD;QACE,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QACjB,WAAW,EAAE,KAAK;KACnB;IACD;QACE,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;QAClB,WAAW,EAAE,MAAM;KACpB;IACD;QACE,MAAM,EAAE,GAAG;QACX,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC;QACnB,WAAW,EAAE,MAAM;KACpB;IACD;QACE,MAAM,EAAE,GAAG;QACX,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC;QACnB,WAAW,EAAE,OAAO;KACrB;IACD;QACE,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC;QACrB,WAAW,EAAE,QAAQ;KACtB;IACD;QACE,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC;QACrB,WAAW,EAAE,SAAS;KACvB;IACD;QACE,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC;QAC1B,WAAW,EAAE,YAAY;KAC1B;IACD;QACE,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC;QAC1B,WAAW,EAAE,aAAa;KAC3B;IACD;QACE,MAAM,EAAE,gBAAgB;QACxB,MAAM,EAAE,MAAM,CAAC,gBAAgB,CAAC;QAChC,WAAW,EAAE,kBAAkB;KAChC;CACF,CAAC","sourcesContent":["export const NUMBER_VALUES = [\n {\n number: 0,\n bigint: BigInt(0),\n hexadecimal: '0x0',\n },\n {\n number: 1,\n bigint: BigInt(1),\n hexadecimal: '0x1',\n },\n {\n number: 16,\n bigint: BigInt(16),\n hexadecimal: '0x10',\n },\n {\n number: 255,\n bigint: BigInt(255),\n hexadecimal: '0xff',\n },\n {\n number: 256,\n bigint: BigInt(256),\n hexadecimal: '0x100',\n },\n {\n number: 65535,\n bigint: BigInt(65535),\n hexadecimal: '0xffff',\n },\n {\n number: 65536,\n bigint: BigInt(65536),\n hexadecimal: '0x10000',\n },\n {\n number: 4294967295,\n bigint: BigInt(4294967295),\n hexadecimal: '0xffffffff',\n },\n {\n number: 4294967296,\n bigint: BigInt(4294967296),\n hexadecimal: '0x100000000',\n },\n {\n number: 9007199254740991,\n bigint: BigInt(9007199254740991),\n hexadecimal: '0x1fffffffffffff',\n },\n];\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"assert.js","sourceRoot":"","sources":["../src/assert.ts"],"names":[],"mappings":";;;AAAA,6CAAkE;AAMlE;;;;;;GAMG;AACH,SAAS,kBAAkB,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,SAAS,IAAI,KAAK,CAAC;AAC3E,CAAC;AAED;;;;;;GAMG;AACH,SAAS,eAAe,CACtB,EAA6B;IAE7B,0BAA0B;IAC1B,OAAO,OAAO,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC;AACvE,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,eAAe,CAAC,KAAc;IACrC,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAE1E,2EAA2E;IAC3E,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACzB,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KAC7B;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;GAMG;AACH,gEAAgE;AAChE,SAAS,QAAQ,CAAC,YAAuC,EAAE,OAAe;IACxE,IAAI,eAAe,CAAC,YAAY,CAAC,EAAE;QACjC,OAAO,IAAI,YAAY,CAAC;YACtB,OAAO;SACR,CAAC,CAAC;KACJ;IACD,OAAO,YAAY,CAAC;QAClB,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAa,cAAe,SAAQ,KAAK;IAGvC,YAAY,OAA4B;QACtC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAHhB,SAAI,GAAG,eAAe,CAAC;IAIhC,CAAC;CACF;AAND,wCAMC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,MAAM,CACpB,KAAU,EACV,UAA0B,mBAAmB;AAC7C,gEAAgE;AAChE,eAA0C,cAAc;IAExD,IAAI,CAAC,KAAK,EAAE;QACV,IAAI,OAAO,YAAY,KAAK,EAAE;YAC5B,MAAM,OAAO,CAAC;SACf;QAED,MAAM,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;KACvC;AACH,CAAC;AAbD,wBAaC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,YAAY,CAC1B,KAAc,EACd,MAAoB,EACpB,WAAW,GAAG,kBAAkB;AAChC,gEAAgE;AAChE,eAA0C,cAAc;IAExD,IAAI;QACF,IAAA,oBAAiB,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;KAClC;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,QAAQ,CAAC,YAAY,EAAE,GAAG,WAAW,KAAK,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KAC5E;AACH,CAAC;AAZD,oCAYC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,gBAAgB,CAAC,OAAc;IAC7C,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;AACJ,CAAC;AAJD,4CAIC","sourcesContent":["import { assert as assertSuperstruct, Struct } from 'superstruct';\n\nexport type AssertionErrorConstructor =\n | (new (args: { message: string }) => Error)\n | ((args: { message: string }) => Error);\n\n/**\n * Type guard for determining whether the given value is an error object with a\n * `message` property, such as an instance of Error.\n *\n * @param error - The object to check.\n * @returns True or false, depending on the result.\n */\nfunction isErrorWithMessage(error: unknown): error is { message: string } {\n return typeof error === 'object' && error !== null && 'message' in error;\n}\n\n/**\n * Check if a value is a constructor, i.e., a function that can be called with\n * the `new` keyword.\n *\n * @param fn - The value to check.\n * @returns `true` if the value is a constructor, or `false` otherwise.\n */\nfunction isConstructable(\n fn: AssertionErrorConstructor,\n): fn is new (args: { message: string }) => Error {\n /* istanbul ignore next */\n return Boolean(typeof fn?.prototype?.constructor?.name === 'string');\n}\n\n/**\n * Get the error message from an unknown error object. If the error object has\n * a `message` property, that property is returned. Otherwise, the stringified\n * error object is returned.\n *\n * @param error - The error object to get the message from.\n * @returns The error message.\n */\nfunction getErrorMessage(error: unknown): string {\n const message = isErrorWithMessage(error) ? error.message : String(error);\n\n // If the error ends with a period, remove it, as we'll add our own period.\n if (message.endsWith('.')) {\n return message.slice(0, -1);\n }\n\n return message;\n}\n\n/**\n * Initialise an {@link AssertionErrorConstructor} error.\n *\n * @param ErrorWrapper - The error class to use.\n * @param message - The error message.\n * @returns The error object.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction getError(ErrorWrapper: AssertionErrorConstructor, message: string) {\n if (isConstructable(ErrorWrapper)) {\n return new ErrorWrapper({\n message,\n });\n }\n return ErrorWrapper({\n message,\n });\n}\n\n/**\n * The default error class that is thrown if an assertion fails.\n */\nexport class AssertionError extends Error {\n readonly code = 'ERR_ASSERTION';\n\n constructor(options: { message: string }) {\n super(options.message);\n }\n}\n\n/**\n * Same as Node.js assert.\n * If the value is falsy, throws an error, does nothing otherwise.\n *\n * @throws {@link AssertionError} If value is falsy.\n * @param value - The test that should be truthy to pass.\n * @param message - Message to be passed to {@link AssertionError} or an\n * {@link Error} instance to throw.\n * @param ErrorWrapper - The error class to throw if the assertion fails.\n * Defaults to {@link AssertionError}. If a custom error class is provided for\n * the `message` argument, this argument is ignored.\n */\nexport function assert(\n value: any,\n message: string | Error = 'Assertion failed.',\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper: AssertionErrorConstructor = AssertionError,\n): asserts value {\n if (!value) {\n if (message instanceof Error) {\n throw message;\n }\n\n throw getError(ErrorWrapper, message);\n }\n}\n\n/**\n * Assert a value against a Superstruct struct.\n *\n * @param value - The value to validate.\n * @param struct - The struct to validate against.\n * @param errorPrefix - A prefix to add to the error message. Defaults to\n * \"Assertion failed\".\n * @param ErrorWrapper - The error class to throw if the assertion fails.\n * Defaults to {@link AssertionError}.\n * @throws If the value is not valid.\n */\nexport function assertStruct<T, S>(\n value: unknown,\n struct: Struct<T, S>,\n errorPrefix = 'Assertion failed',\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper: AssertionErrorConstructor = AssertionError,\n): asserts value is T {\n try {\n assertSuperstruct(value, struct);\n } catch (error) {\n throw getError(ErrorWrapper, `${errorPrefix}: ${getErrorMessage(error)}.`);\n }\n}\n\n/**\n * Use in the default case of a switch that you want to be fully exhaustive.\n * Using this function forces the compiler to enforce exhaustivity during\n * compile-time.\n *\n * @example\n * ```\n * const number = 1;\n * switch (number) {\n * case 0:\n * ...\n * case 1:\n * ...\n * default:\n * assertExhaustive(snapPrefix);\n * }\n * ```\n * @param _object - The object on which the switch is being operated.\n */\nexport function assertExhaustive(_object: never): never {\n throw new Error(\n 'Invalid branch reached. Should be detected during compilation.',\n );\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"base64.js","sourceRoot":"","sources":["../src/base64.ts"],"names":[],"mappings":";;;AAAA,6CAA8C;AAE9C,qCAAkC;AAmBlC;;;;;;GAMG;AACI,MAAM,MAAM,GAAG,CACpB,MAAoB,EACpB,UAAyB,EAAE,EAC3B,EAAE;IACF,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,KAAK,CAAC;IACzD,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,QAAQ,CAAC;IAEtD,IAAI,OAAe,CAAC;IACpB,IAAI,YAAY,KAAK,QAAQ,EAAE;QAC7B,OAAO,GAAG,MAAM,CAAC,GAAG,CAAA,gBAAgB,CAAC;KACtC;SAAM;QACL,IAAA,eAAM,EAAC,YAAY,KAAK,WAAW,CAAC,CAAC;QACrC,OAAO,GAAG,MAAM,CAAC,GAAG,CAAA,eAAe,CAAC;KACrC;IAED,IAAI,EAAU,CAAC;IACf,IAAI,eAAe,EAAE;QACnB,EAAE,GAAG,IAAI,MAAM,CACb,OAAO,OAAO,WAAW,OAAO,QAAQ,OAAO,UAAU,EACzD,GAAG,CACJ,CAAC;KACH;SAAM;QACL,EAAE,GAAG,IAAI,MAAM,CACb,OAAO,OAAO,WAAW,OAAO,SAAS,OAAO,QAAQ,OAAO,UAAU,EACzE,GAAG,CACJ,CAAC;KACH;IAED,OAAO,IAAA,qBAAO,EAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC,CAAC;AA7BW,QAAA,MAAM,UA6BjB","sourcesContent":["import { pattern, Struct } from 'superstruct';\n\nimport { assert } from './assert';\n\nexport type Base64Options = {\n /**\n * Is the `=` padding at the end required or not.\n *\n * @default false\n */\n // Padding is optional in RFC 4648, that's why the default value is false\n paddingRequired?: boolean;\n /**\n * Which character set should be used.\n * The sets are based on {@link https://datatracker.ietf.org/doc/html/rfc4648 RFC 4648}.\n *\n * @default 'base64'\n */\n characterSet?: 'base64' | 'base64url';\n};\n\n/**\n * Ensure that a provided string-based struct is valid base64.\n *\n * @param struct - The string based struct.\n * @param options - Optional options to specialize base64 validation. See {@link Base64Options} documentation.\n * @returns A superstruct validating base64.\n */\nexport const base64 = <T extends string, S>(\n struct: Struct<T, S>,\n options: Base64Options = {},\n) => {\n const paddingRequired = options.paddingRequired ?? false;\n const characterSet = options.characterSet ?? 'base64';\n\n let letters: string;\n if (characterSet === 'base64') {\n letters = String.raw`[A-Za-z0-9+\\/]`;\n } else {\n assert(characterSet === 'base64url');\n letters = String.raw`[-_A-Za-z0-9]`;\n }\n\n let re: RegExp;\n if (paddingRequired) {\n re = new RegExp(\n `^(?:${letters}{4})*(?:${letters}{3}=|${letters}{2}==)?$`,\n 'u',\n );\n } else {\n re = new RegExp(\n `^(?:${letters}{4})*(?:${letters}{2,3}|${letters}{3}=|${letters}{2}==)?$`,\n 'u',\n );\n }\n\n return pattern(struct, re);\n};\n"]}
package/dist/bytes.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"bytes.js","sourceRoot":"","sources":["../src/bytes.ts"],"names":[],"mappings":";;;AAAA,qCAAkC;AAClC,+BAAgE;AAEhE,2BAA2B;AAC3B,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAExC,2BAA2B;AAC3B,MAAM,4BAA4B,GAAG,EAAE,CAAC;AACxC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAIhC;;;;;;;;;;;;;GAaG;AACH,SAAS,8BAA8B;IACrC,6EAA6E;IAC7E,6EAA6E;IAC7E,6EAA6E;IAC7E,eAAe;IACf,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,OAAO,GAAG,EAAE;QACV,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;gBAC5B,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;aACnD;SACF;QAED,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,uBAAuB,GAAG,8BAA8B,EAAE,CAAC;AAEjE;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,KAAc;IACpC,OAAO,KAAK,YAAY,UAAU,CAAC;AACrC,CAAC;AAFD,0BAEC;AAED;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,KAAc;IAC1C,IAAA,eAAM,EAAC,OAAO,CAAC,KAAK,CAAC,EAAE,6BAA6B,CAAC,CAAC;AACxD,CAAC;AA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B,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;QAC5B,UAAU,IAAI,KAAK,CAAC,MAAM,CAAC;KAC5B;IAED,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC5D,gEAAgE;QAChE,uEAAuE;QACvE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QACvC,MAAM,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;KACtC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AArBD,kCAqBC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,cAAc,CAAC,KAAiB;IAC9C,4EAA4E;IAC5E,qEAAqE;IACrE,eAAe;IACf,iDAAiD;IACjD,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,KAAK,YAAY,MAAM,EAAE;QAC5D,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAC/B,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CACpC,CAAC;QAEF,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;KAC7B;IAED,OAAO,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;AACxE,CAAC;AAfD,wCAeC","sourcesContent":["import { assert } from './assert';\nimport { add0x, assertIsHexString, Hex, remove0x } from './hex';\n\n// '0'.charCodeAt(0) === 48\nconst HEX_MINIMUM_NUMBER_CHARACTER = 48;\n\n// '9'.charCodeAt(0) === 57\nconst HEX_MAXIMUM_NUMBER_CHARACTER = 58;\nconst HEX_CHARACTER_OFFSET = 87;\n\nexport type Bytes = bigint | number | string | Uint8Array;\n\n/**\n * Memoized function that returns an array to be used as a lookup table for\n * converting bytes to hexadecimal values.\n *\n * The array is created lazily and then cached for future use. The benefit of\n * this approach is that the performance of converting bytes to hex is much\n * better than if we were to call `toString(16)` on each byte.\n *\n * The downside is that the array is created once and then never garbage\n * collected. This is not a problem in practice because the array is only 256\n * elements long.\n *\n * @returns A function that returns the lookup table.\n */\nfunction getPrecomputedHexValuesBuilder(): () => string[] {\n // To avoid issues with tree shaking, we need to use a function to return the\n // array. This is because the array is only used in the `bytesToHex` function\n // and if we were to use a global variable, the array might be removed by the\n // tree shaker.\n const lookupTable: string[] = [];\n\n return () => {\n if (lookupTable.length === 0) {\n for (let i = 0; i < 256; i++) {\n lookupTable.push(i.toString(16).padStart(2, '0'));\n }\n }\n\n return lookupTable;\n };\n}\n\n/**\n * Function implementation of the {@link getPrecomputedHexValuesBuilder}\n * function.\n */\nconst getPrecomputedHexValues = getPrecomputedHexValuesBuilder();\n\n/**\n * Check if a value is a `Uint8Array`.\n *\n * @param value - The value to check.\n * @returns Whether the value is a `Uint8Array`.\n */\nexport function isBytes(value: unknown): value is Uint8Array {\n return value instanceof Uint8Array;\n}\n\n/**\n * Assert that a value is a `Uint8Array`.\n *\n * @param value - The value to check.\n * @throws If the value is not a `Uint8Array`.\n */\nexport function assertIsBytes(value: unknown): asserts value is Uint8Array {\n assert(isBytes(value), 'Value must be a Uint8Array.');\n}\n\n/**\n * Convert a `Uint8Array` to a hexadecimal string.\n *\n * @param bytes - The bytes to convert to a hexadecimal string.\n * @returns The hexadecimal string.\n */\nexport function bytesToHex(bytes: Uint8Array): Hex {\n assertIsBytes(bytes);\n\n if (bytes.length === 0) {\n return '0x';\n }\n\n const lookupTable = getPrecomputedHexValues();\n const hexadecimal = new Array(bytes.length);\n\n for (let i = 0; i < bytes.length; i++) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n hexadecimal[i] = lookupTable[bytes[i]!];\n }\n\n return add0x(hexadecimal.join(''));\n}\n\n/**\n * Convert a `Uint8Array` to a `bigint`.\n *\n * To convert a `Uint8Array` to a `number` instead, use {@link bytesToNumber}.\n * To convert a two's complement encoded `Uint8Array` to a `bigint`, use\n * {@link bytesToSignedBigInt}.\n *\n * @param bytes - The bytes to convert to a `bigint`.\n * @returns The `bigint`.\n */\nexport function bytesToBigInt(bytes: Uint8Array): bigint {\n assertIsBytes(bytes);\n\n const hexadecimal = bytesToHex(bytes);\n return BigInt(hexadecimal);\n}\n\n/**\n * Convert a `Uint8Array` to a signed `bigint`. This assumes that the bytes are\n * encoded in two's complement.\n *\n * To convert a `Uint8Array` to an unsigned `bigint` instead, use\n * {@link bytesToBigInt}.\n *\n * @see https://en.wikipedia.org/wiki/Two%27s_complement\n * @param bytes - The bytes to convert to a signed `bigint`.\n * @returns The signed `bigint`.\n */\nexport function bytesToSignedBigInt(bytes: Uint8Array): bigint {\n assertIsBytes(bytes);\n\n let value = BigInt(0);\n for (const byte of bytes) {\n // eslint-disable-next-line no-bitwise\n value = (value << BigInt(8)) + BigInt(byte);\n }\n\n return BigInt.asIntN(bytes.length * 8, value);\n}\n\n/**\n * Convert a `Uint8Array` to a `number`.\n *\n * To convert a `Uint8Array` to a `bigint` instead, use {@link bytesToBigInt}.\n *\n * @param bytes - The bytes to convert to a number.\n * @returns The number.\n * @throws If the resulting number is not a safe integer.\n */\nexport function bytesToNumber(bytes: Uint8Array): number {\n assertIsBytes(bytes);\n\n const bigint = bytesToBigInt(bytes);\n\n assert(\n bigint <= BigInt(Number.MAX_SAFE_INTEGER),\n 'Number is not a safe integer. Use `bytesToBigInt` instead.',\n );\n\n return Number(bigint);\n}\n\n/**\n * Convert a UTF-8 encoded `Uint8Array` to a `string`.\n *\n * @param bytes - The bytes to convert to a string.\n * @returns The string.\n */\nexport function bytesToString(bytes: Uint8Array): string {\n assertIsBytes(bytes);\n\n return new TextDecoder().decode(bytes);\n}\n\n/**\n * Convert a hexadecimal string to a `Uint8Array`. The string can optionally be\n * prefixed with `0x`. It accepts even and odd length strings.\n *\n * If the value is \"0x\", an empty `Uint8Array` is returned.\n *\n * @param value - The hexadecimal string to convert to bytes.\n * @returns The bytes as `Uint8Array`.\n */\nexport function hexToBytes(value: string): Uint8Array {\n // \"0x\" is often used as empty byte array.\n if (value?.toLowerCase?.() === '0x') {\n return new Uint8Array();\n }\n\n assertIsHexString(value);\n\n // Remove the `0x` prefix if it exists, and pad the string to have an even\n // number of characters.\n const strippedValue = remove0x(value).toLowerCase();\n const normalizedValue =\n strippedValue.length % 2 === 0 ? strippedValue : `0${strippedValue}`;\n const bytes = new Uint8Array(normalizedValue.length / 2);\n\n for (let i = 0; i < bytes.length; i++) {\n // While this is not the prettiest way to convert a hexadecimal string to a\n // `Uint8Array`, it is a lot faster than using `parseInt` to convert each\n // character.\n const c1 = normalizedValue.charCodeAt(i * 2);\n const c2 = normalizedValue.charCodeAt(i * 2 + 1);\n const n1 =\n c1 -\n (c1 < HEX_MAXIMUM_NUMBER_CHARACTER\n ? HEX_MINIMUM_NUMBER_CHARACTER\n : HEX_CHARACTER_OFFSET);\n const n2 =\n c2 -\n (c2 < HEX_MAXIMUM_NUMBER_CHARACTER\n ? HEX_MINIMUM_NUMBER_CHARACTER\n : HEX_CHARACTER_OFFSET);\n\n bytes[i] = n1 * 16 + n2;\n }\n\n return bytes;\n}\n\n/**\n * Convert a `bigint` to a `Uint8Array`.\n *\n * This assumes that the `bigint` is an unsigned integer. To convert a signed\n * `bigint` instead, use {@link signedBigIntToBytes}.\n *\n * @param value - The bigint to convert to bytes.\n * @returns The bytes as `Uint8Array`.\n */\nexport function bigIntToBytes(value: bigint): Uint8Array {\n assert(typeof value === 'bigint', 'Value must be a bigint.');\n assert(value >= BigInt(0), 'Value must be a non-negative bigint.');\n\n const hexadecimal = value.toString(16);\n return hexToBytes(hexadecimal);\n}\n\n/**\n * Check if a `bigint` fits in a certain number of bytes.\n *\n * @param value - The `bigint` to check.\n * @param bytes - The number of bytes.\n * @returns Whether the `bigint` fits in the number of bytes.\n */\nfunction bigIntFits(value: bigint, bytes: number): boolean {\n assert(bytes > 0);\n\n /* eslint-disable no-bitwise */\n const mask = value >> BigInt(31);\n return !(((~value & mask) + (value & ~mask)) >> BigInt(bytes * 8 + ~0));\n /* eslint-enable no-bitwise */\n}\n\n/**\n * Convert a signed `bigint` to a `Uint8Array`. This uses two's complement\n * encoding to represent negative numbers.\n *\n * To convert an unsigned `bigint` to a `Uint8Array` instead, use\n * {@link bigIntToBytes}.\n *\n * @see https://en.wikipedia.org/wiki/Two%27s_complement\n * @param value - The number to convert to bytes.\n * @param byteLength - The length of the resulting `Uint8Array`. If the number\n * is larger than the maximum value that can be represented by the given length,\n * an error is thrown.\n * @returns The bytes as `Uint8Array`.\n */\nexport function signedBigIntToBytes(\n value: bigint,\n byteLength: number,\n): Uint8Array {\n assert(typeof value === 'bigint', 'Value must be a bigint.');\n assert(typeof byteLength === 'number', 'Byte length must be a number.');\n assert(byteLength > 0, 'Byte length must be greater than 0.');\n assert(\n bigIntFits(value, byteLength),\n 'Byte length is too small to represent the given value.',\n );\n\n // ESLint doesn't like mutating function parameters, so to avoid having to\n // disable the rule, we create a new variable.\n let numberValue = value;\n const bytes = new Uint8Array(byteLength);\n\n for (let i = 0; i < bytes.length; i++) {\n bytes[i] = Number(BigInt.asUintN(8, numberValue));\n // eslint-disable-next-line no-bitwise\n numberValue >>= BigInt(8);\n }\n\n return bytes.reverse();\n}\n\n/**\n * Convert a `number` to a `Uint8Array`.\n *\n * @param value - The number to convert to bytes.\n * @returns The bytes as `Uint8Array`.\n * @throws If the number is not a safe integer.\n */\nexport function numberToBytes(value: number): Uint8Array {\n assert(typeof value === 'number', 'Value must be a number.');\n assert(value >= 0, 'Value must be a non-negative number.');\n assert(\n Number.isSafeInteger(value),\n 'Value is not a safe integer. Use `bigIntToBytes` instead.',\n );\n\n const hexadecimal = value.toString(16);\n return hexToBytes(hexadecimal);\n}\n\n/**\n * Convert a `string` to a UTF-8 encoded `Uint8Array`.\n *\n * @param value - The string to convert to bytes.\n * @returns The bytes as `Uint8Array`.\n */\nexport function stringToBytes(value: string): Uint8Array {\n assert(typeof value === 'string', 'Value must be a string.');\n\n return new TextEncoder().encode(value);\n}\n\n/**\n * Convert a byte-like value to a `Uint8Array`. The value can be a `Uint8Array`,\n * a `bigint`, a `number`, or a `string`.\n *\n * This will attempt to guess the type of the value based on its type and\n * contents. For more control over the conversion, use the more specific\n * conversion functions, such as {@link hexToBytes} or {@link stringToBytes}.\n *\n * If the value is a `string`, and it is prefixed with `0x`, it will be\n * interpreted as a hexadecimal string. Otherwise, it will be interpreted as a\n * UTF-8 string. To convert a hexadecimal string to bytes without interpreting\n * it as a UTF-8 string, use {@link hexToBytes} instead.\n *\n * If the value is a `bigint`, it is assumed to be unsigned. To convert a signed\n * `bigint` to bytes, use {@link signedBigIntToBytes} instead.\n *\n * If the value is a `Uint8Array`, it will be returned as-is.\n *\n * @param value - The value to convert to bytes.\n * @returns The bytes as `Uint8Array`.\n */\nexport function valueToBytes(value: Bytes): Uint8Array {\n if (typeof value === 'bigint') {\n return bigIntToBytes(value);\n }\n\n if (typeof value === 'number') {\n return numberToBytes(value);\n }\n\n if (typeof value === 'string') {\n if (value.startsWith('0x')) {\n return hexToBytes(value);\n }\n\n return stringToBytes(value);\n }\n\n if (isBytes(value)) {\n return value;\n }\n\n throw new TypeError(`Unsupported value type: \"${typeof value}\".`);\n}\n\n/**\n * Concatenate multiple byte-like values into a single `Uint8Array`. The values\n * can be `Uint8Array`, `bigint`, `number`, or `string`. This uses\n * {@link valueToBytes} under the hood to convert each value to bytes. Refer to\n * the documentation of that function for more information.\n *\n * @param values - The values to concatenate.\n * @returns The concatenated bytes as `Uint8Array`.\n */\nexport function concatBytes(values: Bytes[]): Uint8Array {\n const normalizedValues = new Array(values.length);\n let byteLength = 0;\n\n for (let i = 0; i < values.length; i++) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const value = valueToBytes(values[i]!);\n\n normalizedValues[i] = value;\n byteLength += value.length;\n }\n\n const bytes = new Uint8Array(byteLength);\n for (let i = 0, offset = 0; i < normalizedValues.length; i++) {\n // While we could simply spread the values into an array and use\n // `Uint8Array.from`, that is a lot slower than using `Uint8Array.set`.\n bytes.set(normalizedValues[i], offset);\n offset += normalizedValues[i].length;\n }\n\n return bytes;\n}\n\n/**\n * Create a {@link DataView} from a {@link Uint8Array}. This is a convenience\n * function that avoids having to create a {@link DataView} manually, which\n * requires passing the `byteOffset` and `byteLength` parameters every time.\n *\n * Not passing the `byteOffset` and `byteLength` parameters can result in\n * unexpected behavior when the {@link Uint8Array} is a view of a larger\n * {@link ArrayBuffer}, e.g., when using {@link Uint8Array.subarray}.\n *\n * This function also supports Node.js {@link Buffer}s.\n *\n * @example\n * ```typescript\n * const bytes = new Uint8Array([1, 2, 3]);\n *\n * // This is equivalent to:\n * // const dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n * const dataView = createDataView(bytes);\n * ```\n * @param bytes - The bytes to create the {@link DataView} from.\n * @returns The {@link DataView}.\n */\nexport function createDataView(bytes: Uint8Array): DataView {\n // To maintain compatibility with Node.js, we need to check if the bytes are\n // a Buffer. If so, we need to slice the buffer to get the underlying\n // ArrayBuffer.\n // eslint-disable-next-line no-restricted-globals\n if (typeof Buffer !== 'undefined' && bytes instanceof Buffer) {\n const buffer = bytes.buffer.slice(\n bytes.byteOffset,\n bytes.byteOffset + bytes.byteLength,\n );\n\n return new DataView(buffer);\n }\n\n return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n}\n"]}
package/dist/checksum.js DELETED
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChecksumStruct = void 0;
4
- const superstruct_1 = require("superstruct");
5
- const base64_1 = require("./base64");
6
- exports.ChecksumStruct = (0, superstruct_1.size)((0, base64_1.base64)((0, superstruct_1.string)(), { paddingRequired: true }), 44, 44);
7
- //# sourceMappingURL=checksum.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"checksum.js","sourceRoot":"","sources":["../src/checksum.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAE3C,qCAAkC;AAErB,QAAA,cAAc,GAAG,IAAA,kBAAI,EAChC,IAAA,eAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,EAC3C,EAAE,EACF,EAAE,CACH,CAAC","sourcesContent":["import { size, string } from 'superstruct';\n\nimport { base64 } from './base64';\n\nexport const ChecksumStruct = size(\n base64(string(), { paddingRequired: true }),\n 44,\n 44,\n);\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"coercers.js","sourceRoot":"","sources":["../src/coercers.ts"],"names":[],"mappings":";;;AAAA,6CAUqB;AAErB,qCAAkC;AAClC,mCAAiD;AACjD,+BAA6C;AAE7C,MAAM,gBAAgB,GAAG,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,qBAAe,CAAC,CAAC,CAAC;AAChF,MAAM,aAAa,GAAG,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;AACjE,MAAM,aAAa,GAAG,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAEjE,MAAM,eAAe,GAAG,IAAA,mBAAK,EAAC,CAAC,qBAAe,EAAE,IAAA,sBAAQ,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AACvE,MAAM,YAAY,GAAG,IAAA,oBAAM,EACzB,IAAA,sBAAQ,EAAC,UAAU,CAAC,EACpB,IAAA,mBAAK,EAAC,CAAC,qBAAe,CAAC,CAAC,EACxB,kBAAU,CACX,CAAC;AAEF,MAAM,UAAU,GAAG,IAAA,oBAAM,EAAC,qBAAe,EAAE,IAAA,sBAAQ,EA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AI,KAAK,YAAY,yBAAW,EAAE;YAChC,MAAM,IAAI,KAAK,CACb,qCAAqC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAC7D,CAAC;SACH;QAED,0BAA0B;QAC1B,MAAM,KAAK,CAAC;KACb;AACH,CAAC;AAjBD,kCAiBC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,SAAS,CAAC,KAAgB;IACxC,IACE,CAAC,KAAK,YAAY,UAAU,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;QACnD,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,EAC3D;QACA,OAAO,IAAI,CAAC;KACb;IAED,IAAI;QACF,OAAO,IAAA,oBAAM,EAAC,KAAK,EAAE,UAAU,CAAC,CAAC;KAClC;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,KAAK,YAAY,yBAAW,EAAE;YAChC,MAAM,IAAI,KAAK,CACb,qCAAqC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAC7D,CAAC;SACH;QAED,0BAA0B;QAC1B,MAAM,KAAK,CAAC;KACb;AACH,CAAC;AApBD,8BAoBC","sourcesContent":["import {\n bigint,\n coerce,\n create,\n Infer,\n instance,\n number,\n string,\n StructError,\n union,\n} from 'superstruct';\n\nimport { assert } from './assert';\nimport { bytesToHex, hexToBytes } from './bytes';\nimport { Hex, StrictHexStruct } from './hex';\n\nconst NumberLikeStruct = union([number(), bigint(), string(), StrictHexStruct]);\nconst NumberCoercer = coerce(number(), NumberLikeStruct, Number);\nconst BigIntCoercer = coerce(bigint(), NumberLikeStruct, BigInt);\n\nconst BytesLikeStruct = union([StrictHexStruct, instance(Uint8Array)]);\nconst BytesCoercer = coerce(\n instance(Uint8Array),\n union([StrictHexStruct]),\n hexToBytes,\n);\n\nconst HexCoercer = coerce(StrictHexStruct, instance(Uint8Array), bytesToHex);\n\nexport type NumberLike = Infer<typeof NumberLikeStruct>;\nexport type BytesLike = Infer<typeof BytesLikeStruct>;\n\n/**\n * Create a number from a number-like value.\n *\n * - If the value is a number, it is returned as-is.\n * - If the value is a `bigint`, it is converted to a number.\n * - If the value is a string, it is interpreted as a decimal number.\n * - If the value is a hex string (i.e., it starts with \"0x\"), it is\n * interpreted as a hexadecimal number.\n *\n * This validates that the value is a number-like value, and that the resulting\n * number is not `NaN` or `Infinity`.\n *\n * @example\n * ```typescript\n * const value = createNumber('0x010203');\n * console.log(value); // 66051\n *\n * const otherValue = createNumber(123n);\n * console.log(otherValue); // 123\n * ```\n * @param value - The value to create the number from.\n * @returns The created number.\n * @throws If the value is not a number-like value, or if the resulting number\n * is `NaN` or `Infinity`.\n */\nexport function createNumber(value: NumberLike): number {\n try {\n const result = create(value, NumberCoercer);\n\n assert(\n Number.isFinite(result),\n `Expected a number-like value, got \"${value}\".`,\n );\n\n return result;\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(`Expected a number-like value, got \"${value}\".`);\n }\n\n /* istanbul ignore next */\n throw error;\n }\n}\n\n/**\n * Create a `bigint` from a number-like value.\n *\n * - If the value is a number, it is converted to a `bigint`.\n * - If the value is a `bigint`, it is returned as-is.\n * - If the value is a string, it is interpreted as a decimal number and\n * converted to a `bigint`.\n * - If the value is a hex string (i.e., it starts with \"0x\"), it is\n * interpreted as a hexadecimal number and converted to a `bigint`.\n *\n * @example\n * ```typescript\n * const value = createBigInt('0x010203');\n * console.log(value); // 16909060n\n *\n * const otherValue = createBigInt(123);\n * console.log(otherValue); // 123n\n * ```\n * @param value - The value to create the bigint from.\n * @returns The created bigint.\n * @throws If the value is not a number-like value.\n */\nexport function createBigInt(value: NumberLike): bigint {\n try {\n // The `BigInt` constructor throws if the value is not a number-like value.\n // There is no need to validate the value manually.\n return create(value, BigIntCoercer);\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(\n `Expected a number-like value, got \"${String(error.value)}\".`,\n );\n }\n\n /* istanbul ignore next */\n throw error;\n }\n}\n\n/**\n * Create a byte array from a bytes-like value.\n *\n * - If the value is a byte array, it is returned as-is.\n * - If the value is a hex string (i.e., it starts with \"0x\"), it is interpreted\n * as a hexadecimal number and converted to a byte array.\n *\n * @example\n * ```typescript\n * const value = createBytes('0x010203');\n * console.log(value); // Uint8Array [ 1, 2, 3 ]\n *\n * const otherValue = createBytes('0x010203');\n * console.log(otherValue); // Uint8Array [ 1, 2, 3 ]\n * ```\n * @param value - The value to create the byte array from.\n * @returns The created byte array.\n * @throws If the value is not a bytes-like value.\n */\nexport function createBytes(value: BytesLike): Uint8Array {\n if (typeof value === 'string' && value.toLowerCase() === '0x') {\n return new Uint8Array();\n }\n\n try {\n return create(value, BytesCoercer);\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(\n `Expected a bytes-like value, got \"${String(error.value)}\".`,\n );\n }\n\n /* istanbul ignore next */\n throw error;\n }\n}\n\n/**\n * Create a hexadecimal string from a bytes-like value.\n *\n * - If the value is a hex string (i.e., it starts with \"0x\"), it is returned\n * as-is.\n * - If the value is a `Uint8Array`, it is converted to a hex string.\n *\n * @example\n * ```typescript\n * const value = createHex(new Uint8Array([1, 2, 3]));\n * console.log(value); // '0x010203'\n *\n * const otherValue = createHex('0x010203');\n * console.log(otherValue); // '0x010203'\n * ```\n * @param value - The value to create the hex string from.\n * @returns The created hex string.\n * @throws If the value is not a bytes-like value.\n */\nexport function createHex(value: BytesLike): Hex {\n if (\n (value instanceof Uint8Array && value.length === 0) ||\n (typeof value === 'string' && value.toLowerCase() === '0x')\n ) {\n return '0x';\n }\n\n try {\n return create(value, HexCoercer);\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(\n `Expected a bytes-like value, got \"${String(error.value)}\".`,\n );\n }\n\n /* istanbul ignore next */\n throw error;\n }\n}\n"]}
@@ -1,109 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
- var _FrozenMap_map, _FrozenSet_set;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.FrozenSet = exports.FrozenMap = void 0;
16
- /**
17
- * A {@link ReadonlyMap} that cannot be modified after instantiation.
18
- * The implementation uses an inner map hidden via a private field, and the
19
- * immutability guarantee relies on it being impossible to get a reference
20
- * to this map.
21
- */
22
- class FrozenMap {
23
- constructor(entries) {
24
- _FrozenMap_map.set(this, void 0);
25
- __classPrivateFieldSet(this, _FrozenMap_map, new Map(entries), "f");
26
- Object.freeze(this);
27
- }
28
- get size() {
29
- return __classPrivateFieldGet(this, _FrozenMap_map, "f").size;
30
- }
31
- [(_FrozenMap_map = new WeakMap(), Symbol.iterator)]() {
32
- return __classPrivateFieldGet(this, _FrozenMap_map, "f")[Symbol.iterator]();
33
- }
34
- entries() {
35
- return __classPrivateFieldGet(this, _FrozenMap_map, "f").entries();
36
- }
37
- forEach(callbackfn, thisArg) {
38
- // We have to wrap the specified callback in order to prevent it from
39
- // receiving a reference to the inner map.
40
- return __classPrivateFieldGet(this, _FrozenMap_map, "f").forEach((value, key, _map) => callbackfn.call(thisArg, value, key, this));
41
- }
42
- get(key) {
43
- return __classPrivateFieldGet(this, _FrozenMap_map, "f").get(key);
44
- }
45
- has(key) {
46
- return __classPrivateFieldGet(this, _FrozenMap_map, "f").has(key);
47
- }
48
- keys() {
49
- return __classPrivateFieldGet(this, _FrozenMap_map, "f").keys();
50
- }
51
- values() {
52
- return __classPrivateFieldGet(this, _FrozenMap_map, "f").values();
53
- }
54
- toString() {
55
- return `FrozenMap(${this.size}) {${this.size > 0
56
- ? ` ${[...this.entries()]
57
- .map(([key, value]) => `${String(key)} => ${String(value)}`)
58
- .join(', ')} `
59
- : ''}}`;
60
- }
61
- }
62
- exports.FrozenMap = FrozenMap;
63
- /**
64
- * A {@link ReadonlySet} that cannot be modified after instantiation.
65
- * The implementation uses an inner set hidden via a private field, and the
66
- * immutability guarantee relies on it being impossible to get a reference
67
- * to this set.
68
- */
69
- class FrozenSet {
70
- constructor(values) {
71
- _FrozenSet_set.set(this, void 0);
72
- __classPrivateFieldSet(this, _FrozenSet_set, new Set(values), "f");
73
- Object.freeze(this);
74
- }
75
- get size() {
76
- return __classPrivateFieldGet(this, _FrozenSet_set, "f").size;
77
- }
78
- [(_FrozenSet_set = new WeakMap(), Symbol.iterator)]() {
79
- return __classPrivateFieldGet(this, _FrozenSet_set, "f")[Symbol.iterator]();
80
- }
81
- entries() {
82
- return __classPrivateFieldGet(this, _FrozenSet_set, "f").entries();
83
- }
84
- forEach(callbackfn, thisArg) {
85
- // We have to wrap the specified callback in order to prevent it from
86
- // receiving a reference to the inner set.
87
- return __classPrivateFieldGet(this, _FrozenSet_set, "f").forEach((value, value2, _set) => callbackfn.call(thisArg, value, value2, this));
88
- }
89
- has(value) {
90
- return __classPrivateFieldGet(this, _FrozenSet_set, "f").has(value);
91
- }
92
- keys() {
93
- return __classPrivateFieldGet(this, _FrozenSet_set, "f").keys();
94
- }
95
- values() {
96
- return __classPrivateFieldGet(this, _FrozenSet_set, "f").values();
97
- }
98
- toString() {
99
- return `FrozenSet(${this.size}) {${this.size > 0
100
- ? ` ${[...this.values()].map((member) => String(member)).join(', ')} `
101
- : ''}}`;
102
- }
103
- }
104
- exports.FrozenSet = FrozenSet;
105
- Object.freeze(FrozenMap);
106
- Object.freeze(FrozenMap.prototype);
107
- Object.freeze(FrozenSet);
108
- Object.freeze(FrozenSet.prototype);
109
- //# sourceMappingURL=collections.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"collections.js","sourceRoot":"","sources":["../src/collections.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACH,MAAM,SAAS;IAWb,YAAY,OAAmD;QAV/D,iCAA+B;QAW7B,uBAAA,IAAI,kBAAQ,IAAI,GAAG,CAAa,OAAO,CAAC,MAAA,CAAC;QACzC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAXD,IAAW,IAAI;QACb,OAAO,uBAAA,IAAI,sBAAK,CAAC,IAAI,CAAC;IACxB,CAAC;IAEM,kCAAC,MAAM,CAAC,QAAQ,EAAC;QACtB,OAAO,uBAAA,IAAI,sBAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;IACtC,CAAC;IAOM,OAAO;QACZ,OAAO,uBAAA,IAAI,sBAAK,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IAEM,OAAO,CACZ,UAAuD,EACvD,OAAa;QAEb,qEAAqE;QACrE,0CAA0C;QAC1C,OAAO,uBAAA,IAAI,sBAAK,CAAC,OAAO,CAAC,CAAC,KAAY,EAAE,GAAQ,EAAE,IAAa,EAAE,EAAE,CACjE,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAC3C,CAAC;IACJ,CAAC;IAEM,GAAG,CAAC,GAAQ;QACjB,OAAO,uBAAA,IAAI,sBAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAEM,GAAG,CAAC,GAAQ;QACjB,OAAO,uBAAA,IAAI,sBAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAEM,IAAI;QACT,OAAO,uBAAA,IAAI,sBAAK,CAA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EAAE,IAAI,CAAC,CAC9C,CAAC;IACJ,CAAC;IAEM,GAAG,CAAC,KAAY;QACrB,OAAO,uBAAA,IAAI,sBAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAEM,IAAI;QACT,OAAO,uBAAA,IAAI,sBAAK,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;IAEM,MAAM;QACX,OAAO,uBAAA,IAAI,sBAAK,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC;IAEM,QAAQ;QACb,OAAO,aAAa,IAAI,CAAC,IAAI,MAC3B,IAAI,CAAC,IAAI,GAAG,CAAC;YACX,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YACtE,CAAC,CAAC,EACN,GAAG,CAAC;IACN,CAAC;CACF;AAQmB,8BAAS;AAN7B,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACzB,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAEnC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACzB,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC","sourcesContent":["/**\n * A {@link ReadonlyMap} that cannot be modified after instantiation.\n * The implementation uses an inner map hidden via a private field, and the\n * immutability guarantee relies on it being impossible to get a reference\n * to this map.\n */\nclass FrozenMap<Key, Value> implements ReadonlyMap<Key, Value> {\n readonly #map: Map<Key, Value>;\n\n public get size() {\n return this.#map.size;\n }\n\n public [Symbol.iterator]() {\n return this.#map[Symbol.iterator]();\n }\n\n constructor(entries?: readonly (readonly [Key, Value])[] | null) {\n this.#map = new Map<Key, Value>(entries);\n Object.freeze(this);\n }\n\n public entries() {\n return this.#map.entries();\n }\n\n public forEach(\n callbackfn: (value: Value, key: Key, map: this) => void,\n thisArg?: any,\n ): void {\n // We have to wrap the specified callback in order to prevent it from\n // receiving a reference to the inner map.\n return this.#map.forEach((value: Value, key: Key, _map: unknown) =>\n callbackfn.call(thisArg, value, key, this),\n );\n }\n\n public get(key: Key) {\n return this.#map.get(key);\n }\n\n public has(key: Key) {\n return this.#map.has(key);\n }\n\n public keys() {\n return this.#map.keys();\n }\n\n public values() {\n return this.#map.values();\n }\n\n public toString(): string {\n return `FrozenMap(${this.size}) {${\n this.size > 0\n ? ` ${[...this.entries()]\n .map(([key, value]) => `${String(key)} => ${String(value)}`)\n .join(', ')} `\n : ''\n }}`;\n }\n}\n\n/**\n * A {@link ReadonlySet} that cannot be modified after instantiation.\n * The implementation uses an inner set hidden via a private field, and the\n * immutability guarantee relies on it being impossible to get a reference\n * to this set.\n */\nclass FrozenSet<Value> implements ReadonlySet<Value> {\n readonly #set: Set<Value>;\n\n public get size() {\n return this.#set.size;\n }\n\n public [Symbol.iterator]() {\n return this.#set[Symbol.iterator]();\n }\n\n constructor(values?: readonly Value[] | null) {\n this.#set = new Set<Value>(values);\n Object.freeze(this);\n }\n\n public entries() {\n return this.#set.entries();\n }\n\n public forEach(\n callbackfn: (value: Value, value2: Value, set: this) => void,\n thisArg?: any,\n ): void {\n // We have to wrap the specified callback in order to prevent it from\n // receiving a reference to the inner set.\n return this.#set.forEach((value: Value, value2: Value, _set: unknown) =>\n callbackfn.call(thisArg, value, value2, this),\n );\n }\n\n public has(value: Value) {\n return this.#set.has(value);\n }\n\n public keys() {\n return this.#set.keys();\n }\n\n public values() {\n return this.#set.values();\n }\n\n public toString(): string {\n return `FrozenSet(${this.size}) {${\n this.size > 0\n ? ` ${[...this.values()].map((member) => String(member)).join(', ')} `\n : ''\n }}`;\n }\n}\n\nObject.freeze(FrozenMap);\nObject.freeze(FrozenMap.prototype);\n\nObject.freeze(FrozenSet);\nObject.freeze(FrozenSet.prototype);\n\nexport { FrozenMap, FrozenSet };\n"]}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=encryption-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encryption-types.js","sourceRoot":"","sources":["../src/encryption-types.ts"],"names":[],"mappings":"","sourcesContent":["export type Eip1024EncryptedData = {\n version: string;\n nonce: string;\n ephemPublicKey: string;\n ciphertext: string;\n};\n"]}
package/dist/hex.js DELETED
@@ -1,134 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.remove0x = exports.add0x = exports.isValidChecksumAddress = exports.getChecksumAddress = exports.isValidHexAddress = exports.assertIsStrictHexString = exports.assertIsHexString = exports.isStrictHexString = exports.isHexString = exports.HexChecksumAddressStruct = exports.HexAddressStruct = exports.StrictHexStruct = exports.HexStruct = void 0;
4
- const sha3_1 = require("@noble/hashes/sha3");
5
- const superstruct_1 = require("superstruct");
6
- const assert_1 = require("./assert");
7
- const bytes_1 = require("./bytes");
8
- exports.HexStruct = (0, superstruct_1.pattern)((0, superstruct_1.string)(), /^(?:0x)?[0-9a-f]+$/iu);
9
- exports.StrictHexStruct = (0, superstruct_1.pattern)((0, superstruct_1.string)(), /^0x[0-9a-f]+$/iu);
10
- exports.HexAddressStruct = (0, superstruct_1.pattern)((0, superstruct_1.string)(), /^0x[0-9a-f]{40}$/u);
11
- exports.HexChecksumAddressStruct = (0, superstruct_1.pattern)((0, superstruct_1.string)(), /^0x[0-9a-fA-F]{40}$/u);
12
- /**
13
- * Check if a string is a valid hex string.
14
- *
15
- * @param value - The value to check.
16
- * @returns Whether the value is a valid hex string.
17
- */
18
- function isHexString(value) {
19
- return (0, superstruct_1.is)(value, exports.HexStruct);
20
- }
21
- exports.isHexString = isHexString;
22
- /**
23
- * Strictly check if a string is a valid hex string. A valid hex string must
24
- * start with the "0x"-prefix.
25
- *
26
- * @param value - The value to check.
27
- * @returns Whether the value is a valid hex string.
28
- */
29
- function isStrictHexString(value) {
30
- return (0, superstruct_1.is)(value, exports.StrictHexStruct);
31
- }
32
- exports.isStrictHexString = isStrictHexString;
33
- /**
34
- * Assert that a value is a valid hex string.
35
- *
36
- * @param value - The value to check.
37
- * @throws If the value is not a valid hex string.
38
- */
39
- function assertIsHexString(value) {
40
- (0, assert_1.assert)(isHexString(value), 'Value must be a hexadecimal string.');
41
- }
42
- exports.assertIsHexString = assertIsHexString;
43
- /**
44
- * Assert that a value is a valid hex string. A valid hex string must start with
45
- * the "0x"-prefix.
46
- *
47
- * @param value - The value to check.
48
- * @throws If the value is not a valid hex string.
49
- */
50
- function assertIsStrictHexString(value) {
51
- (0, assert_1.assert)(isStrictHexString(value), 'Value must be a hexadecimal string, starting with "0x".');
52
- }
53
- exports.assertIsStrictHexString = assertIsStrictHexString;
54
- /**
55
- * Validate that the passed prefixed hex string is an all-lowercase
56
- * hex address, or a valid mixed-case checksum address.
57
- *
58
- * @param possibleAddress - Input parameter to check against.
59
- * @returns Whether or not the input is a valid hex address.
60
- */
61
- function isValidHexAddress(possibleAddress) {
62
- return ((0, superstruct_1.is)(possibleAddress, exports.HexAddressStruct) ||
63
- isValidChecksumAddress(possibleAddress));
64
- }
65
- exports.isValidHexAddress = isValidHexAddress;
66
- /**
67
- * Encode a passed hex string as an ERC-55 mixed-case checksum address.
68
- *
69
- * @param address - The hex address to encode.
70
- * @returns The address encoded according to ERC-55.
71
- * @see https://eips.ethereum.org/EIPS/eip-55
72
- */
73
- function getChecksumAddress(address) {
74
- (0, assert_1.assert)((0, superstruct_1.is)(address, exports.HexChecksumAddressStruct), 'Invalid hex address.');
75
- const unPrefixed = remove0x(address.toLowerCase());
76
- const unPrefixedHash = remove0x((0, bytes_1.bytesToHex)((0, sha3_1.keccak_256)(unPrefixed)));
77
- return `0x${unPrefixed
78
- .split('')
79
- .map((character, nibbleIndex) => {
80
- const hashCharacter = unPrefixedHash[nibbleIndex];
81
- (0, assert_1.assert)((0, superstruct_1.is)(hashCharacter, (0, superstruct_1.string)()), 'Hash shorter than address.');
82
- return parseInt(hashCharacter, 16) > 7
83
- ? character.toUpperCase()
84
- : character;
85
- })
86
- .join('')}`;
87
- }
88
- exports.getChecksumAddress = getChecksumAddress;
89
- /**
90
- * Validate that the passed hex string is a valid ERC-55 mixed-case
91
- * checksum address.
92
- *
93
- * @param possibleChecksum - The hex address to check.
94
- * @returns True if the address is a checksum address.
95
- */
96
- function isValidChecksumAddress(possibleChecksum) {
97
- if (!(0, superstruct_1.is)(possibleChecksum, exports.HexChecksumAddressStruct)) {
98
- return false;
99
- }
100
- return getChecksumAddress(possibleChecksum) === possibleChecksum;
101
- }
102
- exports.isValidChecksumAddress = isValidChecksumAddress;
103
- /**
104
- * Add the `0x`-prefix to a hexadecimal string. If the string already has the
105
- * prefix, it is returned as-is.
106
- *
107
- * @param hexadecimal - The hexadecimal string to add the prefix to.
108
- * @returns The prefixed hexadecimal string.
109
- */
110
- function add0x(hexadecimal) {
111
- if (hexadecimal.startsWith('0x')) {
112
- return hexadecimal;
113
- }
114
- if (hexadecimal.startsWith('0X')) {
115
- return `0x${hexadecimal.substring(2)}`;
116
- }
117
- return `0x${hexadecimal}`;
118
- }
119
- exports.add0x = add0x;
120
- /**
121
- * Remove the `0x`-prefix from a hexadecimal string. If the string doesn't have
122
- * the prefix, it is returned as-is.
123
- *
124
- * @param hexadecimal - The hexadecimal string to remove the prefix from.
125
- * @returns The un-prefixed hexadecimal string.
126
- */
127
- function remove0x(hexadecimal) {
128
- if (hexadecimal.startsWith('0x') || hexadecimal.startsWith('0X')) {
129
- return hexadecimal.substring(2);
130
- }
131
- return hexadecimal;
132
- }
133
- exports.remove0x = remove0x;
134
- //# sourceMappingURL=hex.js.map
package/dist/hex.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"hex.js","sourceRoot":"","sources":["../src/hex.ts"],"names":[],"mappings":";;;AAAA,6CAA6D;AAC7D,6CAA0D;AAE1D,qCAAkC;AAClC,mCAAqC;AAIxB,QAAA,SAAS,GAAG,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AED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,WAAmB;IAC1C,IAAI,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QAChE,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KACjC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAND,4BAMC","sourcesContent":["import { keccak_256 as keccak256 } from '@noble/hashes/sha3';\nimport { is, pattern, string, Struct } from 'superstruct';\n\nimport { assert } from './assert';\nimport { bytesToHex } from './bytes';\n\nexport type Hex = `0x${string}`;\n\nexport const HexStruct = pattern(string(), /^(?:0x)?[0-9a-f]+$/iu);\nexport const StrictHexStruct = pattern(string(), /^0x[0-9a-f]+$/iu) as Struct<\n Hex,\n null\n>;\nexport const HexAddressStruct = pattern(\n string(),\n /^0x[0-9a-f]{40}$/u,\n) as Struct<Hex, null>;\nexport const HexChecksumAddressStruct = pattern(\n string(),\n /^0x[0-9a-fA-F]{40}$/u,\n) as Struct<Hex, null>;\n\n/**\n * Check if a string is a valid hex string.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid hex string.\n */\nexport function isHexString(value: unknown): value is string {\n return is(value, HexStruct);\n}\n\n/**\n * Strictly check if a string is a valid hex string. A valid hex string must\n * start with the \"0x\"-prefix.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid hex string.\n */\nexport function isStrictHexString(value: unknown): value is Hex {\n return is(value, StrictHexStruct);\n}\n\n/**\n * Assert that a value is a valid hex string.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid hex string.\n */\nexport function assertIsHexString(value: unknown): asserts value is string {\n assert(isHexString(value), 'Value must be a hexadecimal string.');\n}\n\n/**\n * Assert that a value is a valid hex string. A valid hex string must start with\n * the \"0x\"-prefix.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid hex string.\n */\nexport function assertIsStrictHexString(value: unknown): asserts value is Hex {\n assert(\n isStrictHexString(value),\n 'Value must be a hexadecimal string, starting with \"0x\".',\n );\n}\n\n/**\n * Validate that the passed prefixed hex string is an all-lowercase\n * hex address, or a valid mixed-case checksum address.\n *\n * @param possibleAddress - Input parameter to check against.\n * @returns Whether or not the input is a valid hex address.\n */\nexport function isValidHexAddress(possibleAddress: Hex) {\n return (\n is(possibleAddress, HexAddressStruct) ||\n isValidChecksumAddress(possibleAddress)\n );\n}\n\n/**\n * Encode a passed hex string as an ERC-55 mixed-case checksum address.\n *\n * @param address - The hex address to encode.\n * @returns The address encoded according to ERC-55.\n * @see https://eips.ethereum.org/EIPS/eip-55\n */\nexport function getChecksumAddress(address: Hex) {\n assert(is(address, HexChecksumAddressStruct), 'Invalid hex address.');\n const unPrefixed = remove0x(address.toLowerCase());\n const unPrefixedHash = remove0x(bytesToHex(keccak256(unPrefixed)));\n return `0x${unPrefixed\n .split('')\n .map((character, nibbleIndex) => {\n const hashCharacter = unPrefixedHash[nibbleIndex];\n assert(is(hashCharacter, string()), 'Hash shorter than address.');\n return parseInt(hashCharacter, 16) > 7\n ? character.toUpperCase()\n : character;\n })\n .join('')}`;\n}\n\n/**\n * Validate that the passed hex string is a valid ERC-55 mixed-case\n * checksum address.\n *\n * @param possibleChecksum - The hex address to check.\n * @returns True if the address is a checksum address.\n */\nexport function isValidChecksumAddress(possibleChecksum: Hex) {\n if (!is(possibleChecksum, HexChecksumAddressStruct)) {\n return false;\n }\n\n return getChecksumAddress(possibleChecksum) === possibleChecksum;\n}\n\n/**\n * Add the `0x`-prefix to a hexadecimal string. If the string already has the\n * prefix, it is returned as-is.\n *\n * @param hexadecimal - The hexadecimal string to add the prefix to.\n * @returns The prefixed hexadecimal string.\n */\nexport function add0x(hexadecimal: string): Hex {\n if (hexadecimal.startsWith('0x')) {\n return hexadecimal as Hex;\n }\n\n if (hexadecimal.startsWith('0X')) {\n return `0x${hexadecimal.substring(2)}`;\n }\n\n return `0x${hexadecimal}`;\n}\n\n/**\n * Remove the `0x`-prefix from a hexadecimal string. If the string doesn't have\n * the prefix, it is returned as-is.\n *\n * @param hexadecimal - The hexadecimal string to remove the prefix from.\n * @returns The un-prefixed hexadecimal string.\n */\nexport function remove0x(hexadecimal: string): string {\n if (hexadecimal.startsWith('0x') || hexadecimal.startsWith('0X')) {\n return hexadecimal.substring(2);\n }\n\n return hexadecimal;\n}\n"]}
@@ -1 +0,0 @@
1
- export {};
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tsd_1 = require("tsd");
4
- // Valid hex strings:
5
- (0, tsd_1.expectAssignable)('0x');
6
- (0, tsd_1.expectAssignable)('0x0');
7
- (0, tsd_1.expectAssignable)('0x😀');
8
- const embeddedString = 'test';
9
- (0, tsd_1.expectAssignable)(`0x${embeddedString}`);
10
- // Not valid hex strings:
11
- (0, tsd_1.expectNotAssignable)(`0X${embeddedString}`);
12
- (0, tsd_1.expectNotAssignable)(`1x${embeddedString}`);
13
- (0, tsd_1.expectNotAssignable)(0);
14
- (0, tsd_1.expectNotAssignable)('0');
15
- (0, tsd_1.expectNotAssignable)('🙃');
16
- //# sourceMappingURL=hex.test-d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hex.test-d.js","sourceRoot":"","sources":["../src/hex.test-d.ts"],"names":[],"mappings":";;AAAA,6BAA4D;AAI5D,qBAAqB;AAErB,IAAA,sBAAgB,EAAM,IAAI,CAAC,CAAC;AAE5B,IAAA,sBAAgB,EAAM,KAAK,CAAC,CAAC;AAE7B,IAAA,sBAAgB,EAAM,MAAM,CAAC,CAAC;AAE9B,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,IAAA,sBAAgB,EAAM,KAAK,cAAc,EAAE,CAAC,CAAC;AAE7C,yBAAyB;AAEzB,IAAA,yBAAmB,EAAM,KAAK,cAAc,EAAE,CAAC,CAAC;AAEhD,IAAA,yBAAmB,EAAM,KAAK,cAAc,EAAE,CAAC,CAAC;AAEhD,IAAA,yBAAmB,EAAM,CAAC,CAAC,CAAC;AAE5B,IAAA,yBAAmB,EAAM,GAAG,CAAC,CAAC;AAE9B,IAAA,yBAAmB,EAAM,IAAI,CAAC,CAAC","sourcesContent":["import { expectAssignable, expectNotAssignable } from 'tsd';\n\nimport { Hex } from '.';\n\n// Valid hex strings:\n\nexpectAssignable<Hex>('0x');\n\nexpectAssignable<Hex>('0x0');\n\nexpectAssignable<Hex>('0x😀');\n\nconst embeddedString = 'test';\nexpectAssignable<Hex>(`0x${embeddedString}`);\n\n// Not valid hex strings:\n\nexpectNotAssignable<Hex>(`0X${embeddedString}`);\n\nexpectNotAssignable<Hex>(`1x${embeddedString}`);\n\nexpectNotAssignable<Hex>(0);\n\nexpectNotAssignable<Hex>('0');\n\nexpectNotAssignable<Hex>('🙃');\n"]}