@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/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -1
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +3 -2
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -1
- package/dist/hooks/useUpdateQuoteInputs/index.d.ts +2 -0
- package/dist/hooks/useUpdateQuoteInputs/index.d.ts.map +1 -0
- package/dist/hooks/useUpdateQuoteInputs/useUpdateQuoteInputs.d.ts +3 -0
- package/dist/hooks/useUpdateQuoteInputs/useUpdateQuoteInputs.d.ts.map +1 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/types/quote.d.ts +8 -7
- package/dist/types/quote.d.ts.map +1 -1
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +3 -3
- package/src/containers/WidgetInfo/WidgetInfo.tsx +24 -3
- package/src/containers/WidgetInfo/WidgetInfo.types.ts +3 -2
- package/src/hooks/useUpdateQuoteInputs/index.ts +1 -0
- package/src/hooks/{useUpdateQuoteInput/useUpdateQuoteInput.ts → useUpdateQuoteInputs/useUpdateQuoteInputs.ts} +4 -4
- package/src/types/quote.ts +9 -7
- package/dist/hooks/useUpdateQuoteInput/index.d.ts +0 -2
- package/dist/hooks/useUpdateQuoteInput/index.d.ts.map +0 -1
- package/dist/hooks/useUpdateQuoteInput/useUpdateQuoteInput.d.ts +0 -3
- package/dist/hooks/useUpdateQuoteInput/useUpdateQuoteInput.d.ts.map +0 -1
- package/src/hooks/useUpdateQuoteInput/index.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.30.1-next.
|
|
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.
|
|
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 {
|
|
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
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
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 {
|
|
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
|
|
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
|
|
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
|
|
49
|
+
return updateQuoteInputs;
|
|
50
50
|
}
|
package/src/types/quote.ts
CHANGED
|
@@ -133,10 +133,12 @@ export type QuoteErrorResponse = {
|
|
|
133
133
|
options: QuoteError;
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
-
export type
|
|
137
|
-
fromBlockchain
|
|
138
|
-
toBlockchain
|
|
139
|
-
fromToken
|
|
140
|
-
toToken
|
|
141
|
-
requestAmount
|
|
142
|
-
}
|
|
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 +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 +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';
|