@rango-dev/widget-embedded 0.27.3-next.5 → 0.27.3
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/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +1 -2
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/Quote.styles.d.ts +1 -1
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
- package/dist/components/RefreshModal/RefreshModal.styles.d.ts +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -1
- package/dist/hooks/useFetch.d.ts +1 -1
- package/dist/hooks/useFetch.d.ts.map +1 -1
- package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +2 -3
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +4 -1
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +1 -19
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +22 -23
- package/src/components/Quote/Quote.styles.ts +1 -19
- package/src/components/Quote/Quote.tsx +2 -12
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +3 -3
- package/src/hooks/useFetch.ts +2 -13
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +1 -1
- package/src/hooks/useSyncUrlAndStore/useSyncUrlAndStore.ts +1 -10
- package/src/pages/ConfirmSwapPage.tsx +0 -65
- package/src/pages/Home.tsx +2 -1
- package/src/utils/swap.ts +32 -32
- package/src/utils/wallets.ts +30 -17
package/src/utils/wallets.ts
CHANGED
|
@@ -199,34 +199,47 @@ export function prepareAccountsForWalletStore(
|
|
|
199
199
|
return result;
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
export function
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
export function getQuoteWallets(params: {
|
|
203
|
+
filter: 'all' | 'required';
|
|
204
|
+
quote: SelectedQuote | null;
|
|
205
|
+
}): string[] {
|
|
206
|
+
const { filter, quote } = params;
|
|
207
|
+
const wallets = new Set<string>();
|
|
208
|
+
|
|
209
|
+
quote?.swaps.forEach((swap, swapIndex) => {
|
|
206
210
|
const currentStepFromBlockchain = swap.from.blockchain;
|
|
207
211
|
const currentStepToBlockchain = swap.to.blockchain;
|
|
208
|
-
|
|
209
|
-
wallets.push(currentStepFromBlockchain);
|
|
210
|
-
}
|
|
211
|
-
if (!wallets.includes(currentStepToBlockchain)) {
|
|
212
|
-
wallets.push(currentStepToBlockchain);
|
|
213
|
-
}
|
|
212
|
+
wallets.add(currentStepFromBlockchain);
|
|
214
213
|
|
|
215
214
|
// Check if internalSwaps array exists
|
|
216
|
-
if (swap.internalSwaps
|
|
217
|
-
|
|
215
|
+
if (swap.internalSwaps) {
|
|
216
|
+
const { internalSwaps } = swap;
|
|
217
|
+
internalSwaps.forEach((internalSwap, internalSwapIndex) => {
|
|
218
218
|
const internalStepFromBlockchain = internalSwap.from.blockchain;
|
|
219
219
|
const internalStepToBlockchain = internalSwap.to.blockchain;
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
const isLastStep = swapIndex === quote.swaps.length - 1;
|
|
221
|
+
const isLastInternalStep =
|
|
222
|
+
internalSwapIndex === internalSwaps.length - 1;
|
|
223
|
+
|
|
224
|
+
if (
|
|
225
|
+
(!isLastStep && !isLastInternalStep) ||
|
|
226
|
+
(isLastStep &&
|
|
227
|
+
currentStepToBlockchain !== internalStepFromBlockchain) ||
|
|
228
|
+
filter === 'all'
|
|
229
|
+
) {
|
|
230
|
+
wallets.add(internalStepFromBlockchain);
|
|
222
231
|
}
|
|
223
|
-
if (
|
|
224
|
-
wallets.
|
|
232
|
+
if (filter === 'all') {
|
|
233
|
+
wallets.add(internalStepToBlockchain);
|
|
225
234
|
}
|
|
226
235
|
});
|
|
227
236
|
}
|
|
237
|
+
|
|
238
|
+
if (filter === 'all') {
|
|
239
|
+
wallets.add(currentStepToBlockchain);
|
|
240
|
+
}
|
|
228
241
|
});
|
|
229
|
-
return wallets;
|
|
242
|
+
return Array.from(wallets);
|
|
230
243
|
}
|
|
231
244
|
|
|
232
245
|
type Blockchain = { name: string; accounts: ConnectedWallet[] };
|