@ecency/wallets 1.3.6 → 1.3.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/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # @ecency/wallets
2
+
3
+ Utilities for managing Hive blockchain wallets and external cryptocurrency wallets within the Ecency ecosystem.
4
+
5
+ ## Features
6
+
7
+ - Create wallets from BIP39 seed phrases
8
+ - `signDigest` – create a signature for an arbitrary digest
9
+ - `signTx` – sign a transaction with an optional custom chain ID
10
+ - `signTxAndBroadcast` – sign a transaction and immediately broadcast it
11
+ - `signExternalTx` – sign transactions for external chains like BTC or ETH
12
+ - `signExternalTxAndBroadcast` – sign and broadcast transactions on external networks
13
+ - `encryptMemoWithKeys` / `decryptMemoWithKeys` – encrypt or decrypt memos using explicit keys
14
+ - `encryptMemoWithAccounts` / `decryptMemoWithAccounts` – encrypt or decrypt memos by looking up account memo keys
15
+ - `useGetExternalWalletBalanceQuery` – retrieve balances for external wallets such as BTC, ETH, SOL, TRX, TON, ATOM, or APT
16
+
17
+ ## Installation
18
+
19
+ ```sh
20
+ yarn add @ecency/wallets
21
+ # or
22
+ npm install @ecency/wallets
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```ts
28
+ import {
29
+ signDigest,
30
+ signTx,
31
+ signTxAndBroadcast,
32
+ signExternalTx,
33
+ signExternalTxAndBroadcast,
34
+ encryptMemoWithKeys,
35
+ encryptMemoWithAccounts,
36
+ decryptMemoWithKeys,
37
+ decryptMemoWithAccounts,
38
+ EcencyWalletCurrency,
39
+ useGetExternalWalletBalanceQuery,
40
+ } from '@ecency/wallets';
41
+ import { Client } from '@hiveio/dhive';
42
+
43
+ const client = new Client('https://api.hive.blog');
44
+
45
+ const signature = signDigest('deadbeef', privateWif);
46
+ const signedTx = signTx(tx, privateWif, customChainId);
47
+ await signTxAndBroadcast(client, tx, privateWif);
48
+ await signExternalTx(EcencyWalletCurrency.ETH, ethSignParams);
49
+ await signExternalTxAndBroadcast(EcencyWalletCurrency.BTC, btcSignParams);
50
+
51
+ const encrypted = await encryptMemoWithAccounts(client, privateWif, 'alice', '#hello');
52
+ const memo = decryptMemoWithKeys(privateWif, encrypted);
53
+
54
+ // query an external wallet balance (e.g., BTC)
55
+ const { data: btcBalance } = useGetExternalWalletBalanceQuery(
56
+ EcencyWalletCurrency.BTC,
57
+ '1BitcoinAddress...'
58
+ );
59
+ ```
60
+