@quicknode/sdk 1.1.2 → 1.1.4
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/cjs/index.js +7 -6
- package/esm/package.json.js +1 -1
- package/esm/src/api/graphql/modifyQueryForChain.js +6 -5
- package/esm/src/core/index.d.ts +10 -7
- package/index.d.ts +10 -7
- package/package.json +2 -1
package/cjs/index.js
CHANGED
|
@@ -8,6 +8,7 @@ var exchangeGraphcache = require('@urql/exchange-graphcache');
|
|
|
8
8
|
var tslib = require('tslib');
|
|
9
9
|
var zod = require('zod');
|
|
10
10
|
var graphql = require('graphql');
|
|
11
|
+
var klona = require('klona');
|
|
11
12
|
var viem = require('viem');
|
|
12
13
|
var chains = require('viem/chains');
|
|
13
14
|
|
|
@@ -407,8 +408,10 @@ function ValidateInput(schema) {
|
|
|
407
408
|
};
|
|
408
409
|
}
|
|
409
410
|
|
|
410
|
-
|
|
411
|
-
|
|
411
|
+
function modifyQueryForChain(chainName, originalDocumentNode) {
|
|
412
|
+
// We need to deep clone the document node in order to not mutate the query so it is consistent
|
|
413
|
+
// across multiple calls to the same query with different chains
|
|
414
|
+
const documentNode = klona.klona(originalDocumentNode);
|
|
412
415
|
documentNode.definitions = documentNode.definitions.map((doc) => {
|
|
413
416
|
if (doc.kind === graphql.Kind.OPERATION_DEFINITION) {
|
|
414
417
|
doc.selectionSet.selections = doc.selectionSet.selections.map((selection) => {
|
|
@@ -417,9 +420,7 @@ function modifyQueryForChain(chainName, documentNode) {
|
|
|
417
420
|
selection.name.value === 'ethereum') {
|
|
418
421
|
const updatedChainSelection = {
|
|
419
422
|
...selection,
|
|
420
|
-
...
|
|
421
|
-
name: { ...selection.name, value: chainName },
|
|
422
|
-
},
|
|
423
|
+
name: { ...selection.name, value: chainName },
|
|
423
424
|
};
|
|
424
425
|
return updatedChainSelection;
|
|
425
426
|
}
|
|
@@ -1065,7 +1066,7 @@ tslib.__decorate([
|
|
|
1065
1066
|
tslib.__metadata("design:returntype", Promise)
|
|
1066
1067
|
], TransactionsController.prototype, "getByHash", null);
|
|
1067
1068
|
|
|
1068
|
-
var name="@quicknode/sdk";var repository={type:"git",url:"https://github.com/quiknode-labs/qn-oss.git",directory:"packages/libs/sdk"};var license="MIT";var version="1.1.
|
|
1069
|
+
var name="@quicknode/sdk";var repository={type:"git",url:"https://github.com/quiknode-labs/qn-oss.git",directory:"packages/libs/sdk"};var license="MIT";var version="1.1.4";var main="./cjs/index.js";var module$1="./esm/src/index.js";var types="./index.d.ts";var sideEffects=false;var dependencies={"@urql/core":"^4.0.7","@urql/exchange-graphcache":"^6.0.4","cross-fetch":"^3.1.6",graphql:"^16.6.0",klona:"^2.0.6",tslib:"^2.5.3",viem:"^1.2.0",zod:"^3.21.4"};var devDependencies={"@graphql-codegen/cli":"4.0.1","@graphql-codegen/fragment-matcher":"^3.3.1","@graphql-codegen/typed-document-node":"^4.0.1","@graphql-codegen/typescript":"2.8.0","@graphql-codegen/typescript-operations":"^2.5.5","@pollyjs/adapter-node-http":"^6.0.5","@pollyjs/core":"^6.0.5","@pollyjs/persister-fs":"^6.0.5","@types/jest":"^29.5.1","@types/mocha":"^10.0.1","@types/node":"^18.13.0","@types/supertest":"^2.0.12",dotenv:"^16.0.3","eslint-plugin-no-only-tests":"^3.1.0",supertest:"^6.3.3"};var scripts={codegen:"npx graphql-codegen --require dotenv/config"};var exports$1={".":{"import":"./esm/src/index.js",require:"./cjs/index.js"},"./api":{"import":"./esm/src/api/index.js","default":"./cjs/src/api/index.js",types:"./esm/src/api/index.d.ts"},"./core":{"import":"./esm/src/core/index.js","default":"./cjs/src/core/index.js",types:"./esm/src/core/index.d.ts"}};var typesVersions={"*":{api:["./esm/src/api/index.d.ts"],core:["./esm/src/core/index.d.ts"]}};var packageJson = {name:name,repository:repository,license:license,version:version,main:main,module:module$1,types:types,sideEffects:sideEffects,dependencies:dependencies,devDependencies:devDependencies,scripts:scripts,exports:exports$1,typesVersions:typesVersions};
|
|
1069
1070
|
|
|
1070
1071
|
class API {
|
|
1071
1072
|
constructor({ graphApiKey, additionalHeaders, defaultChain, } = {}) {
|
package/esm/package.json.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var name="@quicknode/sdk";var repository={type:"git",url:"https://github.com/quiknode-labs/qn-oss.git",directory:"packages/libs/sdk"};var license="MIT";var version="1.1.
|
|
1
|
+
var name="@quicknode/sdk";var repository={type:"git",url:"https://github.com/quiknode-labs/qn-oss.git",directory:"packages/libs/sdk"};var license="MIT";var version="1.1.4";var main="./cjs/index.js";var module="./esm/src/index.js";var types="./index.d.ts";var sideEffects=false;var dependencies={"@urql/core":"^4.0.7","@urql/exchange-graphcache":"^6.0.4","cross-fetch":"^3.1.6",graphql:"^16.6.0",klona:"^2.0.6",tslib:"^2.5.3",viem:"^1.2.0",zod:"^3.21.4"};var devDependencies={"@graphql-codegen/cli":"4.0.1","@graphql-codegen/fragment-matcher":"^3.3.1","@graphql-codegen/typed-document-node":"^4.0.1","@graphql-codegen/typescript":"2.8.0","@graphql-codegen/typescript-operations":"^2.5.5","@pollyjs/adapter-node-http":"^6.0.5","@pollyjs/core":"^6.0.5","@pollyjs/persister-fs":"^6.0.5","@types/jest":"^29.5.1","@types/mocha":"^10.0.1","@types/node":"^18.13.0","@types/supertest":"^2.0.12",dotenv:"^16.0.3","eslint-plugin-no-only-tests":"^3.1.0",supertest:"^6.3.3"};var scripts={codegen:"npx graphql-codegen --require dotenv/config"};var exports={".":{"import":"./esm/src/index.js",require:"./cjs/index.js"},"./api":{"import":"./esm/src/api/index.js","default":"./cjs/src/api/index.js",types:"./esm/src/api/index.d.ts"},"./core":{"import":"./esm/src/core/index.js","default":"./cjs/src/core/index.js",types:"./esm/src/core/index.d.ts"}};var typesVersions={"*":{api:["./esm/src/api/index.d.ts"],core:["./esm/src/core/index.d.ts"]}};var packageJson = {name:name,repository:repository,license:license,version:version,main:main,module:module,types:types,sideEffects:sideEffects,dependencies:dependencies,devDependencies:devDependencies,scripts:scripts,exports:exports,typesVersions:typesVersions};
|
|
2
2
|
|
|
3
3
|
export { packageJson as default, dependencies, devDependencies, exports, license, main, module, name, repository, scripts, sideEffects, types, typesVersions, version };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Kind } from 'graphql';
|
|
2
|
+
import { klona } from 'klona';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
function modifyQueryForChain(chainName, originalDocumentNode) {
|
|
5
|
+
// We need to deep clone the document node in order to not mutate the query so it is consistent
|
|
6
|
+
// across multiple calls to the same query with different chains
|
|
7
|
+
const documentNode = klona(originalDocumentNode);
|
|
5
8
|
documentNode.definitions = documentNode.definitions.map((doc) => {
|
|
6
9
|
if (doc.kind === Kind.OPERATION_DEFINITION) {
|
|
7
10
|
doc.selectionSet.selections = doc.selectionSet.selections.map((selection) => {
|
|
@@ -10,9 +13,7 @@ function modifyQueryForChain(chainName, documentNode) {
|
|
|
10
13
|
selection.name.value === 'ethereum') {
|
|
11
14
|
const updatedChainSelection = {
|
|
12
15
|
...selection,
|
|
13
|
-
...
|
|
14
|
-
name: { ...selection.name, value: chainName },
|
|
15
|
-
},
|
|
16
|
+
name: { ...selection.name, value: chainName },
|
|
16
17
|
};
|
|
17
18
|
return updatedChainSelection;
|
|
18
19
|
}
|
package/esm/src/core/index.d.ts
CHANGED
|
@@ -294,16 +294,19 @@ type RPCFullTokenMetadata = {
|
|
|
294
294
|
contractAddress: string;
|
|
295
295
|
};
|
|
296
296
|
type RPCTokenTransaction = {
|
|
297
|
-
name: string | null;
|
|
298
|
-
symbol: string | null;
|
|
299
|
-
decimals: string | null;
|
|
300
|
-
address: string;
|
|
301
|
-
quantityIn: string;
|
|
302
|
-
quantityOut: string;
|
|
303
297
|
blockNumber: string;
|
|
304
298
|
transactionHash: string;
|
|
299
|
+
toAddress: string;
|
|
300
|
+
fromAddress: string;
|
|
301
|
+
logIndex: number;
|
|
302
|
+
type: string;
|
|
305
303
|
timestamp: string;
|
|
306
|
-
|
|
304
|
+
receivedTokenContractAddress: string | null;
|
|
305
|
+
sentTokenContractAddress: string | null;
|
|
306
|
+
sentAmount: string;
|
|
307
|
+
receivedAmount: string;
|
|
308
|
+
decimalSentAmount: string;
|
|
309
|
+
decimalReceivedAmount: string;
|
|
307
310
|
};
|
|
308
311
|
type QNGetWalletTokenTransactionsResult = {
|
|
309
312
|
paginatedItems: RPCTokenTransaction[];
|
package/index.d.ts
CHANGED
|
@@ -3038,16 +3038,19 @@ type RPCFullTokenMetadata = {
|
|
|
3038
3038
|
contractAddress: string;
|
|
3039
3039
|
};
|
|
3040
3040
|
type RPCTokenTransaction = {
|
|
3041
|
-
name: string | null;
|
|
3042
|
-
symbol: string | null;
|
|
3043
|
-
decimals: string | null;
|
|
3044
|
-
address: string;
|
|
3045
|
-
quantityIn: string;
|
|
3046
|
-
quantityOut: string;
|
|
3047
3041
|
blockNumber: string;
|
|
3048
3042
|
transactionHash: string;
|
|
3043
|
+
toAddress: string;
|
|
3044
|
+
fromAddress: string;
|
|
3045
|
+
logIndex: number;
|
|
3046
|
+
type: string;
|
|
3049
3047
|
timestamp: string;
|
|
3050
|
-
|
|
3048
|
+
receivedTokenContractAddress: string | null;
|
|
3049
|
+
sentTokenContractAddress: string | null;
|
|
3050
|
+
sentAmount: string;
|
|
3051
|
+
receivedAmount: string;
|
|
3052
|
+
decimalSentAmount: string;
|
|
3053
|
+
decimalReceivedAmount: string;
|
|
3051
3054
|
};
|
|
3052
3055
|
type QNGetWalletTokenTransactionsResult = {
|
|
3053
3056
|
paginatedItems: RPCTokenTransaction[];
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"directory": "packages/libs/sdk"
|
|
7
7
|
},
|
|
8
8
|
"license": "MIT",
|
|
9
|
-
"version": "1.1.
|
|
9
|
+
"version": "1.1.4",
|
|
10
10
|
"main": "./cjs/index.js",
|
|
11
11
|
"module": "./esm/src/index.js",
|
|
12
12
|
"types": "./index.d.ts",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"@urql/exchange-graphcache": "^6.0.4",
|
|
17
17
|
"cross-fetch": "^3.1.6",
|
|
18
18
|
"graphql": "^16.6.0",
|
|
19
|
+
"klona": "^2.0.6",
|
|
19
20
|
"tslib": "^2.5.3",
|
|
20
21
|
"viem": "^1.2.0",
|
|
21
22
|
"zod": "^3.21.4"
|