@wishknish/knishio-client-js 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/client.iife.js +41 -90
  2. package/package.json +19 -18
  3. package/src/AuthToken.js +1 -1
  4. package/src/KnishIOClient.js +8 -8
  5. package/src/Wallet.js +41 -3
  6. package/src/libraries/strings.js +4 -2
  7. package/src/libraries/urql/UrqlClientWrapper.js +166 -0
  8. package/src/mutation/MutationActiveSession.js +4 -4
  9. package/src/mutation/MutationLinkIdentifier.js +4 -4
  10. package/src/mutation/MutationProposeMolecule.js +4 -4
  11. package/src/mutation/MutationRequestAuthorizationGuest.js +4 -4
  12. package/src/query/Query.js +3 -3
  13. package/src/query/QueryActiveSession.js +4 -4
  14. package/src/query/QueryAtom.js +4 -4
  15. package/src/query/QueryBalance.js +4 -4
  16. package/src/query/QueryBatch.js +4 -4
  17. package/src/query/QueryBatchHistory.js +4 -4
  18. package/src/query/QueryContinuId.js +4 -4
  19. package/src/query/QueryMetaType.js +4 -4
  20. package/src/query/QueryMetaTypeViaAtom.js +4 -4
  21. package/src/query/QueryPolicy.js +4 -4
  22. package/src/query/QueryToken.js +4 -4
  23. package/src/query/QueryUserActivity.js +4 -4
  24. package/src/query/QueryWalletBundle.js +4 -4
  25. package/src/query/QueryWalletList.js +4 -4
  26. package/src/subscribe/ActiveSessionSubscribe.js +3 -3
  27. package/src/subscribe/ActiveWalletSubscribe.js +3 -3
  28. package/src/subscribe/CreateMoleculeSubscribe.js +3 -3
  29. package/src/subscribe/Subscribe.js +3 -3
  30. package/src/subscribe/WalletStatusSubscribe.js +3 -3
  31. package/src/types/index.js +2 -0
  32. package/src/libraries/apollo/ApolloClientWrapper.js +0 -143
  33. package/src/libraries/apollo/CipherLink.js +0 -116
  34. package/src/libraries/apollo/Client.js +0 -154
  35. package/src/libraries/apollo/ErrorHandler.js +0 -32
  36. package/src/libraries/apollo/SubscriptionManager.js +0 -60
  37. package/src/libraries/apollo/operationUtils.js +0 -26
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wishknish/knishio-client-js",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "productName": "Knish.IO Javascript SDK Client",
5
5
  "description": "JavaScript implementation of the Knish.IO SDK to consume Knish.IO GraphQL APIs.",
6
6
  "license": "GPL-3.0-or-later",
@@ -40,31 +40,32 @@
40
40
  "graphql"
41
41
  ],
42
42
  "dependencies": {
43
- "@apollo/client": "3.12.8",
44
- "@noble/post-quantum": "^0.3.0",
45
- "@thumbmarkjs/thumbmarkjs": "^0.16.1",
46
- "graphql": "^16.9.0",
47
- "graphql-ws": "^5.16.2",
43
+ "@noble/post-quantum": "^0.4.0",
44
+ "@thumbmarkjs/thumbmarkjs": "^0.19.1",
45
+ "@urql/core": "^5.1.0",
46
+ "graphql": "^16.10.0",
47
+ "graphql-ws": "^6.0.4",
48
48
  "isomorphic-fetch": "^3.0.0",
49
- "jssha": "^3.3.0"
49
+ "jssha": "^3.3.1",
50
+ "wonka": "^6.3.4"
50
51
  },
