@reown/appkit-react-native 0.0.0-feat-multi-social-20250710162403 → 0.0.0-feat-multi-social-20250714194032
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/lib/commonjs/AppKit.js +3 -0
- package/lib/commonjs/AppKit.js.map +1 -1
- package/lib/commonjs/modal/w3m-router/index.js +0 -3
- package/lib/commonjs/modal/w3m-router/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-tokens/index.js +9 -9
- package/lib/commonjs/partials/w3m-account-tokens/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-header/index.js +0 -1
- package/lib/commonjs/partials/w3m-header/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-send-input-address/index.js +16 -13
- package/lib/commonjs/partials/w3m-send-input-address/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-send-input-token/index.js +1 -1
- package/lib/commonjs/partials/w3m-send-input-token/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-send-input-token/utils.js +1 -1
- package/lib/commonjs/partials/w3m-send-input-token/utils.js.map +1 -1
- package/lib/commonjs/partials/w3m-swap-input/index.js +24 -7
- package/lib/commonjs/partials/w3m-swap-input/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-swap-input/styles.js +3 -0
- package/lib/commonjs/partials/w3m-swap-input/styles.js.map +1 -1
- package/lib/commonjs/views/{w3m-swap-select-token-view → w3m-swap-view/components/select-token-view}/index.js +29 -11
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/index.js.map +1 -0
- package/lib/commonjs/views/{w3m-swap-select-token-view → w3m-swap-view/components/select-token-view}/styles.js +11 -2
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/styles.js.map +1 -0
- package/lib/commonjs/views/{w3m-swap-select-token-view → w3m-swap-view/components/select-token-view}/utils.js +3 -3
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/utils.js.map +1 -0
- package/lib/commonjs/views/w3m-swap-view/index.js +32 -25
- package/lib/commonjs/views/w3m-swap-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/styles.js +4 -0
- package/lib/commonjs/views/w3m-swap-view/styles.js.map +1 -1
- package/lib/module/AppKit.js +3 -0
- package/lib/module/AppKit.js.map +1 -1
- package/lib/module/modal/w3m-router/index.js +0 -3
- package/lib/module/modal/w3m-router/index.js.map +1 -1
- package/lib/module/partials/w3m-account-tokens/index.js +9 -9
- package/lib/module/partials/w3m-account-tokens/index.js.map +1 -1
- package/lib/module/partials/w3m-header/index.js +0 -1
- package/lib/module/partials/w3m-header/index.js.map +1 -1
- package/lib/module/partials/w3m-send-input-address/index.js +17 -14
- package/lib/module/partials/w3m-send-input-address/index.js.map +1 -1
- package/lib/module/partials/w3m-send-input-token/index.js +1 -1
- package/lib/module/partials/w3m-send-input-token/index.js.map +1 -1
- package/lib/module/partials/w3m-send-input-token/utils.js +1 -1
- package/lib/module/partials/w3m-send-input-token/utils.js.map +1 -1
- package/lib/module/partials/w3m-swap-input/index.js +24 -7
- package/lib/module/partials/w3m-swap-input/index.js.map +1 -1
- package/lib/module/partials/w3m-swap-input/styles.js +3 -0
- package/lib/module/partials/w3m-swap-input/styles.js.map +1 -1
- package/lib/module/views/{w3m-swap-select-token-view → w3m-swap-view/components/select-token-view}/index.js +32 -14
- package/lib/module/views/w3m-swap-view/components/select-token-view/index.js.map +1 -0
- package/lib/module/views/{w3m-swap-select-token-view → w3m-swap-view/components/select-token-view}/styles.js +12 -3
- package/lib/module/views/w3m-swap-view/components/select-token-view/styles.js.map +1 -0
- package/lib/module/views/{w3m-swap-select-token-view → w3m-swap-view/components/select-token-view}/utils.js +3 -3
- package/lib/module/views/w3m-swap-view/components/select-token-view/utils.js.map +1 -0
- package/lib/module/views/w3m-swap-view/index.js +33 -26
- package/lib/module/views/w3m-swap-view/index.js.map +1 -1
- package/lib/module/views/w3m-swap-view/styles.js +4 -0
- package/lib/module/views/w3m-swap-view/styles.js.map +1 -1
- package/lib/typescript/AppKit.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-router/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-account-tokens/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-header/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-send-input-address/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-swap-input/index.d.ts +2 -1
- package/lib/typescript/partials/w3m-swap-input/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-swap-input/styles.d.ts +3 -0
- package/lib/typescript/partials/w3m-swap-input/styles.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/index.d.ts +8 -0
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/index.d.ts.map +1 -0
- package/lib/typescript/views/{w3m-swap-select-token-view → w3m-swap-view/components/select-token-view}/styles.d.ts +11 -2
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/styles.d.ts.map +1 -0
- package/lib/typescript/views/{w3m-swap-select-token-view → w3m-swap-view/components/select-token-view}/utils.d.ts +1 -1
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/utils.d.ts.map +1 -0
- package/lib/typescript/views/w3m-swap-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/styles.d.ts +4 -0
- package/lib/typescript/views/w3m-swap-view/styles.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/AppKit.ts +4 -0
- package/src/modal/w3m-router/index.tsx +0 -3
- package/src/partials/w3m-account-tokens/index.tsx +6 -8
- package/src/partials/w3m-header/index.tsx +0 -1
- package/src/partials/w3m-send-input-address/index.tsx +15 -14
- package/src/partials/w3m-send-input-token/index.tsx +1 -1
- package/src/partials/w3m-send-input-token/utils.ts +1 -1
- package/src/partials/w3m-swap-input/index.tsx +38 -27
- package/src/partials/w3m-swap-input/styles.ts +3 -0
- package/src/views/{w3m-swap-select-token-view → w3m-swap-view/components/select-token-view}/index.tsx +40 -12
- package/src/views/{w3m-swap-select-token-view → w3m-swap-view/components/select-token-view}/styles.ts +12 -3
- package/src/views/{w3m-swap-select-token-view → w3m-swap-view/components/select-token-view}/utils.ts +7 -6
- package/src/views/w3m-swap-view/index.tsx +79 -66
- package/src/views/w3m-swap-view/styles.ts +4 -0
- package/lib/commonjs/views/w3m-swap-select-token-view/index.js.map +0 -1
- package/lib/commonjs/views/w3m-swap-select-token-view/styles.js.map +0 -1
- package/lib/commonjs/views/w3m-swap-select-token-view/utils.js.map +0 -1
- package/lib/module/views/w3m-swap-select-token-view/index.js.map +0 -1
- package/lib/module/views/w3m-swap-select-token-view/styles.js.map +0 -1
- package/lib/module/views/w3m-swap-select-token-view/utils.js.map +0 -1
- package/lib/typescript/views/w3m-swap-select-token-view/index.d.ts +0 -2
- package/lib/typescript/views/w3m-swap-select-token-view/index.d.ts.map +0 -1
- package/lib/typescript/views/w3m-swap-select-token-view/styles.d.ts.map +0 -1
- package/lib/typescript/views/w3m-swap-select-token-view/utils.d.ts.map +0 -1
|
@@ -7,6 +7,7 @@ export interface SwapInputProps {
|
|
|
7
7
|
gasPrice?: number;
|
|
8
8
|
style?: StyleProp<ViewStyle>;
|
|
9
9
|
loading?: boolean;
|
|
10
|
+
loadingValues?: boolean;
|
|
10
11
|
onTokenPress?: () => void;
|
|
11
12
|
onMaxPress?: () => void;
|
|
12
13
|
onChange?: (value: string) => void;
|
|
@@ -15,5 +16,5 @@ export interface SwapInputProps {
|
|
|
15
16
|
editable?: boolean;
|
|
16
17
|
autoFocus?: boolean;
|
|
17
18
|
}
|
|
18
|
-
export declare function SwapInput({ token, value, style, loading, onTokenPress, onMaxPress, onChange, marketValue, editable, autoFocus }: SwapInputProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function SwapInput({ token, value, style, loading, loadingValues, onTokenPress, onMaxPress, onChange, marketValue, editable, autoFocus }: SwapInputProps): import("react/jsx-runtime").JSX.Element;
|
|
19
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-swap-input/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAa,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAUzE,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAK5E,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAID,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,KAAK,EACL,OAAO,EACP,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,SAAS,EACV,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-swap-input/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAa,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAUzE,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAK5E,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAID,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,KAAK,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,SAAS,EACV,EAAE,cAAc,2CAmHhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-swap-input/styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-swap-input/styles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAGA,wBAmBG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type SwapInputTarget } from '@reown/appkit-core-react-native';
|
|
2
|
+
interface Props {
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
type?: SwapInputTarget;
|
|
5
|
+
}
|
|
6
|
+
export declare function SwapSelectTokenView({ onClose, type }: Props): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/w3m-swap-view/components/select-token-view/index.tsx"],"names":[],"mappings":"AAeA,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,iCAAiC,CAAC;AAOzC,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB;AAED,wBAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,2CAkI3D"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
container: {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
borderRadius: number;
|
|
4
|
+
borderWidth: number;
|
|
5
|
+
borderBottomLeftRadius: number;
|
|
6
|
+
borderBottomRightRadius: number;
|
|
7
|
+
overflow: "hidden";
|
|
8
|
+
marginTop: number;
|
|
9
|
+
flex: number;
|
|
5
10
|
};
|
|
6
11
|
title: {
|
|
7
12
|
paddingTop: number;
|
|
@@ -24,6 +29,10 @@ declare const _default: {
|
|
|
24
29
|
suggestedSeparator: {
|
|
25
30
|
marginVertical: number;
|
|
26
31
|
};
|
|
32
|
+
iconPlaceholder: {
|
|
33
|
+
height: number;
|
|
34
|
+
width: number;
|
|
35
|
+
};
|
|
27
36
|
};
|
|
28
37
|
export default _default;
|
|
29
38
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../../src/views/w3m-swap-view/components/select-token-view/styles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAmCG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type SwapTokenWithBalance } from '@reown/appkit-core-react-native';
|
|
2
2
|
export declare function filterTokens(tokens?: SwapTokenWithBalance[], searchValue?: string): SwapTokenWithBalance[];
|
|
3
|
-
export declare function createSections(isSourceToken: boolean, searchValue: string): {
|
|
3
|
+
export declare function createSections(isSourceToken: boolean, searchValue: string, balances?: SwapTokenWithBalance[]): {
|
|
4
4
|
title: string;
|
|
5
5
|
data: SwapTokenWithBalance[];
|
|
6
6
|
}[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/views/w3m-swap-view/components/select-token-view/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5F,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE,EAAE,WAAW,CAAC,EAAE,MAAM,0BAcjF;AAED,wBAAgB,cAAc,CAC5B,aAAa,EAAE,OAAO,EACtB,WAAW,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,oBAAoB,EAAE;;;IAgBlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-swap-view/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-swap-view/index.tsx"],"names":[],"mappings":"AAuBA,wBAAgB,QAAQ,4CAyMvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-swap-view/styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-swap-view/styles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAuBG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reown/appkit-react-native",
|
|
3
|
-
"version": "0.0.0-feat-multi-social-
|
|
3
|
+
"version": "0.0.0-feat-multi-social-20250714194032",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"types": "lib/typescript/index.d.ts",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@reown/appkit-common-react-native": "0.0.0-feat-multi-social-
|
|
41
|
-
"@reown/appkit-core-react-native": "0.0.0-feat-multi-social-
|
|
42
|
-
"@reown/appkit-siwe-react-native": "0.0.0-feat-multi-social-
|
|
43
|
-
"@reown/appkit-ui-react-native": "0.0.0-feat-multi-social-
|
|
40
|
+
"@reown/appkit-common-react-native": "0.0.0-feat-multi-social-20250714194032",
|
|
41
|
+
"@reown/appkit-core-react-native": "0.0.0-feat-multi-social-20250714194032",
|
|
42
|
+
"@reown/appkit-siwe-react-native": "0.0.0-feat-multi-social-20250714194032",
|
|
43
|
+
"@reown/appkit-ui-react-native": "0.0.0-feat-multi-social-20250714194032",
|
|
44
44
|
"@walletconnect/universal-provider": "2.20.2",
|
|
45
45
|
"valtio": "^1.13.2"
|
|
46
46
|
},
|
package/src/AppKit.ts
CHANGED
|
@@ -496,6 +496,10 @@ export class AppKit {
|
|
|
496
496
|
const network = this.networks.find(n => n.id?.toString() === chainId);
|
|
497
497
|
this.syncBalances(adapter, network);
|
|
498
498
|
|
|
499
|
+
if (OptionsController.state.features?.swaps) {
|
|
500
|
+
SwapController.fetchTokens();
|
|
501
|
+
}
|
|
502
|
+
|
|
499
503
|
if (namespace === 'eip155') {
|
|
500
504
|
this.handleSiweChange({ isNetworkChange: true });
|
|
501
505
|
}
|
|
@@ -21,7 +21,6 @@ import { OnRampSettingsView } from '../../views/w3m-onramp-settings-view';
|
|
|
21
21
|
import { OnRampTransactionView } from '../../views/w3m-onramp-transaction-view';
|
|
22
22
|
import { SwapView } from '../../views/w3m-swap-view';
|
|
23
23
|
import { SwapPreviewView } from '../../views/w3m-swap-preview-view';
|
|
24
|
-
import { SwapSelectTokenView } from '../../views/w3m-swap-select-token-view';
|
|
25
24
|
import { TransactionsView } from '../../views/w3m-transactions-view';
|
|
26
25
|
import { UnsupportedChainView } from '../../views/w3m-unsupported-chain-view';
|
|
27
26
|
import { UpgradeEmailWalletView } from '../../views/w3m-upgrade-email-wallet-view';
|
|
@@ -81,8 +80,6 @@ export function AppKitRouter() {
|
|
|
81
80
|
return SwapView;
|
|
82
81
|
case 'SwapPreview':
|
|
83
82
|
return SwapPreviewView;
|
|
84
|
-
case 'SwapSelectToken':
|
|
85
|
-
return SwapSelectTokenView;
|
|
86
83
|
case 'Transactions':
|
|
87
84
|
return TransactionsView;
|
|
88
85
|
case 'UnsupportedChain':
|
|
@@ -33,10 +33,7 @@ export function AccountTokens({ style, isLoading }: Props) {
|
|
|
33
33
|
const { activeNetwork, balances } = useSnapshot(ConnectionsController.state);
|
|
34
34
|
const networkImage = AssetUtil.getNetworkImage(activeNetwork?.id);
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
const filteredBalances = balances?.filter(balance => balance.quantity);
|
|
38
|
-
|
|
39
|
-
const onRefresh = useCallback(async () => {
|
|
36
|
+
const getBalance = useCallback(async () => {
|
|
40
37
|
setRefreshing(true);
|
|
41
38
|
await ConnectionsController.fetchBalance();
|
|
42
39
|
setRefreshing(false);
|
|
@@ -46,7 +43,7 @@ export function AccountTokens({ style, isLoading }: Props) {
|
|
|
46
43
|
RouterController.push('WalletReceive');
|
|
47
44
|
};
|
|
48
45
|
|
|
49
|
-
if (!
|
|
46
|
+
if (!balances?.length) {
|
|
50
47
|
return (
|
|
51
48
|
<>
|
|
52
49
|
<ListItem
|
|
@@ -75,14 +72,14 @@ export function AccountTokens({ style, isLoading }: Props) {
|
|
|
75
72
|
style={style}
|
|
76
73
|
refreshControl={
|
|
77
74
|
<RefreshControl
|
|
78
|
-
refreshing={
|
|
79
|
-
onRefresh={
|
|
75
|
+
refreshing={refreshing}
|
|
76
|
+
onRefresh={getBalance}
|
|
80
77
|
tintColor={Theme['accent-100']}
|
|
81
78
|
colors={[Theme['accent-100']]}
|
|
82
79
|
/>
|
|
83
80
|
}
|
|
84
81
|
>
|
|
85
|
-
{
|
|
82
|
+
{balances.map(token => (
|
|
86
83
|
<ListToken
|
|
87
84
|
key={token.symbol}
|
|
88
85
|
name={token.name || 'Unknown'}
|
|
@@ -94,6 +91,7 @@ export function AccountTokens({ style, isLoading }: Props) {
|
|
|
94
91
|
pressable={false}
|
|
95
92
|
/>
|
|
96
93
|
))}
|
|
94
|
+
{isLoading && <LoadingSpinner size="sm" style={styles.loadingSpinner} />}
|
|
97
95
|
</ScrollView>
|
|
98
96
|
);
|
|
99
97
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { TextInput } from 'react-native';
|
|
3
3
|
import { FlexView, useTheme } from '@reown/appkit-ui-react-native';
|
|
4
|
-
import {
|
|
4
|
+
import { SendController } from '@reown/appkit-core-react-native';
|
|
5
5
|
|
|
6
6
|
import { useDebounceCallback } from '../../hooks/useDebounceCallback';
|
|
7
7
|
import styles from './styles';
|
|
@@ -15,20 +15,21 @@ export function SendInputAddress({ value }: SendInputAddressProps) {
|
|
|
15
15
|
const [inputValue, setInputValue] = useState<string | undefined>(value);
|
|
16
16
|
|
|
17
17
|
const onSearch = async (search: string) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
// TODO: check when enabling ENS
|
|
19
|
+
// SendController.setLoading(true);
|
|
20
|
+
// const address = await ConnectionController.getEnsAddress(search);
|
|
21
|
+
// SendController.setLoading(false);
|
|
21
22
|
|
|
22
|
-
if (address) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} else {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
23
|
+
// if (address) {
|
|
24
|
+
// SendController.setReceiverProfileName(search);
|
|
25
|
+
// SendController.setReceiverAddress(address);
|
|
26
|
+
// const avatar = await ConnectionController.getEnsAvatar(search);
|
|
27
|
+
// SendController.setReceiverProfileImageUrl(avatar || undefined);
|
|
28
|
+
// } else {
|
|
29
|
+
SendController.setReceiverAddress(search);
|
|
30
|
+
SendController.setReceiverProfileName(undefined);
|
|
31
|
+
SendController.setReceiverProfileImageUrl(undefined);
|
|
32
|
+
// }
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
const { debouncedCallback: onDebounceSearch } = useDebounceCallback({
|
|
@@ -39,7 +39,7 @@ export function SendInputToken({
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
const onMaxPress = () => {
|
|
42
|
-
if (token?.quantity && gasPrice) {
|
|
42
|
+
if (token?.quantity?.numeric && gasPrice) {
|
|
43
43
|
const isNetworkToken =
|
|
44
44
|
token.address === undefined ||
|
|
45
45
|
Object.values(ConstantsUtil.NATIVE_TOKEN_ADDRESS).some(
|
|
@@ -13,7 +13,7 @@ export function getSendValue(token?: Balance, sendTokenAmount?: number) {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function getMaxAmount(token?: Balance) {
|
|
16
|
-
if (token?.quantity) {
|
|
16
|
+
if (token?.quantity?.numeric) {
|
|
17
17
|
return NumberUtil.roundNumber(Number(token.quantity.numeric), 6, 5);
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -21,6 +21,7 @@ export interface SwapInputProps {
|
|
|
21
21
|
gasPrice?: number;
|
|
22
22
|
style?: StyleProp<ViewStyle>;
|
|
23
23
|
loading?: boolean;
|
|
24
|
+
loadingValues?: boolean;
|
|
24
25
|
onTokenPress?: () => void;
|
|
25
26
|
onMaxPress?: () => void;
|
|
26
27
|
onChange?: (value: string) => void;
|
|
@@ -37,6 +38,7 @@ export function SwapInput({
|
|
|
37
38
|
value,
|
|
38
39
|
style,
|
|
39
40
|
loading,
|
|
41
|
+
loadingValues,
|
|
40
42
|
onTokenPress,
|
|
41
43
|
onMaxPress,
|
|
42
44
|
onChange,
|
|
@@ -48,11 +50,11 @@ export function SwapInput({
|
|
|
48
50
|
const valueInputRef = useRef<TextInput | null>(null);
|
|
49
51
|
const isMarketValueGreaterThanZero =
|
|
50
52
|
!!marketValue && NumberUtil.bigNumber(marketValue).isGreaterThan('0');
|
|
51
|
-
const maxAmount = UiUtil.formatNumberToLocalString(token?.quantity
|
|
52
|
-
const maxError = Number(value) > Number(token?.quantity
|
|
53
|
+
const maxAmount = UiUtil.formatNumberToLocalString(token?.quantity?.numeric, 3);
|
|
54
|
+
const maxError = Number(value) > Number(token?.quantity?.numeric);
|
|
53
55
|
const showMax =
|
|
54
56
|
onMaxPress &&
|
|
55
|
-
!!token?.quantity
|
|
57
|
+
!!token?.quantity?.numeric &&
|
|
56
58
|
NumberUtil.multiply(token?.quantity.numeric, token?.price).isGreaterThan(
|
|
57
59
|
MINIMUM_USD_VALUE_TO_CONVERT
|
|
58
60
|
);
|
|
@@ -85,33 +87,40 @@ export function SwapInput({
|
|
|
85
87
|
>
|
|
86
88
|
{loading ? (
|
|
87
89
|
<FlexView flexDirection="row" alignItems="center" justifyContent="space-between">
|
|
88
|
-
<
|
|
90
|
+
<FlexView alignItems="flex-start">
|
|
91
|
+
<Shimmer height={36} width={80} borderRadius={12} style={styles.valueLoader} />
|
|
92
|
+
<Shimmer height={20} width={120} borderRadius={8} />
|
|
93
|
+
</FlexView>
|
|
89
94
|
<Shimmer height={36} width={80} borderRadius={18} />
|
|
90
95
|
</FlexView>
|
|
91
96
|
) : (
|
|
92
97
|
<>
|
|
93
98
|
<FlexView flexDirection="row" alignItems="center" justifyContent="space-between">
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
99
|
+
{loadingValues ? (
|
|
100
|
+
<Shimmer height={36} width={80} borderRadius={12} style={styles.valueLoader} />
|
|
101
|
+
) : (
|
|
102
|
+
<TextInput
|
|
103
|
+
ref={valueInputRef}
|
|
104
|
+
placeholder="0"
|
|
105
|
+
placeholderTextColor={Theme['fg-275']}
|
|
106
|
+
returnKeyType="done"
|
|
107
|
+
style={[styles.input, { color: Theme['fg-100'] }]}
|
|
108
|
+
autoCapitalize="none"
|
|
109
|
+
autoCorrect={false}
|
|
110
|
+
value={value}
|
|
111
|
+
onChangeText={handleInputChange}
|
|
112
|
+
keyboardType="decimal-pad"
|
|
113
|
+
inputMode="decimal"
|
|
114
|
+
autoComplete="off"
|
|
115
|
+
spellCheck={false}
|
|
116
|
+
selectionColor={Theme['accent-100']}
|
|
117
|
+
underlineColorAndroid="transparent"
|
|
118
|
+
selectTextOnFocus={false}
|
|
119
|
+
numberOfLines={1}
|
|
120
|
+
editable={editable}
|
|
121
|
+
autoFocus={autoFocus}
|
|
122
|
+
/>
|
|
123
|
+
)}
|
|
115
124
|
<TokenButton
|
|
116
125
|
text={token?.symbol}
|
|
117
126
|
imageUrl={token?.logoUri}
|
|
@@ -119,7 +128,9 @@ export function SwapInput({
|
|
|
119
128
|
chevron
|
|
120
129
|
/>
|
|
121
130
|
</FlexView>
|
|
122
|
-
{
|
|
131
|
+
{loadingValues ? (
|
|
132
|
+
<Shimmer height={20} width={120} borderRadius={8} />
|
|
133
|
+
) : showMax || isMarketValueGreaterThanZero ? (
|
|
123
134
|
<FlexView
|
|
124
135
|
flexDirection="row"
|
|
125
136
|
alignItems="center"
|
|
@@ -144,7 +155,7 @@ export function SwapInput({
|
|
|
144
155
|
</FlexView>
|
|
145
156
|
)}
|
|
146
157
|
</FlexView>
|
|
147
|
-
)}
|
|
158
|
+
) : null}
|
|
148
159
|
</>
|
|
149
160
|
)}
|
|
150
161
|
</FlexView>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { useSnapshot } from 'valtio';
|
|
3
|
-
import { ScrollView, SectionList, type SectionListData } from 'react-native';
|
|
3
|
+
import { ScrollView, SectionList, View, type SectionListData } from 'react-native';
|
|
4
4
|
import {
|
|
5
5
|
FlexView,
|
|
6
|
+
IconLink,
|
|
6
7
|
InputText,
|
|
7
8
|
ListToken,
|
|
8
9
|
ListTokenTotalHeight,
|
|
@@ -15,33 +16,44 @@ import {
|
|
|
15
16
|
import {
|
|
16
17
|
AssetUtil,
|
|
17
18
|
ConnectionsController,
|
|
18
|
-
RouterController,
|
|
19
19
|
SwapController,
|
|
20
|
+
type SwapControllerState,
|
|
21
|
+
type SwapInputTarget,
|
|
20
22
|
type SwapTokenWithBalance
|
|
21
23
|
} from '@reown/appkit-core-react-native';
|
|
22
24
|
|
|
23
|
-
import { useCustomDimensions } from '
|
|
24
|
-
import { Placeholder } from '
|
|
25
|
+
import { useCustomDimensions } from '../../../../hooks/useCustomDimensions';
|
|
26
|
+
import { Placeholder } from '../../../../partials/w3m-placeholder';
|
|
25
27
|
import styles from './styles';
|
|
26
28
|
import { createSections } from './utils';
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
interface Props {
|
|
31
|
+
onClose: () => void;
|
|
32
|
+
type?: SwapInputTarget;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function SwapSelectTokenView({ onClose, type }: Props) {
|
|
29
36
|
const { padding } = useCustomDimensions();
|
|
30
37
|
const Theme = useTheme();
|
|
31
38
|
const { activeNetwork } = useSnapshot(ConnectionsController.state);
|
|
32
|
-
const { sourceToken, suggestedTokens } = useSnapshot(
|
|
39
|
+
const { sourceToken, suggestedTokens, myTokensWithBalance } = useSnapshot(
|
|
40
|
+
SwapController.state
|
|
41
|
+
) as SwapControllerState;
|
|
42
|
+
|
|
33
43
|
const networkImage = AssetUtil.getNetworkImage(activeNetwork?.id);
|
|
34
44
|
const [tokenSearch, setTokenSearch] = useState<string>('');
|
|
35
|
-
const isSourceToken =
|
|
45
|
+
const isSourceToken = type === 'sourceToken';
|
|
36
46
|
|
|
37
|
-
const [filteredTokens, setFilteredTokens] = useState(
|
|
47
|
+
const [filteredTokens, setFilteredTokens] = useState(
|
|
48
|
+
createSections(isSourceToken, tokenSearch, myTokensWithBalance)
|
|
49
|
+
);
|
|
38
50
|
const suggestedList = suggestedTokens
|
|
39
51
|
?.filter(token => token.address !== SwapController.state.sourceToken?.address)
|
|
40
52
|
.slice(0, 8);
|
|
41
53
|
|
|
42
54
|
const onSearchChange = (value: string) => {
|
|
43
55
|
setTokenSearch(value);
|
|
44
|
-
setFilteredTokens(createSections(isSourceToken, value));
|
|
56
|
+
setFilteredTokens(createSections(isSourceToken, value, myTokensWithBalance));
|
|
45
57
|
};
|
|
46
58
|
|
|
47
59
|
const onTokenPress = (token: SwapTokenWithBalance) => {
|
|
@@ -53,14 +65,30 @@ export function SwapSelectTokenView() {
|
|
|
53
65
|
SwapController.swapTokens();
|
|
54
66
|
}
|
|
55
67
|
}
|
|
56
|
-
|
|
68
|
+
onClose();
|
|
57
69
|
};
|
|
58
70
|
|
|
59
71
|
return (
|
|
60
72
|
<FlexView
|
|
61
|
-
|
|
62
|
-
style={[
|
|
73
|
+
padding={['xl', '0', '0', '0']}
|
|
74
|
+
style={[
|
|
75
|
+
styles.container,
|
|
76
|
+
{
|
|
77
|
+
paddingHorizontal: padding,
|
|
78
|
+
backgroundColor: Theme['bg-100']
|
|
79
|
+
}
|
|
80
|
+
]}
|
|
63
81
|
>
|
|
82
|
+
<FlexView
|
|
83
|
+
flexDirection="row"
|
|
84
|
+
justifyContent="space-between"
|
|
85
|
+
alignItems="center"
|
|
86
|
+
padding={['0', 'm', 'm', 'm']}
|
|
87
|
+
>
|
|
88
|
+
<IconLink icon="chevronLeft" size="md" onPress={onClose} />
|
|
89
|
+
<Text variant="paragraph-600">Select token</Text>
|
|
90
|
+
<View style={styles.iconPlaceholder} />
|
|
91
|
+
</FlexView>
|
|
64
92
|
<FlexView>
|
|
65
93
|
<InputText
|
|
66
94
|
value={tokenSearch}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
|
-
import { Spacing } from '@reown/appkit-ui-react-native';
|
|
2
|
+
import { BorderRadius, Spacing } from '@reown/appkit-ui-react-native';
|
|
3
3
|
|
|
4
4
|
export default StyleSheet.create({
|
|
5
5
|
container: {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
borderRadius: BorderRadius.l,
|
|
7
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
8
|
+
borderBottomLeftRadius: 0,
|
|
9
|
+
borderBottomRightRadius: 0,
|
|
10
|
+
overflow: 'hidden',
|
|
11
|
+
marginTop: 80,
|
|
12
|
+
flex: 1
|
|
8
13
|
},
|
|
9
14
|
title: {
|
|
10
15
|
paddingTop: Spacing['2xs']
|
|
@@ -26,5 +31,9 @@ export default StyleSheet.create({
|
|
|
26
31
|
},
|
|
27
32
|
suggestedSeparator: {
|
|
28
33
|
marginVertical: Spacing.s
|
|
34
|
+
},
|
|
35
|
+
iconPlaceholder: {
|
|
36
|
+
height: 32,
|
|
37
|
+
width: 32
|
|
29
38
|
}
|
|
30
39
|
});
|
package/src/views/{w3m-swap-select-token-view → w3m-swap-view/components/select-token-view}/utils.ts
RENAMED
|
@@ -16,14 +16,15 @@ export function filterTokens(tokens?: SwapTokenWithBalance[], searchValue?: stri
|
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export function createSections(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
export function createSections(
|
|
20
|
+
isSourceToken: boolean,
|
|
21
|
+
searchValue: string,
|
|
22
|
+
balances?: SwapTokenWithBalance[]
|
|
23
|
+
) {
|
|
24
|
+
const myTokensFiltered = filterTokens(balances ?? [], searchValue);
|
|
24
25
|
const popularFiltered = isSourceToken
|
|
25
26
|
? []
|
|
26
|
-
: filterTokens(SwapController.getFilteredPopularTokens()
|
|
27
|
+
: filterTokens(SwapController.getFilteredPopularTokens(balances), searchValue);
|
|
27
28
|
|
|
28
29
|
const sections = [];
|
|
29
30
|
if (myTokensFiltered.length > 0) {
|