@rango-dev/widget-embedded 0.29.1-next.21 → 0.29.1-next.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.29.1-next.21",
3
+ "version": "0.29.1-next.23",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -30,7 +30,7 @@
30
30
  "@rango-dev/queue-manager-rango-preset": "^0.34.1-next.8",
31
31
  "@rango-dev/queue-manager-react": "^0.26.0",
32
32
  "@rango-dev/signer-solana": "^0.29.1-next.1",
33
- "@rango-dev/ui": "^0.35.1-next.11",
33
+ "@rango-dev/ui": "^0.35.1-next.12",
34
34
  "@rango-dev/wallets-react": "^0.20.1-next.6",
35
35
  "@rango-dev/wallets-shared": "^0.34.1-next.6",
36
36
  "bignumber.js": "^9.1.1",
@@ -53,4 +53,4 @@
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  }
56
- }
56
+ }
@@ -155,16 +155,15 @@ export function Quote(props: QuoteProps) {
155
155
 
156
156
  return {
157
157
  swapper: {
158
- displayName: getSwapperDisplayName(swap.swapperId, swappers),
158
+ displayName: getSwapperDisplayName(swap.swapperId, swappers) ?? '',
159
159
  image: swap.swapperLogo,
160
160
  },
161
161
  from: {
162
162
  token: { displayName: swap.from.symbol, image: swap.from.logo },
163
163
  chain: {
164
- displayName: getBlockchainShortNameFor(
165
- swap.from.blockchain,
166
- blockchains
167
- ),
164
+ displayName:
165
+ getBlockchainShortNameFor(swap.from.blockchain, blockchains) ??
166
+ '',
168
167
  image: swap.from.blockchainLogo,
169
168
  },
170
169
  price: {
@@ -194,10 +193,8 @@ export function Quote(props: QuoteProps) {
194
193
  to: {
195
194
  token: { displayName: swap.to.symbol, image: swap.to.logo },
196
195
  chain: {
197
- displayName: getBlockchainShortNameFor(
198
- swap.to.blockchain,
199
- blockchains
200
- ),
196
+ displayName:
197
+ getBlockchainShortNameFor(swap.to.blockchain, blockchains) || '',
201
198
  image: swap.to.blockchainLogo,
202
199
  },
203
200
  price: {
@@ -1,6 +1,6 @@
1
1
  import type { GetStep } from '../SwapDetailsAlerts';
2
2
  import type { Step, StepDetailsProps } from '@rango-dev/ui';
3
- import type { PendingSwapStep } from 'rango-types';
3
+ import type { PendingSwapStep, SwapperType } from 'rango-types';
4
4
 
5
5
  import React from 'react';
6
6
 
@@ -46,7 +46,7 @@ export const getSteps = ({
46
46
  TOKEN_AMOUNT_MIN_DECIMALS,
47
47
  TOKEN_AMOUNT_MAX_DECIMALS
48
48
  ),
49
- realValue: amountToConvert,
49
+ realValue: amountToConvert ?? '',
50
50
  },
51
51
  },
52
52
  to: {
@@ -63,13 +63,13 @@ export const getSteps = ({
63
63
  TOKEN_AMOUNT_MAX_DECIMALS
64
64
  ),
65
65
  realValue:
66
- step.outputAmount || step.expectedOutputAmountHumanReadable,
66
+ step.outputAmount || step.expectedOutputAmountHumanReadable || '',
67
67
  },
68
68
  },
69
69
  swapper: {
70
- displayName: getSwapperDisplayName(step.swapperId, swappers),
70
+ displayName: getSwapperDisplayName(step.swapperId, swappers) ?? '',
71
71
  image: step.swapperLogo ?? '',
72
- type: step.swapperType,
72
+ type: step.swapperType as SwapperType,
73
73
  },
74
74
  internalSwaps: step.internalSwaps
75
75
  ? step.internalSwaps.map((internalSwap) => {
@@ -95,12 +95,10 @@ export const getSteps = ({
95
95
  },
96
96
  },
97
97
  swapper: {
98
- displayName: getSwapperDisplayName(
99
- internalSwap.swapperId,
100
- swappers
101
- ),
98
+ displayName:
99
+ getSwapperDisplayName(internalSwap.swapperId, swappers) ?? '',
102
100
  image: internalSwap.swapperLogo ?? '',
103
- type: internalSwap.swapperType,
101
+ type: internalSwap.swapperType as SwapperType,
104
102
  },
105
103
  };
106
104
  })
@@ -385,7 +385,7 @@ export function SwapDetails(props: SwapDetailsProps) {
385
385
  ),
386
386
  usdValue: outputUsdValue,
387
387
  realUsdValue: realOutputUsdValue,
388
- realValue: outputAmount,
388
+ realValue: outputAmount || '',
389
389
  },
390
390
  token: {
391
391
  displayName: steps[numberOfSteps - 1].to.token.displayName,
@@ -40,7 +40,6 @@ export function Inputs(props: PropTypes) {
40
40
  } = useQuoteStore();
41
41
  const { connectedWallets, getBalanceFor } = useWalletsStore();
42
42
  const fromTokenBalance = fromToken ? getBalanceFor(fromToken) : null;
43
-
44
43
  const fromTokenFormattedBalance =
45
44
  formatBalance(fromTokenBalance)?.amount ?? '0';
46
45
 
@@ -69,6 +68,7 @@ export function Inputs(props: PropTypes) {
69
68
  !inputUsdValue || !outputUsdValue || !outputUsdValue.gt(0)
70
69
  ? null
71
70
  : getPriceImpact(inputUsdValue.toString(), outputUsdValue.toString());
71
+
72
72
  return (
73
73
  <Container>
74
74
  <FromContainer>
@@ -168,11 +168,12 @@ export const useQuoteStore = createSelectors(
168
168
 
169
169
  return {
170
170
  fromBlockchain: chain,
171
+ inputUsdValue: new BigNumber(0),
171
172
  ...(state.fromToken && {
172
173
  selectedQuote: null,
173
174
  fromToken: null,
174
175
  outputAmount: null,
175
- outputUsdValue: null,
176
+ outputUsdValue: new BigNumber(0),
176
177
  }),
177
178
  };
178
179
  });
@@ -203,7 +204,7 @@ export const useQuoteStore = createSelectors(
203
204
  selectedQuote: null,
204
205
  toToken: null,
205
206
  outputAmount: null,
206
- outputUsdValue: null,
207
+ outputUsdValue: new BigNumber(0),
207
208
  }),
208
209
  };
209
210
  });
@@ -268,8 +269,10 @@ export const useQuoteStore = createSelectors(
268
269
  set(() => ({
269
270
  fromToken: null,
270
271
  fromBlockchain: null,
272
+ outputUsdValue: new BigNumber(0),
273
+ inputUsdValue: new BigNumber(0),
274
+ inputAmount: '',
271
275
  outputAmount: null,
272
- outputUsdValue: null,
273
276
  selectedQuote: null,
274
277
  })),
275
278
  resetToBlockchain: () =>
@@ -277,7 +280,7 @@ export const useQuoteStore = createSelectors(
277
280
  toToken: null,
278
281
  toBlockchain: null,
279
282
  outputAmount: null,
280
- outputUsdValue: null,
283
+ outputUsdValue: new BigNumber(0),
281
284
  selectedQuote: null,
282
285
  })),
283
286
  setQuoteWalletConfirmed: (flag) =>