@reown/appkit-common-react-native 0.0.0-chore-spring-effect-20250909214820 → 0.0.0-chore-examples-20251009175707
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/adapters/BitcoinBaseAdapter.js +10 -0
- package/lib/commonjs/adapters/BitcoinBaseAdapter.js.map +1 -0
- package/lib/commonjs/adapters/BlockchainAdapter.js +14 -5
- package/lib/commonjs/adapters/BlockchainAdapter.js.map +1 -1
- package/lib/commonjs/adapters/EvmAdapter.js +2 -2
- package/lib/commonjs/adapters/EvmAdapter.js.map +1 -1
- package/lib/commonjs/adapters/SolanaBaseAdapter.js.map +1 -1
- package/lib/commonjs/index.js +9 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/index.js +4 -4
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/{siwe → siwx}/config.js.map +1 -1
- package/lib/commonjs/types/{siwe → siwx}/index.js +22 -0
- package/lib/commonjs/types/siwx/index.js.map +1 -0
- package/lib/commonjs/types/{siwe → siwx}/message.js.map +1 -1
- package/lib/commonjs/types/siwx/storage.js +6 -0
- package/lib/commonjs/types/siwx/storage.js.map +1 -0
- package/lib/commonjs/types/siwx/verifier.js +35 -0
- package/lib/commonjs/types/siwx/verifier.js.map +1 -0
- package/lib/commonjs/types/storage.js +22 -0
- package/lib/commonjs/types/storage.js.map +1 -1
- package/lib/commonjs/types/wallet/connector.js.map +1 -1
- package/lib/commonjs/utils/ConstantsUtil.js +10 -17
- package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
- package/lib/module/adapters/BitcoinBaseAdapter.js +5 -0
- package/lib/module/adapters/BitcoinBaseAdapter.js.map +1 -0
- package/lib/module/adapters/BlockchainAdapter.js +14 -5
- package/lib/module/adapters/BlockchainAdapter.js.map +1 -1
- package/lib/module/adapters/EvmAdapter.js +2 -2
- package/lib/module/adapters/EvmAdapter.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/index.js +2 -2
- package/lib/module/types/{siwe → siwx}/config.js.map +1 -1
- package/lib/module/types/siwx/index.js +7 -0
- package/lib/module/types/siwx/index.js.map +1 -0
- package/lib/module/types/{siwe → siwx}/message.js.map +1 -1
- package/lib/module/types/siwx/storage.js +4 -0
- package/lib/module/types/siwx/storage.js.map +1 -0
- package/lib/module/types/siwx/verifier.js +30 -0
- package/lib/module/types/siwx/verifier.js.map +1 -0
- package/lib/module/types/storage.js +18 -0
- package/lib/module/types/storage.js.map +1 -1
- package/lib/module/types/wallet/connector.js.map +1 -1
- package/lib/module/utils/ConstantsUtil.js +10 -17
- package/lib/module/utils/ConstantsUtil.js.map +1 -1
- package/lib/typescript/adapters/BitcoinBaseAdapter.d.ts +5 -0
- package/lib/typescript/adapters/BitcoinBaseAdapter.d.ts.map +1 -0
- package/lib/typescript/adapters/BlockchainAdapter.d.ts.map +1 -1
- package/lib/typescript/adapters/EvmAdapter.d.ts +1 -1
- package/lib/typescript/adapters/EvmAdapter.d.ts.map +1 -1
- package/lib/typescript/adapters/SolanaBaseAdapter.d.ts +1 -0
- package/lib/typescript/adapters/SolanaBaseAdapter.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/types/api/events.d.ts +76 -23
- package/lib/typescript/types/api/events.d.ts.map +1 -1
- package/lib/typescript/types/blockchain/balance.d.ts +1 -1
- package/lib/typescript/types/blockchain/balance.d.ts.map +1 -1
- package/lib/typescript/types/blockchain/network.d.ts +1 -1
- package/lib/typescript/types/blockchain/network.d.ts.map +1 -1
- package/lib/typescript/types/common.d.ts +1 -1
- package/lib/typescript/types/common.d.ts.map +1 -1
- package/lib/typescript/types/index.d.ts +1 -1
- package/lib/typescript/types/siwx/config.d.ts +73 -0
- package/lib/typescript/types/siwx/config.d.ts.map +1 -0
- package/lib/typescript/types/siwx/index.d.ts +5 -0
- package/lib/typescript/types/siwx/index.d.ts.map +1 -0
- package/lib/typescript/types/siwx/message.d.ts +92 -0
- package/lib/typescript/types/siwx/message.d.ts.map +1 -0
- package/lib/typescript/types/siwx/storage.d.ts +41 -0
- package/lib/typescript/types/siwx/storage.d.ts.map +1 -0
- package/lib/typescript/types/siwx/verifier.d.ts +28 -0
- package/lib/typescript/types/siwx/verifier.d.ts.map +1 -0
- package/lib/typescript/types/storage.d.ts +32 -0
- package/lib/typescript/types/storage.d.ts.map +1 -1
- package/lib/typescript/types/wallet/connector.d.ts +0 -2
- package/lib/typescript/types/wallet/connector.d.ts.map +1 -1
- package/lib/typescript/types/wallet/wallet-info.d.ts +1 -0
- package/lib/typescript/types/wallet/wallet-info.d.ts.map +1 -1
- package/lib/typescript/utils/ConstantsUtil.d.ts +9 -14
- package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/adapters/BitcoinBaseAdapter.ts +5 -0
- package/src/adapters/BlockchainAdapter.ts +15 -5
- package/src/adapters/EvmAdapter.ts +2 -2
- package/src/adapters/SolanaBaseAdapter.ts +1 -0
- package/src/index.ts +1 -0
- package/src/types/api/events.ts +95 -27
- package/src/types/blockchain/balance.ts +1 -1
- package/src/types/blockchain/network.ts +1 -1
- package/src/types/common.ts +1 -1
- package/src/types/index.ts +2 -2
- package/src/types/siwx/config.ts +73 -0
- package/src/types/siwx/index.ts +4 -0
- package/src/types/siwx/message.ts +92 -0
- package/src/types/siwx/storage.ts +44 -0
- package/src/types/siwx/verifier.ts +32 -0
- package/src/types/storage.ts +34 -0
- package/src/types/wallet/connector.ts +0 -2
- package/src/types/wallet/wallet-info.ts +1 -0
- package/src/utils/ConstantsUtil.ts +11 -17
- package/lib/commonjs/types/siwe/index.js.map +0 -1
- package/lib/module/types/siwe/index.js +0 -6
- package/lib/module/types/siwe/index.js.map +0 -1
- package/lib/typescript/types/siwe/config.d.ts +0 -31
- package/lib/typescript/types/siwe/config.d.ts.map +0 -1
- package/lib/typescript/types/siwe/index.d.ts +0 -3
- package/lib/typescript/types/siwe/index.d.ts.map +0 -1
- package/lib/typescript/types/siwe/message.d.ts +0 -57
- package/lib/typescript/types/siwe/message.d.ts.map +0 -1
- package/src/types/siwe/config.ts +0 -44
- package/src/types/siwe/index.ts +0 -3
- package/src/types/siwe/message.ts +0 -62
- /package/lib/commonjs/types/{siwe → siwx}/config.js +0 -0
- /package/lib/commonjs/types/{siwe → siwx}/message.js +0 -0
- /package/lib/module/types/{siwe → siwx}/config.js +0 -0
- /package/lib/module/types/{siwe → siwx}/message.js +0 -0
package/src/types/api/events.ts
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
Platform,
|
|
3
|
+
SocialProvider,
|
|
4
|
+
AccountType,
|
|
5
|
+
CaipNetworkId,
|
|
6
|
+
ChainNamespace,
|
|
7
|
+
ThemeVariables,
|
|
8
|
+
ThemeMode
|
|
9
|
+
} from '../common';
|
|
10
|
+
import type { Features } from '../ui';
|
|
11
|
+
import type { Metadata } from '../wallet';
|
|
12
|
+
|
|
13
|
+
export type WalletImpressionItem = {
|
|
14
|
+
name: string;
|
|
15
|
+
walletRank: number | undefined;
|
|
16
|
+
explorerId: string;
|
|
17
|
+
view: 'Connect' | 'AllWallets';
|
|
18
|
+
displayIndex?: number;
|
|
19
|
+
query?: string;
|
|
20
|
+
certified?: boolean;
|
|
21
|
+
installed?: boolean;
|
|
22
|
+
};
|
|
2
23
|
|
|
3
24
|
export type EventName =
|
|
4
25
|
| 'MODAL_LOADED'
|
|
5
26
|
| 'MODAL_OPEN'
|
|
6
27
|
| 'MODAL_CLOSE'
|
|
28
|
+
| 'INITIALIZE'
|
|
29
|
+
| 'WALLET_IMPRESSION'
|
|
7
30
|
| 'CLICK_ALL_WALLETS'
|
|
8
31
|
| 'CLICK_NETWORKS'
|
|
9
32
|
| 'SWITCH_NETWORK'
|
|
@@ -14,17 +37,18 @@ export type EventName =
|
|
|
14
37
|
| 'DISCONNECT_ERROR'
|
|
15
38
|
| 'CLICK_WALLET_HELP'
|
|
16
39
|
| 'CLICK_NETWORK_HELP'
|
|
17
|
-
| '
|
|
40
|
+
| 'CLICK_GET_WALLET_HELP'
|
|
41
|
+
| 'GET_WALLET'
|
|
18
42
|
| 'EMAIL_LOGIN_SELECTED'
|
|
19
43
|
| 'EMAIL_VERIFICATION_CODE_PASS'
|
|
20
44
|
| 'EMAIL_VERIFICATION_CODE_FAIL'
|
|
21
45
|
| 'EMAIL_EDIT'
|
|
22
46
|
| 'EMAIL_EDIT_COMPLETE'
|
|
23
47
|
| 'EMAIL_UPGRADE_FROM_MODAL'
|
|
24
|
-
| '
|
|
25
|
-
| '
|
|
26
|
-
| '
|
|
27
|
-
| '
|
|
48
|
+
| 'SIWX_AUTH_SUCCESS'
|
|
49
|
+
| 'SIWX_AUTH_ERROR'
|
|
50
|
+
| 'CLICK_SIGN_SIWX_MESSAGE'
|
|
51
|
+
| 'CLICK_CANCEL_SIWX'
|
|
28
52
|
| 'CLICK_TRANSACTIONS'
|
|
29
53
|
| 'ERROR_FETCH_TRANSACTIONS'
|
|
30
54
|
| 'LOAD_MORE_TRANSACTIONS'
|
|
@@ -59,6 +83,23 @@ export type Event =
|
|
|
59
83
|
connected: boolean;
|
|
60
84
|
};
|
|
61
85
|
}
|
|
86
|
+
| {
|
|
87
|
+
type: 'track';
|
|
88
|
+
event: 'INITIALIZE';
|
|
89
|
+
properties: {
|
|
90
|
+
showWallets?: boolean;
|
|
91
|
+
themeMode?: ThemeMode;
|
|
92
|
+
themeVariables?: ThemeVariables;
|
|
93
|
+
networks: CaipNetworkId[];
|
|
94
|
+
defaultNetwork?: CaipNetworkId;
|
|
95
|
+
metadata?: Metadata;
|
|
96
|
+
enableAnalytics?: boolean;
|
|
97
|
+
features?: Features;
|
|
98
|
+
adapters?: string[];
|
|
99
|
+
extraConnectors?: string[];
|
|
100
|
+
siwx?: boolean;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
62
103
|
| {
|
|
63
104
|
type: 'track';
|
|
64
105
|
event: 'MODAL_CLOSE';
|
|
@@ -78,7 +119,7 @@ export type Event =
|
|
|
78
119
|
type: 'track';
|
|
79
120
|
event: 'SWITCH_NETWORK';
|
|
80
121
|
properties: {
|
|
81
|
-
network:
|
|
122
|
+
network: CaipNetworkId;
|
|
82
123
|
};
|
|
83
124
|
}
|
|
84
125
|
| {
|
|
@@ -87,16 +128,22 @@ export type Event =
|
|
|
87
128
|
properties: {
|
|
88
129
|
name: string;
|
|
89
130
|
platform?: Platform;
|
|
90
|
-
|
|
131
|
+
explorerId?: string;
|
|
132
|
+
walletRank?: number;
|
|
133
|
+
displayIndex?: number;
|
|
134
|
+
view?: 'Connect' | 'AllWallets';
|
|
91
135
|
};
|
|
92
136
|
}
|
|
93
137
|
| {
|
|
94
138
|
type: 'track';
|
|
95
139
|
event: 'CONNECT_SUCCESS';
|
|
140
|
+
address?: string;
|
|
96
141
|
properties: {
|
|
97
142
|
name: string;
|
|
98
|
-
|
|
99
|
-
|
|
143
|
+
caipNetworkId?: CaipNetworkId;
|
|
144
|
+
method?: Platform;
|
|
145
|
+
explorerId?: string;
|
|
146
|
+
reconnect?: boolean;
|
|
100
147
|
};
|
|
101
148
|
}
|
|
102
149
|
| {
|
|
@@ -109,6 +156,9 @@ export type Event =
|
|
|
109
156
|
| {
|
|
110
157
|
type: 'track';
|
|
111
158
|
event: 'DISCONNECT_SUCCESS';
|
|
159
|
+
properties: {
|
|
160
|
+
namespace?: ChainNamespace;
|
|
161
|
+
};
|
|
112
162
|
}
|
|
113
163
|
| {
|
|
114
164
|
type: 'track';
|
|
@@ -124,7 +174,18 @@ export type Event =
|
|
|
124
174
|
}
|
|
125
175
|
| {
|
|
126
176
|
type: 'track';
|
|
127
|
-
event: '
|
|
177
|
+
event: 'CLICK_GET_WALLET_HELP';
|
|
178
|
+
}
|
|
179
|
+
| {
|
|
180
|
+
type: 'track';
|
|
181
|
+
event: 'GET_WALLET';
|
|
182
|
+
properties: {
|
|
183
|
+
name: string;
|
|
184
|
+
explorerId?: string;
|
|
185
|
+
link?: string;
|
|
186
|
+
linkType?: 'appstore' | 'playstore';
|
|
187
|
+
walletRank?: number;
|
|
188
|
+
};
|
|
128
189
|
}
|
|
129
190
|
| {
|
|
130
191
|
type: 'track';
|
|
@@ -152,34 +213,36 @@ export type Event =
|
|
|
152
213
|
}
|
|
153
214
|
| {
|
|
154
215
|
type: 'track';
|
|
155
|
-
|
|
216
|
+
address?: string;
|
|
217
|
+
event: 'CLICK_SIGN_SIWX_MESSAGE';
|
|
156
218
|
properties: {
|
|
157
|
-
network
|
|
219
|
+
network?: CaipNetworkId;
|
|
158
220
|
isSmartAccount: boolean;
|
|
159
221
|
};
|
|
160
222
|
}
|
|
161
223
|
| {
|
|
162
224
|
type: 'track';
|
|
163
|
-
event: '
|
|
225
|
+
event: 'CLICK_CANCEL_SIWX';
|
|
164
226
|
properties: {
|
|
165
|
-
network
|
|
227
|
+
network?: CaipNetworkId;
|
|
166
228
|
isSmartAccount: boolean;
|
|
167
229
|
};
|
|
168
230
|
}
|
|
169
231
|
| {
|
|
170
232
|
type: 'track';
|
|
171
|
-
event: '
|
|
233
|
+
event: 'SIWX_AUTH_SUCCESS';
|
|
172
234
|
properties: {
|
|
173
|
-
network
|
|
235
|
+
network?: CaipNetworkId;
|
|
174
236
|
isSmartAccount: boolean;
|
|
175
237
|
};
|
|
176
238
|
}
|
|
177
239
|
| {
|
|
178
240
|
type: 'track';
|
|
179
|
-
event: '
|
|
241
|
+
event: 'SIWX_AUTH_ERROR';
|
|
180
242
|
properties: {
|
|
181
|
-
network
|
|
243
|
+
network?: CaipNetworkId;
|
|
182
244
|
isSmartAccount: boolean;
|
|
245
|
+
message?: string;
|
|
183
246
|
};
|
|
184
247
|
}
|
|
185
248
|
| {
|
|
@@ -214,7 +277,7 @@ export type Event =
|
|
|
214
277
|
event: 'OPEN_SEND';
|
|
215
278
|
properties: {
|
|
216
279
|
isSmartAccount: boolean;
|
|
217
|
-
network
|
|
280
|
+
network?: CaipNetworkId;
|
|
218
281
|
};
|
|
219
282
|
}
|
|
220
283
|
| {
|
|
@@ -222,7 +285,7 @@ export type Event =
|
|
|
222
285
|
event: 'OPEN_SWAP';
|
|
223
286
|
properties: {
|
|
224
287
|
isSmartAccount: boolean;
|
|
225
|
-
network
|
|
288
|
+
network?: CaipNetworkId;
|
|
226
289
|
};
|
|
227
290
|
}
|
|
228
291
|
| {
|
|
@@ -230,7 +293,7 @@ export type Event =
|
|
|
230
293
|
event: 'INITIATE_SWAP';
|
|
231
294
|
properties: {
|
|
232
295
|
isSmartAccount: boolean;
|
|
233
|
-
network
|
|
296
|
+
network?: CaipNetworkId;
|
|
234
297
|
swapFromToken: string;
|
|
235
298
|
swapToToken: string;
|
|
236
299
|
swapFromAmount: string;
|
|
@@ -242,7 +305,7 @@ export type Event =
|
|
|
242
305
|
event: 'SWAP_SUCCESS';
|
|
243
306
|
properties: {
|
|
244
307
|
isSmartAccount: boolean;
|
|
245
|
-
network
|
|
308
|
+
network?: CaipNetworkId;
|
|
246
309
|
swapFromToken: string;
|
|
247
310
|
swapToToken: string;
|
|
248
311
|
swapFromAmount: string;
|
|
@@ -254,7 +317,7 @@ export type Event =
|
|
|
254
317
|
event: 'SWAP_ERROR';
|
|
255
318
|
properties: {
|
|
256
319
|
isSmartAccount: boolean;
|
|
257
|
-
network
|
|
320
|
+
network?: CaipNetworkId;
|
|
258
321
|
swapFromToken: string;
|
|
259
322
|
swapToToken: string;
|
|
260
323
|
swapFromAmount: string;
|
|
@@ -267,7 +330,7 @@ export type Event =
|
|
|
267
330
|
event: 'SEND_INITIATED';
|
|
268
331
|
properties: {
|
|
269
332
|
isSmartAccount: boolean;
|
|
270
|
-
network
|
|
333
|
+
network?: CaipNetworkId;
|
|
271
334
|
token: string;
|
|
272
335
|
amount: number;
|
|
273
336
|
};
|
|
@@ -277,7 +340,7 @@ export type Event =
|
|
|
277
340
|
event: 'SEND_SUCCESS';
|
|
278
341
|
properties: {
|
|
279
342
|
isSmartAccount: boolean;
|
|
280
|
-
network
|
|
343
|
+
network?: CaipNetworkId;
|
|
281
344
|
token: string;
|
|
282
345
|
amount: number;
|
|
283
346
|
};
|
|
@@ -287,7 +350,7 @@ export type Event =
|
|
|
287
350
|
event: 'SEND_ERROR';
|
|
288
351
|
properties: {
|
|
289
352
|
isSmartAccount: boolean;
|
|
290
|
-
network
|
|
353
|
+
network?: CaipNetworkId;
|
|
291
354
|
token: string;
|
|
292
355
|
amount: number;
|
|
293
356
|
};
|
|
@@ -391,4 +454,9 @@ export type Event =
|
|
|
391
454
|
properties?: {
|
|
392
455
|
message?: string;
|
|
393
456
|
};
|
|
457
|
+
}
|
|
458
|
+
| {
|
|
459
|
+
type: 'track';
|
|
460
|
+
event: 'WALLET_IMPRESSION';
|
|
461
|
+
items: Array<WalletImpressionItem>;
|
|
394
462
|
};
|
|
@@ -11,7 +11,7 @@ export interface Balance {
|
|
|
11
11
|
numeric: string;
|
|
12
12
|
};
|
|
13
13
|
chainId?: string;
|
|
14
|
-
address?: CaipAddress; // contract address
|
|
14
|
+
address?: CaipAddress | string; // contract address
|
|
15
15
|
value?: number; //total value of the amount in currency
|
|
16
16
|
price?: number; //price of the token in currency
|
|
17
17
|
iconUrl?: string;
|
package/src/types/common.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type CaipAddress = `${string}:${string}:${string}`;
|
|
|
4
4
|
|
|
5
5
|
export type CaipNetworkId = `${string}:${string}`;
|
|
6
6
|
|
|
7
|
-
export type ChainNamespace = 'eip155' | 'solana' | '
|
|
7
|
+
export type ChainNamespace = 'eip155' | 'solana' | 'bip122';
|
|
8
8
|
|
|
9
9
|
export type AdapterType = 'solana' | 'wagmi' | 'ethers' | 'universal' | 'bip122';
|
|
10
10
|
|
package/src/types/index.ts
CHANGED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { CaipNetworkId } from '../common';
|
|
2
|
+
import type { SIWXSession, SIWXMessage } from './message';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This interface represents the SIWX configuration plugin, which is used to create and manage SIWX messages and sessions.
|
|
6
|
+
* You may use it to create a custom implementation following your needs, but watch close for the methods requirements.
|
|
7
|
+
*/
|
|
8
|
+
export interface SIWXConfig {
|
|
9
|
+
/**
|
|
10
|
+
* This method will be called to create a new message to be signed by the user.
|
|
11
|
+
*
|
|
12
|
+
* Constraints:
|
|
13
|
+
* - The message MUST be unique and contain all the necessary information to verify the user's identity.
|
|
14
|
+
* - SIWXMessage.toString() method MUST be implemented to return the message string.
|
|
15
|
+
*
|
|
16
|
+
* @param input SIWXMessage.Input
|
|
17
|
+
* @returns SIWXMessage
|
|
18
|
+
*/
|
|
19
|
+
createMessage: (input: SIWXMessage.Input) => Promise<SIWXMessage>;
|
|
20
|
+
/**
|
|
21
|
+
* This method will be called to store a new single session.
|
|
22
|
+
*
|
|
23
|
+
* Constraints:
|
|
24
|
+
* - This method MUST verify if the session is valid and store it in the storage successfully.
|
|
25
|
+
*
|
|
26
|
+
* @param session SIWXSession
|
|
27
|
+
*/
|
|
28
|
+
addSession: (session: SIWXSession) => Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* This method will be called to revoke all the sessions stored for a specific chain and address.
|
|
31
|
+
*
|
|
32
|
+
* Constraints:
|
|
33
|
+
* - This method MUST delete all the sessions stored for the specific chain and address successfully.
|
|
34
|
+
*
|
|
35
|
+
* @param chainId CaipNetworkId
|
|
36
|
+
* @param address string
|
|
37
|
+
*/
|
|
38
|
+
revokeSession: (chainId: CaipNetworkId, address: string) => Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* This method will be called to replace all the sessions in the storage with the new ones.
|
|
41
|
+
*
|
|
42
|
+
* Constraints:
|
|
43
|
+
* - This method MUST verify all the sessions before storing them in the storage;
|
|
44
|
+
* - This method MUST replace all the sessions in the storage with the new ones succesfully otherwise it MUST throw an error.
|
|
45
|
+
*
|
|
46
|
+
* @param sessions SIWXSession[]
|
|
47
|
+
*/
|
|
48
|
+
setSessions: (sessions: SIWXSession[]) => Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* This method will be called to get all the sessions stored for a specific chain and address.
|
|
51
|
+
*
|
|
52
|
+
* Constraints:
|
|
53
|
+
* - This method MUST return only sessions that are verified and valid;
|
|
54
|
+
* - This method MUST NOT return expired sessions.
|
|
55
|
+
*
|
|
56
|
+
* @param chainId CaipNetworkId
|
|
57
|
+
* @param address string
|
|
58
|
+
* @returns
|
|
59
|
+
*/
|
|
60
|
+
getSessions: (chainId: CaipNetworkId, address: string) => Promise<SIWXSession[]>;
|
|
61
|
+
/**
|
|
62
|
+
* This method determines whether the wallet stays connected when the user denies the signature request.
|
|
63
|
+
*
|
|
64
|
+
* @returns {boolean}
|
|
65
|
+
*/
|
|
66
|
+
getRequired?: () => boolean;
|
|
67
|
+
/**
|
|
68
|
+
* This flag determines whether the session should be cleared when the user disconnects.
|
|
69
|
+
*
|
|
70
|
+
* @default true
|
|
71
|
+
*/
|
|
72
|
+
signOutOnDisconnect?: boolean;
|
|
73
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { CaipNetworkId } from '../common';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This interface represents a SIWX session, which is used to store the user's identity information.
|
|
5
|
+
*/
|
|
6
|
+
export interface SIWXSession {
|
|
7
|
+
data: SIWXMessage.Data;
|
|
8
|
+
message: string;
|
|
9
|
+
signature: string;
|
|
10
|
+
cacao?: Cacao;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* This interface represents a SIWX message, which is used to create a message to be signed by the user.
|
|
14
|
+
* This must contain the necessary information to verify the user's identity and how to generate the string message.
|
|
15
|
+
*/
|
|
16
|
+
export interface SIWXMessage extends SIWXMessage.Data, SIWXMessage.Methods {}
|
|
17
|
+
export declare namespace SIWXMessage {
|
|
18
|
+
/**
|
|
19
|
+
* This interface represents the SIWX message data, which is used to create a message to be signed by the user.
|
|
20
|
+
*/
|
|
21
|
+
interface Data extends Input, Metadata, Identifier {}
|
|
22
|
+
/**
|
|
23
|
+
* This interface represents the SIWX message input.
|
|
24
|
+
* Here must contain what is different for each user of the application.
|
|
25
|
+
*/
|
|
26
|
+
interface Input {
|
|
27
|
+
accountAddress: string;
|
|
28
|
+
chainId: CaipNetworkId;
|
|
29
|
+
notBefore?: Timestamp;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* This interface represents the SIWX message metadata.
|
|
33
|
+
* Here must contain the main data related to the app.
|
|
34
|
+
*/
|
|
35
|
+
interface Metadata {
|
|
36
|
+
domain: string;
|
|
37
|
+
uri: string;
|
|
38
|
+
version: string;
|
|
39
|
+
nonce: string;
|
|
40
|
+
statement?: string;
|
|
41
|
+
resources?: string[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* This interface represents the SIWX message identifier.
|
|
45
|
+
* Here must contain the request id and the timestamps.
|
|
46
|
+
*/
|
|
47
|
+
interface Identifier {
|
|
48
|
+
requestId?: string;
|
|
49
|
+
issuedAt?: Timestamp;
|
|
50
|
+
expirationTime?: Timestamp;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* This interface represents the SIWX message methods.
|
|
54
|
+
* Here must contain the method to generate the message string and any other method performed by the SIWX message.
|
|
55
|
+
*/
|
|
56
|
+
interface Methods {
|
|
57
|
+
toString: () => string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The timestamp is a UTC string representing the time in ISO 8601 format.
|
|
61
|
+
*/
|
|
62
|
+
type Timestamp = string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface CacaoHeader {
|
|
66
|
+
t: 'caip122';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface CacaoPayload {
|
|
70
|
+
domain: string;
|
|
71
|
+
aud: string;
|
|
72
|
+
nonce: string;
|
|
73
|
+
iss: string;
|
|
74
|
+
version?: string;
|
|
75
|
+
iat?: string;
|
|
76
|
+
nbf?: string;
|
|
77
|
+
exp?: string;
|
|
78
|
+
statement?: string;
|
|
79
|
+
requestId?: string;
|
|
80
|
+
resources?: string[];
|
|
81
|
+
type?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface Cacao {
|
|
85
|
+
h: CacaoHeader;
|
|
86
|
+
p: CacaoPayload;
|
|
87
|
+
s: {
|
|
88
|
+
t: 'eip191' | 'eip1271';
|
|
89
|
+
s: string;
|
|
90
|
+
m?: string;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { CaipNetworkId } from '../common';
|
|
2
|
+
import type { SIWXSession } from './message';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This is the interface for a SIWX storage.
|
|
6
|
+
*/
|
|
7
|
+
export interface SIWXStorage {
|
|
8
|
+
/**
|
|
9
|
+
* Adds a new session for the storage.
|
|
10
|
+
* This method should not verify the session, only store it.
|
|
11
|
+
*
|
|
12
|
+
* @param session SIWXSession
|
|
13
|
+
* @returns Promise<void>
|
|
14
|
+
*/
|
|
15
|
+
add(session: SIWXSession): Promise<void>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Deletes a session from the storage.
|
|
19
|
+
*
|
|
20
|
+
* @param chainId CaipNetworkId
|
|
21
|
+
* @param address string
|
|
22
|
+
* @returns Promise<void>
|
|
23
|
+
*/
|
|
24
|
+
delete(chainId: CaipNetworkId, address: string): Promise<void>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Gets a list of sessions for a given chainId and address.
|
|
28
|
+
* This method should not verify sessions, only return the sessions that are stored.
|
|
29
|
+
*
|
|
30
|
+
* @param chainId CaipNetworkId
|
|
31
|
+
* @param address string
|
|
32
|
+
* @returns Promise<SIWXSession[]>
|
|
33
|
+
*/
|
|
34
|
+
get(chainId: CaipNetworkId, address: string): Promise<SIWXSession[]>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Replaces the current sessions with the new list of sessions.
|
|
38
|
+
* This method should not verify sessions, only store them.
|
|
39
|
+
*
|
|
40
|
+
* @param sessions SIWXSession[]
|
|
41
|
+
* @returns Promise<void>
|
|
42
|
+
*/
|
|
43
|
+
set(sessions: SIWXSession[]): Promise<void>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ChainNamespace } from '../common';
|
|
2
|
+
import type { SIWXSession } from './message';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This is the base class for a SIWX verifier.
|
|
6
|
+
*/
|
|
7
|
+
export abstract class SIWXVerifier {
|
|
8
|
+
/**
|
|
9
|
+
* The chain namespace that this verifier should verify.
|
|
10
|
+
*/
|
|
11
|
+
public abstract readonly chainNamespace: ChainNamespace;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* This method should return true if the verifier should verify the session.
|
|
15
|
+
* By default it will check by the chain namespace, but you may override it for a specific requirement.
|
|
16
|
+
*
|
|
17
|
+
* @param session SIWXSession
|
|
18
|
+
* @returns boolean
|
|
19
|
+
*/
|
|
20
|
+
public shouldVerify(session: SIWXSession): boolean {
|
|
21
|
+
return session.data.chainId.startsWith(this.chainNamespace);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* This method should verify the session.
|
|
26
|
+
* You must implement this method with the verification logic.
|
|
27
|
+
*
|
|
28
|
+
* @param session SIWXSession
|
|
29
|
+
* @returns Promise<boolean> - If `true` means the session is valid.
|
|
30
|
+
*/
|
|
31
|
+
abstract verify(session: SIWXSession): Promise<boolean>;
|
|
32
|
+
}
|
package/src/types/storage.ts
CHANGED
|
@@ -28,3 +28,37 @@ export interface Storage {
|
|
|
28
28
|
*/
|
|
29
29
|
removeItem(key: string): Promise<void>;
|
|
30
30
|
}
|
|
31
|
+
|
|
32
|
+
export interface SafeStorageItems {
|
|
33
|
+
'WALLETCONNECT_DEEPLINK_CHOICE': string; //dont change this one
|
|
34
|
+
'@appkit/recent_wallet': string;
|
|
35
|
+
'@appkit/connected_connectors': string;
|
|
36
|
+
'@appkit/onramp_preferred_country': string;
|
|
37
|
+
'@appkit/onramp_countries': string;
|
|
38
|
+
'@appkit/onramp_service_providers': string;
|
|
39
|
+
'@appkit/onramp_fiat_limits': string;
|
|
40
|
+
'@appkit/onramp_fiat_currencies': string;
|
|
41
|
+
'@appkit/onramp_preferred_fiat_currency': string;
|
|
42
|
+
'@appkit/onramp_countries_defaults': string;
|
|
43
|
+
'@appkit/active_namespace': string;
|
|
44
|
+
'@appkit/coinbase_connector/session': string;
|
|
45
|
+
'@appkit/siwx-auth-token': string;
|
|
46
|
+
'@appkit/siwx-nonce-token': string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const SafeStorageKeys = {
|
|
50
|
+
WC_DEEPLINK: 'WALLETCONNECT_DEEPLINK_CHOICE', //dont change this one
|
|
51
|
+
RECENT_WALLET: '@appkit/recent_wallet',
|
|
52
|
+
CONNECTED_CONNECTORS: '@appkit/connected_connectors',
|
|
53
|
+
ONRAMP_PREFERRED_COUNTRY: '@appkit/onramp_preferred_country',
|
|
54
|
+
ONRAMP_COUNTRIES: '@appkit/onramp_countries',
|
|
55
|
+
ONRAMP_SERVICE_PROVIDERS: '@appkit/onramp_service_providers',
|
|
56
|
+
ONRAMP_FIAT_LIMITS: '@appkit/onramp_fiat_limits',
|
|
57
|
+
ONRAMP_FIAT_CURRENCIES: '@appkit/onramp_fiat_currencies',
|
|
58
|
+
ONRAMP_PREFERRED_FIAT_CURRENCY: '@appkit/onramp_preferred_fiat_currency',
|
|
59
|
+
ONRAMP_COUNTRIES_DEFAULTS: '@appkit/onramp_countries_defaults',
|
|
60
|
+
ACTIVE_NAMESPACE: '@appkit/active_namespace',
|
|
61
|
+
COINBASE_CONNECTOR_SESSION: '@appkit/coinbase_connector/session',
|
|
62
|
+
SIWX_AUTH_TOKEN: '@appkit/siwx-auth-token',
|
|
63
|
+
SIWX_NONCE_TOKEN: '@appkit/siwx-nonce-token'
|
|
64
|
+
} as const;
|
|
@@ -4,7 +4,6 @@ import type { AppKitNetwork } from '../blockchain/network';
|
|
|
4
4
|
import type { Provider } from '../blockchain/adapter';
|
|
5
5
|
import type { WalletInfo, Metadata } from './wallet-info';
|
|
6
6
|
import type { ConnectionProperties } from './connection';
|
|
7
|
-
import type { AppKitSIWEClient } from '../siwe';
|
|
8
7
|
import type { Storage } from '../storage';
|
|
9
8
|
import type { WcWallet } from '../api/wallet-api';
|
|
10
9
|
|
|
@@ -31,7 +30,6 @@ export type ConnectOptions = {
|
|
|
31
30
|
namespaces?: ProposalNamespaces;
|
|
32
31
|
defaultNetwork?: AppKitNetwork;
|
|
33
32
|
universalLink?: string;
|
|
34
|
-
siweConfig?: AppKitSIWEClient;
|
|
35
33
|
};
|
|
36
34
|
|
|
37
35
|
export type ConnectorInitOptions = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const ConstantsUtil = {
|
|
2
|
-
VERSION: '0.0.0-chore-
|
|
2
|
+
VERSION: '0.0.0-chore-examples-20251009175707',
|
|
3
3
|
|
|
4
4
|
EIP155: 'eip155',
|
|
5
5
|
ADD_CHAIN_METHOD: 'wallet_addEthereumChain',
|
|
@@ -16,6 +16,16 @@ export const ConstantsUtil = {
|
|
|
16
16
|
SECURE_SITE_ICON: `https://secure.reown.com/images/favicon.png`,
|
|
17
17
|
REOWN_URL: `https://reown.com`,
|
|
18
18
|
|
|
19
|
+
CHAIN_NAME_MAP: {
|
|
20
|
+
eip155: 'EVM Networks',
|
|
21
|
+
solana: 'Solana',
|
|
22
|
+
polkadot: 'Polkadot',
|
|
23
|
+
bip122: 'Bitcoin',
|
|
24
|
+
cosmos: 'Cosmos',
|
|
25
|
+
sui: 'Sui',
|
|
26
|
+
stacks: 'Stacks'
|
|
27
|
+
},
|
|
28
|
+
|
|
19
29
|
USDT_CONTRACT_ADDRESSES: [
|
|
20
30
|
// Mainnet
|
|
21
31
|
'0xdac17f958d2ee523a2206206994597c13d831ec7',
|
|
@@ -64,21 +74,5 @@ export const ConstantsUtil = {
|
|
|
64
74
|
app_store: 'https://apps.apple.com/app/id1580902717',
|
|
65
75
|
android_app_id: 'com.solflare.mobile',
|
|
66
76
|
ios_schema: 'solflare://'
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
// Storage Keys
|
|
70
|
-
STORAGE_KEYS: {
|
|
71
|
-
WC_DEEPLINK: 'WALLETCONNECT_DEEPLINK_CHOICE', //dont change this one
|
|
72
|
-
RECENT_WALLET: '@appkit/recent_wallet',
|
|
73
|
-
CONNECTED_CONNECTORS: '@appkit/connected_connectors',
|
|
74
|
-
ONRAMP_PREFERRED_COUNTRY: '@appkit/onramp_preferred_country',
|
|
75
|
-
ONRAMP_COUNTRIES: '@appkit/onramp_countries',
|
|
76
|
-
ONRAMP_SERVICE_PROVIDERS: '@appkit/onramp_service_providers',
|
|
77
|
-
ONRAMP_FIAT_LIMITS: '@appkit/onramp_fiat_limits',
|
|
78
|
-
ONRAMP_FIAT_CURRENCIES: '@appkit/onramp_fiat_currencies',
|
|
79
|
-
ONRAMP_PREFERRED_FIAT_CURRENCY: '@appkit/onramp_preferred_fiat_currency',
|
|
80
|
-
ONRAMP_COUNTRIES_DEFAULTS: '@appkit/onramp_countries_defaults',
|
|
81
|
-
ACTIVE_NAMESPACE: '@appkit/active_namespace',
|
|
82
|
-
COINBASE_CONNECTOR_SESSION: '@appkit/coinbase_connector/session'
|
|
83
77
|
}
|
|
84
78
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_config","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_message"],"sourceRoot":"../../../../src","sources":["types/siwe/index.ts"],"mappings":";;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,OAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,OAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,QAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,QAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,QAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,QAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["types/siwe/index.ts"],"mappings":";;AAAA;AACA,cAAc,UAAU;AACxB,cAAc,WAAW","ignoreList":[]}
|