paytaca-cli 0.4.1 → 0.5.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 +5 -3
- package/dist/commands/swap.d.ts +19 -0
- package/dist/commands/swap.d.ts.map +1 -0
- package/dist/commands/swap.js +129 -0
- package/dist/commands/swap.js.map +1 -0
- package/dist/commands/token.d.ts.map +1 -1
- package/dist/commands/token.js +140 -1
- package/dist/commands/token.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/nostr/store.test.js +12 -4
- package/dist/nostr/store.test.js.map +1 -1
- package/dist/utils/prices.d.ts +46 -0
- package/dist/utils/prices.d.ts.map +1 -0
- package/dist/utils/prices.js +93 -0
- package/dist/utils/prices.js.map +1 -0
- package/dist/utils/prices.test.d.ts +5 -0
- package/dist/utils/prices.test.d.ts.map +1 -0
- package/dist/utils/prices.test.js +62 -0
- package/dist/utils/prices.test.js.map +1 -0
- package/dist/wallet/bch.d.ts +14 -0
- package/dist/wallet/bch.d.ts.map +1 -1
- package/dist/wallet/bch.js +24 -0
- package/dist/wallet/bch.js.map +1 -1
- package/dist/wallet/cauldron/api.d.ts +58 -0
- package/dist/wallet/cauldron/api.d.ts.map +1 -0
- package/dist/wallet/cauldron/api.js +60 -0
- package/dist/wallet/cauldron/api.js.map +1 -0
- package/dist/wallet/cauldron/pools.d.ts +66 -0
- package/dist/wallet/cauldron/pools.d.ts.map +1 -0
- package/dist/wallet/cauldron/pools.js +96 -0
- package/dist/wallet/cauldron/pools.js.map +1 -0
- package/dist/wallet/cauldron/pools.test.d.ts +3 -0
- package/dist/wallet/cauldron/pools.test.d.ts.map +1 -0
- package/dist/wallet/cauldron/pools.test.js +149 -0
- package/dist/wallet/cauldron/pools.test.js.map +1 -0
- package/dist/wallet/cauldron/swap.d.ts +69 -0
- package/dist/wallet/cauldron/swap.d.ts.map +1 -0
- package/dist/wallet/cauldron/swap.js +173 -0
- package/dist/wallet/cauldron/swap.js.map +1 -0
- package/dist/wallet/cauldron/transact.d.ts +98 -0
- package/dist/wallet/cauldron/transact.d.ts.map +1 -0
- package/dist/wallet/cauldron/transact.js +307 -0
- package/dist/wallet/cauldron/transact.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cauldron trade transaction building.
|
|
3
|
+
*
|
|
4
|
+
* Adapted from: paytaca-app/src/wallet/cauldron/transact.js.
|
|
5
|
+
*
|
|
6
|
+
* Uses @cashlab/cauldron's ExchangeLab to construct a best-rate trade across
|
|
7
|
+
* the active pools, then createInputAndOutput() selects the wallet coins and
|
|
8
|
+
* payout rules needed to fund and settle it. The final signed transaction is
|
|
9
|
+
* produced by ExchangeLab.createTradeTx() (libauth templates).
|
|
10
|
+
*/
|
|
11
|
+
import { ExchangeLab, buildPoolV0UnlockingBytecode, } from '@cashlab/cauldron';
|
|
12
|
+
import { NATIVE_BCH_TOKEN_ID, PayoutAmountRuleType, SpendableCoinType, } from '@cashlab/common';
|
|
13
|
+
import { bigIntToCompactUint, cashAddressToLockingBytecode, compactUintPrefixToLength, decodePrivateKeyWif, hexToBin, privateKeyToP2pkhLockingBytecode, } from '@cashlab/common/libauth.js';
|
|
14
|
+
import { poolTradeToOutput } from './pools.js';
|
|
15
|
+
const PLACEHOLDER_TOKEN_ID_FOR_SIZE_CALC = Array.from({ length: 64 })
|
|
16
|
+
.fill('0')
|
|
17
|
+
.join('');
|
|
18
|
+
/** Estimated on-chain size of a P2PKH input (Schnorr signature). */
|
|
19
|
+
const P2PKH_INPUT_SIZE = 141n;
|
|
20
|
+
/**
|
|
21
|
+
* Attempt a best-rate trade across the given pools.
|
|
22
|
+
*
|
|
23
|
+
* - Selling token → BCH: pass `supply` (token amount in base units).
|
|
24
|
+
* - Buying token with BCH: pass `demand` (token amount in base units to receive).
|
|
25
|
+
*/
|
|
26
|
+
export function attemptTrade(opts) {
|
|
27
|
+
const exlab = opts.exlab ?? new ExchangeLab();
|
|
28
|
+
const { pools, isBuyingToken, supply, demand } = opts;
|
|
29
|
+
const txFeePerByte = opts.txFeePerByte || 1n;
|
|
30
|
+
if (pools.length === 0)
|
|
31
|
+
throw new Error('No pools provided');
|
|
32
|
+
let supplyTokenId = pools[0].output.token.token_id;
|
|
33
|
+
let demandTokenId = NATIVE_BCH_TOKEN_ID;
|
|
34
|
+
if (isBuyingToken) {
|
|
35
|
+
supplyTokenId = NATIVE_BCH_TOKEN_ID;
|
|
36
|
+
demandTokenId = pools[0].output.token.token_id;
|
|
37
|
+
}
|
|
38
|
+
if (demand) {
|
|
39
|
+
return exlab.constructTradeBestRateForTargetDemand(supplyTokenId, demandTokenId, demand, pools, txFeePerByte);
|
|
40
|
+
}
|
|
41
|
+
return exlab.constructTradeBestRateForTargetSupply(supplyTokenId, demandTokenId, supply, pools, txFeePerByte);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Select the wallet coins and payout rules needed to fund + settle a trade.
|
|
45
|
+
* Mirrors paytaca-app createInputAndOutput().
|
|
46
|
+
*/
|
|
47
|
+
export function createInputAndOutput(opts) {
|
|
48
|
+
const { tradeResult, spendableCoins, platformFee } = opts;
|
|
49
|
+
const tokenOutputSats = opts.tokenOutputSats ?? 1000n;
|
|
50
|
+
if (spendableCoins.length === 0) {
|
|
51
|
+
throw new Error('No UTXOs available to fund the trade');
|
|
52
|
+
}
|
|
53
|
+
const privateKey = spendableCoins[0].key;
|
|
54
|
+
const lockingBytecode = privateKeyToP2pkhLockingBytecode({
|
|
55
|
+
privateKey,
|
|
56
|
+
throwErrors: true,
|
|
57
|
+
});
|
|
58
|
+
const tokenCoins = spendableCoins.filter((coin) => coin.output?.token);
|
|
59
|
+
const bchCoins = spendableCoins.filter((coin) => !coin.output.token);
|
|
60
|
+
const isBuyingToken = tradeResult.entries[0].supply_token_id === NATIVE_BCH_TOKEN_ID;
|
|
61
|
+
const entriesSizes = getEntriesSize(tradeResult);
|
|
62
|
+
const totalPoolTxFee = BigInt(entriesSizes.inputFees + entriesSizes.outputFees);
|
|
63
|
+
let tokensToSupply = !isBuyingToken ? tradeResult.summary.supply : 0n;
|
|
64
|
+
let satoshisToSupply = isBuyingToken ? tradeResult.summary.supply : 0n;
|
|
65
|
+
satoshisToSupply += totalPoolTxFee;
|
|
66
|
+
if (platformFee) {
|
|
67
|
+
satoshisToSupply += platformFee.amount;
|
|
68
|
+
satoshisToSupply += BigInt(getOutputSize(platformFee));
|
|
69
|
+
}
|
|
70
|
+
const inputCoins = [];
|
|
71
|
+
const payouts = [];
|
|
72
|
+
let remainingTokens = 0n;
|
|
73
|
+
if (!isBuyingToken) {
|
|
74
|
+
// Selling tokens: consume token UTXOs until we've covered the supply
|
|
75
|
+
remainingTokens = tokensToSupply;
|
|
76
|
+
for (const spendableCoin of tokenCoins) {
|
|
77
|
+
if (remainingTokens <= 0n)
|
|
78
|
+
break;
|
|
79
|
+
inputCoins.push(spendableCoin);
|
|
80
|
+
remainingTokens -= spendableCoin.output.token.amount;
|
|
81
|
+
satoshisToSupply += P2PKH_INPUT_SIZE;
|
|
82
|
+
satoshisToSupply -= spendableCoin.output.amount;
|
|
83
|
+
}
|
|
84
|
+
if (remainingTokens > 0n) {
|
|
85
|
+
throw new Error('Insufficient tokens to fund the trade');
|
|
86
|
+
}
|
|
87
|
+
// Excess tokens supplied → a token change output (counted in size calc)
|
|
88
|
+
if (remainingTokens < 0n) {
|
|
89
|
+
const changeTokenOutput = {
|
|
90
|
+
to: lockingBytecode,
|
|
91
|
+
amount: tokenOutputSats,
|
|
92
|
+
token: {
|
|
93
|
+
category: PLACEHOLDER_TOKEN_ID_FOR_SIZE_CALC,
|
|
94
|
+
amount: remainingTokens * -1n,
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
satoshisToSupply += changeTokenOutput.amount;
|
|
98
|
+
satoshisToSupply += BigInt(getOutputSize(changeTokenOutput));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
// Buying tokens: fixed payout for the received token amount
|
|
103
|
+
payouts.push({
|
|
104
|
+
type: PayoutAmountRuleType.FIXED,
|
|
105
|
+
locking_bytecode: lockingBytecode,
|
|
106
|
+
amount: tokenOutputSats,
|
|
107
|
+
token: {
|
|
108
|
+
token_id: tradeResult.entries[0].demand_token_id,
|
|
109
|
+
amount: tradeResult.summary.demand,
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
const outputSize = getOutputSize({
|
|
113
|
+
to: lockingBytecode,
|
|
114
|
+
amount: tokenOutputSats,
|
|
115
|
+
token: {
|
|
116
|
+
category: tradeResult.entries[0].demand_token_id,
|
|
117
|
+
amount: tradeResult.summary.demand,
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
satoshisToSupply += tokenOutputSats + BigInt(outputSize);
|
|
121
|
+
}
|
|
122
|
+
if (platformFee) {
|
|
123
|
+
const decoded = cashAddressToLockingBytecode(platformFee.to);
|
|
124
|
+
if (!decoded || typeof decoded === 'string' || !decoded.bytecode) {
|
|
125
|
+
throw new Error(`Invalid platform fee address: ${platformFee.to}`);
|
|
126
|
+
}
|
|
127
|
+
payouts.push({
|
|
128
|
+
type: PayoutAmountRuleType.FIXED,
|
|
129
|
+
locking_bytecode: decoded.bytecode,
|
|
130
|
+
amount: platformFee.amount,
|
|
131
|
+
});
|
|
132
|
+
satoshisToSupply += platformFee.amount + BigInt(getOutputSize(platformFee));
|
|
133
|
+
}
|
|
134
|
+
// Base tx overhead (version + locktime) and varint prefixes for inputs/outputs
|
|
135
|
+
satoshisToSupply += 8n;
|
|
136
|
+
const inputSizePrefixLength = compactUintPrefixToLength(bigIntToCompactUint(BigInt(tradeResult.entries.length + inputCoins.length))[0]);
|
|
137
|
+
const outputSizePrefixLength = compactUintPrefixToLength(bigIntToCompactUint(BigInt(tradeResult.entries.length + payouts.length))[0]);
|
|
138
|
+
satoshisToSupply += BigInt(inputSizePrefixLength) + BigInt(outputSizePrefixLength);
|
|
139
|
+
// Cover the remainder with BCH inputs
|
|
140
|
+
let remainingSats = satoshisToSupply;
|
|
141
|
+
for (const spendableCoin of bchCoins) {
|
|
142
|
+
if (remainingSats <= 0n)
|
|
143
|
+
break;
|
|
144
|
+
inputCoins.push(spendableCoin);
|
|
145
|
+
remainingSats -= spendableCoin.output.amount;
|
|
146
|
+
remainingSats += P2PKH_INPUT_SIZE;
|
|
147
|
+
}
|
|
148
|
+
if (remainingSats > 0n) {
|
|
149
|
+
throw new Error('Insufficient BCH to fund the trade and transaction fees');
|
|
150
|
+
}
|
|
151
|
+
payouts.push({
|
|
152
|
+
type: PayoutAmountRuleType.CHANGE,
|
|
153
|
+
locking_bytecode: lockingBytecode,
|
|
154
|
+
allow_mixing_native_and_token: false,
|
|
155
|
+
allow_mixing_native_and_token_when_bch_change_is_dust: false,
|
|
156
|
+
add_change_to_txfee_when_bch_change_is_dust: true,
|
|
157
|
+
});
|
|
158
|
+
return { inputCoins, payouts };
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Sum the on-chain byte sizes of the pool inputs and outputs for a trade.
|
|
162
|
+
*/
|
|
163
|
+
export function getEntriesSize(tradeResult) {
|
|
164
|
+
const inputFees = tradeResult.entries
|
|
165
|
+
.map((entry) => buildPoolV0UnlockingBytecode(entry.pool.parameters))
|
|
166
|
+
.map((unlockingBytecode) => getInputSize(unlockingBytecode))
|
|
167
|
+
.reduce((subtotal, size) => subtotal + size, 0);
|
|
168
|
+
const outputFees = tradeResult.entries
|
|
169
|
+
.map((entry) => {
|
|
170
|
+
const output = poolTradeToOutput(entry);
|
|
171
|
+
return getOutputSize(output);
|
|
172
|
+
})
|
|
173
|
+
.reduce((subtotal, size) => subtotal + size, 0);
|
|
174
|
+
return { inputFees, outputFees };
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Build a signed transaction for a trade using test coins, then optionally
|
|
178
|
+
* verify it. Used to validate a trade before broadcasting.
|
|
179
|
+
*/
|
|
180
|
+
export function testTradeResult(opts) {
|
|
181
|
+
const exlab = opts.exlab ?? new ExchangeLab();
|
|
182
|
+
const { tradeResult } = opts;
|
|
183
|
+
const firstEntry = tradeResult.entries[0];
|
|
184
|
+
const isSupplyBch = firstEntry.supply_token_id === NATIVE_BCH_TOKEN_ID;
|
|
185
|
+
const tokenId = isSupplyBch ? firstEntry.demand_token_id : firstEntry.supply_token_id;
|
|
186
|
+
const key = new Uint8Array(32).fill(0x11);
|
|
187
|
+
const locking_bytecode = privateKeyToP2pkhLockingBytecode({
|
|
188
|
+
privateKey: key,
|
|
189
|
+
throwErrors: true,
|
|
190
|
+
});
|
|
191
|
+
const tokenAmount = isSupplyBch ? 0n : (tradeResult.summary.supply * 3n) / 2n;
|
|
192
|
+
const satsAmount = (isSupplyBch ? tradeResult.summary.supply : 0n) +
|
|
193
|
+
tradeResult.summary.trade_fee +
|
|
194
|
+
100000n;
|
|
195
|
+
const coins = [
|
|
196
|
+
{
|
|
197
|
+
type: SpendableCoinType.P2PKH,
|
|
198
|
+
key,
|
|
199
|
+
outpoint: { txhash: new Uint8Array(32).fill(0x22), index: 1 },
|
|
200
|
+
output: { locking_bytecode, amount: satsAmount },
|
|
201
|
+
},
|
|
202
|
+
];
|
|
203
|
+
if (tokenAmount) {
|
|
204
|
+
coins.push({
|
|
205
|
+
type: SpendableCoinType.P2PKH,
|
|
206
|
+
key,
|
|
207
|
+
outpoint: { txhash: new Uint8Array(32).fill(0x33), index: 1 },
|
|
208
|
+
output: {
|
|
209
|
+
locking_bytecode,
|
|
210
|
+
amount: 1000n,
|
|
211
|
+
token: { token_id: tokenId, amount: tokenAmount },
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
const payoutRules = [];
|
|
216
|
+
if (isSupplyBch) {
|
|
217
|
+
payoutRules.push({
|
|
218
|
+
type: PayoutAmountRuleType.FIXED,
|
|
219
|
+
locking_bytecode,
|
|
220
|
+
amount: 1000n,
|
|
221
|
+
token: { token_id: tokenId, amount: tradeResult.summary.demand },
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
payoutRules.push({
|
|
225
|
+
type: PayoutAmountRuleType.CHANGE,
|
|
226
|
+
locking_bytecode,
|
|
227
|
+
allow_mixing_native_and_token: false,
|
|
228
|
+
allow_mixing_native_and_token_when_bch_change_is_dust: false,
|
|
229
|
+
add_change_to_txfee_when_bch_change_is_dust: true,
|
|
230
|
+
});
|
|
231
|
+
const tradeTx = exlab.createTradeTx(tradeResult.entries, coins, payoutRules, null, 1n);
|
|
232
|
+
if (opts.verify)
|
|
233
|
+
exlab.verifyTradeTx(tradeTx);
|
|
234
|
+
return tradeTx;
|
|
235
|
+
}
|
|
236
|
+
export function watchtowerUtxosToSpendableCoins(opts) {
|
|
237
|
+
const { utxos, wallet } = opts;
|
|
238
|
+
const addressPathPrivkeyMap = new Map();
|
|
239
|
+
return utxos.map((utxo) => {
|
|
240
|
+
let privateKey = addressPathPrivkeyMap.get(utxo.address_path);
|
|
241
|
+
if (!privateKey) {
|
|
242
|
+
const wif = wallet.getPrivateKeyWifAt(utxo.address_path);
|
|
243
|
+
const decodedWif = decodePrivateKeyWif(wif);
|
|
244
|
+
if (typeof decodedWif === 'string')
|
|
245
|
+
throw new Error(decodedWif);
|
|
246
|
+
privateKey = decodedWif.privateKey;
|
|
247
|
+
addressPathPrivkeyMap.set(utxo.address_path, privateKey);
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
type: SpendableCoinType.P2PKH,
|
|
251
|
+
key: privateKey,
|
|
252
|
+
outpoint: { txhash: hexToBin(utxo.txid), index: utxo.vout },
|
|
253
|
+
output: {
|
|
254
|
+
locking_bytecode: privateKeyToP2pkhLockingBytecode({
|
|
255
|
+
privateKey,
|
|
256
|
+
throwErrors: true,
|
|
257
|
+
}),
|
|
258
|
+
amount: BigInt(utxo.value),
|
|
259
|
+
token: !utxo.is_cashtoken
|
|
260
|
+
? undefined
|
|
261
|
+
: {
|
|
262
|
+
token_id: utxo.tokenid,
|
|
263
|
+
amount: BigInt(utxo.amount ?? 0),
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* On-chain byte size of a transaction input for a given unlocking script.
|
|
271
|
+
* Mirrors cashscript getInputSize().
|
|
272
|
+
*/
|
|
273
|
+
export function getInputSize(inputScript) {
|
|
274
|
+
const scriptSize = inputScript.length;
|
|
275
|
+
const prefixSize = scriptSize > 252 ? 3 : 1;
|
|
276
|
+
return 32 + 4 + prefixSize + scriptSize + 4;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* On-chain byte size of a transaction output.
|
|
280
|
+
* Mirrors cashscript getOutputSize() (string `to` is treated as a CashAddress).
|
|
281
|
+
*/
|
|
282
|
+
export function getOutputSize(output) {
|
|
283
|
+
let lockingBytecode;
|
|
284
|
+
if (typeof output.to === 'string') {
|
|
285
|
+
const decoded = cashAddressToLockingBytecode(output.to);
|
|
286
|
+
if (typeof decoded === 'string') {
|
|
287
|
+
throw new Error(`Invalid CashAddress: ${decoded}`);
|
|
288
|
+
}
|
|
289
|
+
lockingBytecode = decoded?.bytecode;
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
lockingBytecode = output.to;
|
|
293
|
+
}
|
|
294
|
+
if (!lockingBytecode) {
|
|
295
|
+
throw new Error('Invalid locking bytecode for output size calculation');
|
|
296
|
+
}
|
|
297
|
+
let size = 8 +
|
|
298
|
+
compactUintPrefixToLength(bigIntToCompactUint(BigInt(lockingBytecode.length))[0]) +
|
|
299
|
+
lockingBytecode.length;
|
|
300
|
+
if (output.token) {
|
|
301
|
+
size +=
|
|
302
|
+
34 +
|
|
303
|
+
compactUintPrefixToLength(bigIntToCompactUint(BigInt(output.token.amount))[0]);
|
|
304
|
+
}
|
|
305
|
+
return size;
|
|
306
|
+
}
|
|
307
|
+
//# sourceMappingURL=transact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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,OAAO,EAAE,CAAC,CAAA;QACpD,CAAC;QACD,eAAe,GAAG,OAAO,EAAE,QAAQ,CAAA;IACrC,CAAC;SAAM,CAAC;QACN,eAAe,GAAG,MAAM,CAAC,EAAE,CAAA;IAC7B,CAAC;IACD,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACzE,CAAC;IAED,IAAI,IAAI,GACN,CAAC;QACD,yBAAyB,CACvB,mBAAmB,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAE,CACxD;QACD,eAAe,CAAC,MAAM,CAAA;IAExB,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,IAAI;YACF,EAAE;gBACF,yBAAyB,CACvB,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAE,CACrD,CAAA;IACL,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paytaca-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Command-line interface for the Paytaca Bitcoin Cash wallet",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -41,12 +41,13 @@
|
|
|
41
41
|
"license": "SEE LICENSE IN LICENSE",
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@bitauth/libauth": "2.0.0-alpha.8",
|
|
44
|
+
"@cashlab/cauldron": "^1.0.3",
|
|
44
45
|
"@napi-rs/keyring": "^1.2.0",
|
|
45
46
|
"bip39": "^3.1.0",
|
|
46
47
|
"chalk": "^5.4.1",
|
|
47
48
|
"commander": "^12.1.0",
|
|
48
|
-
"nostr-tools": "^2.23.3",
|
|
49
49
|
"js-sha256": "^0.9.0",
|
|
50
|
+
"nostr-tools": "^2.23.3",
|
|
50
51
|
"qrcode-terminal": "^0.12.0",
|
|
51
52
|
"watchtower-cash-js": "^0.2.4"
|
|
52
53
|
},
|