51
52
  "devDependencies": {
52
53
  "@jest/globals": "^29.7.0",
53
54
  "@rollup/plugin-babel": "^6.0.4",
54
- "@rollup/plugin-commonjs": "^25.0.7",
55
- "@rollup/plugin-node-resolve": "^15.2.3",
55
+ "@rollup/plugin-commonjs": "^28.0.2",
56
+ "@rollup/plugin-node-resolve": "^16.0.0",
57
+ "buffer": "^6.0.3",
56
58
  "esbuild-jest": "^0.5.0",
57
- "eslint": "^8.0.1",
59
+ "eslint": "^8.57.1",
58
60
  "eslint-config-standard": "^17.1.0",
59
- "eslint-plugin-import": "^2.25.2",
60
- "eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
61
- "eslint-plugin-promise": "^6.0.0",
62
- "eslint-plugin-vue": "^9.23.0",
63
- "esmock": "^2.6.7",
61
+ "eslint-plugin-import": "^2.31.0",
62
+ "eslint-plugin-n": "^16.6.2",
63
+ "eslint-plugin-promise": "^6.6.0",
64
+ "eslint-plugin-vue": "^9.32.0",
65
+ "esmock": "^2.7.0",
64
66
  "jest": "^29.7.0",
65
- "rollup": "^4.13.0",
66
- "vite": "^5.1.6",
67
- "vite-plugin-node-polyfills": "^0.21.0"
67
+ "rollup": "^4.34.8",
68
+ "vite": "^6.1.1"
68
69
  },
