@rango-dev/widget-embedded 0.45.1-next.1 → 0.45.1-next.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.45.1-next.1",
3
+ "version": "0.45.1-next.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -25,15 +25,15 @@
25
25
  "@lingui/core": "4.2.1",
26
26
  "@lingui/react": "4.2.1",
27
27
  "@rango-dev/logging-core": "^0.9.1-next.0",
28
- "@rango-dev/provider-all": "^0.48.1-next.1",
28
+ "@rango-dev/provider-all": "^0.48.1-next.2",
29
29
  "@rango-dev/queue-manager-core": "^0.30.1-next.0",
30
- "@rango-dev/queue-manager-rango-preset": "^0.47.1-next.1",
30
+ "@rango-dev/queue-manager-rango-preset": "^0.47.1-next.2",
31
31
  "@rango-dev/queue-manager-react": "^0.30.1-next.0",
32
32
  "@rango-dev/signer-solana": "^0.41.1-next.0",
33
- "@rango-dev/ui": "^0.48.1-next.1",
34
- "@rango-dev/wallets-core": "^0.45.1-next.1",
35
- "@rango-dev/wallets-react": "^0.32.1-next.1",
36
- "@rango-dev/wallets-shared": "^0.46.1-next.1",
33
+ "@rango-dev/ui": "^0.48.1-next.3",
34
+ "@rango-dev/wallets-core": "^0.45.1-next.2",
35
+ "@rango-dev/wallets-react": "^0.32.1-next.2",
36
+ "@rango-dev/wallets-shared": "^0.46.1-next.2",
37
37
  "bignumber.js": "^9.1.1",
38
38
  "copy-to-clipboard": "^3.3.3",
39
39
  "dayjs": "^1.11.7",
@@ -32,26 +32,3 @@ export const SlippageChip = styled(Chip, {
32
32
  width: '61px',
33
33
  flexShrink: 0,
34
34
  });
35
-
36
- export const SlippageTextFieldContainer = styled('div', {
37
- outlineWidth: 1,
38
- outlineStyle: 'solid',
39
- borderRadius: '$xs',
40
- flex: 1,
41
- variants: {
42
- status: {
43
- safe: {
44
- outlineColor: '$secondary500',
45
- },
46
- error: {
47
- outlineColor: '$error500',
48
- },
49
- warning: {
50
- outlineColor: '$warning500',
51
- },
52
- empty: {
53
- outlineWidth: 0,
54
- },
55
- },
56
- },
57
- });
@@ -21,7 +21,6 @@ import {
21
21
  Head,
22
22
  SlippageChip,
23
23
  SlippageChipsContainer,
24
- SlippageTextFieldContainer,
25
24
  } from './Slippage.styles';
26
25
  import { SlippageTooltipContent } from './SlippageTooltipContent';
27
26
 
@@ -92,32 +91,31 @@ export function Slippage() {
92
91
  />
93
92
  );
94
93
  })}
95
- <SlippageTextFieldContainer
94
+
95
+ <TextField
96
+ type="number"
97
+ min="0.01"
98
+ max="30"
99
+ step="0.01"
96
100
  status={
97
- slippageValidation?.type || (customSlippage ? 'safe' : 'empty')
98
- }>
99
- <TextField
100
- type="number"
101
- min="0.01"
102
- max="30"
103
- step="0.01"
104
- id="widget-slippage-chip-text-input"
105
- onInput={onInput}
106
- fullWidth
107
- variant="contained"
108
- value={customSlippage === null ? '' : customSlippage}
109
- color="dark"
110
- onChange={onSlippageValueChange}
111
- suffix={
112
- customSlippage && (
113
- <Typography variant="body" size="small">
114
- %
115
- </Typography>
116
- )
117
- }
118
- placeholder={i18n.t('Custom')}
119
- />
120
- </SlippageTextFieldContainer>
101
+ slippageValidation?.type || (customSlippage ? 'success' : 'default')
102
+ }
103
+ id="widget-slippage-chip-text-input"
104
+ onInput={onInput}
105
+ fullWidth
106
+ variant="contained"
107
+ value={customSlippage === null ? '' : customSlippage}
108
+ color="dark"
109
+ onChange={onSlippageValueChange}
110
+ suffix={
111
+ customSlippage && (
112
+ <Typography variant="body" size="small">
113
+ %
114
+ </Typography>
115
+ )
116
+ }
117
+ placeholder={i18n.t('Custom')}
118
+ />
121
119
  </SlippageChipsContainer>
