paytaca-cli 0.1.0 → 0.2.0
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 +28 -10
- package/dist/commands/address.d.ts +2 -0
- package/dist/commands/address.d.ts.map +1 -1
- package/dist/commands/address.js +19 -4
- package/dist/commands/address.js.map +1 -1
- package/dist/commands/balance.d.ts +2 -0
- package/dist/commands/balance.d.ts.map +1 -1
- package/dist/commands/balance.js +58 -12
- package/dist/commands/balance.js.map +1 -1
- package/dist/commands/history.d.ts +2 -0
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +40 -7
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/receive.d.ts +9 -1
- package/dist/commands/receive.d.ts.map +1 -1
- package/dist/commands/receive.js +117 -8
- package/dist/commands/receive.js.map +1 -1
- package/dist/commands/token.d.ts +16 -0
- package/dist/commands/token.d.ts.map +1 -0
- package/dist/commands/token.js +351 -0
- package/dist/commands/token.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/wallet/bch.d.ts +110 -3
- package/dist/wallet/bch.d.ts.map +1 -1
- package/dist/wallet/bch.js +214 -2
- package/dist/wallet/bch.js.map +1 -1
- package/dist/wallet/keys.d.ts +8 -0
- package/dist/wallet/keys.d.ts.map +1 -1
- package/dist/wallet/keys.js +10 -0
- package/dist/wallet/keys.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A command-line interface for the Paytaca [Bitcoin Cash](https://bitcoincash.org) (BCH) wallet. Built with the same core logic as the [Paytaca mobile app](https://github.com/paytaca/paytaca-app), using [watchtower-cash-js](https://github.com/paytaca/watchtower-cash-js) for transaction operations and [libauth](https://github.com/bitauth/libauth) for HD key derivation.
|
|
4
4
|
|
|
5
|
-
Bitcoin Cash is peer-to-peer electronic cash, enabling fast, low-fee transactions for everyday use. Paytaca CLI brings the full capabilities of the Paytaca wallet to the terminal — create wallets, derive addresses, send and receive BCH, and view transaction history, all from the command line.
|
|
5
|
+
Bitcoin Cash is peer-to-peer electronic cash, enabling fast, low-fee transactions for everyday use. Paytaca CLI brings the full capabilities of the Paytaca wallet to the terminal — create wallets, derive addresses, send and receive BCH, manage CashTokens (fungible tokens and NFTs), and view transaction history, all from the command line.
|
|
6
6
|
|
|
7
7
|
Designed to be AI agent-friendly and useful for automation by power users.
|
|
8
8
|
|
|
@@ -38,15 +38,20 @@ paytaca wallet export # Display the stored seed phrase
|
|
|
38
38
|
```bash
|
|
39
39
|
paytaca balance # Show BCH balance (BCH + sats)
|
|
40
40
|
paytaca balance --sats # Show in satoshis only
|
|
41
|
+
paytaca balance --token <category> # Show balance for a specific CashToken
|
|
41
42
|
paytaca balance --chipnet # Query chipnet balance
|
|
42
43
|
```
|
|
43
44
|
|
|
44
45
|
### Receive
|
|
45
46
|
|
|
46
47
|
```bash
|
|
47
|
-
paytaca receive
|
|
48
|
-
paytaca receive 3
|
|
49
|
-
paytaca receive --no-qr
|
|
48
|
+
paytaca receive # Show receiving address with QR code
|
|
49
|
+
paytaca receive --index 3 # Show address at index 3
|
|
50
|
+
paytaca receive --no-qr # Address only, no QR code
|
|
51
|
+
paytaca receive --amount 0.5 # BIP21 URI with BCH amount
|
|
52
|
+
paytaca receive --token # Token-aware z-prefix address
|
|
53
|
+
paytaca receive --token <category> # PayPro URI for a specific token
|
|
54
|
+
paytaca receive --token <category> --amount 100 # PayPro URI with token amount
|
|
50
55
|
```
|
|
51
56
|
|
|
52
57
|
### Send
|
|
@@ -64,6 +69,7 @@ paytaca history # Show recent transactions
|
|
|
64
69
|
paytaca history --sats # Amounts in satoshis
|
|
65
70
|
paytaca history --type incoming # Filter: incoming, outgoing, or all
|
|
66
71
|
paytaca history --page 2 # Pagination
|
|
72
|
+
paytaca history --token <category> # Filter by CashToken category
|
|
67
73
|
```
|
|
68
74
|
|
|
69
75
|
### Address
|
|
@@ -71,8 +77,19 @@ paytaca history --page 2 # Pagination
|
|
|
71
77
|
```bash
|
|
72
78
|
paytaca address derive # Derive address at index 0
|
|
73
79
|
paytaca address derive 5 # Derive address at index 5
|
|
80
|
+
paytaca address derive --token # Derive token-aware z-prefix address
|
|
74
81
|
paytaca address list # List first 5 addresses
|
|
75
82
|
paytaca address list -n 20 # List first 20 addresses
|
|
83
|
+
paytaca address list --token # List token-aware z-prefix addresses
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### CashTokens
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
paytaca token list # List fungible tokens with balances
|
|
90
|
+
paytaca token info <category> # Token metadata, balance, and NFTs
|
|
91
|
+
paytaca token send <address> <amount> --token <cat> # Send fungible tokens
|
|
92
|
+
paytaca token send-nft <address> --token <cat> --commitment <hex> # Send an NFT
|
|
76
93
|
```
|
|
77
94
|
|
|
78
95
|
## Network
|
|
@@ -101,15 +118,16 @@ Powered by [@napi-rs/keyring](https://github.com/Brooooooklyn/keyring-node) (pre
|
|
|
101
118
|
src/
|
|
102
119
|
commands/ CLI command definitions (Commander.js)
|
|
103
120
|
wallet.ts wallet create | import | info | export
|
|
104
|
-
balance.ts balance display
|
|
105
|
-
receive.ts receiving address + QR code
|
|
121
|
+
balance.ts balance display (BCH and CashTokens)
|
|
122
|
+
receive.ts receiving address + QR code + payment URIs
|
|
106
123
|
send.ts BCH sending
|
|
107
|
-
history.ts transaction history
|
|
108
|
-
address.ts HD address derivation
|
|
124
|
+
history.ts transaction history (BCH and CashTokens)
|
|
125
|
+
address.ts HD address derivation (standard and z-prefix)
|
|
126
|
+
token.ts CashToken commands (list, info, send, send-nft)
|
|
109
127
|
wallet/
|
|
110
128
|
index.ts Wallet class, mnemonic gen/import/load
|
|
111
|
-
bch.ts BchWallet (balance, send, history,
|
|
112
|
-
keys.ts LibauthHDWallet (HD key derivation)
|
|
129
|
+
bch.ts BchWallet (balance, send, history, CashTokens)
|
|
130
|
+
keys.ts LibauthHDWallet (HD key derivation, token addresses)
|
|
113
131
|
storage/
|
|
114
132
|
keychain.ts OS keychain wrapper (@napi-rs/keyring)
|
|
115
133
|
utils/
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Derives Bitcoin Cash addresses from the stored seed phrase
|
|
5
5
|
* using the HD path m/44'/145'/0'/0/{index} (receiving)
|
|
6
6
|
* and m/44'/145'/0'/1/{index} (change).
|
|
7
|
+
*
|
|
8
|
+
* Use --token to derive token-aware (z-prefix) addresses for CashTokens.
|
|
7
9
|
*/
|
|
8
10
|
import { Command } from 'commander';
|
|
9
11
|
export declare function registerAddressCommands(program: Command): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src/commands/address.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src/commands/address.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAInC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+F9D"}
|
package/dist/commands/address.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Derives Bitcoin Cash addresses from the stored seed phrase
|
|
5
5
|
* using the HD path m/44'/145'/0'/0/{index} (receiving)
|
|
6
6
|
* and m/44'/145'/0'/1/{index} (change).
|
|
7
|
+
*
|
|
8
|
+
* Use --token to derive token-aware (z-prefix) addresses for CashTokens.
|
|
7
9
|
*/
|
|
8
10
|
import chalk from 'chalk';
|
|
9
11
|
import { loadWallet, loadMnemonic } from '../wallet/index.js';
|
|
@@ -17,8 +19,10 @@ export function registerAddressCommands(program) {
|
|
|
17
19
|
.description('Derive receiving and change addresses at a given index')
|
|
18
20
|
.argument('[index]', 'Address index (default: 0)', '0')
|
|
19
21
|
.option('--chipnet', 'Use chipnet (testnet) instead of mainnet')
|
|
22
|
+
.option('--token', 'Show token-aware (z-prefix) addresses for CashTokens')
|
|
20
23
|
.action((_index, opts) => {
|
|
21
24
|
const isChipnet = Boolean(opts.chipnet);
|
|
25
|
+
const isToken = Boolean(opts.token);
|
|
22
26
|
const index = parseInt(_index, 10);
|
|
23
27
|
if (isNaN(index) || index < 0) {
|
|
24
28
|
console.log(chalk.red('\nError: Index must be a non-negative integer.\n'));
|
|
@@ -32,10 +36,16 @@ export function registerAddressCommands(program) {
|
|
|
32
36
|
const w = loadWallet();
|
|
33
37
|
const bchWallet = w.forNetwork(isChipnet);
|
|
34
38
|
const network = isChipnet ? 'chipnet' : 'mainnet';
|
|
35
|
-
const addressSet =
|
|
36
|
-
|
|
39
|
+
const addressSet = isToken
|
|
40
|
+
? bchWallet.getTokenAddressSetAt(index)
|
|
41
|
+
: bchWallet.getAddressSetAt(index);
|
|
42
|
+
const label = isToken ? 'Token address' : 'Address';
|
|
43
|
+
console.log(chalk.bold(`\n ${label} at index ${index} (${network})\n`));
|
|
37
44
|
console.log(` Receiving: ${addressSet.receiving}`);
|
|
38
45
|
console.log(chalk.dim(` Change: ${addressSet.change}`));
|
|
46
|
+
if (isToken) {
|
|
47
|
+
console.log(chalk.dim(' Type: token-aware (z-prefix)'));
|
|
48
|
+
}
|
|
39
49
|
console.log();
|
|
40
50
|
});
|
|
41
51
|
// ── address list ───────────────────────────────────────────────────────
|
|
@@ -44,8 +54,10 @@ export function registerAddressCommands(program) {
|
|
|
44
54
|
.description('List derived receiving addresses')
|
|
45
55
|
.option('-n, --count <count>', 'Number of addresses to derive', '5')
|
|
46
56
|
.option('--chipnet', 'Use chipnet (testnet) instead of mainnet')
|
|
57
|
+
.option('--token', 'Show token-aware (z-prefix) addresses for CashTokens')
|
|
47
58
|
.action((_opts) => {
|
|
48
59
|
const isChipnet = Boolean(_opts.chipnet);
|
|
60
|
+
const isToken = Boolean(_opts.token);
|
|
49
61
|
const count = parseInt(_opts.count, 10);
|
|
50
62
|
if (isNaN(count) || count < 1) {
|
|
51
63
|
console.log(chalk.red('\nError: Count must be a positive integer.\n'));
|
|
@@ -59,11 +71,14 @@ export function registerAddressCommands(program) {
|
|
|
59
71
|
const w = loadWallet();
|
|
60
72
|
const bchWallet = w.forNetwork(isChipnet);
|
|
61
73
|
const network = isChipnet ? 'chipnet' : 'mainnet';
|
|
62
|
-
|
|
74
|
+
const typeLabel = isToken ? 'Token Addresses' : 'Addresses';
|
|
75
|
+
console.log(chalk.bold(`\n ${typeLabel} (${network})\n`));
|
|
63
76
|
console.log(chalk.dim(` ${'Index'.padEnd(8)}${'Receiving Address'}`));
|
|
64
77
|
console.log(chalk.dim(` ${'─'.repeat(70)}`));
|
|
65
78
|
for (let i = 0; i < count; i++) {
|
|
66
|
-
const addressSet =
|
|
79
|
+
const addressSet = isToken
|
|
80
|
+
? bchWallet.getTokenAddressSetAt(i)
|
|
81
|
+
: bchWallet.getAddressSetAt(i);
|
|
67
82
|
console.log(` ${String(i).padEnd(8)}${addressSet.receiving}`);
|
|
68
83
|
}
|
|
69
84
|
console.log();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src/commands/address.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src/commands/address.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAE7D,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACtD,MAAM,OAAO,GAAG,OAAO;SACpB,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,+BAA+B,CAAC,CAAA;IAE/C,0EAA0E;IAC1E,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,wDAAwD,CAAC;SACrE,QAAQ,CAAC,SAAS,EAAE,4BAA4B,EAAE,GAAG,C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}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Displays the BCH balance for the current wallet.
|
|
5
5
|
* Shows both BCH and satoshi denominations, plus spendable vs total
|
|
6
6
|
* when they differ (e.g. unconfirmed UTXOs).
|
|
7
|
+
*
|
|
8
|
+
* Use --token <category> to display the balance for a specific CashToken.
|
|
7
9
|
*/
|
|
8
10
|
import { Command } from 'commander';
|
|
9
11
|
export declare function registerBalanceCommand(program: Command): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../src/commands/balance.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../src/commands/balance.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAcnC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0H7D"}
|
package/dist/commands/balance.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Displays the BCH balance for the current wallet.
|
|
5
5
|
* Shows both BCH and satoshi denominations, plus spendable vs total
|
|
6
6
|
* when they differ (e.g. unconfirmed UTXOs).
|
|
7
|
+
*
|
|
8
|
+
* Use --token <category> to display the balance for a specific CashToken.
|
|
7
9
|
*/
|
|
8
10
|
import chalk from 'chalk';
|
|
9
11
|
import { loadWallet, loadMnemonic } from '../wallet/index.js';
|
|
@@ -20,11 +22,17 @@ export function registerBalanceCommand(program) {
|
|
|
20
22
|
.command('balance')
|
|
21
23
|
.description('Display wallet balance')
|
|
22
24
|
.option('--chipnet', 'Use chipnet (testnet) instead of mainnet')
|
|
25
|
+
.option('--token <id>', 'Show balance for a specific CashToken category (64-character hex)')
|
|
23
26
|
.option('--sats', 'Display balance in satoshis only')
|
|
24
27
|
.action(async (opts) => {
|
|
25
28
|
const isChipnet = Boolean(opts.chipnet);
|
|
26
29
|
const showSatsOnly = Boolean(opts.sats);
|
|
27
30
|
const network = isChipnet ? 'chipnet' : 'mainnet';
|
|
31
|
+
const tokenId = opts.token || '';
|
|
32
|
+
if (tokenId && !/^[a-fA-F0-9]{64}$/.test(tokenId)) {
|
|
33
|
+
console.log(chalk.red('\nError: Token must be a 64-character hex string.\n'));
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
28
36
|
// ── Validate wallet ──────────────────────────────────────────────
|
|
29
37
|
const data = loadMnemonic();
|
|
30
38
|
if (!data) {
|
|
@@ -33,23 +41,61 @@ export function registerBalanceCommand(program) {
|
|
|
33
41
|
}
|
|
34
42
|
const w = loadWallet();
|
|
35
43
|
const bchWallet = w.forNetwork(isChipnet);
|
|
36
|
-
console.log(chalk.bold(`\n Balance (${network})\n`));
|
|
37
44
|
try {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
if (tokenId) {
|
|
46
|
+
// ── Token balance ────────────────────────────────────────────
|
|
47
|
+
let tokenName = '';
|
|
48
|
+
let tokenSymbol = '';
|
|
49
|
+
let decimals = 0;
|
|
50
|
+
try {
|
|
51
|
+
const info = await bchWallet.getTokenInfo(tokenId);
|
|
52
|
+
if (info) {
|
|
53
|
+
tokenName = info.name !== 'Unknown Token' ? info.name : '';
|
|
54
|
+
tokenSymbol = info.symbol || '';
|
|
55
|
+
decimals = info.decimals || 0;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// Token info unavailable — proceed without metadata
|
|
60
|
+
}
|
|
61
|
+
const label = tokenSymbol || tokenName || 'Token';
|
|
62
|
+
console.log(chalk.bold(`\n ${label} Balance (${network})\n`));
|
|
63
|
+
console.log(chalk.dim(` Category: ${tokenId}`));
|
|
64
|
+
if (tokenName) {
|
|
65
|
+
console.log(chalk.dim(` Name: ${tokenName}`));
|
|
66
|
+
}
|
|
67
|
+
const result = await bchWallet.getTokenBalance(tokenId);
|
|
68
|
+
const displayBalance = decimals > 0
|
|
69
|
+
? (result.balance / 10 ** decimals)
|
|
70
|
+
: result.balance;
|
|
71
|
+
const displaySpendable = decimals > 0
|
|
72
|
+
? (result.spendable / 10 ** decimals)
|
|
73
|
+
: result.spendable;
|
|
74
|
+
const unit = tokenSymbol || 'tokens';
|
|
75
|
+
console.log(` Balance: ${displayBalance} ${unit}`);
|
|
43
76
|
if (result.spendable !== result.balance) {
|
|
44
|
-
console.log(chalk.dim(` Spendable: ${
|
|
77
|
+
console.log(chalk.dim(` Spendable: ${displaySpendable} ${unit}`));
|
|
45
78
|
}
|
|
46
79
|
}
|
|
47
80
|
else {
|
|
48
|
-
|
|
49
|
-
console.log(chalk.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
81
|
+
// ── BCH balance ──────────────────────────────────────────────
|
|
82
|
+
console.log(chalk.bold(`\n Balance (${network})\n`));
|
|
83
|
+
const result = await bchWallet.getBalance();
|
|
84
|
+
const balanceSats = bchToSats(result.balance);
|
|
85
|
+
const spendableSats = bchToSats(result.spendable);
|
|
86
|
+
if (showSatsOnly) {
|
|
87
|
+
console.log(` Balance: ${formatSats(balanceSats)} sats`);
|
|
88
|
+
if (result.spendable !== result.balance) {
|
|
89
|
+
console.log(chalk.dim(` Spendable: ${formatSats(spendableSats)} sats`));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
console.log(` Balance: ${result.balance} BCH`);
|
|
94
|
+
console.log(chalk.dim(` ${formatSats(balanceSats)} sats`));
|
|
95
|
+
if (result.spendable !== result.balance) {
|
|
96
|
+
console.log(` Spendable: ${result.spendable} BCH`);
|
|
97
|
+
console.log(chalk.dim(` ${formatSats(spendableSats)} sats`));
|
|
98
|
+
}
|
|
53
99
|
}
|
|
54
100
|
}
|
|
55
101
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balance.js","sourceRoot":"","sources":["../../src/commands/balance.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{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O,CAAC,GAAG,EAAE,CAAA;IACf,CAAC,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Displays transaction history for the current wallet.
|
|
5
5
|
* Fetches paginated records from the Watchtower API, showing
|
|
6
6
|
* direction (incoming/outgoing), amount, date, and txid.
|
|
7
|
+
*
|
|
8
|
+
* Use --token to filter history for a specific CashToken.
|
|
7
9
|
*/
|
|
8
10
|
import { Command } from 'commander';
|
|
9
11
|
export declare function registerHistoryCommand(program: Command): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/commands/history.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/commands/history.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AA6BnC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqJ7D"}
|
package/dist/commands/history.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Displays transaction history for the current wallet.
|
|
5
5
|
* Fetches paginated records from the Watchtower API, showing
|
|
6
6
|
* direction (incoming/outgoing), amount, date, and txid.
|
|
7
|
+
*
|
|
8
|
+
* Use --token to filter history for a specific CashToken.
|
|
7
9
|
*/
|
|
8
10
|
import chalk from 'chalk';
|
|
9
11
|
import { loadWallet, loadMnemonic } from '../wallet/index.js';
|
|
@@ -38,6 +40,7 @@ export function registerHistoryCommand(program) {
|
|
|
38
40
|
.option('--chipnet', 'Use chipnet (testnet) instead of mainnet')
|
|
39
41
|
.option('--page <page>', 'Page number (default: 1)', '1')
|
|
40
42
|
.option('--type <type>', 'Filter by type: all, incoming, outgoing (default: all)', 'all')
|
|
43
|
+
.option('--token <id>', 'Filter by CashToken category ID (64-character hex)')
|
|
41
44
|
.option('--sats', 'Display amounts in satoshis')
|
|
42
45
|
.action(async (opts) => {
|
|
43
46
|
const isChipnet = Boolean(opts.chipnet);
|
|
@@ -45,6 +48,7 @@ export function registerHistoryCommand(program) {
|
|
|
45
48
|
const network = isChipnet ? 'chipnet' : 'mainnet';
|
|
46
49
|
const page = parseInt(opts.page, 10);
|
|
47
50
|
const recordType = opts.type;
|
|
51
|
+
const tokenId = opts.token || '';
|
|
48
52
|
if (isNaN(page) || page < 1) {
|
|
49
53
|
console.log(chalk.red('\nError: Page must be a positive integer.\n'));
|
|
50
54
|
process.exit(1);
|
|
@@ -53,6 +57,10 @@ export function registerHistoryCommand(program) {
|
|
|
53
57
|
console.log(chalk.red('\nError: Type must be "all", "incoming", or "outgoing".\n'));
|
|
54
58
|
process.exit(1);
|
|
55
59
|
}
|
|
60
|
+
if (tokenId && !/^[a-fA-F0-9]{64}$/.test(tokenId)) {
|
|
61
|
+
console.log(chalk.red('\nError: Token must be a 64-character hex string.\n'));
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
56
64
|
// ── Validate wallet ──────────────────────────────────────────────
|
|
57
65
|
const data = loadMnemonic();
|
|
58
66
|
if (!data) {
|
|
@@ -61,14 +69,35 @@ export function registerHistoryCommand(program) {
|
|
|
61
69
|
}
|
|
62
70
|
const w = loadWallet();
|
|
63
71
|
const bchWallet = w.forNetwork(isChipnet);
|
|
64
|
-
|
|
72
|
+
// Resolve token label for header
|
|
73
|
+
let headerLabel = 'Transaction History';
|
|
74
|
+
if (tokenId) {
|
|
75
|
+
try {
|
|
76
|
+
const info = await bchWallet.getTokenInfo(tokenId);
|
|
77
|
+
if (info?.symbol) {
|
|
78
|
+
headerLabel = `${info.symbol} Transaction History`;
|
|
79
|
+
}
|
|
80
|
+
else if (info?.name && info.name !== 'Unknown Token') {
|
|
81
|
+
headerLabel = `${info.name} Transaction History`;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
headerLabel = `Token Transaction History`;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
headerLabel = 'Token Transaction History';
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
console.log(chalk.bold(`\n ${headerLabel} (${network})\n`));
|
|
92
|
+
if (tokenId) {
|
|
93
|
+
console.log(chalk.dim(` Category: ${tokenId}\n`));
|
|
94
|
+
}
|
|
65
95
|
try {
|
|
66
|
-
const result = await bchWallet.getHistory({ page, recordType });
|
|
96
|
+
const result = await bchWallet.getHistory({ page, recordType, tokenId });
|
|
67
97
|
if (!result.history || result.history.length === 0) {
|
|
68
98
|
console.log(chalk.dim(' No transactions found.\n'));
|
|
69
99
|
return;
|
|
70
100
|
}
|
|
71
|
-
// ── Table header ───────────────────────────────────────────────
|
|
72
101
|
const explorer = isChipnet
|
|
73
102
|
? 'https://chipnet.chaingraph.cash/tx/'
|
|
74
103
|
: 'https://bchexplorer.info/tx/';
|
|
@@ -77,9 +106,12 @@ export function registerHistoryCommand(program) {
|
|
|
77
106
|
const arrow = isIncoming
|
|
78
107
|
? chalk.green(' IN')
|
|
79
108
|
: chalk.red(' OUT');
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
109
|
+
// When filtering by token, the amount is the token amount (not BCH)
|
|
110
|
+
const amount = tokenId
|
|
111
|
+
? `${tx.amount}`
|
|
112
|
+
: showSats
|
|
113
|
+
? `${bchToSats(tx.amount).toLocaleString('en-US')} sats`
|
|
114
|
+
: `${tx.amount} BCH`;
|
|
83
115
|
const amountColored = isIncoming
|
|
84
116
|
? chalk.green(`+${amount}`)
|
|
85
117
|
: chalk.red(`-${amount}`);
|
|
@@ -92,9 +124,10 @@ export function registerHistoryCommand(program) {
|
|
|
92
124
|
}
|
|
93
125
|
// ── Pagination info ────────────────────────────────────────────
|
|
94
126
|
const pageNum = parseInt(result.page, 10) || page;
|
|
127
|
+
const tokenFlag = tokenId ? ` --token ${tokenId}` : '';
|
|
95
128
|
console.log(chalk.dim(` Page ${pageNum} of ${result.num_pages}` +
|
|
96
129
|
(result.has_next
|
|
97
|
-
? ` — next: paytaca history --page ${pageNum + 1}${isChipnet ? ' --chipnet' : ''}`
|
|
130
|
+
? ` — next: paytaca history --page ${pageNum + 1}${tokenFlag}${isChipnet ? ' --chipnet' : ''}`
|
|
98
131
|
: '')));
|
|
99
132
|
}
|
|
100
133
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/commands/history.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/commands/history.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAE7D,yDAAyD;AACzD,SAAS,SAAS,CAAC,GAAW;IAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,CAAA;AAC9B,CAAC;AAED,6DAA6D;AAC7D,SAAS,UAAU,CAAC,OAAe;IACjC,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAA;IAC3B,IAAI,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAAE,OAAO,OAAO,CAAA;IACtC,OAAO,CAAC,CAAC,cAAc,CAAC,OAAO,EAAE;QAC/B,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;QACd,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,KAAK;KACd,CAAC,CAAA;AACJ,CAAC;AAED,kCAAkC;AAClC,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE;QAAE,OAAO,IAAI,CAAA;IAClC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAA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AAG,EAAE,QAAQ,EAAE,MAAM,CAAA;YACpC,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;gBACnB,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,MAAM,CACV,+DAA+D,CAChE,CACF,CAAA;gBACD,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,GAAG,CACP,wEAAwE,CACzE,CACF,CAAA;YACH,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,GAAG,CAAC,8BAA8B,GAAG,CAAC,OAAO,IAAI,GAAG,EAAE,CAAC,CAC9D,CAAA;gBACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACjB,CAAC;QACH,CAAC;QAED,OAAO,CAAC,GAAG,EAAE,CAAA;IACf,CAAC,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CLI command: receive
|
|
3
3
|
*
|
|
4
|
-
* Displays a receiving address and its QR code for accepting BCH payments.
|
|
4
|
+
* Displays a receiving address and its QR code for accepting BCH or CashToken payments.
|
|
5
5
|
* The QR code encodes the address in CashAddr format, rendered directly
|
|
6
6
|
* in the terminal using Unicode block characters.
|
|
7
|
+
*
|
|
8
|
+
* Use --token to display a token-aware (z-prefix) address for receiving CashTokens.
|
|
9
|
+
* Optionally pass a category ID to generate a PayPro payment URI:
|
|
10
|
+
* --token <category> → bitcoincash:<z-address>?c=<category>
|
|
11
|
+
*
|
|
12
|
+
* Use --amount to embed a requested amount into the URI:
|
|
13
|
+
* BCH: bitcoincash:<address>?amount=<bch> (BIP21)
|
|
14
|
+
* Token: bitcoincash:<z-address>?c=<cat>&f=<base_units> (PayPro)
|
|
7
15
|
*/
|
|
8
16
|
import { Command } from 'commander';
|
|
9
17
|
export declare function registerReceiveCommand(program: Command): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"receive.d.ts","sourceRoot":"","sources":["../../src/commands/receive.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"receive.d.ts","sourceRoot":"","sources":["../../src/commands/receive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAwCnC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA4I7D"}
|