@wishknish/knishio-client-js 0.6.4 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/client.cjs.js +567 -0
  2. package/dist/client.cjs.js.map +1 -0
  3. package/dist/client.es.mjs +8665 -0
  4. package/dist/client.es.mjs.map +1 -0
  5. package/dist/client.iife.js +84 -45
  6. package/dist/client.iife.js.map +1 -0
  7. package/package.json +48 -28
  8. package/src/Atom.js +132 -5
  9. package/src/AtomMeta.js +7 -8
  10. package/src/AuthToken.js +1 -1
  11. package/src/KnishIOClient.js +180 -78
  12. package/src/Meta.js +6 -2
  13. package/src/Molecule.js +383 -44
  14. package/src/PolicyMeta.js +1 -1
  15. package/src/Wallet.js +67 -12
  16. package/src/exception/AtomIndexException.js +1 -1
  17. package/src/exception/AtomsMissingException.js +1 -1
  18. package/src/exception/AuthorizationRejectedException.js +1 -1
  19. package/src/exception/BalanceInsufficientException.js +1 -1
  20. package/src/exception/BatchIdException.js +1 -1
  21. package/src/exception/CodeException.js +1 -1
  22. package/src/exception/DecryptionKeyException.js +1 -1
  23. package/src/exception/InvalidResponseException.js +1 -1
  24. package/src/exception/MetaMissingException.js +1 -1
  25. package/src/exception/MolecularHashMismatchException.js +1 -1
  26. package/src/exception/MolecularHashMissingException.js +1 -1
  27. package/src/exception/NegativeAmountException.js +1 -1
  28. package/src/exception/PolicyInvalidException.js +1 -1
  29. package/src/exception/SignatureMalformedException.js +1 -1
  30. package/src/exception/SignatureMismatchException.js +1 -1
  31. package/src/exception/StackableUnitAmountException.js +1 -1
  32. package/src/exception/StackableUnitDecimalsException.js +1 -1
  33. package/src/exception/TransferBalanceException.js +1 -1
  34. package/src/exception/TransferMalformedException.js +1 -1
  35. package/src/exception/TransferMismatchedException.js +1 -1
  36. package/src/exception/TransferRemainderException.js +1 -1
  37. package/src/exception/TransferToSelfException.js +1 -1
  38. package/src/exception/TransferUnbalancedException.js +1 -1
  39. package/src/exception/UnauthenticatedException.js +1 -1
  40. package/src/exception/WalletCredentialException.js +1 -1
  41. package/src/exception/WalletShadowException.js +1 -1
  42. package/src/exception/WrongTokenTypeException.js +1 -1
  43. package/src/exception/index.js +25 -25
  44. package/src/index.js +29 -9
  45. package/src/instance/Rules/Callback.js +5 -5
  46. package/src/instance/Rules/Condition.js +1 -1
  47. package/src/instance/Rules/Rule.js +4 -4
  48. package/src/instance/Rules/exception/RuleArgumentException.js +1 -1
  49. package/src/libraries/CheckMolecule.js +285 -27
  50. package/src/libraries/crypto.js +16 -2
  51. package/src/libraries/strings.js +1 -1
  52. package/src/libraries/urql/UrqlClientWrapper.js +3 -1
  53. package/src/mutation/Mutation.js +2 -2
  54. package/src/mutation/MutationActiveSession.js +2 -2
  55. package/src/mutation/MutationAppendRequest.js +91 -0
  56. package/src/mutation/MutationClaimShadowWallet.js +3 -3
  57. package/src/mutation/MutationCreateIdentifier.js +2 -2
  58. package/src/mutation/MutationCreateMeta.js +2 -2
  59. package/src/mutation/MutationCreateRule.js +2 -2
  60. package/src/mutation/MutationCreateToken.js +2 -2
  61. package/src/mutation/MutationCreateWallet.js +2 -2
  62. package/src/mutation/MutationDepositBufferToken.js +1 -1
  63. package/src/mutation/MutationLinkIdentifier.js +2 -2
  64. package/src/mutation/MutationPeering.js +82 -0
  65. package/src/mutation/MutationProposeMolecule.js +2 -2
  66. package/src/mutation/MutationRequestAuthorization.js +2 -2
  67. package/src/mutation/MutationRequestAuthorizationGuest.js +2 -2
  68. package/src/mutation/MutationRequestTokens.js +2 -2
  69. package/src/mutation/MutationTransferTokens.js +2 -2
  70. package/src/mutation/MutationWithdrawBufferToken.js +1 -1
  71. package/src/query/Query.js +2 -2
  72. package/src/query/QueryActiveSession.js +2 -2
  73. package/src/query/QueryAtom.js +2 -2
  74. package/src/query/QueryBalance.js +2 -2
  75. package/src/query/QueryBatch.js +2 -2
  76. package/src/query/QueryBatchHistory.js +3 -3
  77. package/src/query/QueryContinuId.js +2 -2
  78. package/src/query/QueryMetaType.js +11 -5
  79. package/src/query/QueryMetaTypeViaAtom.js +11 -4
  80. package/src/query/QueryMetaTypeViaMolecule.js +223 -0
  81. package/src/query/QueryPolicy.js +2 -2
  82. package/src/query/QueryToken.js +2 -2
  83. package/src/query/QueryUserActivity.js +2 -2
  84. package/src/query/QueryWalletBundle.js +2 -2
  85. package/src/query/QueryWalletList.js +2 -2
  86. package/src/response/Response.js +168 -4
  87. package/src/response/ResponseActiveSession.js +2 -2
  88. package/src/response/{ResponseMetaBatch.js → ResponseAppendRequest.js} +4 -21
  89. package/src/response/ResponseAtom.js +2 -2
  90. package/src/response/ResponseAuthorizationGuest.js +4 -4
  91. package/src/response/ResponseBalance.js +9 -4
  92. package/src/response/ResponseClaimShadowWallet.js +1 -1
  93. package/src/response/ResponseContinuId.js +4 -4
  94. package/src/response/ResponseCreateIdentifier.js +1 -1
  95. package/src/response/ResponseCreateMeta.js +1 -1
  96. package/src/response/ResponseCreateRule.js +1 -1
  97. package/src/response/ResponseCreateToken.js +1 -1
  98. package/src/response/ResponseCreateWallet.js +1 -1
  99. package/src/response/ResponseLinkIdentifier.js +3 -3
  100. package/src/response/ResponseMetaType.js +2 -2
  101. package/src/response/ResponseMetaTypeViaAtom.js +2 -2
  102. package/src/response/ResponseMetaTypeViaMolecule.js +210 -0
  103. package/src/response/ResponsePeering.js +55 -0
  104. package/src/response/ResponsePolicy.js +2 -2
  105. package/src/response/ResponseProposeMolecule.js +3 -3
  106. package/src/response/ResponseQueryActiveSession.js +2 -2
  107. package/src/response/ResponseQueryUserActivity.js +2 -2
  108. package/src/response/ResponseRequestAuthorization.js +3 -3
  109. package/src/response/ResponseRequestAuthorizationGuest.js +3 -3
  110. package/src/response/ResponseRequestTokens.js +1 -1
  111. package/src/response/ResponseTransferTokens.js +1 -1
  112. package/src/response/ResponseWalletBundle.js +3 -3
  113. package/src/response/ResponseWalletList.js +5 -5
  114. package/src/subscribe/ActiveSessionSubscribe.js +1 -1
  115. package/src/subscribe/ActiveWalletSubscribe.js +1 -1
  116. package/src/subscribe/CreateMoleculeSubscribe.js +1 -1
  117. package/src/subscribe/Subscribe.js +1 -1
  118. package/src/subscribe/WalletStatusSubscribe.js +1 -1
  119. package/src/types/index.js +2 -2
  120. package/src/versions/Version4.js +1 -1
  121. package/src/versions/index.js +1 -1
