@reown/appkit-core-react-native 0.0.0-refactor-modal-migration-20241010184043 → 0.0.0-refactor-modal-migration-20241015194516
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/AccountController.js +11 -1
- package/lib/commonjs/controllers/AccountController.js.map +1 -1
- package/lib/commonjs/controllers/ConnectionController.js +17 -1
- package/lib/commonjs/controllers/ConnectionController.js.map +1 -1
- package/lib/commonjs/controllers/NetworkController.js +14 -1
- package/lib/commonjs/controllers/NetworkController.js.map +1 -1
- package/lib/commonjs/controllers/OptionsController.js.map +1 -1
- package/lib/commonjs/controllers/RouterController.js.map +1 -1
- package/lib/commonjs/controllers/SendController.js +4 -4
- package/lib/commonjs/controllers/SendController.js.map +1 -1
- package/lib/commonjs/controllers/TransactionsController.js +2 -1
- package/lib/commonjs/controllers/TransactionsController.js.map +1 -1
- package/lib/module/controllers/AccountController.js +11 -1
- package/lib/module/controllers/AccountController.js.map +1 -1
- package/lib/module/controllers/ConnectionController.js +17 -1
- package/lib/module/controllers/ConnectionController.js.map +1 -1
- package/lib/module/controllers/NetworkController.js +14 -1
- package/lib/module/controllers/NetworkController.js.map +1 -1
- package/lib/module/controllers/OptionsController.js.map +1 -1
- package/lib/module/controllers/RouterController.js.map +1 -1
- package/lib/module/controllers/SendController.js +4 -4
- package/lib/module/controllers/SendController.js.map +1 -1
- package/lib/module/controllers/TransactionsController.js +2 -1
- package/lib/module/controllers/TransactionsController.js.map +1 -1
- package/lib/typescript/controllers/AccountController.d.ts +5 -1
- package/lib/typescript/controllers/AccountController.d.ts.map +1 -1
- package/lib/typescript/controllers/ApiController.d.ts +1 -1
- package/lib/typescript/controllers/ConnectionController.d.ts +3 -1
- package/lib/typescript/controllers/ConnectionController.d.ts.map +1 -1
- package/lib/typescript/controllers/NetworkController.d.ts +3 -0
- package/lib/typescript/controllers/NetworkController.d.ts.map +1 -1
- package/lib/typescript/controllers/OptionsController.d.ts +2 -2
- package/lib/typescript/controllers/OptionsController.d.ts.map +1 -1
- package/lib/typescript/controllers/RouterController.d.ts +1 -1
- package/lib/typescript/controllers/RouterController.d.ts.map +1 -1
- package/lib/typescript/controllers/TransactionsController.d.ts.map +1 -1
- package/lib/typescript/utils/TypeUtil.d.ts +37 -1
- package/lib/typescript/utils/TypeUtil.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/controllers/AccountController.ts +16 -2
- package/src/controllers/ConnectionController.ts +21 -2
- package/src/controllers/NetworkController.ts +21 -1
- package/src/controllers/OptionsController.ts +2 -1
- package/src/controllers/RouterController.ts +1 -0
- package/src/controllers/SendController.ts +4 -4
- package/src/controllers/TransactionsController.ts +2 -1
- package/src/utils/TypeUtil.ts +41 -1
|
@@ -97,7 +97,7 @@ export const SendController = {
|
|
|
97
97
|
type: 'track',
|
|
98
98
|
event: 'SEND_INITIATED',
|
|
99
99
|
properties: {
|
|
100
|
-
isSmartAccount:
|
|
100
|
+
isSmartAccount: AccountController.state.preferredAccountType === 'smartAccount',
|
|
101
101
|
token: this.state.token.address,
|
|
102
102
|
amount: this.state.sendTokenAmount,
|
|
103
103
|
network: NetworkController.state.caipNetwork?.id || ''
|
|
@@ -120,7 +120,7 @@ export const SendController = {
|
|
|
120
120
|
type: 'track',
|
|
121
121
|
event: 'SEND_INITIATED',
|
|
122
122
|
properties: {
|
|
123
|
-
isSmartAccount:
|
|
123
|
+
isSmartAccount: AccountController.state.preferredAccountType === 'smartAccount',
|
|
124
124
|
token: this.state.token?.symbol,
|
|
125
125
|
amount: this.state.sendTokenAmount,
|
|
126
126
|
network: NetworkController.state.caipNetwork?.id || ''
|
|
@@ -162,7 +162,7 @@ export const SendController = {
|
|
|
162
162
|
type: 'track',
|
|
163
163
|
event: 'SEND_SUCCESS',
|
|
164
164
|
properties: {
|
|
165
|
-
isSmartAccount:
|
|
165
|
+
isSmartAccount: AccountController.state.preferredAccountType === 'smartAccount',
|
|
166
166
|
token: this.state.token?.symbol || '',
|
|
167
167
|
amount: params.sendTokenAmount,
|
|
168
168
|
network: NetworkController.state.caipNetwork?.id || ''
|
|
@@ -175,7 +175,7 @@ export const SendController = {
|
|
|
175
175
|
type: 'track',
|
|
176
176
|
event: 'SEND_ERROR',
|
|
177
177
|
properties: {
|
|
178
|
-
isSmartAccount:
|
|
178
|
+
isSmartAccount: AccountController.state.preferredAccountType === 'smartAccount',
|
|
179
179
|
token: this.state.token?.symbol || '',
|
|
180
180
|
amount: params.sendTokenAmount,
|
|
181
181
|
network: NetworkController.state.caipNetwork?.id || ''
|
|
@@ -5,6 +5,7 @@ import { EventsController } from './EventsController';
|
|
|
5
5
|
import { SnackController } from './SnackController';
|
|
6
6
|
import { NetworkController } from './NetworkController';
|
|
7
7
|
import { BlockchainApiController } from './BlockchainApiController';
|
|
8
|
+
import { AccountController } from './AccountController';
|
|
8
9
|
|
|
9
10
|
// -- Types --------------------------------------------- //
|
|
10
11
|
type TransactionByMonthMap = Record<string, Transaction[]>;
|
|
@@ -74,7 +75,7 @@ export const TransactionsController = {
|
|
|
74
75
|
address: accountAddress,
|
|
75
76
|
projectId,
|
|
76
77
|
cursor: state.next,
|
|
77
|
-
isSmartAccount:
|
|
78
|
+
isSmartAccount: AccountController.state.preferredAccountType === 'smartAccount'
|
|
78
79
|
}
|
|
79
80
|
});
|
|
80
81
|
SnackController.showError('Failed to fetch transactions');
|
package/src/utils/TypeUtil.ts
CHANGED
|
@@ -56,6 +56,8 @@ export type CaipNamespaces = Record<
|
|
|
56
56
|
}
|
|
57
57
|
>;
|
|
58
58
|
|
|
59
|
+
export type SdkType = 'appkit';
|
|
60
|
+
|
|
59
61
|
export type SdkVersion =
|
|
60
62
|
| `react-native-wagmi-${string}`
|
|
61
63
|
| `react-native-ethers5-${string}`
|
|
@@ -375,18 +377,34 @@ export type Event =
|
|
|
375
377
|
| {
|
|
376
378
|
type: 'track';
|
|
377
379
|
event: 'CLICK_SIGN_SIWE_MESSAGE';
|
|
380
|
+
properties: {
|
|
381
|
+
network: string;
|
|
382
|
+
isSmartAccount: boolean;
|
|
383
|
+
};
|
|
378
384
|
}
|
|
379
385
|
| {
|
|
380
386
|
type: 'track';
|
|
381
387
|
event: 'CLICK_CANCEL_SIWE';
|
|
388
|
+
properties: {
|
|
389
|
+
network: string;
|
|
390
|
+
isSmartAccount: boolean;
|
|
391
|
+
};
|
|
382
392
|
}
|
|
383
393
|
| {
|
|
384
394
|
type: 'track';
|
|
385
395
|
event: 'SIWE_AUTH_SUCCESS';
|
|
396
|
+
properties: {
|
|
397
|
+
network: string;
|
|
398
|
+
isSmartAccount: boolean;
|
|
399
|
+
};
|
|
386
400
|
}
|
|
387
401
|
| {
|
|
388
402
|
type: 'track';
|
|
389
403
|
event: 'SIWE_AUTH_ERROR';
|
|
404
|
+
properties: {
|
|
405
|
+
network: string;
|
|
406
|
+
isSmartAccount: boolean;
|
|
407
|
+
};
|
|
390
408
|
}
|
|
391
409
|
| {
|
|
392
410
|
type: 'track';
|
|
@@ -473,6 +491,14 @@ export type Event =
|
|
|
473
491
|
properties: {
|
|
474
492
|
provider: SocialProvider;
|
|
475
493
|
};
|
|
494
|
+
}
|
|
495
|
+
| {
|
|
496
|
+
type: 'track';
|
|
497
|
+
event: 'SET_PREFERRED_ACCOUNT_TYPE';
|
|
498
|
+
properties: {
|
|
499
|
+
accountType: AppKitFrameAccountType;
|
|
500
|
+
network: string;
|
|
501
|
+
};
|
|
476
502
|
};
|
|
477
503
|
|
|
478
504
|
// -- Send Controller Types -------------------------------------
|
|
@@ -500,6 +526,9 @@ export interface WriteContractArgs {
|
|
|
500
526
|
* Matches type defined for packages/wallet/src/AppKitFrameProvider.ts
|
|
501
527
|
* It's duplicated in order to decouple scaffold from email package
|
|
502
528
|
*/
|
|
529
|
+
|
|
530
|
+
export type AppKitFrameAccountType = 'eoa' | 'smartAccount';
|
|
531
|
+
|
|
503
532
|
export interface AppKitFrameProvider {
|
|
504
533
|
readonly id: string;
|
|
505
534
|
readonly name: string;
|
|
@@ -510,6 +539,7 @@ export interface AppKitFrameProvider {
|
|
|
510
539
|
getSecureSiteHeaders(): Record<string, string>;
|
|
511
540
|
getEmail(): string | undefined;
|
|
512
541
|
getUsername(): string | undefined;
|
|
542
|
+
getLastUsedChainId(): Promise<number | undefined>;
|
|
513
543
|
rejectRpcRequest(): void;
|
|
514
544
|
connectEmail(payload: { email: string }): Promise<{
|
|
515
545
|
action: 'VERIFY_DEVICE' | 'VERIFY_OTP';
|
|
@@ -521,7 +551,7 @@ export interface AppKitFrameProvider {
|
|
|
521
551
|
address: string;
|
|
522
552
|
accounts?:
|
|
523
553
|
| {
|
|
524
|
-
type:
|
|
554
|
+
type: AppKitFrameAccountType;
|
|
525
555
|
address: string;
|
|
526
556
|
}[]
|
|
527
557
|
| undefined;
|
|
@@ -553,16 +583,26 @@ export interface AppKitFrameProvider {
|
|
|
553
583
|
syncDappData(payload: {
|
|
554
584
|
projectId: string;
|
|
555
585
|
sdkVersion: SdkVersion;
|
|
586
|
+
sdkType: SdkType;
|
|
556
587
|
metadata?: Metadata;
|
|
557
588
|
}): Promise<unknown>;
|
|
558
589
|
connect(payload?: { chainId: number | undefined }): Promise<{
|
|
559
590
|
chainId: number;
|
|
560
591
|
email: string;
|
|
561
592
|
address: string;
|
|
593
|
+
smartAccountDeployed: boolean;
|
|
594
|
+
preferredAccountType: AppKitFrameAccountType;
|
|
562
595
|
}>;
|
|
563
596
|
switchNetwork(chainId: number): Promise<{
|
|
564
597
|
chainId: number;
|
|
565
598
|
}>;
|
|
599
|
+
setPreferredAccount(type: AppKitFrameAccountType): Promise<{
|
|
600
|
+
type: string;
|
|
601
|
+
address: string;
|
|
602
|
+
}>;
|
|
603
|
+
getSmartAccountEnabledNetworks(): Promise<{
|
|
604
|
+
smartAccountEnabledNetworks: number[];
|
|
605
|
+
}>;
|
|
566
606
|
disconnect(): Promise<unknown>;
|
|
567
607
|
request(req: any): Promise<any>;
|
|
568
608
|
AuthView: () => JSX.Element | null;
|