@wishknish/knishio-client-js 0.5.2 → 0.6.1
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.
- package/README.md +207 -274
- package/dist/client.iife.js +533 -0
- package/package.json +37 -79
- package/src/.babelrc +0 -22
- package/src/Atom.js +171 -132
- package/src/AtomMeta.js +76 -50
- package/src/AuthToken.js +38 -47
- package/src/KnishIOClient.js +934 -987
- package/src/Meta.js +15 -17
- package/src/Molecule.js +423 -494
- package/src/PolicyMeta.js +32 -41
- package/src/TokenUnit.js +30 -32
- package/src/Wallet.js +275 -265
- package/src/exception/AtomIndexException.js +4 -8
- package/src/exception/AtomsMissingException.js +4 -6
- package/src/exception/AuthorizationRejectedException.js +4 -5
- package/src/exception/BalanceInsufficientException.js +4 -8
- package/src/exception/BaseException.js +6 -8
- package/src/exception/BatchIdException.js +5 -7
- package/src/exception/CodeException.js +4 -8
- package/src/{libraries/ApolloLink/HttpLink.js → exception/DecryptionKeyException.js} +12 -15
- package/src/exception/InvalidResponseException.js +4 -5
- package/src/exception/MetaMissingException.js +4 -6
- package/src/exception/MolecularHashMismatchException.js +4 -6
- package/src/exception/MolecularHashMissingException.js +4 -5
- package/src/exception/NegativeAmountException.js +4 -5
- package/src/exception/PolicyInvalidException.js +4 -4
- package/src/exception/SignatureMalformedException.js +4 -5
- package/src/exception/SignatureMismatchException.js +4 -5
- package/src/exception/StackableUnitAmountException.js +4 -5
- package/src/exception/StackableUnitDecimalsException.js +4 -5
- package/src/exception/TransferBalanceException.js +4 -5
- package/src/exception/TransferMalformedException.js +4 -5
- package/src/exception/TransferMismatchedException.js +4 -5
- package/src/exception/TransferRemainderException.js +4 -5
- package/src/exception/TransferToSelfException.js +4 -5
- package/src/exception/TransferUnbalancedException.js +4 -5
- package/src/exception/UnauthenticatedException.js +4 -5
- package/src/{libraries/ApolloLink/AuthLink.js → exception/WalletCredentialException.js} +12 -40
- package/src/exception/WalletShadowException.js +4 -5
- package/src/exception/WrongTokenTypeException.js +4 -5
- package/src/exception/index.js +26 -26
- package/src/index.js +8 -10
- package/src/instance/Rules/Callback.js +91 -93
- package/src/instance/Rules/Condition.js +21 -23
- package/src/instance/Rules/Meta.js +13 -14
- package/src/instance/Rules/Rule.js +39 -43
- package/src/instance/Rules/exception/RuleArgumentException.js +4 -4
- package/src/libraries/CheckMolecule.js +253 -232
- package/src/libraries/Decimal.js +13 -17
- package/src/libraries/Dot.js +74 -48
- package/src/libraries/Hex.js +49 -54
- package/src/libraries/array.js +50 -41
- package/src/libraries/crypto.js +20 -27
- package/src/libraries/strings.js +58 -91
- package/src/libraries/urql/UrqlClientWrapper.js +166 -0
- package/src/mutation/Mutation.js +44 -25
- package/src/mutation/MutationActiveSession.js +12 -12
- package/src/mutation/MutationClaimShadowWallet.js +15 -17
- package/src/mutation/MutationCreateIdentifier.js +11 -12
- package/src/mutation/MutationCreateMeta.js +11 -12
- package/src/mutation/MutationCreateRule.js +11 -12
- package/src/mutation/MutationCreateToken.js +18 -13
- package/src/mutation/MutationCreateWallet.js +9 -11
- package/src/mutation/MutationDepositBufferToken.js +7 -9
- package/src/mutation/MutationLinkIdentifier.js +12 -14
- package/src/mutation/MutationProposeMolecule.js +24 -25
- package/src/mutation/MutationRequestAuthorization.js +9 -10
- package/src/mutation/MutationRequestAuthorizationGuest.js +12 -15
- package/src/mutation/MutationRequestTokens.js +11 -14
- package/src/mutation/MutationTransferTokens.js +11 -14
- package/src/mutation/MutationWithdrawBufferToken.js +7 -10
- package/src/query/Query.js +62 -36
- package/src/query/QueryActiveSession.js +11 -13
- package/src/query/QueryAtom.js +75 -76
- package/src/query/QueryBalance.js +11 -12
- package/src/query/QueryBatch.js +17 -14
- package/src/query/QueryBatchHistory.js +16 -13
- package/src/query/QueryContinuId.js +13 -10
- package/src/query/QueryMetaType.js +45 -57
- package/src/query/QueryMetaTypeViaAtom.js +49 -57
- package/src/query/QueryPolicy.js +11 -12
- package/src/query/QueryToken.js +11 -13
- package/src/query/QueryUserActivity.js +11 -13
- package/src/query/QueryWalletBundle.js +15 -47
- package/src/query/QueryWalletList.js +15 -16
- package/src/response/Response.js +29 -34
- package/src/response/ResponseActiveSession.js +6 -6
- package/src/response/ResponseAtom.js +29 -30
- package/src/response/ResponseAuthorizationGuest.js +17 -18
- package/src/response/ResponseBalance.js +12 -13
- package/src/response/ResponseClaimShadowWallet.js +1 -1
- package/src/response/ResponseContinuId.js +21 -22
- package/src/response/ResponseCreateIdentifier.js +1 -1
- package/src/response/ResponseCreateMeta.js +1 -1
- package/src/response/ResponseCreateRule.js +1 -1
- package/src/response/ResponseCreateToken.js +1 -1
- package/src/response/ResponseCreateWallet.js +1 -1
- package/src/response/ResponseLinkIdentifier.js +9 -10
- package/src/response/ResponseMetaBatch.js +6 -8
- package/src/response/ResponseMetaType.js +19 -20
- package/src/response/ResponseMetaTypeViaAtom.js +19 -19
- package/src/response/ResponsePolicy.js +14 -15
- package/src/response/ResponseProposeMolecule.js +27 -30
- package/src/response/ResponseQueryActiveSession.js +20 -23
- package/src/response/ResponseQueryUserActivity.js +11 -12
- package/src/response/ResponseRequestAuthorization.js +11 -16
- package/src/response/ResponseRequestAuthorizationGuest.js +18 -21
- package/src/response/ResponseRequestTokens.js +1 -1
- package/src/response/ResponseTransferTokens.js +8 -9
- package/src/response/ResponseWalletBundle.js +16 -17
- package/src/response/ResponseWalletList.js +44 -47
- package/src/subscribe/ActiveSessionSubscribe.js +5 -6
- package/src/subscribe/ActiveWalletSubscribe.js +5 -6
- package/src/subscribe/CreateMoleculeSubscribe.js +5 -5
- package/src/subscribe/Subscribe.js +26 -26
- package/src/subscribe/WalletStatusSubscribe.js +5 -6
- package/src/versions/HashAtom.js +78 -0
- package/src/versions/Version4.js +34 -0
- package/src/versions/index.js +5 -0
- package/dist/client.umd.js +0 -453
- package/src/httpClient/ApolloClient.js +0 -245
- package/src/libraries/ApolloLink/CipherLink.js +0 -117
- package/src/libraries/ApolloLink/Client.js +0 -231
- package/src/libraries/ApolloLink/PusherLink.js +0 -234
- package/src/libraries/ApolloLink/handler.js +0 -106
- package/src/libraries/Base58.js +0 -71
- package/src/libraries/Base64.js +0 -40
- package/src/libraries/BaseX.js +0 -91
- package/src/libraries/Soda.js +0 -93
- package/src/query/QueryMetaInstance.js +0 -99
- package/src/test/Test.js +0 -670
- package/src/test/TestTokenUnit.js +0 -340
package/src/response/Response.js
CHANGED
|
@@ -45,15 +45,14 @@ 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 InvalidResponseException from '../exception/InvalidResponseException'
|
|
49
|
-
import UnauthenticatedException from '../exception/UnauthenticatedException'
|
|
50
|
-
import Dot from '../libraries/Dot'
|
|
48
|
+
import InvalidResponseException from '../exception/InvalidResponseException'
|
|
49
|
+
import UnauthenticatedException from '../exception/UnauthenticatedException'
|
|
50
|
+
import Dot from '../libraries/Dot'
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Base Response class for processing node responses
|
|
54
54
|
*/
|
|
55
55
|
export default class Response {
|
|
56
|
-
|
|
57
56
|
/**
|
|
58
57
|
* Class constructor
|
|
59
58
|
*
|
|
@@ -61,35 +60,33 @@ export default class Response {
|
|
|
61
60
|
* @param {object} json
|
|
62
61
|
* @param {string|null} dataKey
|
|
63
62
|
*/
|
|
64
|
-
constructor (
|
|
63
|
+
constructor ({
|
|
65
64
|
query,
|
|
66
65
|
json,
|
|
67
66
|
dataKey = null
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
this.
|
|
71
|
-
this
|
|
72
|
-
this.$
|
|
73
|
-
this.$
|
|
74
|
-
this.$
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
throw new InvalidResponseException();
|
|
67
|
+
}) {
|
|
68
|
+
this.dataKey = dataKey
|
|
69
|
+
this.errorKey = 'exception'
|
|
70
|
+
this.$__payload = null
|
|
71
|
+
this.$__query = query
|
|
72
|
+
this.$__originResponse = json
|
|
73
|
+
this.$__response = json
|
|
74
|
+
|
|
75
|
+
if (typeof this.$__response === 'undefined' || this.$__response === null) {
|
|
76
|
+
throw new InvalidResponseException()
|
|
79
77
|
}
|
|
80
78
|
|
|
81
|
-
if (
|
|
79
|
+
if (Dot.has(this.$__response, this.errorKey)) {
|
|
80
|
+
const error = Dot.get(this.$__response, this.errorKey)
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if ( String( error ).includes( 'Unauthenticated' ) ) {
|
|
86
|
-
throw new UnauthenticatedException();
|
|
82
|
+
if (String(error).includes('Unauthenticated')) {
|
|
83
|
+
throw new UnauthenticatedException()
|
|
87
84
|
}
|
|
88
85
|
|
|
89
|
-
throw new InvalidResponseException()
|
|
86
|
+
throw new InvalidResponseException()
|
|
90
87
|
}
|
|
91
88
|
|
|
92
|
-
this.init()
|
|
89
|
+
this.init()
|
|
93
90
|
}
|
|
94
91
|
|
|
95
92
|
/**
|
|
@@ -102,45 +99,43 @@ export default class Response {
|
|
|
102
99
|
* @return {*}
|
|
103
100
|
*/
|
|
104
101
|
data () {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return this.response();
|
|
102
|
+
if (!this.dataKey) {
|
|
103
|
+
return this.response()
|
|
108
104
|
}
|
|
109
105
|
|
|
110
106
|
// Check key & return custom data from the response
|
|
111
|
-
if (
|
|
112
|
-
throw new InvalidResponseException()
|
|
107
|
+
if (!Dot.has(this.response(), this.dataKey)) {
|
|
108
|
+
throw new InvalidResponseException()
|
|
113
109
|
}
|
|
114
110
|
|
|
115
|
-
return Dot.get(
|
|
111
|
+
return Dot.get(this.response(), this.dataKey)
|
|
116
112
|
}
|
|
117
113
|
|
|
118
114
|
/**
|
|
119
115
|
* @return {object}
|
|
120
116
|
*/
|
|
121
117
|
response () {
|
|
122
|
-
return this.$__response
|
|
118
|
+
return this.$__response
|
|
123
119
|
}
|
|
124
120
|
|
|
125
121
|
/**
|
|
126
122
|
* @return {*}
|
|
127
123
|
*/
|
|
128
124
|
payload () {
|
|
129
|
-
return null
|
|
125
|
+
return null
|
|
130
126
|
}
|
|
131
127
|
|
|
132
128
|
/**
|
|
133
129
|
* @return {Query}
|
|
134
130
|
*/
|
|
135
131
|
query () {
|
|
136
|
-
return this.$__query
|
|
132
|
+
return this.$__query
|
|
137
133
|
}
|
|
138
134
|
|
|
139
135
|
/**
|
|
140
136
|
* @return {*}
|
|
141
137
|
*/
|
|
142
138
|
status () {
|
|
143
|
-
return null
|
|
139
|
+
return null
|
|
144
140
|
}
|
|
145
|
-
|
|
146
141
|
}
|
|
@@ -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 Query from '../query/Query'
|
|
50
|
-
import Response from './Response'
|
|
49
|
+
import Query from '../query/Query'
|
|
50
|
+
import Response from './Response'
|
|
51
51
|
|
|
52
52
|
export default class ResponseActiveSession extends Response {
|
|
53
53
|
/**
|
|
@@ -56,14 +56,14 @@ export default class ResponseActiveSession 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
66
|
dataKey: 'data.ActiveSession'
|
|
67
|
-
}
|
|
67
|
+
})
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -46,29 +46,28 @@ 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
|
|
50
|
-
import
|
|
49
|
+
import Query from '../query/Query'
|
|
50
|
+
import Response from './Response'
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Response for MetaType Query
|
|
54
54
|
*/
|
|
55
55
|
export default class ResponseAtom 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.Atom'
|
|
71
|
-
}
|
|
70
|
+
})
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
/**
|
|
@@ -77,52 +76,52 @@ export default class ResponseAtom extends Response {
|
|
|
77
76
|
* @return {null|*}
|
|
78
77
|
*/
|
|
79
78
|
payload () {
|
|
80
|
-
const metaTypeData = this.data()
|
|
79
|
+
const metaTypeData = this.data()
|
|
81
80
|
|
|
82
|
-
if (
|
|
83
|
-
return null
|
|
81
|
+
if (!metaTypeData) {
|
|
82
|
+
return null
|
|
84
83
|
}
|
|
85
84
|
|
|
86
|
-
|
|
85
|
+
const response = {
|
|
87
86
|
instances: [],
|
|
88
87
|
instanceCount: {},
|
|
89
88
|
paginatorInfo: {}
|
|
90
|
-
}
|
|
89
|
+
}
|
|
91
90
|
|
|
92
|
-
if (
|
|
93
|
-
response.instances = metaTypeData.instances
|
|
91
|
+
if (metaTypeData.instances) {
|
|
92
|
+
response.instances = metaTypeData.instances
|
|
94
93
|
|
|
95
|
-
for (
|
|
96
|
-
|
|
97
|
-
if (
|
|
98
|
-
response.instances[
|
|
94
|
+
for (const instanceKey in response.instances) {
|
|
95
|
+
const instance = response.instances[instanceKey]
|
|
96
|
+
if (instance.metasJson) {
|
|
97
|
+
response.instances[instanceKey].metas = JSON.parse(instance.metasJson)
|
|
99
98
|
}
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
|
|
103
|
-
if (
|
|
104
|
-
response.instanceCount = metaTypeData.instanceCount
|
|
102
|
+
if (metaTypeData.instanceCount) {
|
|
103
|
+
response.instanceCount = metaTypeData.instanceCount
|
|
105
104
|
}
|
|
106
105
|
|
|
107
|
-
if (
|
|
108
|
-
response.paginatorInfo = metaTypeData.paginatorInfo
|
|
106
|
+
if (metaTypeData.paginatorInfo) {
|
|
107
|
+
response.paginatorInfo = metaTypeData.paginatorInfo
|
|
109
108
|
}
|
|
110
109
|
|
|
111
|
-
return response
|
|
110
|
+
return response
|
|
112
111
|
}
|
|
113
112
|
|
|
114
113
|
metas () {
|
|
115
|
-
const response = this.payload()
|
|
116
|
-
const metas = []
|
|
114
|
+
const response = this.payload()
|
|
115
|
+
const metas = []
|
|
117
116
|
|
|
118
|
-
if (
|
|
119
|
-
for (
|
|
120
|
-
if (
|
|
121
|
-
metas.push(
|
|
117
|
+
if (response && response.instances) {
|
|
118
|
+
for (const instance of response.instances) {
|
|
119
|
+
if (instance.metasJson) {
|
|
120
|
+
metas.push(JSON.parse(instance.metasJson))
|
|
122
121
|
}
|
|
123
122
|
}
|
|
124
123
|
}
|
|
125
124
|
|
|
126
|
-
return metas
|
|
125
|
+
return metas
|
|
127
126
|
}
|
|
128
127
|
}
|
|
@@ -46,31 +46,30 @@ 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
|
|
50
|
-
import
|
|
51
|
-
import Dot from '../libraries/Dot'
|
|
52
|
-
import InvalidResponseException from '../exception/InvalidResponseException'
|
|
49
|
+
import Query from '../query/Query'
|
|
50
|
+
import Response from './Response'
|
|
51
|
+
import Dot from '../libraries/Dot'
|
|
52
|
+
import InvalidResponseException from '../exception/InvalidResponseException'
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Response for Guest Authorization Request
|
|
56
56
|
*/
|
|
57
57
|
export default class ResponseAuthorizationGuest extends Response {
|
|
58
|
-
|
|
59
58
|
/**
|
|
60
59
|
* Class constructor
|
|
61
60
|
*
|
|
62
61
|
* @param {Query} query
|
|
63
62
|
* @param {object} json
|
|
64
63
|
*/
|
|
65
|
-
constructor (
|
|
64
|
+
constructor ({
|
|
66
65
|
query,
|
|
67
66
|
json
|
|
68
|
-
}
|
|
69
|
-
super(
|
|
67
|
+
}) {
|
|
68
|
+
super({
|
|
70
69
|
query,
|
|
71
70
|
json,
|
|
72
71
|
dataKey: 'data.AccessToken'
|
|
73
|
-
}
|
|
72
|
+
})
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
/**
|
|
@@ -79,7 +78,7 @@ export default class ResponseAuthorizationGuest extends Response {
|
|
|
79
78
|
* @return {string}
|
|
80
79
|
*/
|
|
81
80
|
reason () {
|
|
82
|
-
return 'Invalid response from server'
|
|
81
|
+
return 'Invalid response from server'
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
/**
|
|
@@ -88,7 +87,7 @@ export default class ResponseAuthorizationGuest extends Response {
|
|
|
88
87
|
* @return {boolean}
|
|
89
88
|
*/
|
|
90
89
|
success () {
|
|
91
|
-
return this.payload() !== null
|
|
90
|
+
return this.payload() !== null
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
/**
|
|
@@ -97,7 +96,7 @@ export default class ResponseAuthorizationGuest extends Response {
|
|
|
97
96
|
* @return {null|Wallet}
|
|
98
97
|
*/
|
|
99
98
|
payload () {
|
|
100
|
-
return this.data()
|
|
99
|
+
return this.data()
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
/**
|
|
@@ -106,11 +105,11 @@ export default class ResponseAuthorizationGuest extends Response {
|
|
|
106
105
|
* @param key
|
|
107
106
|
* @return {*}
|
|
108
107
|
*/
|
|
109
|
-
payloadKey (
|
|
110
|
-
if (
|
|
111
|
-
throw new InvalidResponseException(
|
|
108
|
+
payloadKey (key) {
|
|
109
|
+
if (!Dot.has(this.payload(), key)) {
|
|
110
|
+
throw new InvalidResponseException(`ResponseAuthorizationGuest::payloadKey() - '${ key }' key is not found in the payload!`)
|
|
112
111
|
}
|
|
113
|
-
return Dot.get(
|
|
112
|
+
return Dot.get(this.payload(), key)
|
|
114
113
|
}
|
|
115
114
|
|
|
116
115
|
/**
|
|
@@ -119,7 +118,7 @@ export default class ResponseAuthorizationGuest extends Response {
|
|
|
119
118
|
* @return {*}
|
|
120
119
|
*/
|
|
121
120
|
token () {
|
|
122
|
-
return this.payloadKey(
|
|
121
|
+
return this.payloadKey('token')
|
|
123
122
|
}
|
|
124
123
|
|
|
125
124
|
/**
|
|
@@ -128,6 +127,6 @@ export default class ResponseAuthorizationGuest extends Response {
|
|
|
128
127
|
* @return {*}
|
|
129
128
|
*/
|
|
130
129
|
time () {
|
|
131
|
-
return this.payloadKey(
|
|
130
|
+
return this.payloadKey('time')
|
|
132
131
|
}
|
|
133
132
|
}
|
|
@@ -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 ResponseWalletList from './ResponseWalletList'
|
|
48
|
+
import Query from '../query/Query'
|
|
49
|
+
import Response from './Response'
|
|
50
|
+
import ResponseWalletList from './ResponseWalletList'
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Response for balance query
|
|
54
54
|
*/
|
|
55
55
|
export default class ResponseBalance 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.Balance'
|
|
71
|
-
}
|
|
70
|
+
})
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
/**
|
|
@@ -77,14 +76,14 @@ export default class ResponseBalance extends Response {
|
|
|
77
76
|
* @return {null|Wallet}
|
|
78
77
|
*/
|
|
79
78
|
payload () {
|
|
80
|
-
const walletData = this.data()
|
|
79
|
+
const walletData = this.data()
|
|
81
80
|
|
|
82
|
-
if (
|
|
83
|
-
return null
|
|
81
|
+
if (!walletData || !walletData.bundleHash || !walletData.tokenSlug) {
|
|
82
|
+
return null
|
|
84
83
|
}
|
|
85
84
|
|
|
86
|
-
return ResponseWalletList.toClientWallet(
|
|
85
|
+
return ResponseWalletList.toClientWallet({
|
|
87
86
|
data: walletData
|
|
88
|
-
}
|
|
87
|
+
})
|
|
89
88
|
}
|
|
90
89
|
}
|
|
@@ -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,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 Wallet from '../Wallet'
|
|
48
|
+
import Query from '../query/Query'
|
|
49
|
+
import Response from './Response'
|
|
50
|
+
import Wallet from '../Wallet'
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Response for ContinuID query
|
|
54
54
|
*/
|
|
55
55
|
export default class ResponseContinuId 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.ContinuId'
|
|
71
|
-
}
|
|
70
|
+
})
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
/**
|
|
@@ -77,24 +76,24 @@ export default class ResponseContinuId extends Response {
|
|
|
77
76
|
* @return {Wallet|null}
|
|
78
77
|
*/
|
|
79
78
|
payload () {
|
|
80
|
-
let wallet = null
|
|
79
|
+
let wallet = null
|
|
81
80
|
|
|
82
|
-
const continuId = this.data()
|
|
81
|
+
const continuId = this.data()
|
|
83
82
|
|
|
84
|
-
if (
|
|
85
|
-
wallet = new Wallet(
|
|
83
|
+
if (continuId) {
|
|
84
|
+
wallet = new Wallet({
|
|
86
85
|
secret: null,
|
|
87
|
-
token: continuId
|
|
88
|
-
}
|
|
89
|
-
wallet.address = continuId
|
|
90
|
-
wallet.position = continuId
|
|
91
|
-
wallet.bundle = continuId
|
|
92
|
-
wallet.batchId = continuId
|
|
93
|
-
wallet.characters = continuId
|
|
94
|
-
wallet.pubkey = continuId
|
|
95
|
-
wallet.balance = continuId
|
|
86
|
+
token: continuId.tokenSlug
|
|
87
|
+
})
|
|
88
|
+
wallet.address = continuId.address
|
|
89
|
+
wallet.position = continuId.position
|
|
90
|
+
wallet.bundle = continuId.bundleHash
|
|
91
|
+
wallet.batchId = continuId.batchId
|
|
92
|
+
wallet.characters = continuId.characters
|
|
93
|
+
wallet.pubkey = continuId.pubkey
|
|
94
|
+
wallet.balance = continuId.amount * 1.0
|
|
96
95
|
}
|
|
97
96
|
|
|
98
|
-
return wallet
|
|
97
|
+
return wallet
|
|
99
98
|
}
|
|
100
99
|
}
|
|
@@ -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,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 token creation
|
|
@@ -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 rule creation
|
|
@@ -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 token creation
|
|
@@ -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 Wallet creation
|
|
@@ -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 Dot from '../libraries/Dot'
|
|
48
|
+
import Query from '../query/Query'
|
|
49
|
+
import Response from './Response'
|
|
50
|
+
import Dot from '../libraries/Dot'
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Response for mutation to create / link an Identifier to a Wallet Bundle
|
|
54
54
|
*/
|
|
55
55
|
export default class ResponseLinkIdentifier 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.LinkIdentifier'
|
|
71
|
-
}
|
|
70
|
+
})
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
/**
|
|
@@ -77,7 +76,7 @@ export default class ResponseLinkIdentifier extends Response {
|
|
|
77
76
|
* @return {*}
|
|
78
77
|
*/
|
|
79
78
|
success () {
|
|
80
|
-
return Dot.get(
|
|
79
|
+
return Dot.get(this.data(), 'set')
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
/**
|
|
@@ -86,6 +85,6 @@ export default class ResponseLinkIdentifier extends Response {
|
|
|
86
85
|
* @return {*}
|
|
87
86
|
*/
|
|
88
87
|
message () {
|
|
89
|
-
return Dot.get(
|
|
88
|
+
return Dot.get(this.data(), 'message')
|
|
90
89
|
}
|
|
91
90
|
}
|
|
@@ -46,29 +46,27 @@ 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
|
|
50
|
-
import
|
|
49
|
+
import Query from '../query/Query'
|
|
50
|
+
import Response from './Response'
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Response for MetaBatch Query
|
|
54
54
|
*/
|
|
55
55
|
export default class ResponseMetaBatch 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.MetaBatch'
|
|
71
|
-
}
|
|
70
|
+
})
|
|
72
71
|
}
|
|
73
|
-
|
|
74
72
|
}
|