@wishknish/knishio-client-js 0.5.2 → 0.6.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 (138) hide show
  1. package/README.md +207 -274
  2. package/dist/client.iife.js +577 -0
  3. package/package.json +36 -79
  4. package/src/.babelrc +0 -22
  5. package/src/Atom.js +171 -132
  6. package/src/AtomMeta.js +76 -50
  7. package/src/AuthToken.js +37 -46
  8. package/src/KnishIOClient.js +932 -985
  9. package/src/Meta.js +15 -17
  10. package/src/Molecule.js +423 -494
  11. package/src/PolicyMeta.js +32 -41
  12. package/src/TokenUnit.js +30 -32
  13. package/src/Wallet.js +275 -265
  14. package/src/exception/AtomIndexException.js +4 -8
  15. package/src/exception/AtomsMissingException.js +4 -6
  16. package/src/exception/AuthorizationRejectedException.js +4 -5
  17. package/src/exception/BalanceInsufficientException.js +4 -8
  18. package/src/exception/BaseException.js +6 -8
  19. package/src/exception/BatchIdException.js +5 -7
  20. package/src/exception/CodeException.js +4 -8
  21. package/src/{libraries/ApolloLink/HttpLink.js → exception/DecryptionKeyException.js} +12 -15
  22. package/src/exception/InvalidResponseException.js +4 -5
  23. package/src/exception/MetaMissingException.js +4 -6
  24. package/src/exception/MolecularHashMismatchException.js +4 -6
  25. package/src/exception/MolecularHashMissingException.js +4 -5
  26. package/src/exception/NegativeAmountException.js +4 -5
  27. package/src/exception/PolicyInvalidException.js +4 -4
  28. package/src/exception/SignatureMalformedException.js +4 -5
  29. package/src/exception/SignatureMismatchException.js +4 -5
  30. package/src/exception/StackableUnitAmountException.js +4 -5
  31. package/src/exception/StackableUnitDecimalsException.js +4 -5
  32. package/src/exception/TransferBalanceException.js +4 -5
  33. package/src/exception/TransferMalformedException.js +4 -5
  34. package/src/exception/TransferMismatchedException.js +4 -5
  35. package/src/exception/TransferRemainderException.js +4 -5
  36. package/src/exception/TransferToSelfException.js +4 -5
  37. package/src/exception/TransferUnbalancedException.js +4 -5
  38. package/src/exception/UnauthenticatedException.js +4 -5
  39. package/src/{libraries/ApolloLink/AuthLink.js → exception/WalletCredentialException.js} +12 -40
  40. package/src/exception/WalletShadowException.js +4 -5
  41. package/src/exception/WrongTokenTypeException.js +4 -5
  42. package/src/exception/index.js +26 -26
  43. package/src/index.js +8 -10
  44. package/src/instance/Rules/Callback.js +91 -93
  45. package/src/instance/Rules/Condition.js +21 -23
  46. package/src/instance/Rules/Meta.js +13 -14
  47. package/src/instance/Rules/Rule.js +39 -43
  48. package/src/instance/Rules/exception/RuleArgumentException.js +4 -4
  49. package/src/libraries/CheckMolecule.js +253 -232
  50. package/src/libraries/Decimal.js +13 -17
  51. package/src/libraries/Dot.js +74 -48
  52. package/src/libraries/Hex.js +49 -54
  53. package/src/libraries/apollo/ApolloClientWrapper.js +143 -0
  54. package/src/libraries/apollo/CipherLink.js +116 -0
  55. package/src/libraries/apollo/Client.js +154 -0
  56. package/src/libraries/apollo/ErrorHandler.js +32 -0
  57. package/src/libraries/apollo/SubscriptionManager.js +60 -0
  58. package/src/libraries/apollo/operationUtils.js +26 -0
  59. package/src/libraries/array.js +50 -41
  60. package/src/libraries/crypto.js +20 -27
  61. package/src/libraries/strings.js +58 -91
  62. package/src/mutation/Mutation.js +44 -25
  63. package/src/mutation/MutationActiveSession.js +12 -12
  64. package/src/mutation/MutationClaimShadowWallet.js +15 -17
  65. package/src/mutation/MutationCreateIdentifier.js +11 -12
  66. package/src/mutation/MutationCreateMeta.js +11 -12
  67. package/src/mutation/MutationCreateRule.js +11 -12
  68. package/src/mutation/MutationCreateToken.js +18 -13
  69. package/src/mutation/MutationCreateWallet.js +9 -11
  70. package/src/mutation/MutationDepositBufferToken.js +7 -9
  71. package/src/mutation/MutationLinkIdentifier.js +12 -14
  72. package/src/mutation/MutationProposeMolecule.js +24 -25
  73. package/src/mutation/MutationRequestAuthorization.js +9 -10
  74. package/src/mutation/MutationRequestAuthorizationGuest.js +12 -15
  75. package/src/mutation/MutationRequestTokens.js +11 -14
  76. package/src/mutation/MutationTransferTokens.js +11 -14
  77. package/src/mutation/MutationWithdrawBufferToken.js +7 -10
  78. package/src/query/Query.js +62 -36
  79. package/src/query/QueryActiveSession.js +11 -13
  80. package/src/query/QueryAtom.js +75 -76
  81. package/src/query/QueryBalance.js +11 -12
  82. package/src/query/QueryBatch.js +17 -14
  83. package/src/query/QueryBatchHistory.js +16 -13
  84. package/src/query/QueryContinuId.js +13 -10
  85. package/src/query/QueryMetaType.js +45 -57
  86. package/src/query/QueryMetaTypeViaAtom.js +49 -57
  87. package/src/query/QueryPolicy.js +11 -12
  88. package/src/query/QueryToken.js +11 -13
  89. package/src/query/QueryUserActivity.js +11 -13
  90. package/src/query/QueryWalletBundle.js +15 -47
  91. package/src/query/QueryWalletList.js +15 -16
  92. package/src/response/Response.js +29 -34
  93. package/src/response/ResponseActiveSession.js +6 -6
  94. package/src/response/ResponseAtom.js +29 -30
  95. package/src/response/ResponseAuthorizationGuest.js +17 -18
  96. package/src/response/ResponseBalance.js +12 -13
  97. package/src/response/ResponseClaimShadowWallet.js +1 -1
  98. package/src/response/ResponseContinuId.js +21 -22
  99. package/src/response/ResponseCreateIdentifier.js +1 -1
  100. package/src/response/ResponseCreateMeta.js +1 -1
  101. package/src/response/ResponseCreateRule.js +1 -1
  102. package/src/response/ResponseCreateToken.js +1 -1
  103. package/src/response/ResponseCreateWallet.js +1 -1
  104. package/src/response/ResponseLinkIdentifier.js +9 -10
  105. package/src/response/ResponseMetaBatch.js +6 -8
  106. package/src/response/ResponseMetaType.js +19 -20
  107. package/src/response/ResponseMetaTypeViaAtom.js +19 -19
  108. package/src/response/ResponsePolicy.js +14 -15
  109. package/src/response/ResponseProposeMolecule.js +27 -30
  110. package/src/response/ResponseQueryActiveSession.js +20 -23
  111. package/src/response/ResponseQueryUserActivity.js +11 -12
  112. package/src/response/ResponseRequestAuthorization.js +11 -16
  113. package/src/response/ResponseRequestAuthorizationGuest.js +18 -21
  114. package/src/response/ResponseRequestTokens.js +1 -1
  115. package/src/response/ResponseTransferTokens.js +8 -9
  116. package/src/response/ResponseWalletBundle.js +16 -17
  117. package/src/response/ResponseWalletList.js +44 -47
  118. package/src/subscribe/ActiveSessionSubscribe.js +5 -6
  119. package/src/subscribe/ActiveWalletSubscribe.js +5 -6
  120. package/src/subscribe/CreateMoleculeSubscribe.js +5 -5
  121. package/src/subscribe/Subscribe.js +26 -26
  122. package/src/subscribe/WalletStatusSubscribe.js +5 -6
  123. package/src/versions/HashAtom.js +78 -0
  124. package/src/versions/Version4.js +34 -0
  125. package/src/versions/index.js +5 -0
  126. package/dist/client.umd.js +0 -453
  127. package/src/httpClient/ApolloClient.js +0 -245
  128. package/src/libraries/ApolloLink/CipherLink.js +0 -117
  129. package/src/libraries/ApolloLink/Client.js +0 -231
  130. package/src/libraries/ApolloLink/PusherLink.js +0 -234
  131. package/src/libraries/ApolloLink/handler.js +0 -106
  132. package/src/libraries/Base58.js +0 -71
  133. package/src/libraries/Base64.js +0 -40
  134. package/src/libraries/BaseX.js +0 -91
  135. package/src/libraries/Soda.js +0 -93
  136. package/src/query/QueryMetaInstance.js +0 -99
  137. package/src/test/Test.js +0 -670
  138. package/src/test/TestTokenUnit.js +0 -340