69
70
  "browserslist": [
70
71
  "> 1%",
package/src/AuthToken.js CHANGED
@@ -170,7 +170,7 @@ export default class AuthToken {
170
170
  }
171
171
 
172
172
  /**
173
- * Get auth data for the final client (apollo)
173
+ * Get auth data for the final GraphQL client
174
174
  * @return {{wallet: Wallet, token: string, pubkey: string}}
175
175
  */
176
176
  getAuthData () {
@@ -98,7 +98,7 @@ import {
98
98
  getFingerprint,
99
99
  getFingerprintData
100
100
  } from '@thumbmarkjs/thumbmarkjs'
101
- import ApolloClientWrapper from './libraries/apollo/ApolloClientWrapper'
101
+ import UrqlClientWrapper from "./libraries/urql/UrqlClientWrapper";
102
102
 
103
103
  /**
104
104
  * Base client class providing a powerful but user-friendly wrapper
@@ -111,7 +111,7 @@ export default class KnishIOClient {
111
111
  * @param {string} uri
112
112
  * @param {string|null} cellSlug
113
113
  * @param {object|null} socket
114
- * @param {ApolloClientWrapper|null} client
114
+ * @param {UrqlClientWrapper|null} client
115
115
  * @param {number} serverSdkVersion
116
116
  * @param {boolean} logging
117
117
  */
@@ -139,7 +139,7 @@ export default class KnishIOClient {
139
139
  * @param {string|[]} uri
140
140
  * @param {string|null} cellSlug
141
141
  * @param {object|null} socket
142
- * @param {ApolloClientWrapper|null} client
142
+ * @param {UrqlClientWrapper|null} client
143
143
  * @param {number} serverSdkVersion
144
144
  * @param {boolean} logging
145
145
  */
@@ -171,7 +171,7 @@ export default class KnishIOClient {
171
171
 
172
172
  this.log('info', `KnishIOClient::initialize() - Initializing new Knish.IO client session for SDK version ${ serverSdkVersion }...`)
173
173
 
174
- this.$__client = client || new ApolloClientWrapper({
174
+ this.$__client = client || new UrqlClientWrapper({
175
175
  socket: {
176
176
  ...{
177
177
  socketUri: null,
@@ -223,7 +223,7 @@ export default class KnishIOClient {
223
223
  /**
224
224
  * Subscribes the client to the node's broadcast socket
225
225
  *
226
- * @return {ApolloClientWrapper}
226
+ * @return {UrqlClientWrapper}
227
227
  */
228
228
  subscribe () {
229
229
  if (!this.client().getSocketUri()) {
@@ -302,9 +302,9 @@ export default class KnishIOClient {
302
302
  }
303
303
 
304
304
  /**
305
- * Returns the Apollo client class session
305
+ * Returns the GraphQL client class session
306
306
  *
307
- * @return {ApolloClientWrapper}
307
+ * @return {UrqlClientWrapper}
308
308
  */
309
309
  client () {
310
310
  if (!this.$__authInProcess) {
@@ -2166,7 +2166,7 @@ export default class KnishIOClient {
2166
2166
  // Save auth token object to global list
2167
2167
  this.$__authTokenObjects[this.getUri()] = authToken
2168
2168
 
2169
- // Set auth data to apollo client
2169
+ // Set auth data to GraphQL client
2170
2170
  this.client().setAuthData(authToken.getAuthData())
2171
2171
 
2172
2172
  // Save a full auth token object with expireAt key
package/src/Wallet.js CHANGED
@@ -401,10 +401,48 @@ export default class Wallet {
401
401
  async decryptMessage (encryptedData) {
402
402
  const { cipherText, encryptedMessage } = encryptedData
403
403
 
404
- const sharedSecret = MlKEM768.decapsulate(this.deserializeKey(cipherText), this.privkey)
405
- const decryptedUint8 = await this.decryptWithSharedSecret(this.deserializeKey(encryptedMessage), sharedSecret)
404
+ let sharedSecret
405
+ try {
406
+ sharedSecret = MlKEM768.decapsulate(this.deserializeKey(cipherText), this.privkey)
407
+ } catch (e) {
408
+ console.error('Wallet::decryptMessage() - Decapsulation failed', e)
409
+ console.info('Wallet::decryptMessage() - my public key', this.pubkey)
410
+ return null
411
+ }
412
+
413
+ let deserializedEncryptedMessage
414
+ try {
415
+ deserializedEncryptedMessage = this.deserializeKey(encryptedMessage)
416
+ } catch (e) {
417
+ console.warn('Wallet::decryptMessage() - Deserialization failed', e)
418
+ console.info('Wallet::decryptMessage() - my public key', this.pubkey)
419
+ console.info('Wallet::decryptMessage() - our shared secret', sharedSecret)
420
+ return null
421
+ }
422
+
423
+ let decryptedUint8
424
+ try {
425
+ decryptedUint8 = await this.decryptWithSharedSecret(deserializedEncryptedMessage, sharedSecret)
426
+ } catch (e) {
427
+ console.warn('Wallet::decryptMessage() - Decryption failed', e)
428
+ console.info('Wallet::decryptMessage() - my public key', this.pubkey)
429
+ console.info('Wallet::decryptMessage() - our shared secret', sharedSecret)
430
+ console.info('Wallet::decryptMessage() - deserialized encrypted message', deserializedEncryptedMessage)
431
+ return null
432
+ }
433
+
434
+ let decryptedString
435
+ try {
436
+ decryptedString = new TextDecoder().decode(decryptedUint8)
437
+ } catch (e) {
438
+ console.warn('Wallet::decryptMessage() - Decoding failed', e)
439
+ console.info('Wallet::decryptMessage() - my public key', this.pubkey)
440
+ console.info('Wallet::decryptMessage() - our shared secret', sharedSecret)
441
+ console.info('Wallet::decryptMessage() - deserialized encrypted message', deserializedEncryptedMessage)
442
+ console.info('Wallet::decryptMessage() - decrypted Uint8Array', decryptedUint8)
443
+ return null
444
+ }
406
445
 
407
- const decryptedString = new TextDecoder().decode(decryptedUint8)
408
446
  return JSON.parse(decryptedString)
409
447
  }
410
448
 
@@ -118,7 +118,8 @@ export function hexStringToBuffer (hexString) {
118
118
  * @return {string}
119
119
  */
120
120
  export function hexToBase64 (string) {
121
- return Buffer.from(string, 'hex').toString('base64')
121
+ const bytes = hexStringToBuffer(string)
122
+ return btoa(String.fromCharCode.apply(null, bytes))
122
123
  }
123
124
 
124
125
  /**
@@ -128,7 +129,8 @@ export function hexToBase64 (string) {
128
129
  * @return {string}
129
130
  */
130
131
  export function base64ToHex (string) {
131
- return Buffer.from(string, 'base64').toString('hex')
132
+ const bytes = new Uint8Array(atob(string).split('').map(char => char.charCodeAt(0)))
133
+ return bufferToHexString(bytes)
132
134
  }
133
135
 
134
136
  /**
@@ -0,0 +1,166 @@
1
+ import {
2
+ createClient,
3
+ subscriptionExchange,
4
+ cacheExchange,
5
+ fetchExchange
6
+ } from '@urql/core'
7
+ import { createClient as createWSClient } from 'graphql-ws'
8
+ import { pipe, map } from 'wonka'
9
+
10
+ class UrqlClientWrapper {
11
+ constructor ({ serverUri, socket = null, encrypt = false }) {
12
+ this.$__client = this.createUrqlClient({ serverUri, socket, encrypt })
13
+ this.$__authToken = ''
14
+ this.$__pubkey = null
15
+ this.$__wallet = null
16
+ this.serverUri = serverUri
17
+ this.soketi = socket
18
+ this.cipherLink = !!encrypt
19
+ this.$__subscriptionManager = new Map()
20
+ }
21
+
22
+ createUrqlClient ({ serverUri, socket, encrypt }) {
23
+ const exchanges = [cacheExchange, fetchExchange]
24
+
25
+ // Add subscription support if socket is configured
26
+ if (socket && socket.socketUri) {
27
+ const wsClient = createWSClient({
28
+ url: socket.socketUri,
29
+ connectionParams: () => ({
30
+ authToken: this.$__authToken
31
+ })
32
+ })
33
+
34
+ exchanges.push(subscriptionExchange({
35
+ forwardSubscription: operation => ({
36
+ subscribe: sink => {
37
+ const disposable = wsClient.subscribe(operation, sink)
38
+ return { unsubscribe: disposable }
39
+ }
40
+ })
41
+ }))
42
+ }
43
+
44
+ return createClient({
45
+ url: serverUri,
46
+ exchanges,
47
+ fetchOptions: () => ({
48
+ headers: {
49
+ 'X-Auth-Token': this.$__authToken
50
+ }
51
+ })
52
+ })
53
+ }
54
+
55
+ setAuthData ({ token, pubkey, wallet }) {
56
+ this.$__authToken = token
57
+ this.$__pubkey = pubkey
58
+ this.$__wallet = wallet
59
+
60
+ // Recreate client with new auth data
61
+ this.$__client = this.createUrqlClient({
62
+ serverUri: this.serverUri,
63
+ socket: this.soketi,
64
+ encrypt: !!this.cipherLink
65
+ })
66
+ }
67
+
68
+ async query (request) {
69
+ const { query, variables } = request
70
+ const result = await this.$__client.query(query, variables).toPromise()
71
+ return this.formatResponse(result)
72
+ }
73
+
74
+ async mutate (request) {
75
+ const { mutation, variables } = request
76
+ const result = await this.$__client.mutation(mutation, variables).toPromise()
77
+ return this.formatResponse(result)
78
+ }
79
+
80
+ subscribe (request, closure) {
81
+ const { query, variables, operationName } = request
82
+
83
+ const { unsubscribe } = pipe(
84
+ this.$__client.subscription(query, variables),
85
+ map(result => {
86
+ closure(this.formatResponse(result))
87
+ })
88
+ ).subscribe(() => {})
89
+
90
+ // Store subscription for later cleanup
91
+ this.$__subscriptionManager.set(operationName, { unsubscribe })
92
+
93
+ return {
94
+ unsubscribe: () => this.unsubscribe(operationName)
95
+ }
96
+ }
97
+
98
+ formatResponse (result) {
99
+ // Match old Apollo response format
100
+ return {
101
+ data: result.data,
102
+ errors: result.error ? [result.error] : undefined
103
+ }
104
+ }
105
+
106
+ socketDisconnect () {
107
+ if (this.soketi) {
108
+ // Unsubscribe from all active subscriptions
109
+ this.unsubscribeAll()
110
+ }
111
+ }
112
+
113
+ unsubscribe (operationName) {
114
+ const subscription = this.$__subscriptionManager.get(operationName)
115
+ if (subscription) {
116
+ subscription.unsubscribe()
117
+ this.$__subscriptionManager.delete(operationName)
118
+ }
119
+ }
120
+
121
+ unsubscribeAll () {
122
+ this.$__subscriptionManager.forEach((subscription, operationName) => {
123
+ this.unsubscribe(operationName)
124
+ })
125
+ }
126
+
127
+ unsubscribeFromChannel (operationName) {
128
+ this.unsubscribe(operationName)
129
+ }
130
+
131
+ setEncryption (encrypt = false) {
132
+ this.cipherLink = encrypt
133
+ this.$__client = this.createUrqlClient({
134
+ serverUri: this.serverUri,
135
+ socket: this.soketi,
136
+ encrypt
137
+ })
138
+ }
139
+
140
+ getAuthToken () { return this.$__authToken }
141
+ getPubKey () { return this.$__pubkey }
142
+ getWallet () { return this.$__wallet }
143
+ getServerUri () { return this.serverUri }
144
+ getSocketUri () { return this.soketi ? this.soketi.socketUri : null }
145
+ getUri () { return this.serverUri }
146
+
147
+ setUri (uri) {
148
+ this.serverUri = uri
149
+ this.$__client = this.createUrqlClient({
150
+ serverUri: uri,
151
+ socket: this.soketi,
152
+ encrypt: !!this.cipherLink
153
+ })
154
+ }
155
+
156
+ setSocketUri ({ socketUri, appKey }) {
157
+ this.soketi = { socketUri, appKey }
158
+ this.$__client = this.createUrqlClient({
159
+ serverUri: this.serverUri,
160
+ socket: this.soketi,
161
+ encrypt: !!this.cipherLink
162
+ })
163
+ }
164
+ }
165
+
166
+ export default UrqlClientWrapper
@@ -47,18 +47,18 @@ License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
48
  import Mutation from '../mutation/Mutation'
49
49
  import ResponseActiveSession from '../response/ResponseActiveSession'
50
- import { gql } from '@apollo/client/core'
50
+ import { gql } from '@urql/core'
51
51
 
52
52
  /**
53
53
  * Mutation for declaring an active User Session with a given MetaAsset
54
54
  */
55
55
  export default class MutationActiveSession extends Mutation {
56
56
  /**
57
- * @param {ApolloClientWrapper} apolloClient
57
+ * @param {UrqlClientWrapper} graphQLClient
58
58
  * @param {KnishIOClient} knishIOClient
59
59
  */
60
- constructor (apolloClient, knishIOClient) {
61
- super(apolloClient, knishIOClient)
60
+ constructor (graphQLClient, knishIOClient) {
61
+ super(graphQLClient, knishIOClient)
62
62
 
63
63
  this.$__query = gql`mutation(
64
64
  $bundleHash: String!,
@@ -47,18 +47,18 @@ License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
48
  import Mutation from '../mutation/Mutation'
49
49
  import ResponseLinkIdentifier from '../response/ResponseLinkIdentifier'
50
- import { gql } from '@apollo/client/core'
50
+ import { gql } from '@urql/core'
51
51
 
52
52
  /**
53
53
  * Query for linking an Identifier to a Wallet Bundle
54
54
  */
55
55
  export default class MutationLinkIdentifier extends Mutation {
56
56
  /**
57
- * @param {ApolloClientWrapper} apolloClient
57
+ * @param {UrqlClientWrapper} graphQLClient
58
58
  * @param {KnishIOClient} knishIOClient
59
59
  */
60
- constructor (apolloClient, knishIOClient) {
61
- super(apolloClient, knishIOClient)
60
+ constructor (graphQLClient, knishIOClient) {
61
+ super(graphQLClient, knishIOClient)
62
62
 
63
63
  this.$__query = gql`mutation( $bundle: String!, $type: String!, $content: String! ) {
64
64
  LinkIdentifier( bundle: $bundle, type: $type, content: $content ) {
@@ -47,16 +47,16 @@ License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
48
  import ResponseProposeMolecule from '../response/ResponseProposeMolecule'
49
49
  import Mutation from './Mutation'
50
- import { gql } from '@apollo/client/core'
50
+ import { gql } from '@urql/core'
51
51
 
52
52
  export default class MutationProposeMolecule extends Mutation {
53
53
  /**
54
- * @param {ApolloClientWrapper} apolloClient
54
+ * @param {UrqlClientWrapper} graphQLClient
55
55
  * @param {KnishIOClient} knishIOClient
56
56
  * @param molecule
57
57
  */
58
- constructor (apolloClient, knishIOClient, molecule) {
59
- super(apolloClient, knishIOClient)
58
+ constructor (graphQLClient, knishIOClient, molecule) {
59
+ super(graphQLClient, knishIOClient)
60
60
 
61
61
  this.$__molecule = molecule
62
62
  this.$__remainderWallet = null
@@ -45,17 +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 { gql } from '@apollo/client/core'
49
48
  import Mutation from '../mutation/Mutation'
50
49
  import ResponseRequestAuthorizationGuest from '../response/ResponseRequestAuthorizationGuest'
50
+ import { gql } from '@urql/core'
51
51
 
52
52
  export default class MutationRequestAuthorizationGuest extends Mutation {
53
53
  /**
54
- * @param {ApolloClientWrapper} apolloClient
54
+ * @param {UrqlClientWrapper} graphQLClient
55
55
  * @param {KnishIOClient} knishIOClient
56
56
  */
57
- constructor (apolloClient, knishIOClient) {
58
- super(apolloClient, knishIOClient)
57
+ constructor (graphQLClient, knishIOClient) {
58
+ super(graphQLClient, knishIOClient)
59
59
 
60
60
  this.$__query = gql`mutation( $cellSlug: String, $pubkey: String, $encrypt: Boolean ) {
61
61
  AccessToken( cellSlug: $cellSlug, pubkey: $pubkey, encrypt: $encrypt ) {
@@ -50,11 +50,11 @@ import Response from '../response/Response'
50
50
 
51
51
  export default class Query {
52
52
  /**
53
- * @param {ApolloClientWrapper} apolloClient
53
+ * @param {UrqlClientWrapper} graphQLClient
54
54
  * @param {KnishIOClient} knishIOClient
55
55
  */
56
- constructor (apolloClient, knishIOClient) {
57
- this.client = apolloClient
56
+ constructor (graphQLClient, knishIOClient) {
57
+ this.client = graphQLClient
58
58
  this.knishIOClient = knishIOClient
59
59
  this.$__variables = null
60
60
  this.$__query = null
@@ -47,18 +47,18 @@ License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
48
  import Query from './Query'
49
49
  import ResponseQueryActiveSession from '../response/ResponseQueryActiveSession'
50
- import { gql } from '@apollo/client/core'
50
+ import { gql } from '@urql/core'
51
51
 
52
52
  /**
53
53
  * Query for retrieving a list of active User Sessions
54
54
  */
55
55
  export default class QueryActiveSession extends Query {
56
56
  /**
57
- * @param {ApolloClientWrapper} apolloClient
57
+ * @param {UrqlClientWrapper} graphQLClient
58
58
  * @param {KnishIOClient} knishIOClient
59
59
  */
60
- constructor (apolloClient, knishIOClient) {
61
- super(apolloClient, knishIOClient)
60
+ constructor (graphQLClient, knishIOClient) {
61
+ super(graphQLClient, knishIOClient)
62
62
 
63
63
  this.$__query = gql`query ActiveUserQuery ($bundleHash:String, $metaType: String, $metaId: String) {
64
64
  ActiveUser (bundleHash: $bundleHash, metaType: $metaType, metaId: $metaId) {
@@ -46,19 +46,19 @@ 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
  import Query from './Query'
49
- import { gql } from '@apollo/client/core'
50
49
  import ResponseAtom from '../response/ResponseAtom'
50
+ import { gql } from '@urql/core'
51
51
 
52
52
  /**
53
53
  * Query for getting the balance of a given wallet or token slug
54
54
  */
55
55
  export default class QueryAtom extends Query {
56
56
  /**
57
- * @param {ApolloClientWrapper} apolloClient
57
+ * @param {UrqlClientWrapper} graphQLClient
58
58
  * @param {KnishIOClient} knishIOClient
59
59
  */
60
- constructor (apolloClient, knishIOClient) {
61
- super(apolloClient, knishIOClient)
60
+ constructor (graphQLClient, knishIOClient) {
61
+ super(graphQLClient, knishIOClient)
62
62
 
63
63
  this.$__query = gql`query(
64
64
  $molecularHashes: [String!],
@@ -46,19 +46,19 @@ 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
  import Query from './Query'
49
- import { gql } from '@apollo/client/core'
50
49
  import ResponseBalance from '../response/ResponseBalance'
50
+ import { gql } from '@urql/core'
51
51
 
52
52
  /**
53
53
  * Query for getting the balance of a given wallet or token slug
54
54
  */
55
55
  export default class QueryBalance extends Query {
56
56
  /**
57
- * @param {ApolloClientWrapper} apolloClient
57
+ * @param {UrqlClientWrapper} graphQLClient
58
58
  * @param {KnishIOClient} knishIOClient
59
59
  */
60
- constructor (apolloClient, knishIOClient) {
61
- super(apolloClient, knishIOClient)
60
+ constructor (graphQLClient, knishIOClient) {
61
+ super(graphQLClient, knishIOClient)
62
62
 
63
63
  this.$__query = gql`query( $address: String, $bundleHash: String, $type: String, $token: String, $position: String ) {
64
64
  Balance( address: $address, bundleHash: $bundleHash, type: $type, token: $token, position: $position ) {
@@ -47,18 +47,18 @@ License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
48
  import Query from './Query'
49
49
  import Response from '../response/Response'
50
- import { gql } from '@apollo/client/core'
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 QueryBatch extends Query {
56
56
  /**
57
- * @param {ApolloClientWrapper} apolloClient
57
+ * @param {UrqlClientWrapper} graphQLClient
58
58
  * @param {KnishIOClient} knishIOClient
59
59
  */
60
- constructor (apolloClient, knishIOClient) {
61
- super(apolloClient, knishIOClient)
60
+ constructor (graphQLClient, knishIOClient) {
61
+ super(graphQLClient, knishIOClient)
62
62
 
63
63
  this.$__query = gql`query( $batchId: String ) {
64
64
  Batch( batchId: $batchId ) {
@@ -48,18 +48,18 @@ License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
48
48
  import Query from './Query'
49
49
  import QueryBatch from './QueryBatch'
50
50
  import Response from '../response/Response'
51
- import { gql } from '@apollo/client/core'
51
+ import { gql } from '@urql/core'
52
52
 
53
53
  /**
54
54
  * Query for retrieving Meta Asset information
55
55
  */
56
56
  export default class QueryBatchHistory extends Query {
57
57
  /**
58
- * @param {ApolloClientWrapper} apolloClient
58
+ * @param {UrqlClientWrapper} graphQLClient
59
59
  * @param {KnishIOClient} knishIOClient
60
60
  */
61
- constructor (apolloClient, knishIOClient) {
62
- super(apolloClient, knishIOClient)
61
+ constructor (graphQLClient, knishIOClient) {
62
+ super(graphQLClient, knishIOClient)
63
63
 
64
64
  this.$__query = gql`query( $batchId: String ) {
65
65
  BatchHistory( batchId: $batchId ) {
@@ -47,18 +47,18 @@ License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
48
  import Query from './Query'
49
49
  import ResponseContinuId from '../response/ResponseContinuId'
50
- import { gql } from '@apollo/client/core'
50
+ import { gql } from '@urql/core'
51
51
 
52
52
  /**
53
53
  * Queries the node for the next wallet to sign with for ContinuID
54
54
  */
55
55
  export default class QueryContinuId extends Query {
56
56
  /**
57
- * @param {ApolloClientWrapper} apolloClient
57
+ * @param {UrqlClientWrapper} graphQLClient
58
58
  * @param {KnishIOClient} knishIOClient
59
59
  */
60
- constructor (apolloClient, knishIOClient) {
61
- super(apolloClient, knishIOClient)
60
+ constructor (graphQLClient, knishIOClient) {
61
+ super(graphQLClient, knishIOClient)
62
62
 
63
63
  this.$__query = gql`query ($bundle: String!) {
64
64
  ContinuId(bundle: $bundle) {
@@ -47,18 +47,18 @@ License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
47
47
  */
48
48
  import Query from './Query'
49
49
  import ResponseMetaType from '../response/ResponseMetaType'
50
- import { gql } from '@apollo/client/core'
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
- * @param {ApolloClientWrapper} apolloClient
57
+ * @param {UrqlClientWrapper} graphQLClient
58
58
  * @param {KnishIOClient} knishIOClient
59
59
  */
60
- constructor (apolloClient, knishIOClient) {
61
- super(apolloClient, knishIOClient)
60
+ constructor (graphQLClient, knishIOClient) {
61
+ super(graphQLClient, knishIOClient)
62
62
 
63
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
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 ) {