gitmark 0.0.73 → 0.0.74

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/bin/git-mark.js CHANGED
@@ -335,6 +335,8 @@ async function cmdInit(args) {
335
335
  const newTxid = await broadcastTx(rawTx, explorer);
336
336
 
337
337
  savePrivateState({ txid: newTxid, vout: 0, amount: outputAmount }, chain);
338
+ const xonly = pubkey.slice(2); // 64-char x-only Nostr pubkey
339
+ trail['@id'] = `txo:${chain}:${newTxid}:0?amount=${outputAmount}&pubkey=${xonly}`;
338
340
  console.log(`Funded: ${outputAmount} sats (txid: ${newTxid})`);
339
341
  }
340
342
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitmark",
3
- "version": "0.0.73",
3
+ "version": "0.0.74",
4
4
  "type": "module",
5
5
  "description": "Anchor git commits to Bitcoin via blocktrails",
6
6
  "main": "bin/git-mark.js",
@@ -189,6 +189,19 @@ describe('Trail format', () => {
189
189
  assert.strictEqual(trail.states.length, trail.txo.length);
190
190
  });
191
191
 
192
+ it('@id is valid txo URI with amount and 64-char x-only pubkey', () => {
193
+ const privkey = secp256k1.utils.randomPrivateKey();
194
+ const pubkey = bytesToHex(secp256k1.getPublicKey(privkey, true));
195
+ const xonly = pubkey.slice(2);
196
+ const txid = 'a'.repeat(64);
197
+ const id = `txo:tbtc4:${txid}:0?amount=14968&pubkey=${xonly}`;
198
+ const parsed = parseTxoUri(id);
199
+ assert.strictEqual(parsed.chain, 'tbtc4');
200
+ assert.strictEqual(parsed.txid, txid);
201
+ assert.strictEqual(parsed.amount, 14968);
202
+ assert.strictEqual(xonly.length, 64);
203
+ });
204
+
192
205
  it('txo URIs include amount and commit params', () => {
193
206
  const txoUri = 'txo:tbtc4:abc123:0?amount=9700&commit=deadbeef';
194
207
  const parsed = parseTxoUri(txoUri);