@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.
- package/README.md +207 -274
- package/dist/client.iife.js +577 -0
- package/package.json +36 -79
- package/src/.babelrc +0 -22
- package/src/Atom.js +171 -132
- package/src/AtomMeta.js +76 -50
- package/src/AuthToken.js +37 -46
- package/src/KnishIOClient.js +932 -985
- 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/apollo/ApolloClientWrapper.js +143 -0
- package/src/libraries/apollo/CipherLink.js +116 -0
- package/src/libraries/apollo/Client.js +154 -0
- package/src/libraries/apollo/ErrorHandler.js +32 -0
- package/src/libraries/apollo/SubscriptionManager.js +60 -0
- package/src/libraries/apollo/operationUtils.js +26 -0
- package/src/libraries/array.js +50 -41
- package/src/libraries/crypto.js +20 -27
- package/src/libraries/strings.js +58 -91
- 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
|
@@ -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
|
}
|
|
@@ -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 ResponseMetaType 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.MetaType'
|
|
71
|
-
}
|
|
70
|
+
})
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
/**
|
|
@@ -77,32 +76,32 @@ export default class ResponseMetaType 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 || metaTypeData.length === 0) {
|
|
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
|
-
|
|
91
|
+
const metaData = metaTypeData.pop()
|
|
93
92
|
|
|
94
|
-
if (
|
|
95
|
-
response.instances = metaData.instances
|
|
93
|
+
if (metaData.instances) {
|
|
94
|
+
response.instances = metaData.instances
|
|
96
95
|
}
|
|
97
96
|
|
|
98
|
-
if (
|
|
99
|
-
response.instanceCount = metaData.instanceCount
|
|
97
|
+
if (metaData.instanceCount) {
|
|
98
|
+
response.instanceCount = metaData.instanceCount
|
|
100
99
|
}
|
|
101
100
|
|
|
102
|
-
if (
|
|
103
|
-
response.paginatorInfo = metaData.paginatorInfo
|
|
101
|
+
if (metaData.paginatorInfo) {
|
|
102
|
+
response.paginatorInfo = metaData.paginatorInfo
|
|
104
103
|
}
|
|
105
104
|
|
|
106
|
-
return response
|
|
105
|
+
return response
|
|
107
106
|
}
|
|
108
107
|
}
|
|
@@ -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
|
|
50
|
-
import
|
|
49
|
+
import Query from '../query/Query'
|
|
50
|
+
import Response from './Response'
|
|
51
51
|
|
|
52
52
|
export default class ResponseMetaTypeViaAtom extends Response {
|
|
53
53
|
/**
|
|
@@ -56,44 +56,44 @@ export default class ResponseMetaTypeViaAtom 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.MetaTypeViaAtom'
|
|
67
|
-
}
|
|
67
|
+
})
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
payload () {
|
|
71
|
-
const metaTypeData = this.data()
|
|
71
|
+
const metaTypeData = this.data()
|
|
72
72
|
|
|
73
|
-
if (
|
|
74
|
-
return null
|
|
73
|
+
if (!metaTypeData || metaTypeData.length === 0) {
|
|
74
|
+
return null
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
const response = {
|
|
78
78
|
instances: {},
|
|
79
79
|
instanceCount: {},
|
|
80
80
|
paginatorInfo: {}
|
|
81
|
-
}
|
|
81
|
+
}
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
const metaData = metaTypeData.pop()
|
|
84
84
|
|
|
85
|
-
if (
|
|
86
|
-
response.instances = metaData.instances
|
|
85
|
+
if (metaData.instances) {
|
|
86
|
+
response.instances = metaData.instances
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
if (
|
|
90
|
-
response.instanceCount = metaData.instanceCount
|
|
89
|
+
if (metaData.instanceCount) {
|
|
90
|
+
response.instanceCount = metaData.instanceCount
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
if (
|
|
94
|
-
response.paginatorInfo = metaData.paginatorInfo
|
|
93
|
+
if (metaData.paginatorInfo) {
|
|
94
|
+
response.paginatorInfo = metaData.paginatorInfo
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
return response
|
|
97
|
+
return response
|
|
98
98
|
}
|
|
99
99
|
}
|