Commit 1115b39 1 parent 84d89b0 commit 1115b39 Copy full SHA for 1115b39
File tree 1 file changed +34
-11
lines changed
packages/create-invoice-form/src/lib
1 file changed +34
-11
lines changed Original file line number Diff line number Diff line change 162
162
currency = undefined ;
163
163
filteredSettlementCurrencies = [];
164
164
network = undefined ;
165
- networks = [];
165
+
166
+ const availableNetworks = new Set (
167
+ currencyManager .knownCurrencies .map ((currency ) => currency .network )
168
+ );
166
169
167
170
if (invoiceCurrency .type === Types .RequestLogic .CURRENCY .ISO4217 ) {
168
- networks = (getCurrencySupportedNetworksForConversion (
169
- invoiceCurrency .hash ,
170
- currencyManager
171
- ) ?? []) as string [];
171
+ const conversionNetworks = new Set (
172
+ getCurrencySupportedNetworksForConversion (
173
+ invoiceCurrency .hash ,
174
+ currencyManager
175
+ )
176
+ );
177
+
178
+ networks = [... availableNetworks ].filter (
179
+ (network ) =>
180
+ conversionNetworks .has (network ) &&
181
+ (config .supportedNetworks
182
+ ? config .supportedNetworks .includes (network )
183
+ : true )
184
+ );
172
185
} else {
173
186
const baseSymbol = invoiceCurrency .symbol .split (" -" )[0 ];
174
- networks = currencyManager .knownCurrencies
175
- .filter ((currency ) => {
176
- const currencyBaseSymbol = currency .symbol .split (" -" )[0 ];
177
- return currencyBaseSymbol === baseSymbol ;
178
- })
179
- .map ((currency ) => currency .network );
187
+ networks = [... availableNetworks ].filter ((network ) => {
188
+ const hasToken = currencyManager .knownCurrencies .some (
189
+ (currency ) =>
190
+ currency .network === network &&
191
+ currency .symbol .split (" -" )[0 ] === baseSymbol
192
+ );
193
+
194
+ return (
195
+ hasToken &&
196
+ (config .supportedNetworks
197
+ ? config .supportedNetworks .includes (network )
198
+ : true )
199
+ );
200
+ });
180
201
}
202
+
203
+ networks = [... new Set (networks )];
181
204
}
182
205
};
183
206
You can’t perform that action at this time.
0 commit comments