lynx-client 0.0.27 → 0.0.28
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.
|
@@ -38,10 +38,26 @@ primitiveArrayKeys = []) {
|
|
|
38
38
|
// @ts-ignore
|
|
39
39
|
}
|
|
40
40
|
else if (innerStructsConcreteObjectMap[key] !== undefined) {
|
|
41
|
+
// Extract nested configuration for this specific nested struct
|
|
41
42
|
// @ts-ignore
|
|
42
|
-
|
|
43
|
+
const nestedTemplate = innerStructsConcreteObjectMap[key];
|
|
44
|
+
const nestedInnerArrays = {};
|
|
45
|
+
const nestedInnerStructs = {};
|
|
46
|
+
// Scan the nested template to find arrays and structs within it
|
|
47
|
+
for (const [nestedKey, nestedValue] of Object.entries(nestedTemplate)) {
|
|
48
|
+
if (nestedValue && typeof nestedValue === 'object') {
|
|
49
|
+
if (Array.isArray(nestedValue)) {
|
|
50
|
+
// This is an array in the nested struct
|
|
51
|
+
nestedInnerArrays[nestedKey] = nestedValue.length > 0 ? nestedValue[0] : {};
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
// This is a further nested struct
|
|
55
|
+
nestedInnerStructs[nestedKey] = nestedValue;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
43
59
|
// @ts-ignore
|
|
44
|
-
|
|
60
|
+
obj[key] = ethersStructResponseToObject(value, nestedTemplate, nestedInnerArrays, nestedInnerStructs, primitiveArrayKeys);
|
|
45
61
|
}
|
|
46
62
|
else if (Array.isArray(value)) {
|
|
47
63
|
if (value.length === 0) {
|
|
@@ -63,10 +79,26 @@ primitiveArrayKeys = []) {
|
|
|
63
79
|
// // @ts-ignore
|
|
64
80
|
// `@@@@ innerArraysConcreteObjectMap[key] ${innerArraysConcreteObjectMap[key]}`,
|
|
65
81
|
// );
|
|
82
|
+
// Detect nested structs and arrays within the array element template
|
|
83
|
+
// and pass them as innerStructsConcreteObjectMap and innerArraysConcreteObjectMap
|
|
84
|
+
const nestedStructs = {};
|
|
85
|
+
const nestedArrays = {};
|
|
86
|
+
if (emptyObjectOfArray && typeof emptyObjectOfArray === 'object') {
|
|
87
|
+
for (const [nestedKey, nestedValue] of Object.entries(emptyObjectOfArray)) {
|
|
88
|
+
if (nestedValue && typeof nestedValue === 'object') {
|
|
89
|
+
if (Array.isArray(nestedValue)) {
|
|
90
|
+
// This is a nested array
|
|
91
|
+
nestedArrays[nestedKey] = nestedValue.length > 0 ? nestedValue[0] : {};
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// This is a nested struct
|
|
95
|
+
nestedStructs[nestedKey] = nestedValue;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
66
100
|
// @ts-ignore
|
|
67
|
-
obj[key] = ethersStructResponseToArray(value, emptyObjectOfArray,
|
|
68
|
-
// JSON.parse(stringifyObject(value[0] as object)),
|
|
69
|
-
{}, {}, primitiveArrayKeys);
|
|
101
|
+
obj[key] = ethersStructResponseToArray(value, emptyObjectOfArray, nestedArrays, nestedStructs, primitiveArrayKeys);
|
|
70
102
|
}
|
|
71
103
|
}
|
|
72
104
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethersTypes.d.ts","sourceRoot":"","sources":["../../../../lib/utils/ethersTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,IAAI;KAClD,CAAC,IAAI,MAAM,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACjD,MAAM,GACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,GACtC,SAAS,GACT,gBAAgB,CAAC,C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,CAAC,CAAC,CAAC,CAAC,GAC5C,OAAO;CACpB,CAAC;AAEF;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,MAAM,EAC3D,oBAAoB,EAAE,MAAM,EAI5B,mBAAmB,GAAE,CAAC,GAAG,SAAqB,EAG9C,4BAA4B,GAAE,MAAW,EACzC,6BAA6B,GAAE,MAAW,EAE1C,kBAAkB,GAAE,MAAM,EAAO,GAChC,CAAC,CAiHH;AAED,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,MAAM,EAC1D,yBAAyB,EAAE,MAAM,EAAE,EACnC,mBAAmB,GAAE,CAAC,GAAG,SAAqB,EAC9C,4BAA4B,GAAE,MAAW,EACzC,6BAA6B,GAAE,MAAW,EAC1C,kBAAkB,GAAE,MAAM,EAAO,GAChC,CAAC,EAAE,CAUL"}
|
|
@@ -38,10 +38,26 @@ primitiveArrayKeys = []) {
|
|
|
38
38
|
// @ts-ignore
|
|
39
39
|
}
|
|
40
40
|
else if (innerStructsConcreteObjectMap[key] !== undefined) {
|
|
41
|
+
// Extract nested configuration for this specific nested struct
|
|
41
42
|
// @ts-ignore
|
|
42
|
-
|
|
43
|
+
const nestedTemplate = innerStructsConcreteObjectMap[key];
|
|
44
|
+
const nestedInnerArrays = {};
|
|
45
|
+
const nestedInnerStructs = {};
|
|
46
|
+
// Scan the nested template to find arrays and structs within it
|
|
47
|
+
for (const [nestedKey, nestedValue] of Object.entries(nestedTemplate)) {
|
|
48
|
+
if (nestedValue && typeof nestedValue === 'object') {
|
|
49
|
+
if (Array.isArray(nestedValue)) {
|
|
50
|
+
// This is an array in the nested struct
|
|
51
|
+
nestedInnerArrays[nestedKey] = nestedValue.length > 0 ? nestedValue[0] : {};
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
// This is a further nested struct
|
|
55
|
+
nestedInnerStructs[nestedKey] = nestedValue;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
43
59
|
// @ts-ignore
|
|
44
|
-
|
|
60
|
+
obj[key] = ethersStructResponseToObject(value, nestedTemplate, nestedInnerArrays, nestedInnerStructs, primitiveArrayKeys);
|
|
45
61
|
}
|
|
46
62
|
else if (Array.isArray(value)) {
|
|
47
63
|
if (value.length === 0) {
|
|
@@ -63,10 +79,26 @@ primitiveArrayKeys = []) {
|
|
|
63
79
|
// // @ts-ignore
|
|
64
80
|
// `@@@@ innerArraysConcreteObjectMap[key] ${innerArraysConcreteObjectMap[key]}`,
|
|
65
81
|
// );
|
|
82
|
+
// Detect nested structs and arrays within the array element template
|
|
83
|
+
// and pass them as innerStructsConcreteObjectMap and innerArraysConcreteObjectMap
|
|
84
|
+
const nestedStructs = {};
|
|
85
|
+
const nestedArrays = {};
|
|
86
|
+
if (emptyObjectOfArray && typeof emptyObjectOfArray === 'object') {
|
|
87
|
+
for (const [nestedKey, nestedValue] of Object.entries(emptyObjectOfArray)) {
|
|
88
|
+
if (nestedValue && typeof nestedValue === 'object') {
|
|
89
|
+
if (Array.isArray(nestedValue)) {
|
|
90
|
+
// This is a nested array
|
|
91
|
+
nestedArrays[nestedKey] = nestedValue.length > 0 ? nestedValue[0] : {};
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// This is a nested struct
|
|
95
|
+
nestedStructs[nestedKey] = nestedValue;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
66
100
|
// @ts-ignore
|
|
67
|
-
obj[key] = ethersStructResponseToArray(value, emptyObjectOfArray,
|
|
68
|
-
// JSON.parse(stringifyObject(value[0] as object)),
|
|
69
|
-
{}, {}, primitiveArrayKeys);
|
|
101
|
+
obj[key] = ethersStructResponseToArray(value, emptyObjectOfArray, nestedArrays, nestedStructs, primitiveArrayKeys);
|
|
70
102
|
}
|
|
71
103
|
}
|
|
72
104
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethersTypes.d.ts","sourceRoot":"","sources":["../../../../lib/utils/ethersTyp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MAAM,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACjD,MAAM,GACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,GACtC,SAAS,GACT,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,YAAY,GACzC,MAAM,GACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,WAAW,GACxC,MAAM,GACN,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACnC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAC5C,OAAO;CACpB,CAAC;AAEF;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,MAAM,EAC3D,oBAAoB,EAAE,MAAM,EAI5B,mBAAmB,GAAE,CAAC,GAAG,SAAqB,EAG9C,4BAA4B,GAAE,MAAW,EACzC,6BAA6B,GAAE,MAAW,EAE1C,kBAAkB,GAAE,MAAM,EAAO,GAChC,CAAC,CAiHH;AAED,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,MAAM,EAC1D,yBAAyB,EAAE,MAAM,EAAE,EACnC,mBAAmB,GAAE,CAAC,GAAG,SAAqB,EAC9C,4BAA4B,GAAE,MAAW,EACzC,6BAA6B,GAAE,MAAW,EAC1C,kBAAkB,GAAE,MAAM,EAAO,GAChC,CAAC,EAAE,CAUL"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lynx-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"description": "Client library for interacting with Lynx publicly available services",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/jest": "^30.0.0",
|
|
41
41
|
"@types/node": "^22.0.0",
|
|
42
|
+
"commander": "^14.0.1",
|
|
42
43
|
"jest": "^30.1.3",
|
|
43
44
|
"prettier": "^3.6.2",
|
|
44
45
|
"ts-jest": "^29.4.1",
|