@txnlab/use-wallet 0.0.7 → 0.0.8
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/cjs/hooks/useWallet.d.ts +9 -0
- package/dist/cjs/index.js +34 -34
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/hooks/useWallet.d.ts +9 -0
- package/dist/esm/index.js +34 -34
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/package.json +1 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PROVIDER_ID } from "../types";
|
|
2
|
+
import { TransactionsArray } from "../types";
|
|
2
3
|
export { PROVIDER_ID };
|
|
3
4
|
export default function useWallet(): {
|
|
4
5
|
accounts: import("../types").Account[];
|
|
@@ -7,4 +8,12 @@ export default function useWallet(): {
|
|
|
7
8
|
sendTransactions: (transactions: Uint8Array[]) => Promise<import("../types").ConfirmedTxn & {
|
|
8
9
|
id: string;
|
|
9
10
|
}>;
|
|
11
|
+
getAddress: () => string | undefined;
|
|
12
|
+
groupTransactionsBySender: (transactions: TransactionsArray) => Promise<Record<string, import("../types").TxnInfo[]>>;
|
|
13
|
+
getAccountInfo: () => Promise<import("../types").AccountInfo>;
|
|
14
|
+
getAssets: () => Promise<import("../types").Asset[]>;
|
|
15
|
+
signEncodedTransactions: (transactions: TransactionsArray) => Promise<Uint8Array[]>;
|
|
16
|
+
sendRawTransactions: (transactions: Uint8Array[]) => Promise<import("../types").ConfirmedTxn & {
|
|
17
|
+
id: string;
|
|
18
|
+
}>;
|
|
10
19
|
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -3391,45 +3391,45 @@ function useWallet() {
|
|
|
3391
3391
|
const result = await walletClient?.sendRawTransactions(transactions);
|
|
3392
3392
|
return result;
|
|
3393
3393
|
};
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3394
|
+
const getAccountInfo = async () => {
|
|
3395
|
+
if (!activeAccount)
|
|
3396
|
+
throw new Error("No selected account.");
|
|
3397
|
+
const walletClient = await getWalletClient(activeAccount.providerId);
|
|
3398
|
+
const accountInfo = await walletClient?.getAccountInfo(activeAccount.address);
|
|
3399
|
+
return accountInfo;
|
|
3400
|
+
};
|
|
3401
|
+
const getAddress = () => {
|
|
3402
|
+
return activeAccount?.address;
|
|
3403
|
+
};
|
|
3404
|
+
const getAssets = async () => {
|
|
3405
|
+
if (!activeAccount)
|
|
3406
|
+
throw new Error("No selected account.");
|
|
3407
|
+
const walletClient = await getWalletClient(activeAccount.providerId);
|
|
3408
|
+
return await walletClient?.getAssets(activeAccount.address);
|
|
3409
|
+
};
|
|
3410
|
+
const groupTransactionsBySender = async (transactions) => {
|
|
3411
|
+
const walletClient = await getWalletClient(activeAccount?.providerId);
|
|
3412
|
+
return walletClient?.groupTransactionsBySender(transactions);
|
|
3413
|
+
};
|
|
3414
|
+
const signEncodedTransactions = async (transactions) => {
|
|
3415
|
+
const walletClient = await getWalletClient(activeAccount?.providerId);
|
|
3416
|
+
return await walletClient?.signEncodedTransactions(transactions);
|
|
3417
|
+
};
|
|
3418
|
+
const sendRawTransactions = async (transactions) => {
|
|
3419
|
+
const walletClient = await getWalletClient(activeAccount?.providerId);
|
|
3420
|
+
return await walletClient?.sendRawTransactions(transactions);
|
|
3421
|
+
};
|
|
3422
3422
|
return {
|
|
3423
3423
|
accounts,
|
|
3424
3424
|
activeAccount,
|
|
3425
3425
|
signTransactions,
|
|
3426
3426
|
sendTransactions,
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3427
|
+
getAddress,
|
|
3428
|
+
groupTransactionsBySender,
|
|
3429
|
+
getAccountInfo,
|
|
3430
|
+
getAssets,
|
|
3431
|
+
signEncodedTransactions,
|
|
3432
|
+
sendRawTransactions,
|
|
3433
3433
|
};
|
|
3434
3434
|
}
|
|
3435
3435
|
|