@@ -46,8 +46,8 @@ 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 Response from './Response';
50
- import Query from '../query/Query';
49
+ import Query from '../query/Query'
50
+ import Response from './Response'
51
51
 
52
52
  export default class ResponsePolicy extends Response {
53
53
  /**
@@ -56,16 +56,16 @@ export default class ResponsePolicy extends Response {
56
56
  * @param {Query} query
57
57
  * @param {object} json
58
58
  */
59
- constructor ( {
59
+ constructor ({
60
60
  query,
61
61
  json
62
- } ) {
63
- super( {
62
+ }) {
63
+ super({
64
64
  query,
65
65
  json
66
- } );
67
- this.dataKey = 'data.Policy';
68
- this.init();
66
+ })
67
+ this.dataKey = 'data.Policy'
68
+ this.init()
69
69
  }
70
70
 
71
71
  /**
@@ -73,17 +73,16 @@ export default class ResponsePolicy extends Response {
73
73
  * @returns {null|object}
74
74
  */
75
75
  payload () {
76
+ const policy = this.data()
76
77
 
77
- const policy = this.data();
78
-
79
- if ( !policy ) {
80
- return null;
78
+ if (!policy) {
79
+ return null
81
80
  }
82
81
 
83
- if ( policy.callback ) {
84
- return JSON.parse( policy.callback );
82
+ if (policy.callback) {
83
+ return JSON.parse(policy.callback)
85
84
  }
86
85
 
87
- return null;
86
+ return null
88
87
  }
89
88
  }
@@ -45,52 +45,51 @@ 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 Response from './Response';
49
- import Dot from '../libraries/Dot';
50
- import Molecule from '../Molecule';
48
+ import Response from './Response'
49
+ import Dot from '../libraries/Dot'
50
+ import Molecule from '../Molecule'
51
51
 
52
52
  /**
53
53
  * Response for proposing new Molecules
54
54
  */
55
55
  export default class ResponseProposeMolecule extends Response {
56
-
57
56
  /**
58
57
  * Class constructor
59
58
  *
60
59
  * @param {MutationProposeMolecule} query
61
60
  * @param {object} json
62
61
  */
63
- constructor ( {
62
+ constructor ({
64
63
  query,
65
64
  json
66
- } ) {
67
- super( {
65
+ }) {
66
+ super({
68
67
  query,
69
68
  json,
70
69
  dataKey: 'data.ProposeMolecule'
71
- } );
72
- this.$__clientMolecule = query.molecule();
70
+ })
71
+ this.$__clientMolecule = query.molecule()
73
72
  }
74
73
 
75
74
  /**
76
75
  * Initialize response object with payload data
77
76
  */
78
77
  init () {
79
- const payloadJson = Dot.get( this.data(), 'payload' );
78
+ const payloadJson = Dot.get(this.data(), 'payload')
80
79
  try {
81
- this.$__payload = Object.prototype.toString.call( payloadJson ) === '[object String]' ?
82
- JSON.parse( payloadJson ) : payloadJson;
83
- } catch ( err ) {
84
- this.$__payload = null;
80
+ this.$__payload = Object.prototype.toString.call(payloadJson) === '[object String]'
81
+ ? JSON.parse(payloadJson)
82
+ : payloadJson
83
+ } catch (err) {
84
+ this.$__payload = null
85
85
  }
86
86
  }
87
87
 
88
-
89
88
  /**
90
89
  * Returns the client molecule
91
90
  */
92
91
  clientMolecule () {
93
- return this.$__clientMolecule;
92
+ return this.$__clientMolecule
94
93
  }
95
94
 
96
95
  /**
@@ -99,20 +98,19 @@ export default class ResponseProposeMolecule extends Response {
99
98
  * @return {Molecule|null}
100
99
  */
101
100
  molecule () {
101
+ const data = this.data()
102
102
 
103
- const data = this.data();
104
-
105
- if ( !data ) {
106
- return null;
103
+ if (!data) {
104
+ return null
107
105
  }
108
106
 
109
- const molecule = new Molecule( {} );
107
+ const molecule = new Molecule({})
110
108
 
111
- molecule.molecularHash = Dot.get( data, 'molecularHash' );
112
- molecule.status = Dot.get( data, 'status' );
113
- molecule.createdAt = Dot.get( data, 'createdAt' );
109
+ molecule.molecularHash = Dot.get(data, 'molecularHash')
110
+ molecule.status = Dot.get(data, 'status')
111
+ molecule.createdAt = Dot.get(data, 'createdAt')
114
112
 
115
- return molecule;
113
+ return molecule
116
114
  }
117
115
 
118
116
  /**
@@ -121,7 +119,7 @@ export default class ResponseProposeMolecule extends Response {
121
119
  * @return {boolean}
122
120
  */
123
121
  success () {
124
- return this.status() === 'accepted';
122
+ return this.status() === 'accepted'
125
123
  }
126
124
 
127
125
  /**
@@ -130,7 +128,7 @@ export default class ResponseProposeMolecule extends Response {
130
128
  * @return {string}
131
129
  */
132
130
  status () {
133
- return Dot.get( this.data(), 'status', 'rejected' );
131
+ return Dot.get(this.data(), 'status', 'rejected')
134
132
  }
135
133
 
136
134
  /**
@@ -139,7 +137,7 @@ export default class ResponseProposeMolecule extends Response {
139
137
  * @return {string}
140
138
  */
141
139
  reason () {
142
- return Dot.get( this.data(), 'reason', 'Invalid response from server' );
140
+ return Dot.get(this.data(), 'reason', 'Invalid response from server')
143
141
  }
144
142
 
145
143
  /**
@@ -148,7 +146,6 @@ export default class ResponseProposeMolecule extends Response {
148
146
  * @return {null}
149
147
  */
150
148
  payload () {
151
- return this.$__payload;
149
+ return this.$__payload
152
150
  }
153
-
154
151
  }
@@ -46,60 +46,57 @@ 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 Query from '../query/Query';
50
- import Response from './Response';
49
+ import Query from '../query/Query'
50
+ import Response from './Response'
51
51
 
52
52
  /**
53
53
  * Response for QueryActiveSession
54
54
  */
55
55
  export default class ResponseQueryActiveSession extends Response {
56
-
57
56
  /**
58
57
  * Class constructor
59
58
  *
60
59
  * @param {Query} query
61
60
  * @param {object} json
62
61
  */
63
- constructor ( {
62
+ constructor ({
64
63
  query,
65
64
  json
66
- } ) {
67
- super( {
65
+ }) {
66
+ super({
68
67
  query,
69
68
  json,
70
69
  dataKey: 'data.ActiveUser'
71
- } );
70
+ })
72
71
  }
73
72
 
74
73
  payload () {
75
- const list = this.data();
74
+ const list = this.data()
76
75
 
77
- if ( !list ) {
78
- return null;
76
+ if (!list) {
77
+ return null
79
78
  }
80
79
 
81
- const activeUsers = [];
82
-
83
- for ( let item of list ) {
80
+ const activeUsers = []
84
81
 
85
- const activeSession = { ...item };
82
+ for (const item of list) {
83
+ const activeSession = { ...item }
86
84
 
87
- if ( activeSession.jsonData ) {
88
- activeSession.jsonData = JSON.parse( activeSession.jsonData );
85
+ if (activeSession.jsonData) {
86
+ activeSession.jsonData = JSON.parse(activeSession.jsonData)
89
87
  }
90
88
 
91
- if ( activeSession.createdAt ) {
92
- activeSession.createdAt = new Date( activeSession.createdAt );
89
+ if (activeSession.createdAt) {
90
+ activeSession.createdAt = new Date(activeSession.createdAt)
93
91
  }
94
92
 
95
- if ( activeSession.updatedAt ) {
96
- activeSession.updatedAt = new Date( activeSession.updatedAt );
93
+ if (activeSession.updatedAt) {
94
+ activeSession.updatedAt = new Date(activeSession.updatedAt)
97
95
  }
98
96
 
99
- activeUsers.push( activeSession );
97
+ activeUsers.push(activeSession)
100
98
  }
101
99
 
102
- return activeUsers;
100
+ return activeUsers
103
101
  }
104
-
105
102
  }
@@ -45,8 +45,8 @@ 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 Query from '../query/Query';
49
- import Response from './Response';
48
+ import Query from '../query/Query'
49
+ import Response from './Response'
50
50
 
51
51
  export default class ResponseQueryUserActivity extends Response {
52
52
  /**
@@ -55,27 +55,26 @@ export default class ResponseQueryUserActivity extends Response {
55
55
  * @param {Query} query
56
56
  * @param {object} json
57
57
  */
58
- constructor ( {
58
+ constructor ({
59
59
  query,
60
60
  json
61
- } ) {
62
- super( {
61
+ }) {
62
+ super({
63
63
  query,
64
64
  json,
65
65
  dataKey: 'data.UserActivity'
66
- } );
66
+ })
67
67
  }
68
68
 
69
69
  payload () {
70
- const data = JSON.parse( JSON.stringify( this.data() ) );
70
+ const data = JSON.parse(JSON.stringify(this.data()))
71
71
 
72
- if ( data.instances ) {
73
- for ( const datum of data.instances ) {
74
- datum.jsonData = JSON.parse( datum.jsonData );
72
+ if (data.instances) {
73
+ for (const datum of data.instances) {
74
+ datum.jsonData = JSON.parse(datum.jsonData)
75
75
  }
76
76
  }
77
77
 
78
- return data;
78
+ return data
79
79
  }
80
-
81
80
  }
@@ -45,37 +45,34 @@ 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 Dot from '../libraries/Dot';
49
- import InvalidResponseException from '../exception/InvalidResponseException';
50
- import ResponseProposeMolecule from './ResponseProposeMolecule';
48
+ import Dot from '../libraries/Dot'
49
+ import InvalidResponseException from '../exception/InvalidResponseException'
50
+ import ResponseProposeMolecule from './ResponseProposeMolecule'
51
51
 
52
52
  /**
53
53
  * Response for auth token mutation
54
54
  */
55
55
  export default class ResponseRequestAuthorization extends ResponseProposeMolecule {
56
-
57
-
58
56
  /**
59
57
  * return the authorization key
60
58
  *
61
59
  * @param key
62
60
  * @return {*}
63
61
  */
64
- payloadKey ( key ) {
65
- if ( !Dot.has( this.payload(), key ) ) {
66
- throw new InvalidResponseException( `ResponseRequestAuthorization::payloadKey() - '${ key }' key was not found in the payload!` );
62
+ payloadKey (key) {
63
+ if (!Dot.has(this.payload(), key)) {
64
+ throw new InvalidResponseException(`ResponseRequestAuthorization::payloadKey() - '${ key }' key was not found in the payload!`)
67
65
  }
68
- return Dot.get( this.payload(), key );
66
+ return Dot.get(this.payload(), key)
69
67
  }
70
68
 
71
-
72
69
  /**
73
70
  * Returns the auth token
74
71
  *
75
72
  * @return {string}
76
73
  */
77
74
  token () {
78
- return this.payloadKey( 'token' );
75
+ return this.payloadKey('token')
79
76
  }
80
77
 
81
78
  /**
@@ -84,7 +81,7 @@ export default class ResponseRequestAuthorization extends ResponseProposeMolecul
84
81
  * @return {string}
85
82
  */
86
83
  time () {
87
- return this.payloadKey( 'time' );
84
+ return this.payloadKey('time')
88
85
  }
89
86
 
90
87
  /**
@@ -92,7 +89,7 @@ export default class ResponseRequestAuthorization extends ResponseProposeMolecul
92
89
  * @return {string}
93
90
  */
94
91
  encrypt () {
95
- return this.payloadKey( 'encrypt' );
92
+ return this.payloadKey('encrypt')
96
93
  }
97
94
 
98
95
  /**
@@ -100,8 +97,6 @@ export default class ResponseRequestAuthorization extends ResponseProposeMolecul
100
97
  * @return {string}
101
98
  */
102
99
  pubKey () {
103
- return this.payloadKey( 'key' );
100
+ return this.payloadKey('key')
104
101
  }
105
-
106
-
107
102
  }
@@ -45,30 +45,29 @@ 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 Response from './Response';
49
- import Dot from '../libraries/Dot';
50
- import InvalidResponseException from '../exception/InvalidResponseException';
48
+ import Response from './Response'
49
+ import Dot from '../libraries/Dot'
50
+ import InvalidResponseException from '../exception/InvalidResponseException'
51
51
 
52
52
  /**
53
53
  * Response for guest auth mutation
54
54
  */
55
55
  export default class ResponseRequestAuthorizationGuest extends Response {
56
-
57
56
  /**
58
57
  * Class constructor
59
58
  *
60
59
  * @param {MutationRequestAuthorizationGuest} query
61
60
  * @param json
62
61
  */
63
- constructor ( {
62
+ constructor ({
64
63
  query,
65
64
  json
66
- } ) {
67
- super( {
65
+ }) {
66
+ super({
68
67
  query,
69
68
  json,
70
69
  dataKey: 'data.AccessToken'
71
- } );
70
+ })
72
71
  }
73
72
 
74
73
  /**
@@ -77,7 +76,7 @@ export default class ResponseRequestAuthorizationGuest extends Response {
77
76
  * @return {string}
78
77
  */
79
78
  reason () {
80
- return 'Invalid response from server';
79
+ return 'Invalid response from server'
81
80
  }
82
81
 
83
82
  /**
@@ -86,7 +85,7 @@ export default class ResponseRequestAuthorizationGuest extends Response {
86
85
  * @return {boolean}
87
86
  */
88
87
  success () {
89
- return this.payload() !== null;
88
+ return this.payload() !== null
90
89
  }
91
90
 
92
91
  /**
@@ -95,7 +94,7 @@ export default class ResponseRequestAuthorizationGuest extends Response {
95
94
  * @return {null|Wallet}
96
95
  */
97
96
  payload () {
98
- return this.data();
97
+ return this.data()
99
98
  }
100
99
 
101
100
  /**
@@ -104,11 +103,11 @@ export default class ResponseRequestAuthorizationGuest extends Response {
104
103
  * @param key
105
104
  * @return {*}
106
105
  */
107
- payloadKey ( key ) {
108
- if ( !Dot.has( this.payload(), key ) ) {
109
- throw new InvalidResponseException( `ResponseAuthorizationGuest::payloadKey() - '${ key }' key is not found in the payload!` );
106
+ payloadKey (key) {
107
+ if (!Dot.has(this.payload(), key)) {
108
+ throw new InvalidResponseException(`ResponseAuthorizationGuest::payloadKey() - '${ key }' key is not found in the payload!`)
110
109
  }
111
- return Dot.get( this.payload(), key );
110
+ return Dot.get(this.payload(), key)
112
111
  }
113
112
 
114
113
  /**
@@ -117,7 +116,7 @@ export default class ResponseRequestAuthorizationGuest extends Response {
117
116
  * @return {*}
118
117
  */
119
118
  token () {
120
- return this.payloadKey( 'token' );
119
+ return this.payloadKey('token')
121
120
  }
122
121
 
123
122
  /**
@@ -126,7 +125,7 @@ export default class ResponseRequestAuthorizationGuest extends Response {
126
125
  * @return {*}
127
126
  */
128
127
  time () {
129
- return this.payloadKey( 'time' );
128
+ return this.payloadKey('time')
130
129
  }
131
130
 
132
131
  /**
@@ -135,7 +134,7 @@ export default class ResponseRequestAuthorizationGuest extends Response {
135
134
  * @return {string}
136
135
  */
137
136
  pubKey () {
138
- return this.payloadKey( 'key' );
137
+ return this.payloadKey('key')
139
138
  }
140
139
 
141
140
  /**
@@ -143,8 +142,6 @@ export default class ResponseRequestAuthorizationGuest extends Response {
143
142
  * @return {string}
144
143
  */
145
144
  encrypt () {
146
- return this.payloadKey( 'encrypt' );
145
+ return this.payloadKey('encrypt')
147
146
  }
148
-
149
-
150
147
  }
@@ -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 ResponseProposeMolecule from './ResponseProposeMolecule';
48
+ import ResponseProposeMolecule from './ResponseProposeMolecule'
49
49
 
50
50
  /**
51
51
  * Response for identifier creation
@@ -45,13 +45,12 @@ 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 ResponseProposeMolecule from './ResponseProposeMolecule';
48
+ import ResponseProposeMolecule from './ResponseProposeMolecule'
49
49
 
50
50
  /**
51
51
  * Response for token transfer queries
52
52
  */
53
53
  export default class ResponseTransferTokens extends ResponseProposeMolecule {
54
-
55
54
  /**
56
55
  * Returns result of the transfer
57
56
  *
@@ -59,14 +58,14 @@ export default class ResponseTransferTokens extends ResponseProposeMolecule {
59
58
  */
60
59
  payload () {
61
60
  const result = {
62
- reason: null,
63
- status: null
64
- },
65
- data = this.data();
61
+ reason: null,
62
+ status: null
63
+ }
64
+ const data = this.data()
66
65
 
67
- result.reason = typeof data.reason === 'undefined' ? 'Invalid response from server' : data.reason;
68
- result.status = typeof data.status === 'undefined' ? 'rejected' : data.status;
66
+ result.reason = typeof data.reason === 'undefined' ? 'Invalid response from server' : data.reason
67
+ result.status = typeof data.status === 'undefined' ? 'rejected' : data.status
69
68
 
70
- return result;
69
+ return result
71
70
  }
72
71
  }
@@ -45,30 +45,29 @@ 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 Query from '../query/Query';
49
- import Response from './Response';
50
- import Meta from '../Meta';
48
+ import Query from '../query/Query'
49
+ import Response from './Response'
50
+ import Meta from '../Meta'
51
51
 
52
52
  /**
53
53
  * Response for Wallet Bundle query
54
54
  */
55
55
  export default class ResponseWalletBundle extends Response {
56
-
57
56
  /**
58
57
  * Class constructor
59
58
  *
60
59
  * @param {Query} query
61
60
  * @param {object} json
62
61
  */
63
- constructor ( {
62
+ constructor ({
64
63
  query,
65
64
  json
66
- } ) {
67
- super( {
65
+ }) {
66
+ super({
68
67
  query,
69
68
  json,
70
69
  dataKey: 'data.WalletBundle'
71
- } );
70
+ })
72
71
  }
73
72
 
74
73
  /**
@@ -77,19 +76,19 @@ export default class ResponseWalletBundle extends Response {
77
76
  * @return {{}|null}
78
77
  */
79
78
  payload () {
80
- const bundleData = this.data();
79
+ const bundleData = this.data()
81
80
 
82
- if ( !bundleData || bundleData.length === 0 ) {
83
- return null;
81
+ if (!bundleData || bundleData.length === 0) {
82
+ return null
84
83
  }
85
84
 
86
- const aggregate = {};
85
+ const aggregate = {}
87
86
 
88
- bundleData.forEach( bundle => {
89
- bundle.metas = Meta.aggregateMeta( bundle.metas );
90
- aggregate[ bundle.bundleHash ] = bundle;
91
- } );
87
+ bundleData.forEach(bundle => {
88
+ bundle.metas = Meta.aggregateMeta(bundle.metas)
89
+ aggregate[bundle.bundleHash] = bundle
90
+ })
92
91
 
93
- return aggregate;
92
+ return aggregate
94
93
  }
95
94
  }