@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
|
@@ -45,24 +45,23 @@ 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'
|
|
49
|
-
import ResponseMetaType from '../response/ResponseMetaType'
|
|
50
|
-
import { gql } from '@
|
|
48
|
+
import Query from './Query'
|
|
49
|
+
import ResponseMetaType from '../response/ResponseMetaType'
|
|
50
|
+
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Query for retrieving Meta Asset information
|
|
54
54
|
*/
|
|
55
55
|
export default class QueryMetaType extends Query {
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* @param apolloClient
|
|
57
|
+
* @param {UrqlClientWrapper} graphQLClient
|
|
58
|
+
* @param {KnishIOClient} knishIOClient
|
|
60
59
|
*/
|
|
61
|
-
constructor (
|
|
62
|
-
super(
|
|
60
|
+
constructor (graphQLClient, knishIOClient) {
|
|
61
|
+
super(graphQLClient, knishIOClient)
|
|
63
62
|
|
|
64
|
-
this.$__query = gql`query( $metaType: String, $metaTypes: [ String! ], $metaId: String, $metaIds: [ String! ], $key: String, $keys: [ String! ], $value: String, $values: [ String! ], $count: String, $latest: Boolean, $filter: [ MetaFilter! ], $
|
|
65
|
-
MetaType( metaType: $metaType, metaTypes: $metaTypes, metaId: $metaId, metaIds: $metaIds, key: $key, keys: $keys, value: $value, values: $values, count: $count, filter: $filter,
|
|
63
|
+
this.$__query = gql`query( $metaType: String, $metaTypes: [ String! ], $metaId: String, $metaIds: [ String! ], $key: String, $keys: [ String! ], $value: String, $values: [ String! ], $count: String, $latest: Boolean, $filter: [ MetaFilter! ], $queryArgs: QueryArgs, $countBy: String ) {
|
|
64
|
+
MetaType( metaType: $metaType, metaTypes: $metaTypes, metaId: $metaId, metaIds: $metaIds, key: $key, keys: $keys, value: $value, values: $values, count: $count, filter: $filter, queryArgs: $queryArgs, countBy: $countBy ) {
|
|
66
65
|
metaType,
|
|
67
66
|
instanceCount {
|
|
68
67
|
key,
|
|
@@ -85,20 +84,7 @@ export default class QueryMetaType extends Query {
|
|
|
85
84
|
total
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Returns a Response object
|
|
93
|
-
*
|
|
94
|
-
* @param {object} json
|
|
95
|
-
* @return {ResponseMetaType}
|
|
96
|
-
*/
|
|
97
|
-
createResponse ( json ) {
|
|
98
|
-
return new ResponseMetaType( {
|
|
99
|
-
query: this,
|
|
100
|
-
json
|
|
101
|
-
} );
|
|
87
|
+
}`
|
|
102
88
|
}
|
|
103
89
|
|
|
104
90
|
/**
|
|
@@ -109,74 +95,76 @@ export default class QueryMetaType extends Query {
|
|
|
109
95
|
* @param {string|array|null} key
|
|
110
96
|
* @param {string|array|null} value
|
|
111
97
|
* @param {boolean|null} latest
|
|
112
|
-
* @param {boolean|null} latestMetas
|
|
113
98
|
* @param {object|null} filter
|
|
114
99
|
* @param {object|null} queryArgs
|
|
115
100
|
* @param {string|null} count
|
|
116
101
|
* @param {string|null} countBy
|
|
117
102
|
* @return {{}}
|
|
118
103
|
*/
|
|
119
|
-
static createVariables (
|
|
104
|
+
static createVariables ({
|
|
120
105
|
metaType = null,
|
|
121
106
|
metaId = null,
|
|
122
107
|
key = null,
|
|
123
108
|
value = null,
|
|
124
109
|
latest = null,
|
|
125
|
-
latestMetas = true,
|
|
126
110
|
filter = null,
|
|
127
111
|
queryArgs = null,
|
|
128
112
|
count = null,
|
|
129
113
|
countBy = null
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const variables = {};
|
|
114
|
+
}) {
|
|
115
|
+
const variables = {}
|
|
133
116
|
|
|
134
|
-
if (
|
|
135
|
-
variables[
|
|
117
|
+
if (metaType) {
|
|
118
|
+
variables[typeof metaType === 'string' ? 'metaType' : 'metaTypes'] = metaType
|
|
136
119
|
}
|
|
137
120
|
|
|
138
|
-
if (
|
|
139
|
-
variables[
|
|
121
|
+
if (metaId) {
|
|
122
|
+
variables[typeof metaId === 'string' ? 'metaId' : 'metaIds'] = metaId
|
|
140
123
|
}
|
|
141
124
|
|
|
142
|
-
if (
|
|
143
|
-
variables[
|
|
125
|
+
if (key) {
|
|
126
|
+
variables[typeof key === 'string' ? 'key' : 'keys'] = key
|
|
144
127
|
}
|
|
145
128
|
|
|
146
|
-
if (
|
|
147
|
-
variables[
|
|
129
|
+
if (value) {
|
|
130
|
+
variables[typeof value === 'string' ? 'value' : 'values'] = value
|
|
148
131
|
}
|
|
149
132
|
|
|
150
|
-
|
|
151
|
-
variables[ 'latest' ] = !!latest;
|
|
152
|
-
}
|
|
133
|
+
variables.latest = latest === true
|
|
153
134
|
|
|
154
|
-
if (
|
|
155
|
-
variables
|
|
135
|
+
if (filter) {
|
|
136
|
+
variables.filter = filter
|
|
156
137
|
}
|
|
157
138
|
|
|
158
|
-
if (
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if ( queryArgs ) {
|
|
163
|
-
|
|
164
|
-
if ( typeof queryArgs.limit === 'undefined' || queryArgs.limit === 0 ) {
|
|
165
|
-
queryArgs.limit = '*';
|
|
139
|
+
if (queryArgs) {
|
|
140
|
+
if (typeof queryArgs.limit === 'undefined' || queryArgs.limit === 0) {
|
|
141
|
+
queryArgs.limit = '*'
|
|
166
142
|
}
|
|
167
143
|
|
|
168
|
-
variables
|
|
144
|
+
variables.queryArgs = queryArgs
|
|
169
145
|
}
|
|
170
146
|
|
|
171
|
-
if (
|
|
172
|
-
variables
|
|
147
|
+
if (count) {
|
|
148
|
+
variables.count = count
|
|
173
149
|
}
|
|
174
150
|
|
|
175
|
-
if (
|
|
176
|
-
variables
|
|
151
|
+
if (countBy) {
|
|
152
|
+
variables.countBy = countBy
|
|
177
153
|
}
|
|
178
154
|
|
|
179
|
-
return variables
|
|
155
|
+
return variables
|
|
180
156
|
}
|
|
181
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Returns a Response object
|
|
160
|
+
*
|
|
161
|
+
* @param {object} json
|
|
162
|
+
* @return {ResponseMetaType}
|
|
163
|
+
*/
|
|
164
|
+
createResponse (json) {
|
|
165
|
+
return new ResponseMetaType({
|
|
166
|
+
query: this,
|
|
167
|
+
json
|
|
168
|
+
})
|
|
169
|
+
}
|
|
182
170
|
}
|
|
@@ -45,19 +45,17 @@ 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'
|
|
49
|
-
import
|
|
50
|
-
import
|
|
51
|
-
|
|
48
|
+
import Query from './Query'
|
|
49
|
+
import ResponseMetaTypeViaAtom from '../response/ResponseMetaTypeViaAtom'
|
|
50
|
+
import { gql } from '@urql/core'
|
|
52
51
|
|
|
53
52
|
export default class QueryMetaTypeViaAtom extends Query {
|
|
54
53
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* @param apolloClient
|
|
54
|
+
* @param {UrqlClientWrapper} graphQLClient
|
|
55
|
+
* @param {KnishIOClient} knishIOClient
|
|
58
56
|
*/
|
|
59
|
-
constructor (
|
|
60
|
-
super(
|
|
57
|
+
constructor (graphQLClient, knishIOClient) {
|
|
58
|
+
super(graphQLClient, knishIOClient)
|
|
61
59
|
|
|
62
60
|
this.$__query = gql`query ($metaTypes: [String!], $metaIds: [String!], $values: [String!], $keys: [String!], $latest: Boolean, $filter: [MetaFilter!], $queryArgs: QueryArgs, $countBy: String, $atomValues: [String!] ) {
|
|
63
61
|
MetaTypeViaAtom(
|
|
@@ -91,20 +89,7 @@ export default class QueryMetaTypeViaAtom extends Query {
|
|
|
91
89
|
total
|
|
92
90
|
}
|
|
93
91
|
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Returns a Response object
|
|
99
|
-
*
|
|
100
|
-
* @param {object} json
|
|
101
|
-
* @return {ResponseMetaTypeViaAtom}
|
|
102
|
-
*/
|
|
103
|
-
createResponse ( json ) {
|
|
104
|
-
return new ResponseMetaTypeViaAtom( {
|
|
105
|
-
query: this,
|
|
106
|
-
json
|
|
107
|
-
} );
|
|
92
|
+
}`
|
|
108
93
|
}
|
|
109
94
|
|
|
110
95
|
/**
|
|
@@ -118,13 +103,12 @@ export default class QueryMetaTypeViaAtom extends Query {
|
|
|
118
103
|
* @param {array|null} keys
|
|
119
104
|
* @param {array|null} atomValues
|
|
120
105
|
* @param {boolean|null} latest
|
|
121
|
-
* @param {boolean|null} latestMetas
|
|
122
106
|
* @param {array|null} filter
|
|
123
107
|
* @param {object|null} queryArgs
|
|
124
108
|
* @param {string|null} countBy
|
|
125
109
|
* @return {{}}
|
|
126
110
|
*/
|
|
127
|
-
static createVariables (
|
|
111
|
+
static createVariables ({
|
|
128
112
|
metaType = null,
|
|
129
113
|
metaId = null,
|
|
130
114
|
key = null,
|
|
@@ -133,64 +117,72 @@ export default class QueryMetaTypeViaAtom extends Query {
|
|
|
133
117
|
values = null,
|
|
134
118
|
atomValues = null,
|
|
135
119
|
latest = null,
|
|
136
|
-
latestMetas = true,
|
|
137
120
|
filter = null,
|
|
138
121
|
queryArgs = null,
|
|
139
122
|
countBy = null
|
|
140
|
-
}
|
|
141
|
-
const variables = {}
|
|
123
|
+
}) {
|
|
124
|
+
const variables = {}
|
|
142
125
|
|
|
143
|
-
if (
|
|
144
|
-
variables
|
|
126
|
+
if (atomValues) {
|
|
127
|
+
variables.atomValues = atomValues
|
|
145
128
|
}
|
|
146
129
|
|
|
147
|
-
if (
|
|
148
|
-
variables
|
|
130
|
+
if (keys) {
|
|
131
|
+
variables.keys = keys
|
|
149
132
|
}
|
|
150
133
|
|
|
151
|
-
if (
|
|
152
|
-
variables
|
|
134
|
+
if (values) {
|
|
135
|
+
variables.values = values
|
|
153
136
|
}
|
|
154
137
|
|
|
155
|
-
if (
|
|
156
|
-
variables
|
|
138
|
+
if (metaType) {
|
|
139
|
+
variables.metaTypes = typeof metaType === 'string' ? [metaType] : metaType
|
|
157
140
|
}
|
|
158
141
|
|
|
159
|
-
if (
|
|
160
|
-
variables
|
|
142
|
+
if (metaId) {
|
|
143
|
+
variables.metaIds = typeof metaId === 'string' ? [metaId] : metaId
|
|
161
144
|
}
|
|
162
145
|
|
|
163
|
-
if (
|
|
164
|
-
variables
|
|
146
|
+
if (countBy) {
|
|
147
|
+
variables.countBy = countBy
|
|
165
148
|
}
|
|
166
149
|
|
|
167
|
-
if (
|
|
168
|
-
variables
|
|
150
|
+
if (filter) {
|
|
151
|
+
variables.filter = filter
|
|
169
152
|
}
|
|
170
153
|
|
|
171
|
-
if (
|
|
172
|
-
variables
|
|
173
|
-
variables
|
|
154
|
+
if (key && value) {
|
|
155
|
+
variables.filter = variables.filter || []
|
|
156
|
+
variables.filter.push({
|
|
174
157
|
key,
|
|
175
158
|
value,
|
|
176
|
-
|
|
177
|
-
}
|
|
159
|
+
comparison: '='
|
|
160
|
+
})
|
|
178
161
|
}
|
|
179
162
|
|
|
180
|
-
|
|
181
|
-
variables[ 'latest' ] = !!latest;
|
|
182
|
-
variables[ 'latest' ] = !!latestMetas;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
if ( queryArgs ) {
|
|
163
|
+
variables.latest = latest === true
|
|
186
164
|
|
|
187
|
-
|
|
188
|
-
|
|
165
|
+
if (queryArgs) {
|
|
166
|
+
if (typeof queryArgs.limit === 'undefined' || queryArgs.limit === 0) {
|
|
167
|
+
queryArgs.limit = '*'
|
|
189
168
|
}
|
|
190
169
|
|
|
191
|
-
variables
|
|
170
|
+
variables.queryArgs = queryArgs
|
|
192
171
|
}
|
|
193
172
|
|
|
194
|
-
return variables
|
|
173
|
+
return variables
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Returns a Response object
|
|
178
|
+
*
|
|
179
|
+
* @param {object} json
|
|
180
|
+
* @return {ResponseMetaTypeViaAtom}
|
|
181
|
+
*/
|
|
182
|
+
createResponse (json) {
|
|
183
|
+
return new ResponseMetaTypeViaAtom({
|
|
184
|
+
query: this,
|
|
185
|
+
json
|
|
186
|
+
})
|
|
195
187
|
}
|
|
196
188
|
}
|
package/src/query/QueryPolicy.js
CHANGED
|
@@ -46,18 +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 Query from './Query'
|
|
50
|
-
import
|
|
51
|
-
import
|
|
49
|
+
import Query from './Query'
|
|
50
|
+
import ResponsePolicy from '../response/ResponsePolicy'
|
|
51
|
+
import { gql } from "@urql/core";
|
|
52
52
|
|
|
53
53
|
export default class QueryPolicy extends Query {
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* @param apolloClient
|
|
55
|
+
* @param {UrqlClientWrapper} graphQLClient
|
|
56
|
+
* @param {KnishIOClient} knishIOClient
|
|
58
57
|
*/
|
|
59
|
-
constructor (
|
|
60
|
-
super(
|
|
58
|
+
constructor (graphQLClient, knishIOClient) {
|
|
59
|
+
super(graphQLClient, knishIOClient)
|
|
61
60
|
|
|
62
61
|
this.$__query = gql`query( $metaType: String, $metaId: String, ) {
|
|
63
62
|
Policy( metaType: $metaType, metaId: $metaId ) {
|
|
@@ -70,7 +69,7 @@ export default class QueryPolicy extends Query {
|
|
|
70
69
|
rule,
|
|
71
70
|
createdAt
|
|
72
71
|
}
|
|
73
|
-
}
|
|
72
|
+
}`
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
/**
|
|
@@ -79,10 +78,10 @@ export default class QueryPolicy extends Query {
|
|
|
79
78
|
* @param {object} json
|
|
80
79
|
* @return {ResponsePolicy}
|
|
81
80
|
*/
|
|
82
|
-
createResponse (
|
|
83
|
-
return new ResponsePolicy(
|
|
81
|
+
createResponse (json) {
|
|
82
|
+
return new ResponsePolicy({
|
|
84
83
|
query: this,
|
|
85
84
|
json
|
|
86
|
-
}
|
|
85
|
+
})
|
|
87
86
|
}
|
|
88
87
|
}
|
package/src/query/QueryToken.js
CHANGED
|
@@ -45,22 +45,20 @@ 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'
|
|
49
|
-
import
|
|
50
|
-
import
|
|
51
|
-
|
|
48
|
+
import Query from './Query'
|
|
49
|
+
import Response from '../response/Response'
|
|
50
|
+
import { gql } from '@urql/core'
|
|
52
51
|
|
|
53
52
|
/**
|
|
54
53
|
* Query for getting the token info
|
|
55
54
|
*/
|
|
56
55
|
export default class QueryToken extends Query {
|
|
57
56
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* @param apolloClient
|
|
57
|
+
* @param {UrqlClientWrapper} graphQLClient
|
|
58
|
+
* @param {KnishIOClient} knishIOClient
|
|
61
59
|
*/
|
|
62
|
-
constructor (
|
|
63
|
-
super(
|
|
60
|
+
constructor (graphQLClient, knishIOClient) {
|
|
61
|
+
super(graphQLClient, knishIOClient)
|
|
64
62
|
|
|
65
63
|
this.$__query = gql`query( $slug: String, $slugs: [ String! ], $limit: Int, $order: String ) {
|
|
66
64
|
Token( slug: $slug, slugs: $slugs, limit: $limit, order: $order ) {
|
|
@@ -72,7 +70,7 @@ export default class QueryToken extends Query {
|
|
|
72
70
|
amount,
|
|
73
71
|
icon,
|
|
74
72
|
}
|
|
75
|
-
}
|
|
73
|
+
}`
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
/**
|
|
@@ -80,11 +78,11 @@ export default class QueryToken extends Query {
|
|
|
80
78
|
* @param json
|
|
81
79
|
* @returns {Response}
|
|
82
80
|
*/
|
|
83
|
-
createResponse (
|
|
84
|
-
return new Response(
|
|
81
|
+
createResponse (json) {
|
|
82
|
+
return new Response({
|
|
85
83
|
query: this,
|
|
86
84
|
json,
|
|
87
85
|
dataKey: 'data.Token'
|
|
88
|
-
}
|
|
86
|
+
})
|
|
89
87
|
}
|
|
90
88
|
}
|
|
@@ -45,21 +45,20 @@ 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'
|
|
49
|
-
import ResponseQueryUserActivity from '../response/ResponseQueryUserActivity'
|
|
50
|
-
import { gql } from '@
|
|
48
|
+
import Query from './Query'
|
|
49
|
+
import ResponseQueryUserActivity from '../response/ResponseQueryUserActivity'
|
|
50
|
+
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Query for retrieving information about user activity
|
|
54
54
|
*/
|
|
55
55
|
export default class QueryUserActivity extends Query {
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* @param httpClient
|
|
57
|
+
* @param {UrqlClientWrapper} graphQLClient
|
|
58
|
+
* @param {KnishIOClient} knishIOClient
|
|
60
59
|
*/
|
|
61
|
-
constructor (
|
|
62
|
-
super(
|
|
60
|
+
constructor (graphQLClient, knishIOClient) {
|
|
61
|
+
super(graphQLClient, knishIOClient)
|
|
63
62
|
|
|
64
63
|
this.$__query = gql`query UserActivity (
|
|
65
64
|
$bundleHash:String,
|
|
@@ -134,7 +133,7 @@ export default class QueryUserActivity extends Query {
|
|
|
134
133
|
}
|
|
135
134
|
}
|
|
136
135
|
}
|
|
137
|
-
}
|
|
136
|
+
}`
|
|
138
137
|
}
|
|
139
138
|
|
|
140
139
|
/**
|
|
@@ -143,11 +142,10 @@ export default class QueryUserActivity extends Query {
|
|
|
143
142
|
* @param {object} json
|
|
144
143
|
* @return {ResponseQueryUserActivity}
|
|
145
144
|
*/
|
|
146
|
-
createResponse (
|
|
147
|
-
return new ResponseQueryUserActivity(
|
|
145
|
+
createResponse (json) {
|
|
146
|
+
return new ResponseQueryUserActivity({
|
|
148
147
|
query: this,
|
|
149
148
|
json
|
|
150
|
-
}
|
|
149
|
+
})
|
|
151
150
|
}
|
|
152
|
-
|
|
153
151
|
}
|
|
@@ -45,19 +45,23 @@ 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'
|
|
49
|
-
import ResponseWalletBundle from '../response/ResponseWalletBundle'
|
|
50
|
-
import { gql } from '@
|
|
48
|
+
import Query from './Query'
|
|
49
|
+
import ResponseWalletBundle from '../response/ResponseWalletBundle'
|
|
50
|
+
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Query for retrieving information about Wallet Bundles
|
|
54
54
|
*/
|
|
55
55
|
export default class QueryWalletBundle extends Query {
|
|
56
|
+
/**
|
|
57
|
+
* @param {UrqlClientWrapper} graphQLClient
|
|
58
|
+
* @param {KnishIOClient} knishIOClient
|
|
59
|
+
*/
|
|
60
|
+
constructor (graphQLClient, knishIOClient) {
|
|
61
|
+
super(graphQLClient, knishIOClient)
|
|
56
62
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
this.$__query = gql`query( $bundleHash: String, $bundleHashes: [ String! ], $key: String, $keys: [ String! ], $value: String, $values: [ String! ], $keys_values: [ MetaInput ], $latest: Boolean, $limit: Int, $order: String ) {
|
|
60
|
-
WalletBundle( bundleHash: $bundleHash, bundleHashes: $bundleHashes, key: $key, keys: $keys, value: $value, values: $values, keys_values: $keys_values, latest: $latest, limit: $limit, order: $order ) {
|
|
63
|
+
this.$__query = gql`query( $bundleHashes: [ String! ] ) {
|
|
64
|
+
WalletBundle( bundleHashes: $bundleHashes ) {
|
|
61
65
|
bundleHash,
|
|
62
66
|
metas {
|
|
63
67
|
molecularHash,
|
|
@@ -68,7 +72,7 @@ export default class QueryWalletBundle extends Query {
|
|
|
68
72
|
},
|
|
69
73
|
createdAt
|
|
70
74
|
}
|
|
71
|
-
}
|
|
75
|
+
}`
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
/**
|
|
@@ -77,46 +81,10 @@ export default class QueryWalletBundle extends Query {
|
|
|
77
81
|
* @param {object} json
|
|
78
82
|
* @return {ResponseWalletBundle}
|
|
79
83
|
*/
|
|
80
|
-
createResponse (
|
|
81
|
-
return new ResponseWalletBundle(
|
|
84
|
+
createResponse (json) {
|
|
85
|
+
return new ResponseWalletBundle({
|
|
82
86
|
query: this,
|
|
83
87
|
json
|
|
84
|
-
}
|
|
88
|
+
})
|
|
85
89
|
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Builds a GraphQL-friendly variables object based on input fields
|
|
89
|
-
*
|
|
90
|
-
* @param {string|array|null} bundleHash
|
|
91
|
-
* @param {string|array|null} key
|
|
92
|
-
* @param {string|array|null} value
|
|
93
|
-
* @param {boolean|null} latest
|
|
94
|
-
* @return {{}}
|
|
95
|
-
*/
|
|
96
|
-
static createVariables ( {
|
|
97
|
-
bundleHash = null,
|
|
98
|
-
key = null,
|
|
99
|
-
value = null,
|
|
100
|
-
latest = true
|
|
101
|
-
} ) {
|
|
102
|
-
|
|
103
|
-
const variables = {
|
|
104
|
-
latest: latest
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
if ( bundleHash ) {
|
|
108
|
-
variables[ typeof bundleHash === 'string' ? 'bundleHash' : 'bundleHashes' ] = bundleHash;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if ( key ) {
|
|
112
|
-
variables[ typeof key === 'string' ? 'key' : 'keys' ] = key;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if ( value ) {
|
|
116
|
-
variables[ typeof value === 'string' ? 'value' : 'values' ] = value;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return variables;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
90
|
}
|
|
@@ -45,19 +45,23 @@ 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'
|
|
49
|
-
import ResponseWalletList from '../response/ResponseWalletList'
|
|
50
|
-
import { gql } from '@
|
|
48
|
+
import Query from './Query'
|
|
49
|
+
import ResponseWalletList from '../response/ResponseWalletList'
|
|
50
|
+
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Query for getting a list of Wallets
|
|
54
54
|
*/
|
|
55
55
|
export default class QueryWalletList extends Query {
|
|
56
|
+
/**
|
|
57
|
+
* @param {UrqlClientWrapper} graphQLClient
|
|
58
|
+
* @param {KnishIOClient} knishIOClient
|
|
59
|
+
*/
|
|
60
|
+
constructor (graphQLClient, knishIOClient) {
|
|
61
|
+
super(graphQLClient, knishIOClient)
|
|
56
62
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
this.$__query = gql`query( $address: String, $bundleHash: String, $token: String, $position: String, $unspent: Boolean ) {
|
|
60
|
-
Wallet( address: $address, bundleHash: $bundleHash, token: $token, position: $position, unspent: $unspent ) {
|
|
63
|
+
this.$__query = gql`query( $bundleHash: String, $tokenSlug: String ) {
|
|
64
|
+
Wallet( bundleHash: $bundleHash, tokenSlug: $tokenSlug ) {
|
|
61
65
|
address,
|
|
62
66
|
bundleHash,
|
|
63
67
|
token {
|
|
@@ -66,10 +70,6 @@ export default class QueryWalletList extends Query {
|
|
|
66
70
|
fungibility,
|
|
67
71
|
supply
|
|
68
72
|
},
|
|
69
|
-
molecules {
|
|
70
|
-
molecularHash,
|
|
71
|
-
createdAt
|
|
72
|
-
}
|
|
73
73
|
tokenSlug,
|
|
74
74
|
batchId,
|
|
75
75
|
position,
|
|
@@ -87,7 +87,7 @@ export default class QueryWalletList extends Query {
|
|
|
87
87
|
amount
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
}
|
|
90
|
+
}`
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
|
@@ -96,11 +96,10 @@ export default class QueryWalletList extends Query {
|
|
|
96
96
|
* @param {object} json
|
|
97
97
|
* @return {ResponseWalletList}
|
|
98
98
|
*/
|
|
99
|
-
createResponse (
|
|
100
|
-
return new ResponseWalletList(
|
|
99
|
+
createResponse (json) {
|
|
100
|
+
return new ResponseWalletList({
|
|
101
101
|
query: this,
|
|
102
102
|
json
|
|
103
|
-
}
|
|
103
|
+
})
|
|
104
104
|
}
|
|
105
|
-
|
|
106
105
|
}
|