@1sat/actions 0.0.44 → 0.0.46
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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/locks/index.js +1 -1
- package/dist/locks/index.js.map +1 -1
- package/dist/opns/index.d.ts +4 -4
- package/dist/opns/index.d.ts.map +1 -1
- package/dist/opns/index.js +8 -25
- package/dist/opns/index.js.map +1 -1
- package/dist/payments/index.d.ts.map +1 -1
- package/dist/payments/index.js +3 -2
- package/dist/payments/index.js.map +1 -1
- package/dist/sweep/index.js +2 -2
- package/dist/sweep/index.js.map +1 -1
- package/dist/sync/index.d.ts +4 -1
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +28 -229
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/syncMessages.d.ts +20 -0
- package/dist/sync/syncMessages.d.ts.map +1 -0
- package/dist/sync/syncMessages.js +94 -0
- package/dist/sync/syncMessages.js.map +1 -0
- package/dist/utils/internalizeBeef.d.ts +45 -0
- package/dist/utils/internalizeBeef.d.ts.map +1 -0
- package/dist/utils/internalizeBeef.js +252 -0
- package/dist/utils/internalizeBeef.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared BEEF internalization pipeline.
|
|
3
|
+
*
|
|
4
|
+
* Takes raw BEEF bytes, parses the transaction with indexers to determine
|
|
5
|
+
* basket/tags/protocol, builds InternalizeOutput entries, and calls
|
|
6
|
+
* wallet.internalizeAction().
|
|
7
|
+
*
|
|
8
|
+
* Used by both address sync (external deposits) and message box sync (paymail payments).
|
|
9
|
+
*/
|
|
10
|
+
import { Beef, Transaction, } from '@bsv/sdk';
|
|
11
|
+
import { Bsv21Indexer, FundIndexer, InscriptionIndexer, MapIndexer, OpNSIndexer, Outpoint, OriginIndexer, SigmaIndexer, } from '@1sat/wallet';
|
|
12
|
+
import { BRC29_PROTOCOL_ID } from '@1sat/types';
|
|
13
|
+
import { randomActionId } from './createTrackedAction';
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// Main function
|
|
16
|
+
// ============================================================================
|
|
17
|
+
export async function internalizeBeef(opts) {
|
|
18
|
+
const { beef, wallet, services, chain, outputs, addressDerivations } = opts;
|
|
19
|
+
if (!outputs && !addressDerivations) {
|
|
20
|
+
throw new Error('Either outputs or addressDerivations must be provided');
|
|
21
|
+
}
|
|
22
|
+
const beefObj = Beef.fromBinary(Array.from(beef));
|
|
23
|
+
const txids = beefObj.txs
|
|
24
|
+
.filter((btx) => btx.tx != null)
|
|
25
|
+
.map((btx) => btx.tx.id('hex'));
|
|
26
|
+
const mainTxid = txids[txids.length - 1];
|
|
27
|
+
const btx = beefObj.findTxid(mainTxid);
|
|
28
|
+
if (!btx?.tx) {
|
|
29
|
+
throw new Error(`Transaction not found in BEEF`);
|
|
30
|
+
}
|
|
31
|
+
// Ensure source transactions are loaded for inputs
|
|
32
|
+
for (const input of btx.tx.inputs) {
|
|
33
|
+
if (!input.sourceTransaction && input.sourceTXID) {
|
|
34
|
+
const rawTx = await services.beef.getRawTx(input.sourceTXID);
|
|
35
|
+
input.sourceTransaction = Transaction.fromBinary(Array.from(rawTx));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Build vout lookup for explicit output mode
|
|
39
|
+
const derivationByVout = new Map();
|
|
40
|
+
if (outputs) {
|
|
41
|
+
for (const out of outputs) {
|
|
42
|
+
derivationByVout.set(out.outputIndex, out);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Build indexers
|
|
46
|
+
const owners = new Set(addressDerivations ? addressDerivations.keys() : []);
|
|
47
|
+
const network = chain === 'main' ? 'mainnet' : 'testnet';
|
|
48
|
+
const indexers = [
|
|
49
|
+
new FundIndexer(owners, network),
|
|
50
|
+
new InscriptionIndexer(owners, network),
|
|
51
|
+
new Bsv21Indexer(owners, network, services),
|
|
52
|
+
new OriginIndexer(owners, network, services),
|
|
53
|
+
new OpNSIndexer(owners, network),
|
|
54
|
+
new SigmaIndexer(owners, network),
|
|
55
|
+
new MapIndexer(owners, network),
|
|
56
|
+
];
|
|
57
|
+
// Parse transaction with indexers
|
|
58
|
+
const parseCtx = await parseTransaction(btx.tx, indexers);
|
|
59
|
+
// Build InternalizeOutput entries
|
|
60
|
+
const internalizeOutputs = [];
|
|
61
|
+
const ownedTxos = [];
|
|
62
|
+
const actionId = randomActionId();
|
|
63
|
+
for (const txo of parseCtx.txos) {
|
|
64
|
+
// Resolve derivation: explicit vout match OR owner-address match
|
|
65
|
+
const derivation = derivationByVout.get(txo.outpoint.vout) ||
|
|
66
|
+
(txo.owner && addressDerivations?.get(txo.owner)) ||
|
|
67
|
+
null;
|
|
68
|
+
if (!derivation)
|
|
69
|
+
continue;
|
|
70
|
+
const result = buildInternalizeOutput(txo, derivation, actionId);
|
|
71
|
+
if (result) {
|
|
72
|
+
internalizeOutputs.push(result);
|
|
73
|
+
ownedTxos.push(txo);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (internalizeOutputs.length === 0) {
|
|
77
|
+
return { txid: mainTxid, internalized: 0 };
|
|
78
|
+
}
|
|
79
|
+
const args = {
|
|
80
|
+
tx: Array.from(beef),
|
|
81
|
+
outputs: internalizeOutputs,
|
|
82
|
+
description: buildDescription(ownedTxos),
|
|
83
|
+
};
|
|
84
|
+
await wallet.internalizeAction(args);
|
|
85
|
+
return { txid: mainTxid, internalized: internalizeOutputs.length };
|
|
86
|
+
}
|
|
87
|
+
// ============================================================================
|
|
88
|
+
// Internals
|
|
89
|
+
// ============================================================================
|
|
90
|
+
async function parseTransaction(tx, indexers) {
|
|
91
|
+
const txid = tx.id('hex');
|
|
92
|
+
const ctx = {
|
|
93
|
+
tx,
|
|
94
|
+
txid,
|
|
95
|
+
txos: [],
|
|
96
|
+
spends: [],
|
|
97
|
+
summary: {},
|
|
98
|
+
indexers,
|
|
99
|
+
};
|
|
100
|
+
// Parse inputs into spends
|
|
101
|
+
for (let vin = 0; vin < tx.inputs.length; vin++) {
|
|
102
|
+
const input = tx.inputs[vin];
|
|
103
|
+
if (!input.sourceTransaction) {
|
|
104
|
+
throw new Error(`Missing sourceTransaction for input ${vin}`);
|
|
105
|
+
}
|
|
106
|
+
const sourceTxid = input.sourceTransaction.id('hex');
|
|
107
|
+
const txo = {
|
|
108
|
+
output: input.sourceTransaction.outputs[input.sourceOutputIndex],
|
|
109
|
+
outpoint: new Outpoint(sourceTxid, input.sourceOutputIndex),
|
|
110
|
+
data: {},
|
|
111
|
+
};
|
|
112
|
+
for (const indexer of indexers) {
|
|
113
|
+
const result = await indexer.parse(txo);
|
|
114
|
+
if (result) {
|
|
115
|
+
txo.data[indexer.tag] = {
|
|
116
|
+
data: result.data,
|
|
117
|
+
tags: result.tags,
|
|
118
|
+
content: result.content,
|
|
119
|
+
};
|
|
120
|
+
if (result.owner && !txo.owner)
|
|
121
|
+
txo.owner = result.owner;
|
|
122
|
+
if (result.basket && !txo.basket)
|
|
123
|
+
txo.basket = result.basket;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
ctx.spends.push(txo);
|
|
127
|
+
}
|
|
128
|
+
// Parse each output
|
|
129
|
+
for (let vout = 0; vout < tx.outputs.length; vout++) {
|
|
130
|
+
const output = tx.outputs[vout];
|
|
131
|
+
const txo = {
|
|
132
|
+
output,
|
|
133
|
+
outpoint: new Outpoint(txid, vout),
|
|
134
|
+
data: {},
|
|
135
|
+
};
|
|
136
|
+
for (const indexer of indexers) {
|
|
137
|
+
const result = await indexer.parse(txo);
|
|
138
|
+
if (result) {
|
|
139
|
+
txo.data[indexer.tag] = {
|
|
140
|
+
data: result.data,
|
|
141
|
+
tags: result.tags,
|
|
142
|
+
content: result.content,
|
|
143
|
+
};
|
|
144
|
+
if (result.owner && !txo.owner)
|
|
145
|
+
txo.owner = result.owner;
|
|
146
|
+
if (result.basket && !txo.basket)
|
|
147
|
+
txo.basket = result.basket;
|
|
148
|
+
if (result.protocol && !txo.protocol)
|
|
149
|
+
txo.protocol = result.protocol;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
ctx.txos.push(txo);
|
|
153
|
+
}
|
|
154
|
+
// Summarize phase
|
|
155
|
+
for (const indexer of indexers) {
|
|
156
|
+
const summary = await indexer.summarize(ctx, true);
|
|
157
|
+
if (summary) {
|
|
158
|
+
ctx.summary[indexer.tag] = summary;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return ctx;
|
|
162
|
+
}
|
|
163
|
+
function buildInternalizeOutput(txo, derivation, actionId) {
|
|
164
|
+
const vout = txo.outpoint.vout;
|
|
165
|
+
const protocol = txo.protocol || 'wallet payment';
|
|
166
|
+
const idTag = `id:${actionId}`;
|
|
167
|
+
if (protocol === 'basket insertion') {
|
|
168
|
+
const basket = txo.basket || 'custom';
|
|
169
|
+
const tags = [...collectTags(txo), idTag];
|
|
170
|
+
const nameTag = tags.find((t) => t.startsWith('name:'));
|
|
171
|
+
return {
|
|
172
|
+
outputIndex: vout,
|
|
173
|
+
protocol: 'basket insertion',
|
|
174
|
+
insertionRemittance: {
|
|
175
|
+
basket,
|
|
176
|
+
tags,
|
|
177
|
+
customInstructions: JSON.stringify({
|
|
178
|
+
derivationPrefix: derivation.derivationPrefix,
|
|
179
|
+
derivationSuffix: derivation.derivationSuffix,
|
|
180
|
+
senderIdentityKey: derivation.senderIdentityKey,
|
|
181
|
+
...(nameTag && { name: nameTag.slice(5).slice(0, 64) }),
|
|
182
|
+
}),
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
// P2PKH ordinals/tokens: basket insertion so they don't get consumed as change
|
|
187
|
+
if (txo.basket && txo.basket !== 'fund') {
|
|
188
|
+
const tags = [...collectTags(txo), idTag];
|
|
189
|
+
const nameTag = tags.find((t) => t.startsWith('name:'));
|
|
190
|
+
return {
|
|
191
|
+
outputIndex: vout,
|
|
192
|
+
protocol: 'basket insertion',
|
|
193
|
+
insertionRemittance: {
|
|
194
|
+
basket: txo.basket,
|
|
195
|
+
tags,
|
|
196
|
+
customInstructions: JSON.stringify({
|
|
197
|
+
protocolID: BRC29_PROTOCOL_ID,
|
|
198
|
+
keyID: `${derivation.derivationPrefix} ${derivation.derivationSuffix}`,
|
|
199
|
+
...(nameTag && { name: nameTag.slice(5).slice(0, 64) }),
|
|
200
|
+
}),
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
// P2PKH funding output
|
|
205
|
+
return {
|
|
206
|
+
outputIndex: vout,
|
|
207
|
+
protocol: 'wallet payment',
|
|
208
|
+
paymentRemittance: {
|
|
209
|
+
derivationPrefix: derivation.derivationPrefix,
|
|
210
|
+
derivationSuffix: derivation.derivationSuffix,
|
|
211
|
+
senderIdentityKey: derivation.senderIdentityKey,
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
function collectTags(txo) {
|
|
216
|
+
const tags = [];
|
|
217
|
+
for (const indexData of Object.values(txo.data)) {
|
|
218
|
+
tags.push(...indexData.tags);
|
|
219
|
+
}
|
|
220
|
+
return tags;
|
|
221
|
+
}
|
|
222
|
+
function buildDescription(ownedTxos) {
|
|
223
|
+
const parts = [];
|
|
224
|
+
let sats = 0;
|
|
225
|
+
for (const txo of ownedTxos) {
|
|
226
|
+
if (txo.data.bsv21) {
|
|
227
|
+
const token = txo.data.bsv21.data;
|
|
228
|
+
const sym = token.sym || 'tokens';
|
|
229
|
+
const amt = Number(token.amt) / 10 ** token.dec;
|
|
230
|
+
parts.push(`${amt} ${sym}`);
|
|
231
|
+
}
|
|
232
|
+
else if (txo.basket === '1sat') {
|
|
233
|
+
parts.push('ordinal');
|
|
234
|
+
}
|
|
235
|
+
else if (txo.basket === 'opns') {
|
|
236
|
+
parts.push('OPNS name');
|
|
237
|
+
}
|
|
238
|
+
else if (txo.basket === 'fund') {
|
|
239
|
+
sats += Number(txo.output.satoshis || 0);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (sats > 0) {
|
|
243
|
+
parts.push(`${sats} sats`);
|
|
244
|
+
}
|
|
245
|
+
if (parts.length === 0)
|
|
246
|
+
return 'Received via sync';
|
|
247
|
+
const desc = `Received ${parts.join(' + ')}`;
|
|
248
|
+
if (desc.length <= 50)
|
|
249
|
+
return desc;
|
|
250
|
+
return `${desc.slice(0, 47)}...`;
|
|
251
|
+
}
|
|
252
|
+
//# sourceMappingURL=internalizeBeef.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internalizeBeef.js","sourceRoot":"","sources":["../../src/utils/internalizeBeef.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EACN,IAAI,EAGJ,WAAW,GAEX,MAAM,UAAU,CAAA;AACjB,OAAO,EACN,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,QAAQ,EACR,aAAa,EACb,YAAY,GACZ,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAyCtD,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E,MAAM,CAAC,KAAK,UAAU,eAAe,CACpC,IAA4B;IAE5B,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAA;IAE3E,IAAI,CAAC,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;IACzE,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACjD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG;SAC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