@wishknish/knishio-client-ts 0.7.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/LICENSE +674 -0
- package/README.md +425 -0
- package/dist/index.cjs +9961 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.iife.js +32241 -0
- package/dist/index.iife.js.map +1 -0
- package/dist/index.js +9853 -0
- package/dist/index.js.map +1 -0
- package/package.json +113 -0
- package/src/AuthToken.ts +214 -0
- package/src/KnishIOClient.ts +2020 -0
- package/src/constants.ts +398 -0
- package/src/core/Atom.ts +646 -0
- package/src/core/AtomMeta.ts +278 -0
- package/src/core/Meta.ts +428 -0
- package/src/core/Molecule.ts +825 -0
- package/src/core/PolicyMeta.ts +130 -0
- package/src/core/TokenUnit.ts +148 -0
- package/src/core/Wallet.ts +467 -0
- package/src/exception/AtomIndexException.ts +97 -0
- package/src/exception/AtomsMissingException.ts +109 -0
- package/src/exception/AuthorizationRejectedException.ts +63 -0
- package/src/exception/BalanceInsufficientException.ts +58 -0
- package/src/exception/BaseException.ts +275 -0
- package/src/exception/BatchIdException.ts +58 -0
- package/src/exception/CodeException.ts +119 -0
- package/src/exception/DecryptionKeyException.ts +65 -0
- package/src/exception/InvalidResponseException.ts +112 -0
- package/src/exception/MetaMissingException.ts +58 -0
- package/src/exception/MolecularHashMismatchException.ts +115 -0
- package/src/exception/MolecularHashMissingException.ts +58 -0
- package/src/exception/NegativeAmountException.ts +58 -0
- package/src/exception/PolicyInvalidException.ts +58 -0
- package/src/exception/SignatureMalformedException.ts +58 -0
- package/src/exception/SignatureMismatchException.ts +98 -0
- package/src/exception/StackableUnitAmountException.ts +65 -0
- package/src/exception/StackableUnitDecimalsException.ts +65 -0
- package/src/exception/TransferBalanceException.ts +98 -0
- package/src/exception/TransferMalformedException.ts +58 -0
- package/src/exception/TransferMismatchedException.ts +58 -0
- package/src/exception/TransferRemainderException.ts +58 -0
- package/src/exception/TransferToSelfException.ts +58 -0
- package/src/exception/TransferUnbalancedException.ts +58 -0
- package/src/exception/UnauthenticatedException.ts +147 -0
- package/src/exception/WalletCredentialException.ts +108 -0
- package/src/exception/WalletShadowException.ts +65 -0
- package/src/exception/WrongTokenTypeException.ts +58 -0
- package/src/exception/index.ts +272 -0
- package/src/index.ts +512 -0
- package/src/instance/rules/Callback.ts +257 -0
- package/src/instance/rules/Condition.ts +96 -0
- package/src/instance/rules/Meta.ts +163 -0
- package/src/instance/rules/Rule.ts +29 -0
- package/src/instance/rules/exception/RuleArgumentException.ts +65 -0
- package/src/libraries/CheckMolecule.ts +581 -0
- package/src/libraries/Decimal.ts +94 -0
- package/src/libraries/Dot.ts +202 -0
- package/src/libraries/GraphQLClient.ts +276 -0
- package/src/libraries/Hex.ts +155 -0
- package/src/libraries/UrqlClientWrapper.ts +336 -0
- package/src/libraries/array.ts +91 -0
- package/src/libraries/crypto.ts +816 -0
- package/src/libraries/strings.ts +458 -0
- package/src/mutation/Mutation.ts +103 -0
- package/src/mutation/MutationActiveSession.ts +108 -0
- package/src/mutation/MutationClaimShadowWallet.ts +91 -0
- package/src/mutation/MutationCreateIdentifier.ts +86 -0
- package/src/mutation/MutationCreateMeta.ts +92 -0
- package/src/mutation/MutationCreateRule.ts +90 -0
- package/src/mutation/MutationCreateToken.ts +92 -0
- package/src/mutation/MutationCreateWallet.ts +78 -0
- package/src/mutation/MutationDepositBufferToken.ts +72 -0
- package/src/mutation/MutationLinkIdentifier.ts +87 -0
- package/src/mutation/MutationProposeMolecule.ts +147 -0
- package/src/mutation/MutationRequestAuthorization.ts +77 -0
- package/src/mutation/MutationRequestAuthorizationGuest.ts +85 -0
- package/src/mutation/MutationRequestTokens.ts +98 -0
- package/src/mutation/MutationTransferTokens.ts +87 -0
- package/src/mutation/MutationWithdrawBufferToken.ts +73 -0
- package/src/query/Query.ts +187 -0
- package/src/query/QueryActiveSession.ts +89 -0
- package/src/query/QueryAtom.ts +275 -0
- package/src/query/QueryBalance.ts +102 -0
- package/src/query/QueryBatch.ts +145 -0
- package/src/query/QueryBatchHistory.ts +86 -0
- package/src/query/QueryContinuId.ts +91 -0
- package/src/query/QueryMetaType.ts +177 -0
- package/src/query/QueryMetaTypeViaAtom.ts +199 -0
- package/src/query/QueryPolicy.ts +91 -0
- package/src/query/QueryToken.ts +90 -0
- package/src/query/QueryUserActivity.ts +153 -0
- package/src/query/QueryWalletBundle.ts +92 -0
- package/src/query/QueryWalletList.ts +106 -0
- package/src/response/EnhancedResponse.ts +345 -0
- package/src/response/Response.ts +254 -0
- package/src/response/ResponseActiveSession.ts +72 -0
- package/src/response/ResponseAtom.ts +132 -0
- package/src/response/ResponseAuthorizationGuest.ts +119 -0
- package/src/response/ResponseBalance.ts +153 -0
- package/src/response/ResponseClaimShadowWallet.ts +56 -0
- package/src/response/ResponseContinuId.ts +101 -0
- package/src/response/ResponseCreateIdentifier.ts +56 -0
- package/src/response/ResponseCreateMeta.ts +58 -0
- package/src/response/ResponseCreateRule.ts +56 -0
- package/src/response/ResponseCreateToken.ts +58 -0
- package/src/response/ResponseCreateWallet.ts +58 -0
- package/src/response/ResponseLinkIdentifier.ts +87 -0
- package/src/response/ResponseMetaBatch.ts +72 -0
- package/src/response/ResponseMetaType.ts +108 -0
- package/src/response/ResponseMetaTypeViaAtom.ts +108 -0
- package/src/response/ResponsePolicy.ts +90 -0
- package/src/response/ResponseProposeMolecule.ts +155 -0
- package/src/response/ResponseQueryActiveSession.ts +105 -0
- package/src/response/ResponseQueryUserActivity.ts +89 -0
- package/src/response/ResponseRequestAuthorization.ts +100 -0
- package/src/response/ResponseRequestAuthorizationGuest.ts +133 -0
- package/src/response/ResponseRequestTokens.ts +58 -0
- package/src/response/ResponseTransferTokens.ts +72 -0
- package/src/response/ResponseWalletBundle.ts +95 -0
- package/src/response/ResponseWalletList.ts +165 -0
- package/src/schemas/index.ts +457 -0
- package/src/subscribe/ActiveSessionSubscribe.ts +72 -0
- package/src/subscribe/ActiveWalletSubscribe.ts +99 -0
- package/src/subscribe/CreateMoleculeSubscribe.ts +106 -0
- package/src/subscribe/Subscribe.ts +182 -0
- package/src/subscribe/WalletStatusSubscribe.ts +70 -0
- package/src/subscribe/index.ts +59 -0
- package/src/types/assertions.ts +722 -0
- package/src/types/client.ts +567 -0
- package/src/types/crypto.ts +541 -0
- package/src/types/graphql.ts +630 -0
- package/src/types/guards.ts +659 -0
- package/src/types/index.ts +614 -0
- package/src/types/response.ts +133 -0
- package/src/types/template-literals.ts +382 -0
- package/src/validation/UNIVERSAL_CONFIGURATION_INTERFACES.ts +580 -0
- package/src/validation/ValidationService.ts +607 -0
- package/src/validation/schemas.ts +447 -0
- package/src/versions/HashAtom.ts +170 -0
- package/src/versions/Version4.ts +120 -0
- package/src/versions/index.ts +80 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/*
|
|
2
|
+
(
|
|
3
|
+
(/(
|
|
4
|
+
(//(
|
|
5
|
+
(///(
|
|
6
|
+
(/////(
|
|
7
|
+
(//////( )
|
|
8
|
+
(////////( (/)
|
|
9
|
+
(////////( (///)
|
|
10
|
+
(//////////( (////)
|
|
11
|
+
(//////////( (//////)
|
|
12
|
+
(////////////( (///////)
|
|
13
|
+
(/////////////( (/////////)
|
|
14
|
+
(//////////////( (///////////)
|
|
15
|
+
(///////////////( (/////////////)
|
|
16
|
+
(////////////////( (//////////////)
|
|
17
|
+
((((((((((((((((((( (((((((((((((((
|
|
18
|
+
((((((((((((((((((( ((((((((((((((
|
|
19
|
+
((((((((((((((((((( ((((((((((((((
|
|
20
|
+
(((((((((((((((((((( (((((((((((((
|
|
21
|
+
(((((((((((((((((((( ((((((((((((
|
|
22
|
+
((((((((((((((((((( ((((((((((((
|
|
23
|
+
((((((((((((((((((( ((((((((((
|
|
24
|
+
((((((((((((((((((/ (((((((((
|
|
25
|
+
(((((((((((((((((( ((((((((
|
|
26
|
+
((((((((((((((((( (((((((
|
|
27
|
+
(((((((((((((((((( (((((
|
|
28
|
+
################# ##
|
|
29
|
+
################ #
|
|
30
|
+
################# ##
|
|
31
|
+
%################ ###
|
|
32
|
+
###############( ####
|
|
33
|
+
############### ####
|
|
34
|
+
############### ######
|
|
35
|
+
%#############( (#######
|
|
36
|
+
%############# #########
|
|
37
|
+
############( ##########
|
|
38
|
+
########### #############
|
|
39
|
+
######### ##############
|
|
40
|
+
%######
|
|
41
|
+
|
|
42
|
+
Powered by Knish.IO: Connecting a Decentralized World
|
|
43
|
+
|
|
44
|
+
Please visit https://github.com/WishKnish/KnishIO-Client-TS for information.
|
|
45
|
+
|
|
46
|
+
License: https://github.com/WishKnish/KnishIO-Client-TS/blob/master/LICENSE
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
import Query from './Query'
|
|
50
|
+
import ResponseMetaTypeViaAtom from '../response/ResponseMetaTypeViaAtom'
|
|
51
|
+
import type { UrqlClientWrapper } from '../client/GraphQLClient'
|
|
52
|
+
import type KnishIOClient from '../KnishIOClient'
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* QueryMetaTypeViaAtom class - Alternative atom-based meta querying
|
|
56
|
+
* Matches JavaScript SDK QueryMetaTypeViaAtom implementation exactly
|
|
57
|
+
*/
|
|
58
|
+
export default class QueryMetaTypeViaAtom extends Query {
|
|
59
|
+
/**
|
|
60
|
+
* Create new QueryMetaTypeViaAtom instance
|
|
61
|
+
* Matches JavaScript SDK constructor signature exactly
|
|
62
|
+
*/
|
|
63
|
+
constructor(graphQLClient: UrqlClientWrapper, knishIOClient: KnishIOClient) {
|
|
64
|
+
super(graphQLClient, knishIOClient)
|
|
65
|
+
|
|
66
|
+
this.$__query = `query ($metaTypes: [String!], $metaIds: [String!], $values: [String!], $keys: [String!], $latest: Boolean, $filter: [MetaFilter!], $queryArgs: QueryArgs, $countBy: String, $atomValues: [String!], $cellSlugs: [String!] ) {
|
|
67
|
+
MetaTypeViaAtom(
|
|
68
|
+
metaTypes: $metaTypes
|
|
69
|
+
metaIds: $metaIds
|
|
70
|
+
atomValues: $atomValues
|
|
71
|
+
cellSlugs: $cellSlugs
|
|
72
|
+
filter: $filter,
|
|
73
|
+
latest: $latest,
|
|
74
|
+
queryArgs: $queryArgs
|
|
75
|
+
countBy: $countBy
|
|
76
|
+
) {
|
|
77
|
+
metaType,
|
|
78
|
+
instanceCount {
|
|
79
|
+
key,
|
|
80
|
+
value
|
|
81
|
+
},
|
|
82
|
+
instances {
|
|
83
|
+
metaType,
|
|
84
|
+
metaId,
|
|
85
|
+
createdAt,
|
|
86
|
+
metas( values: $values, keys: $keys ) {
|
|
87
|
+
molecularHash,
|
|
88
|
+
position,
|
|
89
|
+
key,
|
|
90
|
+
value,
|
|
91
|
+
createdAt
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
paginatorInfo {
|
|
95
|
+
currentPage,
|
|
96
|
+
total
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}`
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Builds a GraphQL-friendly variables object based on input fields
|
|
104
|
+
* Matches JavaScript SDK createVariables method exactly
|
|
105
|
+
*/
|
|
106
|
+
static createVariables({
|
|
107
|
+
metaType = null,
|
|
108
|
+
metaId = null,
|
|
109
|
+
key = null,
|
|
110
|
+
value = null,
|
|
111
|
+
keys = null,
|
|
112
|
+
values = null,
|
|
113
|
+
atomValues = null,
|
|
114
|
+
latest = null,
|
|
115
|
+
filter = null,
|
|
116
|
+
queryArgs = null,
|
|
117
|
+
countBy = null,
|
|
118
|
+
cellSlug = null
|
|
119
|
+
}: {
|
|
120
|
+
metaType?: string | string[] | null
|
|
121
|
+
metaId?: string | string[] | null
|
|
122
|
+
key?: string | null
|
|
123
|
+
value?: string | null
|
|
124
|
+
keys?: string[] | null
|
|
125
|
+
values?: string[] | null
|
|
126
|
+
atomValues?: string[] | null
|
|
127
|
+
latest?: boolean | null
|
|
128
|
+
filter?: any[] | null
|
|
129
|
+
queryArgs?: any | null
|
|
130
|
+
countBy?: string | null
|
|
131
|
+
cellSlug?: string | string[] | null
|
|
132
|
+
} = {}): Record<string, any> {
|
|
133
|
+
const variables: Record<string, any> = {}
|
|
134
|
+
|
|
135
|
+
if (atomValues) {
|
|
136
|
+
variables.atomValues = atomValues
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (keys) {
|
|
140
|
+
variables.keys = keys
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (values) {
|
|
144
|
+
variables.values = values
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (metaType) {
|
|
148
|
+
variables.metaTypes = typeof metaType === 'string' ? [metaType] : metaType
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (metaId) {
|
|
152
|
+
variables.metaIds = typeof metaId === 'string' ? [metaId] : metaId
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (cellSlug) {
|
|
156
|
+
variables.cellSlugs = typeof cellSlug === 'string' ? [cellSlug] : cellSlug
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (countBy) {
|
|
160
|
+
variables.countBy = countBy
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (filter) {
|
|
164
|
+
variables.filter = filter
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (key && value) {
|
|
168
|
+
variables.filter = variables.filter || []
|
|
169
|
+
variables.filter.push({
|
|
170
|
+
key,
|
|
171
|
+
value,
|
|
172
|
+
comparison: '='
|
|
173
|
+
})
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
variables.latest = latest === true
|
|
177
|
+
|
|
178
|
+
if (queryArgs) {
|
|
179
|
+
if (typeof queryArgs.limit === 'undefined' || queryArgs.limit === 0) {
|
|
180
|
+
queryArgs.limit = '*'
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
variables.queryArgs = queryArgs
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return variables
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Returns a Response object
|
|
191
|
+
* Matches JavaScript SDK createResponse method exactly
|
|
192
|
+
*/
|
|
193
|
+
override createResponse(json: any): ResponseMetaTypeViaAtom {
|
|
194
|
+
return new ResponseMetaTypeViaAtom({
|
|
195
|
+
query: this,
|
|
196
|
+
json
|
|
197
|
+
})
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
(
|
|
3
|
+
(/(
|
|
4
|
+
(//(
|
|
5
|
+
(///(
|
|
6
|
+
(/////(
|
|
7
|
+
(//////( )
|
|
8
|
+
(////////( (/)
|
|
9
|
+
(////////( (///)
|
|
10
|
+
(//////////( (////)
|
|
11
|
+
(//////////( (//////)
|
|
12
|
+
(////////////( (///////)
|
|
13
|
+
(/////////////( (/////////)
|
|
14
|
+
(//////////////( (///////////)
|
|
15
|
+
(///////////////( (/////////////)
|
|
16
|
+
(////////////////( (//////////////)
|
|
17
|
+
((((((((((((((((((( (((((((((((((((
|
|
18
|
+
((((((((((((((((((( ((((((((((((((
|
|
19
|
+
((((((((((((((((((( ((((((((((((((
|
|
20
|
+
(((((((((((((((((((( (((((((((((((
|
|
21
|
+
(((((((((((((((((((( ((((((((((((
|
|
22
|
+
((((((((((((((((((( ((((((((((((
|
|
23
|
+
((((((((((((((((((( ((((((((((
|
|
24
|
+
((((((((((((((((((/ (((((((((
|
|
25
|
+
(((((((((((((((((( ((((((((
|
|
26
|
+
((((((((((((((((( (((((((
|
|
27
|
+
(((((((((((((((((( (((((
|
|
28
|
+
################# ##
|
|
29
|
+
################ #
|
|
30
|
+
################# ##
|
|
31
|
+
%################ ###
|
|
32
|
+
###############( ####
|
|
33
|
+
############### ####
|
|
34
|
+
############### ######
|
|
35
|
+
%#############( (#######
|
|
36
|
+
%############# #########
|
|
37
|
+
############( ##########
|
|
38
|
+
########### #############
|
|
39
|
+
######### ##############
|
|
40
|
+
%######
|
|
41
|
+
|
|
42
|
+
Powered by Knish.IO: Connecting a Decentralized World
|
|
43
|
+
|
|
44
|
+
Please visit https://github.com/WishKnish/KnishIO-Client-TS for information.
|
|
45
|
+
|
|
46
|
+
License: https://github.com/WishKnish/KnishIO-Client-TS/blob/master/LICENSE
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
import Query from './Query'
|
|
50
|
+
import ResponsePolicy from '@/response/ResponsePolicy'
|
|
51
|
+
import { gql } from '@urql/core'
|
|
52
|
+
import type { GraphQLClient as IGraphQLClient } from '@/types'
|
|
53
|
+
import type KnishIOClient from '@/KnishIOClient'
|
|
54
|
+
import type { MetaType, MetaId } from '@/types'
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Query for retrieving Policy information
|
|
58
|
+
*/
|
|
59
|
+
export default class QueryPolicy extends Query {
|
|
60
|
+
/**
|
|
61
|
+
* Constructor
|
|
62
|
+
*/
|
|
63
|
+
constructor(graphQLClient: IGraphQLClient, knishIOClient: KnishIOClient) {
|
|
64
|
+
super(graphQLClient, knishIOClient)
|
|
65
|
+
|
|
66
|
+
this.$__query = gql`
|
|
67
|
+
query($metaType: String, $metaId: String) {
|
|
68
|
+
Policy(metaType: $metaType, metaId: $metaId) {
|
|
69
|
+
molecularHash
|
|
70
|
+
position
|
|
71
|
+
metaType
|
|
72
|
+
metaId
|
|
73
|
+
conditions
|
|
74
|
+
callback
|
|
75
|
+
rule
|
|
76
|
+
createdAt
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
`
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Returns a Response object
|
|
84
|
+
*/
|
|
85
|
+
override createResponse(json: Record<string, any>): ResponsePolicy {
|
|
86
|
+
return new ResponsePolicy({
|
|
87
|
+
query: this,
|
|
88
|
+
json
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/*
|
|
2
|
+
(
|
|
3
|
+
(/(
|
|
4
|
+
(//(
|
|
5
|
+
(///(
|
|
6
|
+
(/////(
|
|
7
|
+
(//////( )
|
|
8
|
+
(////////( (/)
|
|
9
|
+
(////////( (///)
|
|
10
|
+
(//////////( (////)
|
|
11
|
+
(//////////( (//////)
|
|
12
|
+
(////////////( (///////)
|
|
13
|
+
(/////////////( (/////////)
|
|
14
|
+
(//////////////( (///////////)
|
|
15
|
+
(///////////////( (/////////////)
|
|
16
|
+
(////////////////( (//////////////)
|
|
17
|
+
((((((((((((((((((( (((((((((((((((
|
|
18
|
+
((((((((((((((((((( ((((((((((((((
|
|
19
|
+
((((((((((((((((((( ((((((((((((((
|
|
20
|
+
(((((((((((((((((((( (((((((((((((
|
|
21
|
+
(((((((((((((((((((( ((((((((((((
|
|
22
|
+
((((((((((((((((((( ((((((((((((
|
|
23
|
+
((((((((((((((((((( ((((((((((
|
|
24
|
+
((((((((((((((((((/ (((((((((
|
|
25
|
+
(((((((((((((((((( ((((((((
|
|
26
|
+
((((((((((((((((( (((((((
|
|
27
|
+
(((((((((((((((((( (((((
|
|
28
|
+
################# ##
|
|
29
|
+
################ #
|
|
30
|
+
################# ##
|
|
31
|
+
%################ ###
|
|
32
|
+
###############( ####
|
|
33
|
+
############### ####
|
|
34
|
+
############### ######
|
|
35
|
+
%#############( (#######
|
|
36
|
+
%############# #########
|
|
37
|
+
############( ##########
|
|
38
|
+
########### #############
|
|
39
|
+
######### ##############
|
|
40
|
+
%######
|
|
41
|
+
|
|
42
|
+
Powered by Knish.IO: Connecting a Decentralized World
|
|
43
|
+
|
|
44
|
+
Please visit https://github.com/WishKnish/KnishIO-Client-TS for information.
|
|
45
|
+
|
|
46
|
+
License: https://github.com/WishKnish/KnishIO-Client-TS/blob/master/LICENSE
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
import Query from './Query'
|
|
50
|
+
import Response from '@/response/Response'
|
|
51
|
+
import { gql } from '@urql/core'
|
|
52
|
+
import type { GraphQLClient as IGraphQLClient } from '@/types'
|
|
53
|
+
import type KnishIOClient from '@/KnishIOClient'
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Query for getting token information
|
|
57
|
+
*/
|
|
58
|
+
export default class QueryToken extends Query {
|
|
59
|
+
/**
|
|
60
|
+
* Constructor
|
|
61
|
+
*/
|
|
62
|
+
constructor(graphQLClient: IGraphQLClient, knishIOClient: KnishIOClient) {
|
|
63
|
+
super(graphQLClient, knishIOClient)
|
|
64
|
+
|
|
65
|
+
this.$__query = gql`
|
|
66
|
+
query($slug: String, $slugs: [String!], $limit: Int, $order: String) {
|
|
67
|
+
Token(slug: $slug, slugs: $slugs, limit: $limit, order: $order) {
|
|
68
|
+
slug
|
|
69
|
+
name
|
|
70
|
+
fungibility
|
|
71
|
+
supply
|
|
72
|
+
decimals
|
|
73
|
+
amount
|
|
74
|
+
icon
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
`
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Creates a Response object
|
|
82
|
+
*/
|
|
83
|
+
override createResponse(json: Record<string, any>): Response {
|
|
84
|
+
return new Response({
|
|
85
|
+
query: this,
|
|
86
|
+
json,
|
|
87
|
+
dataKey: 'data.Token'
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/*
|
|
2
|
+
(
|
|
3
|
+
(/(
|
|
4
|
+
(//(
|
|
5
|
+
(///(
|
|
6
|
+
(/////(
|
|
7
|
+
(//////( )
|
|
8
|
+
(////////( (/)
|
|
9
|
+
(////////( (///)
|
|
10
|
+
(//////////( (////)
|
|
11
|
+
(//////////( (//////)
|
|
12
|
+
(////////////( (///////)
|
|
13
|
+
(/////////////( (/////////)
|
|
14
|
+
(//////////////( (///////////)
|
|
15
|
+
(///////////////( (/////////////)
|
|
16
|
+
(////////////////( (//////////////)
|
|
17
|
+
((((((((((((((((((( (((((((((((((((
|
|
18
|
+
((((((((((((((((((( ((((((((((((((
|
|
19
|
+
((((((((((((((((((( ((((((((((((((
|
|
20
|
+
(((((((((((((((((((( (((((((((((((
|
|
21
|
+
(((((((((((((((((((( ((((((((((((
|
|
22
|
+
((((((((((((((((((( ((((((((((((
|
|
23
|
+
((((((((((((((((((( ((((((((((
|
|
24
|
+
((((((((((((((((((/ (((((((((
|
|
25
|
+
(((((((((((((((((( ((((((((
|
|
26
|
+
((((((((((((((((( (((((((
|
|
27
|
+
(((((((((((((((((( (((((
|
|
28
|
+
################# ##
|
|
29
|
+
################ #
|
|
30
|
+
################# ##
|
|
31
|
+
%################ ###
|
|
32
|
+
###############( ####
|
|
33
|
+
############### ####
|
|
34
|
+
############### ######
|
|
35
|
+
%#############( (#######
|
|
36
|
+
%############# #########
|
|
37
|
+
############( ##########
|
|
38
|
+
########### #############
|
|
39
|
+
######### ##############
|
|
40
|
+
%######
|
|
41
|
+
|
|
42
|
+
Powered by Knish.IO: Connecting a Decentralized World
|
|
43
|
+
|
|
44
|
+
Please visit https://github.com/WishKnish/KnishIO-Client-TS for information.
|
|
45
|
+
|
|
46
|
+
License: https://github.com/WishKnish/KnishIO-Client-TS/blob/master/LICENSE
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
import Query from './Query'
|
|
50
|
+
import ResponseQueryUserActivity from '@/response/ResponseQueryUserActivity'
|
|
51
|
+
import { gql } from '@urql/core'
|
|
52
|
+
import type { GraphQLClient as IGraphQLClient } from '@/types'
|
|
53
|
+
import type KnishIOClient from '@/KnishIOClient'
|
|
54
|
+
import type { BundleHash, MetaType, MetaId } from '@/types'
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Query for retrieving information about user activity
|
|
58
|
+
*/
|
|
59
|
+
export default class QueryUserActivity extends Query {
|
|
60
|
+
/**
|
|
61
|
+
* Constructor
|
|
62
|
+
*/
|
|
63
|
+
constructor(graphQLClient: IGraphQLClient, knishIOClient: KnishIOClient) {
|
|
64
|
+
super(graphQLClient, knishIOClient)
|
|
65
|
+
|
|
66
|
+
this.$__query = gql`
|
|
67
|
+
query UserActivity(
|
|
68
|
+
$bundleHash: String
|
|
69
|
+
$metaType: String
|
|
70
|
+
$metaId: String
|
|
71
|
+
$ipAddress: String
|
|
72
|
+
$browser: String
|
|
73
|
+
$osCpu: String
|
|
74
|
+
$resolution: String
|
|
75
|
+
$timeZone: String
|
|
76
|
+
$countBy: [CountByUserActivity]
|
|
77
|
+
$interval: span
|
|
78
|
+
) {
|
|
79
|
+
UserActivity(
|
|
80
|
+
bundleHash: $bundleHash
|
|
81
|
+
metaType: $metaType
|
|
82
|
+
metaId: $metaId
|
|
83
|
+
ipAddress: $ipAddress
|
|
84
|
+
browser: $browser
|
|
85
|
+
osCpu: $osCpu
|
|
86
|
+
resolution: $resolution
|
|
87
|
+
timeZone: $timeZone
|
|
88
|
+
countBy: $countBy
|
|
89
|
+
interval: $interval
|
|
90
|
+
) {
|
|
91
|
+
createdAt
|
|
92
|
+
bundleHash
|
|
93
|
+
metaType
|
|
94
|
+
metaId
|
|
95
|
+
instances {
|
|
96
|
+
bundleHash
|
|
97
|
+
metaType
|
|
98
|
+
metaId
|
|
99
|
+
jsonData
|
|
100
|
+
createdAt
|
|
101
|
+
updatedAt
|
|
102
|
+
}
|
|
103
|
+
instanceCount {
|
|
104
|
+
...SubFields
|
|
105
|
+
...Recursive
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
fragment SubFields on InstanceCountType {
|
|
111
|
+
id
|
|
112
|
+
count
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
fragment Recursive on InstanceCountType {
|
|
116
|
+
instances {
|
|
117
|
+
...SubFields
|
|
118
|
+
instances {
|
|
119
|
+
...SubFields
|
|
120
|
+
instances {
|
|
121
|
+
...SubFields
|
|
122
|
+
instances {
|
|
123
|
+
...SubFields
|
|
124
|
+
instances {
|
|
125
|
+
...SubFields
|
|
126
|
+
instances {
|
|
127
|
+
...SubFields
|
|
128
|
+
instances {
|
|
129
|
+
...SubFields
|
|
130
|
+
instances {
|
|
131
|
+
...SubFields
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
`
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Returns a Response object
|
|
146
|
+
*/
|
|
147
|
+
override createResponse(json: Record<string, any>): ResponseQueryUserActivity {
|
|
148
|
+
return new ResponseQueryUserActivity({
|
|
149
|
+
query: this,
|
|
150
|
+
json
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
(
|
|
3
|
+
(/(
|
|
4
|
+
(//(
|
|
5
|
+
(///(
|
|
6
|
+
(/////(
|
|
7
|
+
(//////( )
|
|
8
|
+
(////////( (/)
|
|
9
|
+
(////////( (///)
|
|
10
|
+
(//////////( (////)
|
|
11
|
+
(//////////( (//////)
|
|
12
|
+
(////////////( (///////)
|
|
13
|
+
(/////////////( (/////////)
|
|
14
|
+
(//////////////( (///////////)
|
|
15
|
+
(///////////////( (/////////////)
|
|
16
|
+
(////////////////( (//////////////)
|
|
17
|
+
((((((((((((((((((( (((((((((((((((
|
|
18
|
+
((((((((((((((((((( ((((((((((((((
|
|
19
|
+
((((((((((((((((((( ((((((((((((((
|
|
20
|
+
(((((((((((((((((((( (((((((((((((
|
|
21
|
+
(((((((((((((((((((( ((((((((((((
|
|
22
|
+
((((((((((((((((((( ((((((((((((
|
|
23
|
+
((((((((((((((((((( ((((((((((
|
|
24
|
+
((((((((((((((((((/ (((((((((
|
|
25
|
+
(((((((((((((((((( ((((((((
|
|
26
|
+
((((((((((((((((( (((((((
|
|
27
|
+
(((((((((((((((((( (((((
|
|
28
|
+
################# ##
|
|
29
|
+
################ #
|
|
30
|
+
################# ##
|
|
31
|
+
%################ ###
|
|
32
|
+
###############( ####
|
|
33
|
+
############### ####
|
|
34
|
+
############### ######
|
|
35
|
+
%#############( (#######
|
|
36
|
+
%############# #########
|
|
37
|
+
############( ##########
|
|
38
|
+
########### #############
|
|
39
|
+
######### ##############
|
|
40
|
+
%######
|
|
41
|
+
|
|
42
|
+
Powered by Knish.IO: Connecting a Decentralized World
|
|
43
|
+
|
|
44
|
+
Please visit https://github.com/WishKnish/KnishIO-Client-TS for information.
|
|
45
|
+
|
|
46
|
+
License: https://github.com/WishKnish/KnishIO-Client-TS/blob/master/LICENSE
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
import Query from './Query'
|
|
50
|
+
import ResponseWalletBundle from '../response/ResponseWalletBundle'
|
|
51
|
+
import type GraphQLClient from '../libraries/GraphQLClient'
|
|
52
|
+
import type KnishIOClient from '../KnishIOClient'
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Query for retrieving information about Wallet Bundles
|
|
56
|
+
* Matches JavaScript SDK QueryWalletBundle implementation exactly
|
|
57
|
+
*/
|
|
58
|
+
export default class QueryWalletBundle extends Query {
|
|
59
|
+
/**
|
|
60
|
+
* Create QueryWalletBundle instance
|
|
61
|
+
*/
|
|
62
|
+
constructor(graphQLClient: GraphQLClient, knishIOClient: KnishIOClient) {
|
|
63
|
+
super(graphQLClient, knishIOClient)
|
|
64
|
+
|
|
65
|
+
this.$__query = `
|
|
66
|
+
query($bundleHashes: [String!]) {
|
|
67
|
+
WalletBundle(bundleHashes: $bundleHashes) {
|
|
68
|
+
bundleHash,
|
|
69
|
+
metas {
|
|
70
|
+
molecularHash,
|
|
71
|
+
position,
|
|
72
|
+
key,
|
|
73
|
+
value,
|
|
74
|
+
createdAt
|
|
75
|
+
},
|
|
76
|
+
createdAt
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
`
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Builds a Response object out of a JSON object
|
|
84
|
+
* Matches JavaScript SDK createResponse method signature exactly
|
|
85
|
+
*/
|
|
86
|
+
override createResponse(json: Record<string, unknown>): ResponseWalletBundle {
|
|
87
|
+
return new ResponseWalletBundle({
|
|
88
|
+
query: this,
|
|
89
|
+
json
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
}
|