@txnlab/use-wallet 1.0.0 → 1.0.2
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/README.md +3 -1
- package/dist/cjs/index.js +0 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +0 -8
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Preview a basic implementation in [Storybook](https://txnlab.github.io/use-walle
|
|
|
18
18
|
|
|
19
19
|
## Quick Start
|
|
20
20
|
|
|
21
|
-
⚠️ If you're using
|
|
21
|
+
⚠️ If you're using `create-react-app` and `webpack 5` (most newer React projects), you will need to install polyfills. Follow [these directions](#webpack-5).
|
|
22
22
|
|
|
23
23
|
### Yarn
|
|
24
24
|
|
|
@@ -362,6 +362,8 @@ Note that some of the providers do not require static imports to be provided. Th
|
|
|
362
362
|
|
|
363
363
|
## Webpack 5
|
|
364
364
|
|
|
365
|
+
Note: Frameworks like `next.js` already include polyfills. This step is required if you're using `create-react-app` with `webpack 5`.
|
|
366
|
+
|
|
365
367
|
1. Install `react-app-rewired` and the missing polyfills.
|
|
366
368
|
|
|
367
369
|
```bash
|
package/dist/cjs/index.js
CHANGED
|
@@ -1095,9 +1095,7 @@ class PeraWalletClient extends BaseClient {
|
|
|
1095
1095
|
}
|
|
1096
1096
|
}
|
|
1097
1097
|
async connect(onDisconnect) {
|
|
1098
|
-
this.keepWCAliveStart();
|
|
1099
1098
|
const accounts = await this.#client.connect();
|
|
1100
|
-
this.keepWCAliveStop();
|
|
1101
1099
|
this.#client.connector?.on("disconnect", onDisconnect);
|
|
1102
1100
|
if (accounts.length === 0) {
|
|
1103
1101
|
throw new Error(`No accounts found for ${PeraWalletClient.metadata.id}`);
|
|
@@ -1152,12 +1150,8 @@ class PeraWalletClient extends BaseClient {
|
|
|
1152
1150
|
}
|
|
1153
1151
|
return acc;
|
|
1154
1152
|
}, []);
|
|
1155
|
-
// Play an audio file to keep Wallet Connect's web socket open on iOS
|
|
1156
|
-
// when the user goes into background mode.
|
|
1157
|
-
this.keepWCAliveStart();
|
|
1158
1153
|
// Sign them with the client.
|
|
1159
1154
|
const result = await this.#client.signTransaction([txnsToSign]);
|
|
1160
|
-
this.keepWCAliveStop();
|
|
1161
1155
|
// Join the newly signed transactions with the original group of transactions.
|
|
1162
1156
|
const signedTxns = decodedTxns.reduce((acc, txn, i) => {
|
|
1163
1157
|
if (!("txn" in txn)) {
|
|
@@ -1192,11 +1186,9 @@ class PeraWalletClient extends BaseClient {
|
|
|
1192
1186
|
/** @deprecated */
|
|
1193
1187
|
async signEncodedTransactions(transactions) {
|
|
1194
1188
|
const transactionsToSign = this.formatTransactionsArray(transactions);
|
|
1195
|
-
this.keepWCAliveStart();
|
|
1196
1189
|
const result = (await this.#client.signTransaction([
|
|
1197
1190
|
transactionsToSign,
|
|
1198
1191
|
]));
|
|
1199
|
-
this.keepWCAliveStop();
|
|
1200
1192
|
const signedTransactions = [];
|
|
1201
1193
|
let resultIndex = 0;
|
|
1202
1194
|
for (const [type, txn] of transactions) {
|