@reown/appkit-core 1.6.0 → 1.6.1-rc.1.0
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/esm/exports/index.js.map +1 -1
- package/dist/esm/index.js +29 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/src/controllers/AssetController.js +1 -1
- package/dist/esm/src/controllers/AssetController.js.map +1 -1
- package/dist/esm/src/controllers/ChainController.js +40 -1
- package/dist/esm/src/controllers/ChainController.js.map +1 -1
- package/dist/esm/src/controllers/ConnectionController.js +11 -18
- package/dist/esm/src/controllers/ConnectionController.js.map +1 -1
- package/dist/esm/src/controllers/ConnectorController.js +5 -5
- package/dist/esm/src/controllers/ConnectorController.js.map +1 -1
- package/dist/esm/src/controllers/NetworkController.js +220 -0
- package/dist/esm/src/controllers/NetworkController.js.map +1 -0
- package/dist/esm/src/controllers/OptionsController.js +6 -0
- package/dist/esm/src/controllers/OptionsController.js.map +1 -1
- package/dist/esm/src/controllers/PublicStateController.js +2 -1
- package/dist/esm/src/controllers/PublicStateController.js.map +1 -1
- package/dist/esm/src/controllers/RouterController.js.map +1 -1
- package/dist/esm/src/controllers/SendController.js +40 -4
- package/dist/esm/src/controllers/SendController.js.map +1 -1
- package/dist/esm/src/controllers/SwapController.js +5 -3
- package/dist/esm/src/controllers/SwapController.js.map +1 -1
- package/dist/esm/src/utils/ConstantsUtil.js +2 -2
- package/dist/esm/src/utils/ConstantsUtil.js.map +1 -1
- package/dist/esm/src/utils/CoreHelperUtil.js +9 -0
- package/dist/esm/src/utils/CoreHelperUtil.js.map +1 -1
- package/dist/esm/src/utils/SIWXUtil.js +12 -1
- package/dist/esm/src/utils/SIWXUtil.js.map +1 -1
- package/dist/esm/src/utils/StorageUtil.js +9 -9
- package/dist/esm/src/utils/StorageUtil.js.map +1 -1
- package/dist/esm/tests/controllers/ChainController.test.js +83 -6
- package/dist/esm/tests/controllers/ChainController.test.js.map +1 -1
- package/dist/esm/tests/controllers/ConnectionController.test.js +2 -3
- package/dist/esm/tests/controllers/ConnectionController.test.js.map +1 -1
- package/dist/esm/tests/controllers/NetworkController.test.js +101 -0
- package/dist/esm/tests/controllers/NetworkController.test.js.map +1 -0
- package/dist/esm/tests/controllers/OptionsController.test.js +4 -0
- package/dist/esm/tests/controllers/OptionsController.test.js.map +1 -1
- package/dist/esm/tests/controllers/PublicStateController.test.js +10 -4
- package/dist/esm/tests/controllers/PublicStateController.test.js.map +1 -1
- package/dist/esm/tests/utils/CoreHelperUtil.test.js +13 -0
- package/dist/esm/tests/utils/CoreHelperUtil.test.js.map +1 -1
- package/dist/esm/tests/utils/StorageUtil.test.js +7 -7
- package/dist/esm/tests/utils/StorageUtil.test.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/types/exports/index.d.ts +1 -1
- package/dist/types/index.d.ts +47 -0
- package/dist/types/src/controllers/ChainController.d.ts +1 -0
- package/dist/types/src/controllers/ConnectionController.d.ts +2 -1
- package/dist/types/src/controllers/ConnectorController.d.ts +1 -2
- package/dist/types/src/controllers/NetworkController.d.ts +43 -0
- package/dist/types/src/controllers/OptionsController.d.ts +8 -0
- package/dist/types/src/controllers/PublicStateController.d.ts +24 -3
- package/dist/types/src/controllers/RouterController.d.ts +1 -1
- package/dist/types/src/controllers/SendController.d.ts +5 -0
- package/dist/types/src/utils/ConstantsUtil.d.ts +1 -1
- package/dist/types/src/utils/CoreHelperUtil.d.ts +1 -0
- package/dist/types/src/utils/OptionsUtil.d.ts +1 -1
- package/dist/types/src/utils/SIWXUtil.d.ts +71 -9
- package/dist/types/src/utils/StorageUtil.d.ts +4 -4
- package/dist/types/src/utils/SwapApiUtil.d.ts +1 -1
- package/dist/types/src/utils/TypeUtil.d.ts +6 -3
- package/dist/types/tests/controllers/NetworkController.test.d.ts +1 -0
- package/package.json +4 -4
|
@@ -11,7 +11,7 @@ export type { OnRampControllerState, OnRampProvider } from '../src/controllers/O
|
|
|
11
11
|
export { ConnectionController } from '../src/controllers/ConnectionController.js';
|
|
12
12
|
export type { ConnectionControllerClient, ConnectionControllerState } from '../src/controllers/ConnectionController.js';
|
|
13
13
|
export { ConnectorController } from '../src/controllers/ConnectorController.js';
|
|
14
|
-
export type { ConnectorControllerState } from '../src/controllers/ConnectorController.js';
|
|
14
|
+
export type { ConnectorControllerState, ConnectorWithProviders } from '../src/controllers/ConnectorController.js';
|
|
15
15
|
export { SnackController } from '../src/controllers/SnackController.js';
|
|
16
16
|
export type { SnackControllerState } from '../src/controllers/SnackController.js';
|
|
17
17
|
export { ApiController } from '../src/controllers/ApiController.js';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export { ModalController } from './src/controllers/ModalController.js';
|
|
2
|
+
export type { ModalControllerArguments, ModalControllerState } from './src/controllers/ModalController.js';
|
|
3
|
+
export { RouterController } from './src/controllers/RouterController.js';
|
|
4
|
+
export type { RouterControllerState } from './src/controllers/RouterController.js';
|
|
5
|
+
export { AccountController } from './src/controllers/AccountController.js';
|
|
6
|
+
export type { AccountControllerState } from './src/controllers/AccountController.js';
|
|
7
|
+
export { ChainController } from './src/controllers/ChainController.js';
|
|
8
|
+
export type { ChainControllerState } from './src/controllers/ChainController.js';
|
|
9
|
+
export { NetworkController } from './src/controllers/NetworkController.js';
|
|
10
|
+
export type { NetworkControllerClient, NetworkControllerState } from './src/controllers/NetworkController.js';
|
|
11
|
+
export { OnRampController } from './src/controllers/OnRampController.js';
|
|
12
|
+
export type { OnRampControllerState, OnRampProvider } from './src/controllers/OnRampController.js';
|
|
13
|
+
export { ConnectionController } from './src/controllers/ConnectionController.js';
|
|
14
|
+
export type { ConnectionControllerClient, ConnectionControllerState } from './src/controllers/ConnectionController.js';
|
|
15
|
+
export { ConnectorController } from './src/controllers/ConnectorController.js';
|
|
16
|
+
export type { ConnectorControllerState } from './src/controllers/ConnectorController.js';
|
|
17
|
+
export { SnackController } from './src/controllers/SnackController.js';
|
|
18
|
+
export type { SnackControllerState } from './src/controllers/SnackController.js';
|
|
19
|
+
export { ApiController } from './src/controllers/ApiController.js';
|
|
20
|
+
export type { ApiControllerState } from './src/controllers/ApiController.js';
|
|
21
|
+
export { AssetController } from './src/controllers/AssetController.js';
|
|
22
|
+
export type { AssetControllerState } from './src/controllers/AssetController.js';
|
|
23
|
+
export { ThemeController } from './src/controllers/ThemeController.js';
|
|
24
|
+
export type { ThemeControllerState } from './src/controllers/ThemeController.js';
|
|
25
|
+
export { OptionsController } from './src/controllers/OptionsController.js';
|
|
26
|
+
export type { OptionsControllerState } from './src/controllers/OptionsController.js';
|
|
27
|
+
export { BlockchainApiController } from './src/controllers/BlockchainApiController.js';
|
|
28
|
+
export { PublicStateController } from './src/controllers/PublicStateController.js';
|
|
29
|
+
export type { PublicStateControllerState } from './src/controllers/PublicStateController.js';
|
|
30
|
+
export { EventsController } from './src/controllers/EventsController.js';
|
|
31
|
+
export type { EventsControllerState } from './src/controllers/EventsController.js';
|
|
32
|
+
export { TransactionsController } from './src/controllers/TransactionsController.js';
|
|
33
|
+
export type { TransactionsControllerState } from './src/controllers/TransactionsController.js';
|
|
34
|
+
export { SwapController } from './src/controllers/SwapController.js';
|
|
35
|
+
export type { SwapControllerState, SwapInputTarget } from './src/controllers/SwapController.js';
|
|
36
|
+
export { SendController } from './src/controllers/SendController.js';
|
|
37
|
+
export type { SendControllerState } from './src/controllers/SendController.js';
|
|
38
|
+
export { TooltipController } from './src/controllers/TooltipController.js';
|
|
39
|
+
export type { TooltipControllerState } from './src/controllers/TooltipController.js';
|
|
40
|
+
export { EnsController } from './src/controllers/EnsController.js';
|
|
41
|
+
export type { EnsControllerState } from './src/controllers/EnsController.js';
|
|
42
|
+
export { AssetUtil } from './src/utils/AssetUtil.js';
|
|
43
|
+
export { ConstantsUtil } from './src/utils/ConstantsUtil.js';
|
|
44
|
+
export { CoreHelperUtil } from './src/utils/CoreHelperUtil.js';
|
|
45
|
+
export { StorageUtil } from './src/utils/StorageUtil.js';
|
|
46
|
+
export { RouterUtil } from './src/utils/RouterUtil.js';
|
|
47
|
+
export type * from './src/utils/TypeUtil.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Connector, EstimateGasTransactionArgs, SendTransactionArgs, WcWallet, WriteContractArgs } from '../utils/TypeUtil.js';
|
|
2
2
|
import { type W3mFrameTypes } from '@reown/appkit-wallet';
|
|
3
|
-
import type
|
|
3
|
+
import { type CaipNetwork, type ChainNamespace } from '@reown/appkit-common';
|
|
4
4
|
export interface ConnectExternalOptions {
|
|
5
5
|
id: Connector['id'];
|
|
6
6
|
type: Connector['type'];
|
|
@@ -68,6 +68,7 @@ export declare const ConnectionController: {
|
|
|
68
68
|
getEnsAvatar(value: string): Promise<string | false | undefined>;
|
|
69
69
|
checkInstalled(ids?: string[]): boolean;
|
|
70
70
|
resetWcConnection(): void;
|
|
71
|
+
setUri(uri: string): void;
|
|
71
72
|
setWcLinking(wcLinking: ConnectionControllerState['wcLinking']): void;
|
|
72
73
|
setWcError(wcError: ConnectionControllerState['wcError']): void;
|
|
73
74
|
setRecentWallet(wallet: ConnectionControllerState['recentWallet']): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AuthConnector, Connector } from '../utils/TypeUtil.js';
|
|
2
|
-
interface ConnectorWithProviders extends Connector {
|
|
2
|
+
export interface ConnectorWithProviders extends Connector {
|
|
3
3
|
connectors?: Connector[];
|
|
4
4
|
}
|
|
5
5
|
export interface ConnectorControllerState {
|
|
@@ -21,4 +21,3 @@ export declare const ConnectorController: {
|
|
|
21
21
|
getConnector(id: string, rdns?: string | null): ConnectorWithProviders | undefined;
|
|
22
22
|
syncIfAuthConnector(connector: Connector | AuthConnector): void;
|
|
23
23
|
};
|
|
24
|
-
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { CaipNetwork, CaipNetworkId } from '../utils/TypeUtil.js';
|
|
2
|
+
import { type Chain } from '@web3modal/common';
|
|
3
|
+
export interface NetworkControllerClient {
|
|
4
|
+
switchCaipNetwork: (network: NetworkControllerState['caipNetwork']) => Promise<void>;
|
|
5
|
+
getApprovedCaipNetworksData: () => Promise<{
|
|
6
|
+
approvedCaipNetworkIds: NetworkControllerState['approvedCaipNetworkIds'];
|
|
7
|
+
supportsAllNetworks: NetworkControllerState['supportsAllNetworks'];
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
export interface NetworkControllerState {
|
|
11
|
+
supportsAllNetworks: boolean;
|
|
12
|
+
isDefaultCaipNetwork: boolean;
|
|
13
|
+
isUnsupportedChain?: boolean;
|
|
14
|
+
_client?: NetworkControllerClient;
|
|
15
|
+
caipNetwork?: CaipNetwork;
|
|
16
|
+
requestedCaipNetworks?: CaipNetwork[];
|
|
17
|
+
approvedCaipNetworkIds?: CaipNetworkId[];
|
|
18
|
+
allowUnsupportedChain?: boolean;
|
|
19
|
+
smartAccountEnabledNetworks?: number[];
|
|
20
|
+
}
|
|
21
|
+
export declare const NetworkController: {
|
|
22
|
+
state: NetworkControllerState;
|
|
23
|
+
replaceState(newState: NetworkControllerState | undefined): void;
|
|
24
|
+
subscribeKey<K extends keyof NetworkControllerState>(property: K, callback: (val: NetworkControllerState[K]) => void): () => void;
|
|
25
|
+
_getClient(): NetworkControllerClient;
|
|
26
|
+
initializeDefaultNetwork(): void;
|
|
27
|
+
setDefaultCaipNetwork(caipNetwork: NetworkControllerState['caipNetwork']): void;
|
|
28
|
+
setActiveCaipNetwork(caipNetwork: NetworkControllerState['caipNetwork']): void;
|
|
29
|
+
setCaipNetwork(caipNetwork: NetworkControllerState['caipNetwork']): void;
|
|
30
|
+
setRequestedCaipNetworks(requestedNetworks: NetworkControllerState['requestedCaipNetworks'], chain: Chain | undefined): void;
|
|
31
|
+
setAllowUnsupportedChain(allowUnsupportedChain: NetworkControllerState['allowUnsupportedChain'], chain: Chain | undefined): void;
|
|
32
|
+
setSmartAccountEnabledNetworks(smartAccountEnabledNetworks: NetworkControllerState['smartAccountEnabledNetworks'], chain: Chain | undefined): void;
|
|
33
|
+
getRequestedCaipNetworks(chainToFilter?: Chain): CaipNetwork[];
|
|
34
|
+
switchActiveNetwork(network: NetworkControllerState['caipNetwork']): Promise<void>;
|
|
35
|
+
getApprovedCaipNetworkIds(chainToFilter?: Chain): `${string}:${string}`[] | undefined;
|
|
36
|
+
setApprovedCaipNetworksData(chain: Chain | undefined): Promise<void>;
|
|
37
|
+
checkIfSupportedNetwork(): boolean;
|
|
38
|
+
checkIfSmartAccountEnabled(): boolean;
|
|
39
|
+
resetNetwork(): void;
|
|
40
|
+
getSupportsAllNetworks(): boolean | undefined;
|
|
41
|
+
showUnsupportedChainUI(): void;
|
|
42
|
+
getActiveNetworkTokenAddress(): string;
|
|
43
|
+
};
|
|
@@ -115,6 +115,11 @@ export interface OptionsControllerStatePublic {
|
|
|
115
115
|
* @default false
|
|
116
116
|
*/
|
|
117
117
|
enableEmbedded?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Allow users to switch to an unsupported chain.
|
|
120
|
+
* @default false
|
|
121
|
+
*/
|
|
122
|
+
allowUnsupportedChain?: boolean;
|
|
118
123
|
}
|
|
119
124
|
export interface OptionsControllerStateInternal {
|
|
120
125
|
sdkType: 'appkit';
|
|
@@ -122,6 +127,7 @@ export interface OptionsControllerStateInternal {
|
|
|
122
127
|
isSiweEnabled?: boolean;
|
|
123
128
|
isUniversalProvider?: boolean;
|
|
124
129
|
hasMultipleAddresses?: boolean;
|
|
130
|
+
useInjectedUniversalProvider?: boolean;
|
|
125
131
|
}
|
|
126
132
|
type StateKey = keyof OptionsControllerStatePublic | keyof OptionsControllerStateInternal;
|
|
127
133
|
type OptionsControllerState = OptionsControllerStatePublic & OptionsControllerStateInternal;
|
|
@@ -156,5 +162,7 @@ export declare const OptionsController: {
|
|
|
156
162
|
setSocialsOrder(socialsOrder: SocialProvider[]): void;
|
|
157
163
|
setCollapseWallets(collapseWallets: boolean): void;
|
|
158
164
|
setEnableEmbedded(enableEmbedded: OptionsControllerState['enableEmbedded']): void;
|
|
165
|
+
setAllowUnsupportedChain(allowUnsupportedChain: OptionsControllerState['allowUnsupportedChain']): void;
|
|
166
|
+
setUsingInjectedUniversalProvider(useInjectedUniversalProvider: OptionsControllerState['useInjectedUniversalProvider']): void;
|
|
159
167
|
};
|
|
160
168
|
export {};
|
|
@@ -1,9 +1,30 @@
|
|
|
1
|
-
import type { CaipNetworkId } from '@reown/appkit-common';
|
|
1
|
+
import type { CaipNetworkId, ChainNamespace } from '@reown/appkit-common';
|
|
2
2
|
export interface PublicStateControllerState {
|
|
3
|
+
/**
|
|
4
|
+
* @description Indicates if the AppKit is loading.
|
|
5
|
+
* @type {boolean}
|
|
6
|
+
*/
|
|
3
7
|
loading: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* @description Indicates if the AppKit modal is open.
|
|
10
|
+
* @type {boolean}
|
|
11
|
+
*/
|
|
4
12
|
open: boolean;
|
|
5
|
-
|
|
6
|
-
|
|
13
|
+
/**
|
|
14
|
+
* @description Indicates the selected network id in CAIP-2 format.
|
|
15
|
+
* @type {CaipNetworkId | undefined}
|
|
16
|
+
*/
|
|
17
|
+
selectedNetworkId?: CaipNetworkId | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* @description Indicates the active chain namespace.
|
|
20
|
+
* @type {ChainNamespace | undefined}
|
|
21
|
+
*/
|
|
22
|
+
activeChain?: ChainNamespace | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* @description Indicates if the AppKit has been initialized. This sets to true when all controllers, adapters and internal state is ready.
|
|
25
|
+
* @type {boolean}
|
|
26
|
+
*/
|
|
27
|
+
initialized: boolean;
|
|
7
28
|
}
|
|
8
29
|
export declare const PublicStateController: {
|
|
9
30
|
state: PublicStateControllerState;
|
|
@@ -24,7 +24,7 @@ type TransactionAction = {
|
|
|
24
24
|
onCancel?: () => void;
|
|
25
25
|
};
|
|
26
26
|
export interface RouterControllerState {
|
|
27
|
-
view: 'Account' | 'AccountSettings' | 'AllWallets' | 'ApproveTransaction' | 'BuyInProgress' | 'WalletCompatibleNetworks' | 'ChooseAccountName' | 'Connect' | 'Create' | 'ConnectingExternal' | 'ConnectingFarcaster' | 'ConnectingWalletConnect' | 'ConnectingSiwe' | 'ConnectingSocial' | 'ConnectSocials' | 'ConnectWallets' | 'Downloads' | 'EmailVerifyOtp' | 'EmailVerifyDevice' | 'GetWallet' | 'Networks' | 'OnRampActivity' | 'OnRampFiatSelect' | 'OnRampProviders' | 'OnRampTokenSelect' | 'Profile' | 'RegisterAccountName' | 'RegisterAccountNameSuccess' | 'SwitchNetwork' | 'SwitchAddress' | 'Transactions' | 'UnsupportedChain' | 'UpdateEmailWallet' | 'UpdateEmailPrimaryOtp' | 'UpdateEmailSecondaryOtp' | 'UpgradeEmailWallet' | 'WalletReceive' | 'WalletSend' | 'WalletSendPreview' | 'WalletSendSelectToken' | 'WhatIsANetwork' | 'WhatIsAWallet' | 'WhatIsABuy' | 'Swap' | 'SwapSelectToken' | 'SwapPreview' | 'ConnectingMultiChain' | 'SwitchActiveChain' | 'SmartSessionCreated' | 'SmartSessionList' | 'SIWXSignMessage';
|
|
27
|
+
view: 'Account' | 'AccountSettings' | 'AllWallets' | 'ApproveTransaction' | 'BuyInProgress' | 'WalletCompatibleNetworks' | 'ChooseAccountName' | 'Connect' | 'Create' | 'ConnectingExternal' | 'ConnectingFarcaster' | 'ConnectingWalletConnect' | 'ConnectingWalletConnectBasic' | 'ConnectingSiwe' | 'ConnectingSocial' | 'ConnectSocials' | 'ConnectWallets' | 'Downloads' | 'EmailVerifyOtp' | 'EmailVerifyDevice' | 'GetWallet' | 'Networks' | 'OnRampActivity' | 'OnRampFiatSelect' | 'OnRampProviders' | 'OnRampTokenSelect' | 'Profile' | 'RegisterAccountName' | 'RegisterAccountNameSuccess' | 'SwitchNetwork' | 'SwitchAddress' | 'Transactions' | 'UnsupportedChain' | 'UpdateEmailWallet' | 'UpdateEmailPrimaryOtp' | 'UpdateEmailSecondaryOtp' | 'UpgradeEmailWallet' | 'WalletReceive' | 'WalletSend' | 'WalletSendPreview' | 'WalletSendSelectToken' | 'WhatIsANetwork' | 'WhatIsAWallet' | 'WhatIsABuy' | 'Swap' | 'SwapSelectToken' | 'SwapPreview' | 'ConnectingMultiChain' | 'SwitchActiveChain' | 'SmartSessionCreated' | 'SmartSessionList' | 'SIWXSignMessage';
|
|
28
28
|
history: RouterControllerState['view'][];
|
|
29
29
|
data?: {
|
|
30
30
|
connector?: Connector;
|
|
@@ -19,6 +19,7 @@ export interface SendControllerState {
|
|
|
19
19
|
receiverProfileImageUrl?: string;
|
|
20
20
|
gasPrice?: bigint;
|
|
21
21
|
gasPriceInUSD?: number;
|
|
22
|
+
networkBalanceInUSD?: string;
|
|
22
23
|
loading: boolean;
|
|
23
24
|
}
|
|
24
25
|
export declare const SendController: {
|
|
@@ -32,9 +33,13 @@ export declare const SendController: {
|
|
|
32
33
|
setReceiverProfileName(receiverProfileName: SendControllerState['receiverProfileName']): void;
|
|
33
34
|
setGasPrice(gasPrice: SendControllerState['gasPrice']): void;
|
|
34
35
|
setGasPriceInUsd(gasPriceInUSD: SendControllerState['gasPriceInUSD']): void;
|
|
36
|
+
setNetworkBalanceInUsd(networkBalanceInUSD: SendControllerState['networkBalanceInUSD']): void;
|
|
35
37
|
setLoading(loading: SendControllerState['loading']): void;
|
|
36
38
|
sendToken(): void;
|
|
37
39
|
sendEvmToken(): void;
|
|
40
|
+
fetchNetworkBalance(): Promise<void>;
|
|
41
|
+
isInsufficientNetworkTokenForGas(networkBalanceInUSD: string, gasPriceInUSD: number | undefined): boolean;
|
|
42
|
+
hasInsufficientGasFunds(): boolean;
|
|
38
43
|
sendNativeToken(params: TxParams): Promise<void>;
|
|
39
44
|
sendERC20Token(params: ContractWriteParams): Promise<void>;
|
|
40
45
|
sendSolanaToken(): void;
|
|
@@ -63,7 +63,7 @@ export declare const ConstantsUtil: {
|
|
|
63
63
|
legalCheckbox: false;
|
|
64
64
|
smartSessions: false;
|
|
65
65
|
collapseWallets: false;
|
|
66
|
-
connectMethodsOrder: ("email" | "social" | "wallet")[];
|
|
67
66
|
walletFeaturesOrder: ("swaps" | "send" | "receive" | "onramp")[];
|
|
67
|
+
connectMethodsOrder: undefined;
|
|
68
68
|
};
|
|
69
69
|
};
|
|
@@ -47,5 +47,6 @@ export declare const CoreHelperUtil: {
|
|
|
47
47
|
uniqueBy<T>(arr: T[], key: keyof T): T[];
|
|
48
48
|
generateSdkVersion(adapters: ChainAdapter[], platform: SDKFramework, version: string): AppKitSdkVersion;
|
|
49
49
|
createAccount<N extends ChainNamespace>(namespace: N, address: string, type: NamespaceTypeMap[N]): AccountTypeMap[N];
|
|
50
|
+
isCaipAddress(address?: unknown): address is `eip155:${string}:${string}` | `eip155:${number}:${string}` | `solana:${string}:${string}` | `solana:${number}:${string}` | `polkadot:${string}:${string}` | `polkadot:${number}:${string}` | `bip122:${string}:${string}` | `bip122:${number}:${string}`;
|
|
50
51
|
};
|
|
51
52
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Features, FeaturesKeys } from './TypeUtil.js';
|
|
2
2
|
export declare const OptionsUtil: {
|
|
3
|
-
getFeatureValue(key: FeaturesKeys, features?: Features): boolean | import("./TypeUtil.js").SocialProvider[] | import("./TypeUtil.js").
|
|
3
|
+
getFeatureValue(key: FeaturesKeys, features?: Features): boolean | import("./TypeUtil.js").SocialProvider[] | import("./TypeUtil.js").WalletFeature[] | import("./TypeUtil.js").ConnectMethod[] | undefined;
|
|
4
4
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { CaipNetworkId } from '@reown/appkit-common';
|
|
2
2
|
import UniversalProvider from '@walletconnect/universal-provider';
|
|
3
|
+
/**
|
|
4
|
+
* SIWXUtil holds the methods to interact with the SIWX plugin and must be called internally on AppKit.
|
|
5
|
+
*/
|
|
3
6
|
export declare const SIWXUtil: {
|
|
4
7
|
getSIWX(): SIWXConfig | undefined;
|
|
5
8
|
initializeIfEnabled(): Promise<void>;
|
|
@@ -16,19 +19,69 @@ export declare const SIWXUtil: {
|
|
|
16
19
|
network: string;
|
|
17
20
|
isSmartAccount: boolean;
|
|
18
21
|
};
|
|
22
|
+
clearSessions(): Promise<void>;
|
|
19
23
|
};
|
|
20
24
|
/**
|
|
21
|
-
*
|
|
25
|
+
* This interface represents the SIWX configuration plugin, which is used to create and manage SIWX messages and sessions.
|
|
26
|
+
* AppKit provides predefined implementations for this interface through `@reown/appkit-siwx`.
|
|
27
|
+
* You may use it to create a custom implementation following your needs, but watch close for the methods requirements.
|
|
22
28
|
*/
|
|
23
29
|
export interface SIWXConfig {
|
|
30
|
+
/**
|
|
31
|
+
* This method will be called to create a new message to be signed by the user.
|
|
32
|
+
*
|
|
33
|
+
* Constraints:
|
|
34
|
+
* - The message MUST be unique and contain all the necessary information to verify the user's identity.
|
|
35
|
+
* - SIWXMessage.toString() method MUST be implemented to return the message string.
|
|
36
|
+
*
|
|
37
|
+
* @param input SIWXMessage.Input
|
|
38
|
+
* @returns SIWXMessage
|
|
39
|
+
*/
|
|
24
40
|
createMessage: (input: SIWXMessage.Input) => Promise<SIWXMessage>;
|
|
41
|
+
/**
|
|
42
|
+
* This method will be called to store a new single session.
|
|
43
|
+
*
|
|
44
|
+
* Constraints:
|
|
45
|
+
* - This method MUST verify if the session is valid and store it in the storage successfully.
|
|
46
|
+
*
|
|
47
|
+
* @param session SIWXSession
|
|
48
|
+
*/
|
|
25
49
|
addSession: (session: SIWXSession) => Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* This method will be called to revoke all the sessions stored for a specific chain and address.
|
|
52
|
+
*
|
|
53
|
+
* Constraints:
|
|
54
|
+
* - This method MUST delete all the sessions stored for the specific chain and address successfully.
|
|
55
|
+
*
|
|
56
|
+
* @param chainId CaipNetworkId
|
|
57
|
+
* @param address string
|
|
58
|
+
*/
|
|
26
59
|
revokeSession: (chainId: CaipNetworkId, address: string) => Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* This method will be called to replace all the sessions in the storage with the new ones.
|
|
62
|
+
*
|
|
63
|
+
* Constraints:
|
|
64
|
+
* - This method MUST verify all the sessions before storing them in the storage;
|
|
65
|
+
* - This method MUST replace all the sessions in the storage with the new ones succesfully otherwise it MUST throw an error.
|
|
66
|
+
*
|
|
67
|
+
* @param sessions SIWXSession[]
|
|
68
|
+
*/
|
|
27
69
|
setSessions: (sessions: SIWXSession[]) => Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* This method will be called to get all the sessions stored for a specific chain and address.
|
|
72
|
+
*
|
|
73
|
+
* Constraints:
|
|
74
|
+
* - This method MUST return only sessions that are verified and valid;
|
|
75
|
+
* - This method MUST NOT return expired sessions.
|
|
76
|
+
*
|
|
77
|
+
* @param chainId CaipNetworkId
|
|
78
|
+
* @param address string
|
|
79
|
+
* @returns
|
|
80
|
+
*/
|
|
28
81
|
getSessions: (chainId: CaipNetworkId, address: string) => Promise<SIWXSession[]>;
|
|
29
82
|
}
|
|
30
83
|
/**
|
|
31
|
-
*
|
|
84
|
+
* This interface represents a SIWX session, which is used to store the user's identity information.
|
|
32
85
|
*/
|
|
33
86
|
export interface SIWXSession {
|
|
34
87
|
data: SIWXMessage.Data;
|
|
@@ -37,18 +90,20 @@ export interface SIWXSession {
|
|
|
37
90
|
cacao?: Cacao;
|
|
38
91
|
}
|
|
39
92
|
/**
|
|
40
|
-
*
|
|
93
|
+
* This interface represents a SIWX message, which is used to create a message to be signed by the user.
|
|
94
|
+
* This must contain the necessary information to verify the user's identity and how to generate the string message.
|
|
41
95
|
*/
|
|
42
96
|
export interface SIWXMessage extends SIWXMessage.Data, SIWXMessage.Methods {
|
|
43
97
|
}
|
|
44
98
|
export declare namespace SIWXMessage {
|
|
45
99
|
/**
|
|
46
|
-
*
|
|
100
|
+
* This interface represents the SIWX message data, which is used to create a message to be signed by the user.
|
|
47
101
|
*/
|
|
48
102
|
interface Data extends Input, Metadata, Identifier {
|
|
49
103
|
}
|
|
50
104
|
/**
|
|
51
|
-
*
|
|
105
|
+
* This interface represents the SIWX message input.
|
|
106
|
+
* Here must contain what is different for each user of the application.
|
|
52
107
|
*/
|
|
53
108
|
interface Input {
|
|
54
109
|
accountAddress: string;
|
|
@@ -56,7 +111,8 @@ export declare namespace SIWXMessage {
|
|
|
56
111
|
notBefore?: Timestamp;
|
|
57
112
|
}
|
|
58
113
|
/**
|
|
59
|
-
*
|
|
114
|
+
* This interface represents the SIWX message metadata.
|
|
115
|
+
* Here must contain the main data related to the app.
|
|
60
116
|
*/
|
|
61
117
|
interface Metadata {
|
|
62
118
|
domain: string;
|
|
@@ -67,7 +123,8 @@ export declare namespace SIWXMessage {
|
|
|
67
123
|
resources?: string[];
|
|
68
124
|
}
|
|
69
125
|
/**
|
|
70
|
-
*
|
|
126
|
+
* This interface represents the SIWX message identifier.
|
|
127
|
+
* Here must contain the request id and the timestamps.
|
|
71
128
|
*/
|
|
72
129
|
interface Identifier {
|
|
73
130
|
requestId?: string;
|
|
@@ -75,16 +132,21 @@ export declare namespace SIWXMessage {
|
|
|
75
132
|
expirationTime?: Timestamp;
|
|
76
133
|
}
|
|
77
134
|
/**
|
|
78
|
-
*
|
|
135
|
+
* This interface represents the SIWX message methods.
|
|
136
|
+
* Here must contain the method to generate the message string and any other method performed by the SIWX message.
|
|
79
137
|
*/
|
|
80
138
|
interface Methods {
|
|
81
139
|
toString: () => string;
|
|
82
140
|
}
|
|
83
141
|
/**
|
|
84
|
-
*
|
|
142
|
+
* The timestamp is a UTC string representing the time in ISO 8601 format.
|
|
85
143
|
*/
|
|
86
144
|
type Timestamp = string;
|
|
87
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* The Cacao interface is a reference of CAIP-74 and represents a chain-agnostic Object Capability (OCAP).
|
|
148
|
+
* https://chainagnostic.org/CAIPs/caip-74
|
|
149
|
+
*/
|
|
88
150
|
export interface Cacao {
|
|
89
151
|
h: Cacao.Header;
|
|
90
152
|
p: Cacao.Payload;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CaipNetworkId, type ChainNamespace } from '@reown/appkit-common';
|
|
2
|
-
import type { WcWallet,
|
|
2
|
+
import type { WcWallet, SocialProvider, ConnectionStatus } from './TypeUtil.js';
|
|
3
3
|
export declare const StorageUtil: {
|
|
4
4
|
getActiveNetworkProps(): {
|
|
5
5
|
namespace: ChainNamespace | undefined;
|
|
@@ -16,12 +16,12 @@ export declare const StorageUtil: {
|
|
|
16
16
|
setActiveCaipNetworkId(caipNetworkId: CaipNetworkId): void;
|
|
17
17
|
getActiveCaipNetworkId(): string | undefined;
|
|
18
18
|
deleteActiveCaipNetworkId(): void;
|
|
19
|
-
|
|
19
|
+
deleteConnectedConnectorId(): void;
|
|
20
20
|
setAppKitRecent(wallet: WcWallet): void;
|
|
21
21
|
getRecentWallets(): WcWallet[];
|
|
22
|
-
|
|
22
|
+
setConnectedConnectorId(connectorId: string): void;
|
|
23
23
|
getActiveNamespace(): ChainNamespace | undefined;
|
|
24
|
-
|
|
24
|
+
getConnectedConnectorId(): string | undefined;
|
|
25
25
|
setConnectedSocialProvider(socialProvider: SocialProvider): void;
|
|
26
26
|
getConnectedSocialProvider(): string | undefined;
|
|
27
27
|
getConnectedSocialUsername(): string | undefined;
|
|
@@ -18,7 +18,7 @@ export declare const SwapApiUtil: {
|
|
|
18
18
|
fast: string | undefined;
|
|
19
19
|
instant: string | undefined;
|
|
20
20
|
} | null>;
|
|
21
|
-
fetchSwapAllowance({ tokenAddress, userAddress, sourceTokenAmount, sourceTokenDecimals }: Pick<BlockchainApiSwapAllowanceRequest, "
|
|
21
|
+
fetchSwapAllowance({ tokenAddress, userAddress, sourceTokenAmount, sourceTokenDecimals }: Pick<BlockchainApiSwapAllowanceRequest, "tokenAddress" | "userAddress"> & {
|
|
22
22
|
sourceTokenAmount: string;
|
|
23
23
|
sourceTokenDecimals: number;
|
|
24
24
|
}): Promise<boolean>;
|
|
@@ -347,6 +347,9 @@ export type Event = {
|
|
|
347
347
|
} | {
|
|
348
348
|
type: 'track';
|
|
349
349
|
event: 'DISCONNECT_ERROR';
|
|
350
|
+
properties?: {
|
|
351
|
+
message: string;
|
|
352
|
+
};
|
|
350
353
|
} | {
|
|
351
354
|
type: 'track';
|
|
352
355
|
event: 'CLICK_WALLET_HELP';
|
|
@@ -732,12 +735,12 @@ export type EstimateGasTransactionArgs = {
|
|
|
732
735
|
chainNamespace: 'solana';
|
|
733
736
|
};
|
|
734
737
|
export interface WriteContractArgs {
|
|
735
|
-
receiverAddress: `0x${string}`;
|
|
736
|
-
tokenAmount: bigint;
|
|
737
738
|
tokenAddress: `0x${string}`;
|
|
738
739
|
fromAddress: `0x${string}`;
|
|
739
|
-
method: 'send' | 'transfer' | 'call';
|
|
740
|
+
method: 'send' | 'transfer' | 'call' | 'approve';
|
|
740
741
|
abi: any;
|
|
742
|
+
args: unknown[];
|
|
743
|
+
chainNamespace: ChainNamespace;
|
|
741
744
|
}
|
|
742
745
|
export interface NetworkControllerClient {
|
|
743
746
|
switchCaipNetwork: (network: CaipNetwork) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reown/appkit-core",
|
|
3
|
-
"version": "1.6.0",
|
|
3
|
+
"version": "1.6.1-rc.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/esm/exports/index.js",
|
|
6
6
|
"types": "./dist/types/exports/index.d.ts",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@walletconnect/universal-provider": "2.17.
|
|
39
|
+
"@walletconnect/universal-provider": "2.17.2",
|
|
40
40
|
"valtio": "1.11.2",
|
|
41
41
|
"viem": "2.x",
|
|
42
|
-
"@reown/appkit-common": "1.6.0",
|
|
43
|
-
"@reown/appkit-wallet": "1.6.0"
|
|
42
|
+
"@reown/appkit-common": "1.6.1-rc.1.0",
|
|
43
|
+
"@reown/appkit-wallet": "1.6.1-rc.1.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {},
|
|
46
46
|
"devDependencies": {
|