@reown/appkit-core-react-native 0.0.0-feat-wallet-features-20240925132010 → 0.0.0-refactor-modal-migration-20241003191957
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/controllers/ConnectionController.js +8 -0
- package/lib/commonjs/controllers/ConnectionController.js.map +1 -1
- package/lib/commonjs/controllers/ModalController.js +3 -1
- package/lib/commonjs/controllers/ModalController.js.map +1 -1
- package/lib/commonjs/controllers/OptionsController.js +9 -1
- package/lib/commonjs/controllers/OptionsController.js.map +1 -1
- package/lib/commonjs/controllers/RouterController.js.map +1 -1
- package/lib/commonjs/controllers/TransactionsController.js +0 -1
- package/lib/commonjs/controllers/TransactionsController.js.map +1 -1
- package/lib/commonjs/controllers/WebviewController.js +40 -0
- package/lib/commonjs/controllers/WebviewController.js.map +1 -0
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/ConstantsUtil.js +7 -1
- package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
- package/lib/commonjs/utils/StorageUtil.js +24 -0
- package/lib/commonjs/utils/StorageUtil.js.map +1 -1
- package/lib/module/controllers/ConnectionController.js +8 -0
- package/lib/module/controllers/ConnectionController.js.map +1 -1
- package/lib/module/controllers/ModalController.js +3 -1
- package/lib/module/controllers/ModalController.js.map +1 -1
- package/lib/module/controllers/OptionsController.js +9 -1
- package/lib/module/controllers/OptionsController.js.map +1 -1
- package/lib/module/controllers/RouterController.js.map +1 -1
- package/lib/module/controllers/TransactionsController.js +0 -1
- package/lib/module/controllers/TransactionsController.js.map +1 -1
- package/lib/module/controllers/WebviewController.js +35 -0
- package/lib/module/controllers/WebviewController.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/ConstantsUtil.js +7 -1
- package/lib/module/utils/ConstantsUtil.js.map +1 -1
- package/lib/module/utils/StorageUtil.js +24 -0
- package/lib/module/utils/StorageUtil.js.map +1 -1
- package/lib/typescript/controllers/ConnectionController.d.ts +3 -0
- package/lib/typescript/controllers/ConnectionController.d.ts.map +1 -1
- package/lib/typescript/controllers/ModalController.d.ts.map +1 -1
- package/lib/typescript/controllers/OptionsController.d.ts +3 -1
- package/lib/typescript/controllers/OptionsController.d.ts.map +1 -1
- package/lib/typescript/controllers/RouterController.d.ts +3 -1
- package/lib/typescript/controllers/RouterController.d.ts.map +1 -1
- package/lib/typescript/controllers/TransactionsController.d.ts.map +1 -1
- package/lib/typescript/controllers/WebviewController.d.ts +18 -0
- package/lib/typescript/controllers/WebviewController.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/ConstantsUtil.d.ts +2 -0
- package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
- package/lib/typescript/utils/StorageUtil.d.ts +4 -0
- package/lib/typescript/utils/StorageUtil.d.ts.map +1 -1
- package/lib/typescript/utils/TypeUtil.d.ts +42 -3
- package/lib/typescript/utils/TypeUtil.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/controllers/ConnectionController.ts +12 -0
- package/src/controllers/ModalController.ts +3 -1
- package/src/controllers/OptionsController.ts +16 -2
- package/src/controllers/RouterController.ts +5 -0
- package/src/controllers/TransactionsController.ts +0 -1
- package/src/controllers/WebviewController.ts +48 -0
- package/src/index.ts +2 -0
- package/src/utils/ConstantsUtil.ts +11 -1
- package/src/utils/StorageUtil.ts +30 -0
- package/src/utils/TypeUtil.ts +39 -3
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import type { Features } from './TypeUtil';
|
|
2
|
+
|
|
3
|
+
const defaultFeatures: Features = {
|
|
4
|
+
email: true,
|
|
5
|
+
emailShowWallets: true,
|
|
6
|
+
socials: ['x', 'discord', 'github', 'apple', 'facebook', 'farcaster']
|
|
7
|
+
};
|
|
8
|
+
|
|
1
9
|
export const ConstantsUtil = {
|
|
2
10
|
FOUR_MINUTES_MS: 240000,
|
|
3
11
|
|
|
@@ -9,5 +17,7 @@ export const ConstantsUtil = {
|
|
|
9
17
|
|
|
10
18
|
LINKING_ERROR: 'LINKING_ERROR',
|
|
11
19
|
|
|
12
|
-
NATIVE_TOKEN_ADDRESS: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'
|
|
20
|
+
NATIVE_TOKEN_ADDRESS: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
|
|
21
|
+
|
|
22
|
+
DEFAULT_FEATURES: defaultFeatures
|
|
13
23
|
};
|
package/src/utils/StorageUtil.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
3
3
|
import type { ConnectorType, WcWallet } from './TypeUtil';
|
|
4
|
+
import type { SocialProvider } from '@reown/appkit-common-react-native';
|
|
4
5
|
|
|
5
6
|
// -- Helpers -----------------------------------------------------------------
|
|
6
7
|
const WC_DEEPLINK = 'WALLETCONNECT_DEEPLINK_CHOICE';
|
|
7
8
|
const RECENT_WALLET = '@w3m/recent';
|
|
8
9
|
const CONNECTED_WALLET_IMAGE_URL = '@w3m/connected_wallet_image_url';
|
|
9
10
|
const CONNECTED_CONNECTOR = '@w3m/connected_connector';
|
|
11
|
+
const CONNECTED_SOCIAL = '@appkit/connected_social';
|
|
10
12
|
|
|
11
13
|
// -- Utility -----------------------------------------------------------------
|
|
12
14
|
export const StorageUtil = {
|
|
@@ -134,5 +136,33 @@ export const StorageUtil = {
|
|
|
134
136
|
} catch {
|
|
135
137
|
console.info('Unable to remove Connected Wallet Image URL');
|
|
136
138
|
}
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
async setConnectedSocialProvider(provider: SocialProvider) {
|
|
142
|
+
try {
|
|
143
|
+
await AsyncStorage.setItem(CONNECTED_SOCIAL, JSON.stringify(provider));
|
|
144
|
+
} catch {
|
|
145
|
+
console.info('Unable to set Connected Social Provider');
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
async getConnectedSocialProvider() {
|
|
150
|
+
try {
|
|
151
|
+
const provider = (await AsyncStorage.getItem(CONNECTED_SOCIAL)) as SocialProvider;
|
|
152
|
+
|
|
153
|
+
return provider ? JSON.parse(provider) : undefined;
|
|
154
|
+
} catch {
|
|
155
|
+
console.info('Unable to get Connected Social Provider');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return undefined;
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
async removeConnectedSocialProvider() {
|
|
162
|
+
try {
|
|
163
|
+
await AsyncStorage.removeItem(CONNECTED_SOCIAL);
|
|
164
|
+
} catch {
|
|
165
|
+
console.info('Unable to remove Connected Social Provider');
|
|
166
|
+
}
|
|
137
167
|
}
|
|
138
168
|
};
|
package/src/utils/TypeUtil.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Balance, Transaction } from '@reown/appkit-common-react-native';
|
|
1
|
+
import type { Balance, SocialProvider, Transaction } from '@reown/appkit-common-react-native';
|
|
2
2
|
|
|
3
3
|
export interface BaseError {
|
|
4
4
|
message?: string;
|
|
@@ -60,6 +60,24 @@ export type SdkVersion =
|
|
|
60
60
|
| `react-native-ethers5-${string}`
|
|
61
61
|
| `react-native-ethers-${string}`;
|
|
62
62
|
|
|
63
|
+
export type Features = {
|
|
64
|
+
/**
|
|
65
|
+
* @description Enable or disable the email feature. Enabled by default.
|
|
66
|
+
* @type {boolean}
|
|
67
|
+
*/
|
|
68
|
+
email?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* @description Show or hide the regular wallet options when email is enabled. Enabled by default.
|
|
71
|
+
* @type {boolean}
|
|
72
|
+
*/
|
|
73
|
+
emailShowWallets?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* @description Enable or disable the socials feature. Enabled by default.
|
|
76
|
+
* @type {FeaturesSocials[]}
|
|
77
|
+
*/
|
|
78
|
+
socials?: SocialProvider[] | false;
|
|
79
|
+
};
|
|
80
|
+
|
|
63
81
|
// -- ApiController Types -------------------------------------------------------
|
|
64
82
|
export interface WcWallet {
|
|
65
83
|
id: string;
|
|
@@ -457,7 +475,7 @@ export interface WriteContractArgs {
|
|
|
457
475
|
|
|
458
476
|
// -- Email Types ------------------------------------------------
|
|
459
477
|
/**
|
|
460
|
-
* Matches type defined for packages/
|
|
478
|
+
* Matches type defined for packages/wallet/src/AppKitFrameProvider.ts
|
|
461
479
|
* It's duplicated in order to decouple scaffold from email package
|
|
462
480
|
*/
|
|
463
481
|
export interface AppKitFrameProvider {
|
|
@@ -467,14 +485,31 @@ export interface AppKitFrameProvider {
|
|
|
467
485
|
getSecureSiteDashboardURL(): string;
|
|
468
486
|
getSecureSiteIconURL(): string;
|
|
469
487
|
getSecureSiteHeaders(): Record<string, string>;
|
|
470
|
-
getLoginEmailUsed(): Promise<boolean>;
|
|
471
488
|
getEmail(): string | undefined;
|
|
489
|
+
getUsername(): string | undefined;
|
|
472
490
|
rejectRpcRequest(): void;
|
|
473
491
|
connectEmail(payload: { email: string }): Promise<{
|
|
474
492
|
action: 'VERIFY_DEVICE' | 'VERIFY_OTP';
|
|
475
493
|
}>;
|
|
476
494
|
connectDevice(): Promise<unknown>;
|
|
495
|
+
connectSocial(uri: string): Promise<{
|
|
496
|
+
chainId: string | number;
|
|
497
|
+
email: string;
|
|
498
|
+
address: string;
|
|
499
|
+
accounts?:
|
|
500
|
+
| {
|
|
501
|
+
type: 'eoa' | 'smartAccount';
|
|
502
|
+
address: string;
|
|
503
|
+
}[]
|
|
504
|
+
| undefined;
|
|
505
|
+
userName?: string | undefined;
|
|
506
|
+
}>;
|
|
507
|
+
getSocialRedirectUri(payload: { provider: SocialProvider }): Promise<{
|
|
508
|
+
uri: string;
|
|
509
|
+
}>;
|
|
477
510
|
connectOtp(payload: { otp: string }): Promise<unknown>;
|
|
511
|
+
connectFarcaster: () => Promise<{ username: string }>;
|
|
512
|
+
getFarcasterUri(): Promise<{ url: string }>;
|
|
478
513
|
isConnected(): Promise<{
|
|
479
514
|
isConnected: boolean;
|
|
480
515
|
}>;
|
|
@@ -508,4 +543,5 @@ export interface AppKitFrameProvider {
|
|
|
508
543
|
disconnect(): Promise<unknown>;
|
|
509
544
|
request(req: any): Promise<any>;
|
|
510
545
|
AuthView: () => JSX.Element | null;
|
|
546
|
+
Webview: () => JSX.Element | null;
|
|
511
547
|
}
|