@ar.io/sdk 3.14.0-alpha.6 → 3.14.0-alpha.8
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/bundles/web.bundle.min.js +104 -104
- package/lib/cjs/utils/ant.js +16 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/utils/ant.js +16 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/utils/ant.d.ts +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/utils/ant.js
CHANGED
|
@@ -46,7 +46,22 @@ exports.sortANTRecords = sortANTRecords;
|
|
|
46
46
|
*
|
|
47
47
|
* @param state - The HyperBeam serialized ANT state.
|
|
48
48
|
*/
|
|
49
|
-
const convertHyperBeamStateToAoANTState = (
|
|
49
|
+
const convertHyperBeamStateToAoANTState = (initialState) => {
|
|
50
|
+
function lowerCaseKeys(obj) {
|
|
51
|
+
return Object.fromEntries(Object.entries(obj).map(([key, value]) => {
|
|
52
|
+
if (key.toLowerCase().includes('balances')) {
|
|
53
|
+
return [key.toLowerCase(), value];
|
|
54
|
+
}
|
|
55
|
+
if (typeof value === 'object' &&
|
|
56
|
+
!Array.isArray(value) &&
|
|
57
|
+
value !== null) {
|
|
58
|
+
return [key.toLowerCase(), lowerCaseKeys(value)];
|
|
59
|
+
}
|
|
60
|
+
return [key.toLowerCase(), value];
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
// we need to ensure keys are lower cased because hyperbeam json serializes keys to lowercase inconsistently
|
|
64
|
+
const state = lowerCaseKeys(initialState);
|
|
50
65
|
return {
|
|
51
66
|
Name: state.name,
|
|
52
67
|
Ticker: state.ticker,
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/utils/ant.js
CHANGED
|
@@ -42,7 +42,22 @@ export const sortANTRecords = (antRecords) => {
|
|
|
42
42
|
*
|
|
43
43
|
* @param state - The HyperBeam serialized ANT state.
|
|
44
44
|
*/
|
|
45
|
-
export const convertHyperBeamStateToAoANTState = (
|
|
45
|
+
export const convertHyperBeamStateToAoANTState = (initialState) => {
|
|
46
|
+
function lowerCaseKeys(obj) {
|
|
47
|
+
return Object.fromEntries(Object.entries(obj).map(([key, value]) => {
|
|
48
|
+
if (key.toLowerCase().includes('balances')) {
|
|
49
|
+
return [key.toLowerCase(), value];
|
|
50
|
+
}
|
|
51
|
+
if (typeof value === 'object' &&
|
|
52
|
+
!Array.isArray(value) &&
|
|
53
|
+
value !== null) {
|
|
54
|
+
return [key.toLowerCase(), lowerCaseKeys(value)];
|
|
55
|
+
}
|
|
56
|
+
return [key.toLowerCase(), value];
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
// we need to ensure keys are lower cased because hyperbeam json serializes keys to lowercase inconsistently
|
|
60
|
+
const state = lowerCaseKeys(initialState);
|
|
46
61
|
return {
|
|
47
62
|
Name: state.name,
|
|
48
63
|
Ticker: state.ticker,
|
package/lib/esm/version.js
CHANGED
package/lib/types/utils/ant.d.ts
CHANGED
|
@@ -29,4 +29,4 @@ export declare const sortANTRecords: (antRecords: ANTRecords) => SortedANTRecord
|
|
|
29
29
|
*
|
|
30
30
|
* @param state - The HyperBeam serialized ANT state.
|
|
31
31
|
*/
|
|
32
|
-
export declare const convertHyperBeamStateToAoANTState: (
|
|
32
|
+
export declare const convertHyperBeamStateToAoANTState: (initialState: HyperBeamANTState) => AoANTState;
|
package/lib/types/version.d.ts
CHANGED