@gearbox-protocol/sdk 7.2.0 → 7.3.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.
|
@@ -123,6 +123,12 @@ class AddressMap {
|
|
|
123
123
|
get name() {
|
|
124
124
|
return this.#name;
|
|
125
125
|
}
|
|
126
|
+
static fromRecord(record) {
|
|
127
|
+
return new AddressMap(Object.entries(record));
|
|
128
|
+
}
|
|
129
|
+
static fromMappedArray(array, mapFn) {
|
|
130
|
+
return new AddressMap(array.map((item) => [mapFn(item), item]));
|
|
131
|
+
}
|
|
126
132
|
}
|
|
127
133
|
// Annotate the CommonJS export names for ESM import in node:
|
|
128
134
|
0 && (module.exports = {
|
|
@@ -100,6 +100,12 @@ class AddressMap {
|
|
|
100
100
|
get name() {
|
|
101
101
|
return this.#name;
|
|
102
102
|
}
|
|
103
|
+
static fromRecord(record) {
|
|
104
|
+
return new AddressMap(Object.entries(record));
|
|
105
|
+
}
|
|
106
|
+
static fromMappedArray(array, mapFn) {
|
|
107
|
+
return new AddressMap(array.map((item) => [mapFn(item), item]));
|
|
108
|
+
}
|
|
103
109
|
}
|
|
104
110
|
export {
|
|
105
111
|
AddressMap
|
|
@@ -40,4 +40,6 @@ export declare class AddressMap<T> {
|
|
|
40
40
|
get size(): number;
|
|
41
41
|
freeze(): void;
|
|
42
42
|
protected get name(): string | undefined;
|
|
43
|
+
static fromRecord<T>(record: Record<Address, T>): AddressMap<T>;
|
|
44
|
+
static fromMappedArray<T>(array: T[], mapFn: (item: T) => Address): AddressMap<T>;
|
|
43
45
|
}
|