package/src/Wallet.js CHANGED
@@ -50,15 +50,16 @@ import {
50
50
  chunkSubstr,
51
51
  isHex,
52
52
  randomString
53
- } from './libraries/strings'
53
+ } from './libraries/strings.js'
54
54
  import {
55
55
  generateBatchId,
56
56
  generateBundleHash,
57
- generateSecret
58
- } from './libraries/crypto'
59
- import TokenUnit from './TokenUnit'
60
- import WalletCredentialException from './exception/WalletCredentialException'
61
- import { ml_kem768 as MlKEM768 } from '@noble/post-quantum/ml-kem'
57
+ generateSecret,
58
+ shake256
59
+ } from './libraries/crypto.js'
60
+ import TokenUnit from './TokenUnit.js'
61
+ import WalletCredentialException from './exception/WalletCredentialException.js'
62
+ import { ml_kem768 as MlKEM768 } from '@noble/post-quantum/ml-kem.js'
62
63
 
63
64
  /**
64
65
  * Wallet class represents the set of public and private
@@ -86,7 +87,7 @@ export default class Wallet {
86
87
  characters = null
87
88
  }) {
88
89
  this.token = token
89
- this.balance = 0
90
+ this.balance = '0'
90
91
  this.molecules = {}
91
92
 
92
93
  // Empty values
@@ -207,11 +208,23 @@ export default class Wallet {
207
208
  token,
208
209
  position
209
210
  }) {
211
+ if (!secret) {
212
+ throw new WalletCredentialException('Wallet::generateKey() - Secret is required!')
213
+ }
214
+ if (!position) {
215
+ throw new WalletCredentialException('Wallet::generateKey() - Position is required!')
216
+ }
217
+
218
+ // Normalize non-hex secret via SHAKE256 (matching Rust/Kotlin behavior)
219
+ const secretHex = isHex(secret) ? secret : shake256(secret, 1024)
220
+ // Normalize non-hex position via SHAKE256
221
+ const positionHex = isHex(position) ? position : shake256(position, 256)
222
+
210
223
  // Converting secret to bigInt
211
- const bigIntSecret = BigInt(`0x${ secret }`)
224
+ const bigIntSecret = BigInt(`0x${ secretHex }`)
212
225
 
213
226
  // Adding new position to the user secret to produce the indexed key
214
- const indexedKey = bigIntSecret + BigInt(`0x${ position }`)
227
+ const indexedKey = bigIntSecret + BigInt(`0x${ positionHex }`)
215
228
 
216
229
  // Hashing the indexed key to produce the intermediate key
217
230
  const intermediateKeySponge = new JsSHA('SHAKE256', 'TEXT')
@@ -270,16 +283,18 @@ export default class Wallet {
270
283
  * Initializes the ML-KEM key pair
271
284
  */
