@rango-dev/widget-embedded 0.30.1-next.17 → 0.30.1-next.19

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.30.1-next.17",
3
+ "version": "0.30.1-next.19",
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.35.2-next.3",
31
31
  "@rango-dev/queue-manager-react": "^0.26.1-next.1",
32
32
  "@rango-dev/signer-solana": "^0.30.1-next.1",
33
- "@rango-dev/ui": "^0.36.1-next.8",
33
+ "@rango-dev/ui": "^0.36.1-next.9",
34
34
  "@rango-dev/wallets-react": "^0.21.2-next.3",
35
35
  "@rango-dev/wallets-shared": "^0.35.2-next.1",
36
36
  "bignumber.js": "^9.1.1",
@@ -53,4 +53,4 @@
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  }
56
- }
56
+ }
@@ -4,7 +4,7 @@ import { useManager } from '@rango-dev/queue-manager-react';
4
4
  import React, { createContext, useContext } from 'react';
5
5
 
6
6
  import { useLanguage } from '../../hooks/useLanguage';
7
- import { useUpdateQuoteInput } from '../../hooks/useUpdateQuoteInput/useUpdateQuoteInput';
7
+ import { useUpdateQuoteInputs } from '../../hooks/useUpdateQuoteInputs/useUpdateQuoteInputs';
8
8
  import { useAppStore } from '../../store/AppStore';
9
9
  import { useNotificationStore } from '../../store/notification';
10
10
  import { useQuoteStore } from '../../store/quote';
@@ -36,7 +36,9 @@ export function WidgetInfo(props: React.PropsWithChildren) {
36
36
  const resetLanguage = useLanguage().resetLanguage;
37
37
  const notifications = useNotificationStore().getNotifications();
38
38
  const clearNotifications = useNotificationStore().clearNotifications;
39
- const updateQuoteInput = useUpdateQuoteInput();
39
+ const updateQuoteInputs = useUpdateQuoteInputs();
40
+ const { fromBlockchain, toBlockchain, fromToken, toToken, inputAmount } =
41
+ useQuoteStore();
40
42
 
41
43
  // eslint-disable-next-line react/jsx-no-constructed-context-values
42
44
  const value: WidgetInfoContextInterface = {
@@ -62,7 +64,26 @@ export function WidgetInfo(props: React.PropsWithChildren) {
62
64
  clearAll: clearNotifications,
63
65
  },
64
66
  quote: {
65
- updateQuoteInput,
67
+ quoteInputs: {
68
+ fromBlockchain: fromBlockchain?.name ?? null,
69
+ fromToken: fromToken
70
+ ? {
71
+ symbol: fromToken.symbol,
72
+ blockchain: fromToken.blockchain,
73
+ address: fromToken.address,
74
+ }
75
+ : null,
76
+ toBlockchain: toBlockchain?.name ?? null,
77
+ toToken: toToken
78
+ ? {
79
+ symbol: toToken.symbol,
80
+ blockchain: toToken.blockchain,
81
+ address: toToken.address,
82
+ }
83
+ : null,
84
+ requestAmount: inputAmount,
85
+ },
86
+ updateQuoteInputs,
66
87
  },
67
88
  };
68
89
 
@@ -1,7 +1,7 @@
1
1
  import type { WidgetHistory } from './WidgetInfo.helpers';
2
2
  import type { FetchStatus, FindToken } from '../../store/slices/data';
3
3
  import type { ConnectedWallet } from '../../store/wallets';
4
- import type { UpdateQuoteInput, Wallet } from '../../types';
4
+ import type { QuoteInputs, UpdateQuoteInputs, Wallet } from '../../types';
5
5
  import type { Notification } from '../../types/notification';
6
6
  import type { BlockchainMeta, SwapperMeta, Token } from 'rango-sdk';
7
7
 
@@ -28,6 +28,7 @@ export interface WidgetInfoContextInterface {
28
28
  clearAll: () => void;
29
29
  };
30
30
  quote: {
31
- updateQuoteInput: UpdateQuoteInput;
31
+ quoteInputs: QuoteInputs;
32
+ updateQuoteInputs: UpdateQuoteInputs;
32
33
  };
33
34
  }
@@ -0,0 +1 @@
1
+ export { useUpdateQuoteInputs } from './useUpdateQuoteInputs';
@@ -1,10 +1,10 @@
1
- import type { UpdateQuoteInput } from '../../types';
1
+ import type { UpdateQuoteInputs } from '../../types';
2
2
 
3
3
  import { useAppStore } from '../../store/AppStore';
4
4
  import { useQuoteStore } from '../../store/quote';
5
5
 
6
6
  // This hook provides a function to update quote inputs using fewer and simpler parameters.
7
- export function useUpdateQuoteInput() {
7
+ export function useUpdateQuoteInputs() {
8
8
  const { findToken } = useAppStore();
9
9
  const blockchains = useAppStore().blockchains();
10
10
  const tokens = useAppStore().tokens();
@@ -16,7 +16,7 @@ export function useUpdateQuoteInput() {
16
16
  setInputAmount,
17
17
  } = useQuoteStore();
18
18
 
19
- const updateQuoteInput: UpdateQuoteInput = (params) => {
19
+ const updateQuoteInputs: UpdateQuoteInputs = (params) => {
20
20
  const { fromBlockchain, fromToken, toBlockchain, toToken, requestAmount } =
21
21
  params;
22
22
  const meta = { blockchains, tokens };
@@ -46,5 +46,5 @@ export function useUpdateQuoteInput() {
46
46
  }
47
47
  };
48
48
 
49
- return updateQuoteInput;
49
+ return updateQuoteInputs;
50
50
  }
@@ -133,10 +133,12 @@ export type QuoteErrorResponse = {
133
133
  options: QuoteError;
134
134
  };
135
135
 
136
- export type UpdateQuoteInput = (params: {
137
- fromBlockchain?: string | null;
138
- toBlockchain?: string | null;
139
- fromToken?: Asset | null;
140
- toToken?: Asset | null;
141
- requestAmount?: string;
142
- }) => void;
136
+ export type QuoteInputs = {
137
+ fromBlockchain: string | null;
138
+ toBlockchain: string | null;
139
+ fromToken: Asset | null;
140
+ toToken: Asset | null;
141
+ requestAmount: string;
142
+ };
143
+
144
+ export type UpdateQuoteInputs = (params: Partial<QuoteInputs>) => void;
@@ -1,2 +0,0 @@
1
- export { useUpdateQuoteInput } from './useUpdateQuoteInput';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useUpdateQuoteInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { UpdateQuoteInput } from '../../types';
2
- export declare function useUpdateQuoteInput(): UpdateQuoteInput;
3
- //# sourceMappingURL=useUpdateQuoteInput.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useUpdateQuoteInput.d.ts","sourceRoot":"","sources":["../../../src/hooks/useUpdateQuoteInput/useUpdateQuoteInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAMpD,wBAAgB,mBAAmB,qBA2ClC"}
@@ -1 +0,0 @@
1
- export { useUpdateQuoteInput } from './useUpdateQuoteInput';