@aptos-labs/wallet-adapter-react 2.2.1 → 2.3.1
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/CHANGELOG.md +18 -0
- package/dist/index.js +12 -7
- package/dist/index.mjs +12 -7
- package/package.json +2 -2
- package/src/WalletProvider.tsx +14 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @aptos-labs/wallet-adapter-react
|
|
2
2
|
|
|
3
|
+
## 2.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [41f9485]
|
|
8
|
+
- @aptos-labs/wallet-adapter-core@3.10.0
|
|
9
|
+
|
|
10
|
+
## 2.3.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 444c708: Fix wallet detection
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [6be2a06]
|
|
19
|
+
- @aptos-labs/wallet-adapter-core@3.9.0
|
|
20
|
+
|
|
3
21
|
## 2.2.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -207,13 +207,18 @@ var AptosWalletAdapterProvider = ({
|
|
|
207
207
|
setWallets(updatedWallets);
|
|
208
208
|
};
|
|
209
209
|
const handleStandardWalletsAdded = (standardWallet) => {
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
210
|
+
const existingWalletIndex = wallets.findIndex(
|
|
211
|
+
(wallet2) => wallet2.name == standardWallet.name
|
|
212
|
+
);
|
|
213
|
+
if (existingWalletIndex !== -1) {
|
|
214
|
+
setWallets((wallets2) => [
|
|
215
|
+
...wallets2.slice(0, existingWalletIndex),
|
|
216
|
+
standardWallet,
|
|
217
|
+
...wallets2.slice(existingWalletIndex + 1)
|
|
218
|
+
]);
|
|
219
|
+
} else {
|
|
220
|
+
setWallets((wallets2) => [...wallets2, standardWallet]);
|
|
221
|
+
}
|
|
217
222
|
};
|
|
218
223
|
(0, import_react2.useEffect)(() => {
|
|
219
224
|
walletCore.on("connect", handleConnect);
|
package/dist/index.mjs
CHANGED
|
@@ -180,13 +180,18 @@ var AptosWalletAdapterProvider = ({
|
|
|
180
180
|
setWallets(updatedWallets);
|
|
181
181
|
};
|
|
182
182
|
const handleStandardWalletsAdded = (standardWallet) => {
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
183
|
+
const existingWalletIndex = wallets.findIndex(
|
|
184
|
+
(wallet2) => wallet2.name == standardWallet.name
|
|
185
|
+
);
|
|
186
|
+
if (existingWalletIndex !== -1) {
|
|
187
|
+
setWallets((wallets2) => [
|
|
188
|
+
...wallets2.slice(0, existingWalletIndex),
|
|
189
|
+
standardWallet,
|
|
190
|
+
...wallets2.slice(existingWalletIndex + 1)
|
|
191
|
+
]);
|
|
192
|
+
} else {
|
|
193
|
+
setWallets((wallets2) => [...wallets2, standardWallet]);
|
|
194
|
+
}
|
|
190
195
|
};
|
|
191
196
|
useEffect(() => {
|
|
192
197
|
walletCore.on("connect", handleConnect);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptos-labs/wallet-adapter-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Aptos Wallet Adapter React Provider",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@aptos-labs/wallet-adapter-tsconfig": "0.0.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@aptos-labs/wallet-adapter-core": "3.
|
|
40
|
+
"@aptos-labs/wallet-adapter-core": "3.10.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"react": "^18"
|
package/src/WalletProvider.tsx
CHANGED
|
@@ -224,13 +224,20 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
|
|
|
224
224
|
const handleStandardWalletsAdded = (standardWallet: Wallet) => {
|
|
225
225
|
// Manage current wallet state by removing optional duplications
|
|
226
226
|
// as new wallets are coming
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
227
|
+
const existingWalletIndex = wallets.findIndex(
|
|
228
|
+
(wallet) => wallet.name == standardWallet.name
|
|
229
|
+
);
|
|
230
|
+
if (existingWalletIndex !== -1) {
|
|
231
|
+
// If wallet exists, replace it with the new wallet
|
|
232
|
+
setWallets((wallets) => [
|
|
233
|
+
...wallets.slice(0, existingWalletIndex),
|
|
234
|
+
standardWallet,
|
|
235
|
+
...wallets.slice(existingWalletIndex + 1),
|
|
236
|
+
]);
|
|
237
|
+
} else {
|
|
238
|
+
// If wallet doesn't exist, add it to the array
|
|
239
|
+
setWallets((wallets) => [...wallets, standardWallet]);
|
|
240
|
+
}
|
|
234
241
|
};
|
|
235
242
|
|
|
236
243
|
useEffect(() => {
|