272
285
  initializeMLKEM () {
273
- // Generate a 64-byte (512-bit) seed from the Knish.IO private key
274
- const seedHex = generateSecret(this.key, 64)
286
+ // Generate a 64-byte (512-bit) seed from the Knish.IO private key
287
+ // Use deterministic approach: generateSecret(key, 128) → 128 hex chars = 64 bytes
288
+ const seedHex = generateSecret(this.key, 128) // 128 hex chars = 64 bytes
275
289
 
276
- // Convert the hex string to a Uint8Array
290
+ // Convert the hex string to a Uint8Array
277
291
  const seed = new Uint8Array(64)
278
292
  for (let i = 0; i < 64; i++) {
279
293
  seed[i] = parseInt(seedHex.substr(i * 2, 2), 16)
280
294
  }
281
295
 
282
296
  const { publicKey, secretKey } = MlKEM768.keygen(seed)
297
+
283
298
  this.pubkey = this.serializeKey(publicKey)
284
299
  this.privkey = secretKey // Note: We're keeping privkey as UInt8Array for security
285
300
  }
@@ -293,6 +308,46 @@ export default class Wallet {
293
308
  return new Uint8Array(binaryString.length).map((_, i) => binaryString.charCodeAt(i))
294
309
  }
295
310
 
311
+ /**
312
+ * Returns balance as a Number for arithmetic operations.
313
+ * WARNING: Precision loss for values > 2^53.
314
+ *
315
+ * @return {number}
316
+ */
317
+ balanceAsNumber () {
318
+ return Number(this.balance)
319
+ }
320
+
321
+ /**
322
+ * Returns balance as a BigInt for precision-safe integer arithmetic.
323
+ * Truncates any fractional component.
324
+ *
325
+ * @return {bigint}
326
+ */
327
+ balanceAsBigInt () {
328
+ const str = String(this.balance)
329
+ const intPart = str.includes('.') ? str.split('.')[0] : str
330
+ return BigInt(intPart || '0')
331
+ }
332
+
333
+ /**
334
+ * Sets balance from a BigInt value
335
+ *
336
+ * @param {bigint} value
337
+ */
338
+ setBalanceBigInt (value) {
339
+ this.balance = value.toString()
340
+ }
341
+
342
+ /**
343
+ * Sets balance from a Number value, storing as String
344
+ *
345
+ * @param {number} value
346
+ */
347
+ setBalanceNumber (value) {
348
+ this.balance = String(value)
349
+ }
350
+
296
351
  /**
297
352
  *
298
353
  * @returns {*[]}
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Atoms must have an index so that they can be sorted in a Molecule
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Empty molecules are not allowed
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Thrown when attempt to authorize is rejected by the node
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Thrown when the node does not have enough tokens to fulfill a T request
@@ -1,4 +1,4 @@
1
- import BaseException from './BaseException'
1
+ import BaseException from './BaseException.js'
2
2
 
3
3
  /**
4
4
  * Generic code exception
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Generic code exception
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Decryption key exception
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Exception for bad GraphQL responses
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * M isotope atoms must always contain metadata
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Molecular hash does not match - contents may have been tampered with
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * A molecular hash is always required.
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Thrown when a negative amount is provided
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Exception for bad GraphQL responses
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Thrown when a molecular signature is malformed
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Thrown when signature does not match the public key
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Thrown when a stackable token is being transferred with both unit IDs AND an amount specified (ambiguous)
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Thrown when a stackable token is being created with units and non-zero decimals
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Thrown when you try to transfer more tokens than you have available
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Thrown when V isotope atoms are arranged incorrectly
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Thrown when the token slugs of wallets involved in a transfer do not match
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Thrown when the remainder atom in a V isotope transfer is incorrect
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Thrown when attempting to transfer tokens to yourself
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Thrown when V isotope atom amounts do not add up to zero
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Thrown when attempting to transact without an auth token
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Thrown when failing to retrieve shadow wallets
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Thrown when failing to retrieve shadow wallets
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import BaseException from './BaseException'
48
+ import BaseException from './BaseException.js'
49
49
 
50
50
  /**
51
51
  * Thrown when trying to use an inappropriate token slug for a particular isotope
@@ -45,31 +45,31 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
45
45
 
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
- import AtomIndexException from './AtomIndexException'
49
- import AtomsMissingException from './AtomsMissingException'
50
- import AuthorizationRejectedException from './AuthorizationRejectedException'
51
- import BalanceInsufficientException from './BalanceInsufficientException'
52
- import BatchIdException from './BatchIdException'
53
- import CodeException from './CodeException'
54
- import InvalidResponseException from './InvalidResponseException'
55
- import MetaMissingException from './MetaMissingException'
56
- import MolecularHashMismatchException from './MolecularHashMismatchException'
57
- import MolecularHashMissingException from './MolecularHashMissingException'
58
- import NegativeAmountException from './NegativeAmountException'
59
- import PolicyInvalidException from './PolicyInvalidException'
60
- import SignatureMalformedException from './SignatureMalformedException'
61
- import SignatureMismatchException from './SignatureMismatchException'
62
- import StackableUnitAmountException from './StackableUnitAmountException'
63
- import StackableUnitDecimalsException from './StackableUnitDecimalsException'
64
- import TransferBalanceException from './TransferBalanceException'
65
- import TransferMalformedException from './TransferMalformedException'
66
- import TransferMismatchedException from './TransferMismatchedException'
67
- import TransferRemainderException from './TransferRemainderException'
68
- import TransferToSelfException from './TransferToSelfException'
69
- import TransferUnbalancedException from './TransferUnbalancedException'
70
- import UnauthenticatedException from './UnauthenticatedException'
71
- import WalletShadowException from './WalletShadowException'
72
- import WrongTokenTypeException from './WrongTokenTypeException'
48
+ import AtomIndexException from './AtomIndexException.js'
49
+ import AtomsMissingException from './AtomsMissingException.js'
50
+ import AuthorizationRejectedException from './AuthorizationRejectedException.js'
51
+ import BalanceInsufficientException from './BalanceInsufficientException.js'
52
+ import BatchIdException from './BatchIdException.js'
53
+ import CodeException from './CodeException.js'
54
+ import InvalidResponseException from './InvalidResponseException.js'
55
+ import MetaMissingException from './MetaMissingException.js'
56
+ import MolecularHashMismatchException from './MolecularHashMismatchException.js'
57
+ import MolecularHashMissingException from './MolecularHashMissingException.js'
58
+ import NegativeAmountException from './NegativeAmountException.js'
59
+ import PolicyInvalidException from './PolicyInvalidException.js'
60
+ import SignatureMalformedException from './SignatureMalformedException.js'
61
+ import SignatureMismatchException from './SignatureMismatchException.js'
62
+ import StackableUnitAmountException from './StackableUnitAmountException.js'
63
+ import StackableUnitDecimalsException from './StackableUnitDecimalsException.js'
64
+ import TransferBalanceException from './TransferBalanceException.js'
65
+ import TransferMalformedException from './TransferMalformedException.js'
66
+ import TransferMismatchedException from './TransferMismatchedException.js'
67
+ import TransferRemainderException from './TransferRemainderException.js'
68
+ import TransferToSelfException from './TransferToSelfException.js'
69
+ import TransferUnbalancedException from './TransferUnbalancedException.js'
70
+ import UnauthenticatedException from './UnauthenticatedException.js'
71
+ import WalletShadowException from './WalletShadowException.js'
72
+ import WrongTokenTypeException from './WrongTokenTypeException.js'
73
73
 
74
74
  export {
75
75
  AtomIndexException,
package/src/index.js CHANGED
@@ -46,11 +46,17 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
48
 
49
- import Atom from './Atom'
50
- import Molecule from './Molecule'
51
- import Wallet from './Wallet'
52
- import Meta from './Meta'
53
- import KnishIOClient from './KnishIOClient'
49
+ import Atom from './Atom.js'
50
+ import Molecule from './Molecule.js'
51
+ import Wallet from './Wallet.js'
52
+ import Meta from './Meta.js'
53
+ import KnishIOClient from './KnishIOClient.js'
54
+ import MutationPeering from './mutation/MutationPeering.js'
55
+ import MutationAppendRequest from './mutation/MutationAppendRequest.js'
56
+ import QueryMetaTypeViaMolecule from './query/QueryMetaTypeViaMolecule.js'
57
+ import ResponsePeering from './response/ResponsePeering.js'
58
+ import ResponseAppendRequest from './response/ResponseAppendRequest.js'
59
+ import ResponseMetaTypeViaMolecule from './response/ResponseMetaTypeViaMolecule.js'
54
60
  import {
55
61
  base64ToHex,
56
62
  bufferToHexString,
@@ -60,11 +66,12 @@ import {
60
66
  hexToBase64,
61
67
  isHex,
62
68
  randomString
63
- } from './libraries/strings'
69
+ } from './libraries/strings.js'
64
70
  import {
65
71
  generateBundleHash,
66
- generateSecret
67
- } from './libraries/crypto'
72
+ generateSecret,
73
+ shake256
74
+ } from './libraries/crypto.js'
68
75
 
69
76
  export {
70
77
  Atom,
@@ -73,6 +80,18 @@ export {
73
80
  Meta,
74
81
  KnishIOClient,
75
82
 
83
+ // queries
84
+ QueryMetaTypeViaMolecule,
85
+
86
+ // mutations
87
+ MutationPeering,
88
+ MutationAppendRequest,
89
+
90
+ // responses
91
+ ResponsePeering,
92
+ ResponseAppendRequest,
93
+ ResponseMetaTypeViaMolecule,
94
+
76
95
  // strings
77
96
  chunkSubstr,
78
97
  base64ToHex,
@@ -85,5 +104,6 @@ export {
85
104
 
86
105
  // crypto
87
106
  generateSecret,
88
- generateBundleHash
107
+ generateBundleHash,
108
+ shake256
89
109
  }
@@ -46,11 +46,11 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
48
 
49
- import Meta from './Meta'
50
- import RuleArgumentException from './exception/RuleArgumentException'
51
- import { isNumeric } from '../../libraries/strings'
52
- import { intersect } from '../../libraries/array'
53
- import CodeException from '../../exception/CodeException'
49
+ import Meta from './Meta.js'
50
+ import RuleArgumentException from './exception/RuleArgumentException.js'
51
+ import { isNumeric } from '../../libraries/strings.js'
52
+ import { intersect } from '../../libraries/array.js'
53
+ import CodeException from '../../exception/CodeException.js'
54
54
 
55
55
  export default class Callback {
56
56
  /**
@@ -46,7 +46,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
48
 
49
- import RuleArgumentException from './exception/RuleArgumentException'
49
+ import RuleArgumentException from './exception/RuleArgumentException.js'
50
50
 
51
51
  export default class Condition {
52
52
  /**
@@ -46,10 +46,10 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
46
46
  License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
48
 
49
- import Callback from './Callback'
50
- import Condition from './Condition'
51
- import RuleArgumentException from './exception/RuleArgumentException'
52
- import MetaMissingException from '../../exception/MetaMissingException'
49
+ import Callback from './Callback.js'
50
+ import Condition from './Condition.js'
51
+ import RuleArgumentException from './exception/RuleArgumentException.js'
52
+ import MetaMissingException from '../../exception/MetaMissingException.js'
53
53
 
54
54
  export default class Rule {
55
55
  /**
@@ -1,4 +1,4 @@
1
- import BaseException from '../../../exception/BaseException'
1
+ import BaseException from '../../../exception/BaseException.js'
2
2
 
3
3
  export default class RuleArgumentException extends BaseException {
4
4
  /**