122
120
 
123
121
  {slippageValidation && (
@@ -77,7 +77,7 @@ export function useUpdates(params: UseUpdatesParams): UseUpdates {
77
77
  );
78
78
 
79
79
  if (data.length) {
80
- void newWalletConnected(data, info.namespace);
80
+ void newWalletConnected(data, info.namespace, state.derivationPath);
81
81
  }
82
82
  };
83
83
 
@@ -100,7 +100,11 @@ export interface WalletsSlice {
100
100
  namespaces?: Namespace[];
101
101
  }
102
102
  ) => void;
103
- addConnectedWallet: (accounts: Wallet[], namespace?: Namespace) => void;
103
+ addConnectedWallet: (
104
+ accounts: Wallet[],
105
+ namespace?: Namespace,
106
+ derivationPath?: string
107
+ ) => void;
104
108
  setWalletsAsSelected: (
105
109
  wallets: { walletType: string; chain: string }[]
106
110
  ) => void;
@@ -109,7 +113,8 @@ export interface WalletsSlice {
109
113
  */
110
114
  newWalletConnected: (
111
115
  accounts: Wallet[],
112
- namespace?: Namespace
116
+ namespace?: Namespace,
117
+ derivationPath?: string
113
118
  ) => Promise<void>;
114
119
  disconnectNamespaces: (walletType: string, namespaces: Namespace[]) => void;
115
120
  /**
@@ -231,7 +236,7 @@ export const createWalletsSlice = keepLastUpdated<AppStoreState, WalletsSlice>(
231
236
  };
232
237
  });
233
238
  },
234
- addConnectedWallet: (accounts, namespace) => {
239
+ addConnectedWallet: (accounts, namespace, derivationPath) => {
235
240
  /*
236
241
  * When we are going to add a new account, there are two thing that can be happens:
237
242
  * 1. Wallet hasn't add yet.
@@ -276,6 +281,7 @@ export const createWalletsSlice = keepLastUpdated<AppStoreState, WalletsSlice>(
276
281
  walletType: account.walletType,
277
282
  selected: shouldMarkWalletAsSelected,
278
283
  namespace: namespace,
284
+ derivationPath: derivationPath,
279
285
  loading: false,
280
286
  error: false,
281
287
  };
@@ -435,13 +441,13 @@ export const createWalletsSlice = keepLastUpdated<AppStoreState, WalletsSlice>(
435
441
  connectedWallets: nextConnectedWalletsWithUpdatedSelectedStatus,
436
442
  });
437
443
  },
438
- newWalletConnected: async (accounts, namespace) => {
444
+ newWalletConnected: async (accounts, namespace, derivationPath) => {
439
445
  eventEmitter.emit(WidgetEvents.WalletEvent, {
440
446
  type: WalletEventTypes.CONNECT,
441
447
  payload: { walletType: accounts[0].walletType, accounts },
442
448
  });
443
449
 
444
- get().addConnectedWallet(accounts, namespace);
450
+ get().addConnectedWallet(accounts, namespace, derivationPath);
445
451
 
446
452
  void get().fetchBalances(accounts);
447
453
  },
@@ -6,6 +6,7 @@ export interface Wallet {
6
6
  address: string;
7
7
  walletType: WalletType;
8
8
  isContractWallet?: boolean;
9
+ derivationPath?: string;
9
10
  }
10
11
 
11
12
  export type Balance = {
package/src/utils/swap.ts CHANGED
@@ -534,13 +534,18 @@ export function getWalletsForNewSwap(selectedWallets: Wallet[]) {
534
534
  const wallets = selectedWallets.reduce(
535
535
  (
536
536
  selectedWalletsMap: {
537
- [p: string]: { address: string; walletType: WalletType };
537
+ [p: string]: {
538
+ address: string;
539
+ walletType: WalletType;
540
+ derivationPath?: string;
541
+ };
538
542
  },
539
543
  selectedWallet
540
544
  ) => (
541
545
  (selectedWalletsMap[selectedWallet.chain] = {
542
546
  address: selectedWallet.address,
543
547
  walletType: selectedWallet.walletType,
548
+ derivationPath: selectedWallet.derivationPath,
544
549
  }),
545
550
  selectedWalletsMap
546
551
  ),