@1sat/templates 0.0.1

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.
Files changed (57) hide show
  1. package/dist/bitcom/aip.d.ts +88 -0
  2. package/dist/bitcom/aip.d.ts.map +1 -0
  3. package/dist/bitcom/aip.js +205 -0
  4. package/dist/bitcom/aip.js.map +1 -0
  5. package/dist/bitcom/b.d.ts +99 -0
  6. package/dist/bitcom/b.d.ts.map +1 -0
  7. package/dist/bitcom/b.js +206 -0
  8. package/dist/bitcom/b.js.map +1 -0
  9. package/dist/bitcom/bap.d.ts +126 -0
  10. package/dist/bitcom/bap.d.ts.map +1 -0
  11. package/dist/bitcom/bap.js +334 -0
  12. package/dist/bitcom/bap.js.map +1 -0
  13. package/dist/bitcom/bitcom.d.ts +75 -0
  14. package/dist/bitcom/bitcom.d.ts.map +1 -0
  15. package/dist/bitcom/bitcom.js +186 -0
  16. package/dist/bitcom/bitcom.js.map +1 -0
  17. package/dist/bitcom/map.d.ts +90 -0
  18. package/dist/bitcom/map.d.ts.map +1 -0
  19. package/dist/bitcom/map.js +215 -0
  20. package/dist/bitcom/map.js.map +1 -0
  21. package/dist/bitcom/sigma.d.ts +93 -0
  22. package/dist/bitcom/sigma.d.ts.map +1 -0
  23. package/dist/bitcom/sigma.js +175 -0
  24. package/dist/bitcom/sigma.js.map +1 -0
  25. package/dist/bsocial/bsocial.d.ts +152 -0
  26. package/dist/bsocial/bsocial.d.ts.map +1 -0
  27. package/dist/bsocial/bsocial.js +397 -0
  28. package/dist/bsocial/bsocial.js.map +1 -0
  29. package/dist/bsv20/bsv20.d.ts +277 -0
  30. package/dist/bsv20/bsv20.d.ts.map +1 -0
  31. package/dist/bsv20/bsv20.js +544 -0
  32. package/dist/bsv20/bsv20.js.map +1 -0
  33. package/dist/bsv21/bsv21.d.ts +231 -0
  34. package/dist/bsv21/bsv21.d.ts.map +1 -0
  35. package/dist/bsv21/bsv21.js +475 -0
  36. package/dist/bsv21/bsv21.js.map +1 -0
  37. package/dist/index.d.ts +35 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +31 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/inscription/inscription.d.ts +165 -0
  42. package/dist/inscription/inscription.d.ts.map +1 -0
  43. package/dist/inscription/inscription.js +401 -0
  44. package/dist/inscription/inscription.js.map +1 -0
  45. package/dist/lock/lock.d.ts +92 -0
  46. package/dist/lock/lock.d.ts.map +1 -0
  47. package/dist/lock/lock.js +283 -0
  48. package/dist/lock/lock.js.map +1 -0
  49. package/dist/ordlock/ordlock.d.ts +126 -0
  50. package/dist/ordlock/ordlock.d.ts.map +1 -0
  51. package/dist/ordlock/ordlock.js +316 -0
  52. package/dist/ordlock/ordlock.js.map +1 -0
  53. package/dist/signer.d.ts +39 -0
  54. package/dist/signer.d.ts.map +1 -0
  55. package/dist/signer.js +54 -0
  56. package/dist/signer.js.map +1 -0
  57. package/package.json +43 -0
@@ -0,0 +1,126 @@
1
+ import { type LockingScript, type ScriptTemplate } from '@bsv/sdk';
2
+ import { type BitComDecoded } from './bitcom.js';
3
+ /**
4
+ * Bitcoin Attestation Protocol (BAP) Types
5
+ */
6
+ export declare enum BAPAttestationType {
7
+ ID = "ID",
8
+ ATTEST = "ATTEST",
9
+ REVOKE = "REVOKE",
10
+ ALIAS = "ALIAS"
11
+ }
12
+ /**
13
+ * BAP Data Structure
14
+ */
15
+ export interface BAPData {
16
+ bitcomIndex?: number;
17
+ type: BAPAttestationType;
18
+ idKey?: string;
19
+ address?: string;
20
+ sequence: bigint;
21
+ algorithm?: string;
22
+ signerAddr?: string;
23
+ signature?: string;
24
+ rootAddress?: string;
25
+ isSignedByID: boolean;
26
+ profile?: unknown;
27
+ }
28
+ /**
29
+ * BAP Protocol Prefix
30
+ */
31
+ export declare const BAP_PROTOCOL_PREFIX = "1BAPSuaPnfGnSBM3GLV9yhxUdYe4vGbdMT";
32
+ /**
33
+ * Bitcoin Attestation Protocol (BAP) Template
34
+ *
35
+ * BAP is an advanced identity and attestation system that builds on AIP to provide
36
+ * verifiable claims, identity verification, and decentralized reputation management.
37
+ *
38
+ * Core attestation types:
39
+ * - ID: Create and register digital identities with cryptographic proof
40
+ * - ATTEST: Make verifiable claims and attestations about other identities
41
+ * - REVOKE: Revoke previous attestations or invalidate claims
42
+ * - ALIAS: Create human-readable aliases for identities
43
+ */
44
+ export default class BAP implements ScriptTemplate {
45
+ bitcomIndex?: number;
46
+ type: BAPAttestationType;
47
+ idKey?: string;
48
+ address?: string;
49
+ sequence: bigint;
50
+ algorithm?: string;
51
+ signerAddr?: string;
52
+ signature?: string;
53
+ rootAddress?: string;
54
+ isSignedByID: boolean;
55
+ profile?: unknown;
56
+ constructor(data: BAPData);
57
+ /**
58
+ * Creates a BAP locking script
59
+ *
60
+ * @returns LockingScript - The BAP locking script
61
+ */
62
+ lock(): LockingScript;
63
+ /**
64
+ * Decodes a BAP protocol from BitCom structure
65
+ *
66
+ * @param bitcom - The BitCom decoded structure
67
+ * @returns BAP | null - The decoded BAP data, or null if not found
68
+ */
69
+ static decode(bitcom: BitComDecoded): BAP | null;
70
+ /**
71
+ * Creates a BAP ID attestation
72
+ *
73
+ * @param identityKey - The identity public key
74
+ * @param address - The associated address
75
+ * @param algorithm - The AIP algorithm
76
+ * @param signerAddr - The signer address
77
+ * @param signature - The AIP signature
78
+ * @returns BAP - The ID attestation
79
+ */
80
+ static createID(identityKey: string, address: string, algorithm?: string, signerAddr?: string, signature?: string): BAP;
81
+ /**
82
+ * Creates a BAP ATTEST attestation
83
+ *
84
+ * @param txid - The transaction ID being attested to
85
+ * @param sequence - The sequence number
86
+ * @param algorithm - The AIP algorithm
87
+ * @param signerAddr - The signer address
88
+ * @param signature - The AIP signature
89
+ * @returns BAP - The ATTEST attestation
90
+ */
91
+ static createAttest(txid: string, sequence: bigint, algorithm?: string, signerAddr?: string, signature?: string): BAP;
92
+ /**
93
+ * Creates a BAP REVOKE attestation
94
+ *
95
+ * @param txid - The transaction ID being revoked
96
+ * @param sequence - The sequence number
97
+ * @param algorithm - The AIP algorithm
98
+ * @param signerAddr - The signer address
99
+ * @param signature - The AIP signature
100
+ * @returns BAP - The REVOKE attestation
101
+ */
102
+ static createRevoke(txid: string, sequence: bigint, algorithm?: string, signerAddr?: string, signature?: string): BAP;
103
+ /**
104
+ * Creates a BAP ALIAS attestation
105
+ *
106
+ * @param alias - The human-readable alias
107
+ * @param profile - The profile data
108
+ * @param algorithm - The AIP algorithm
109
+ * @param signerAddr - The signer address
110
+ * @param signature - The AIP signature
111
+ * @returns BAP - The ALIAS attestation
112
+ */
113
+ static createAlias(alias: string, profile: unknown, algorithm?: string, signerAddr?: string, signature?: string): BAP;
114
+ /**
115
+ * Verifies the AIP signature for the BAP attestation
116
+ *
117
+ * @param _protocolData - The protocol data for signature verification
118
+ * @returns boolean - True if signature is valid
119
+ */
120
+ verifySignature(_protocolData: unknown[]): boolean;
121
+ /**
122
+ * Placeholder for unlock method - BAP is read-only
123
+ */
124
+ unlock(): never;
125
+ }
126
+ //# sourceMappingURL=bap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bap.d.ts","sourceRoot":"","sources":["../../src/bitcom/bap.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,aAAa,EAElB,KAAK,cAAc,EAEnB,MAAM,UAAU,CAAA;AACjB,OAAe,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAExD;;GAEG;AACH,oBAAY,kBAAkB;IAC7B,EAAE,OAAO;IACT,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,KAAK,UAAU;CACf;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,kBAAkB,CAAA;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAA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GAAG;IAaN;;;;;;;;;OASG;IACH,MAAM,CAAC,YAAY,CAClB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GAChB,GAAG;IAaN;;;;;;;;;OASG;IACH,MAAM,CAAC,WAAW,CACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,OAAO,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GAChB,GAAG;IAcN;;;;;OAKG;IACH,eAAe,CAAC,aAAa,EAAE,OAAO,EAAE,GAAG,OAAO;IAiBlD;;OAEG;IACH,MAAM,IAAI,KAAK;CAKf"}
@@ -0,0 +1,334 @@
1
+ import { Script, Utils, } from '@bsv/sdk';
2
+ import BitCom from './bitcom.js';
3
+ /**
4
+ * Bitcoin Attestation Protocol (BAP) Types
5
+ */
6
+ export var BAPAttestationType;
7
+ (function (BAPAttestationType) {
8
+ BAPAttestationType["ID"] = "ID";
9
+ BAPAttestationType["ATTEST"] = "ATTEST";
10
+ BAPAttestationType["REVOKE"] = "REVOKE";
11
+ BAPAttestationType["ALIAS"] = "ALIAS";
12
+ })(BAPAttestationType || (BAPAttestationType = {}));
13
+ /**
14
+ * BAP Protocol Prefix
15
+ */
16
+ export const BAP_PROTOCOL_PREFIX = '1BAPSuaPnfGnSBM3GLV9yhxUdYe4vGbdMT';
17
+ /**
18
+ * Bitcoin Attestation Protocol (BAP) Template
19
+ *
20
+ * BAP is an advanced identity and attestation system that builds on AIP to provide
21
+ * verifiable claims, identity verification, and decentralized reputation management.
22
+ *
23
+ * Core attestation types:
24
+ * - ID: Create and register digital identities with cryptographic proof
25
+ * - ATTEST: Make verifiable claims and attestations about other identities
26
+ * - REVOKE: Revoke previous attestations or invalidate claims
27
+ * - ALIAS: Create human-readable aliases for identities
28
+ */
29
+ export default class BAP {
30
+ bitcomIndex;
31
+ type;
32
+ idKey;
33
+ address;
34
+ sequence;
35
+ algorithm;
36
+ signerAddr;
37
+ signature;
38
+ rootAddress;
39
+ isSignedByID;
40
+ profile;
41
+ constructor(data) {
42
+ this.bitcomIndex = data.bitcomIndex;
43
+ this.type = data.type;
44
+ this.idKey = data.idKey;
45
+ this.address = data.address;
46
+ this.sequence = data.sequence;
47
+ this.algorithm = data.algorithm;
48
+ this.signerAddr = data.signerAddr;
49
+ this.signature = data.signature;
50
+ this.rootAddress = data.rootAddress;
51
+ this.isSignedByID = data.isSignedByID;
52
+ this.profile = data.profile;
53
+ }
54
+ /**
55
+ * Creates a BAP locking script
56
+ *
57
+ * @returns LockingScript - The BAP locking script
58
+ */
59
+ lock() {
60
+ const script = new Script();
61
+ // Add attestation type
62
+ script.writeBin(Utils.toArray(this.type, 'utf8'));
63
+ // Add type-specific data
64
+ if (this.type === BAPAttestationType.ID) {
65
+ if (this.idKey != null && this.idKey !== '') {
66
+ script.writeBin(Utils.toArray(this.idKey, 'utf8'));
67
+ }
68
+ if (this.address != null && this.address !== '') {
69
+ script.writeBin(Utils.toArray(this.address, 'utf8'));
70
+ }
71
+ }
72
+ else if (this.type === BAPAttestationType.ATTEST ||
73
+ this.type === BAPAttestationType.REVOKE) {
74
+ if (this.idKey != null && this.idKey !== '') {
75
+ script.writeBin(Utils.toArray(this.idKey, 'utf8'));
76
+ }
77
+ // Add sequence number
78
+ script.writeBin(Utils.toArray(this.sequence.toString(), 'utf8'));
79
+ }
80
+ else if (this.type === BAPAttestationType.ALIAS) {
81
+ if (this.idKey != null && this.idKey !== '') {
82
+ script.writeBin(Utils.toArray(this.idKey, 'utf8'));
83
+ }
84
+ if (this.profile != null) {
85
+ const profileJson = JSON.stringify(this.profile);
86
+ script.writeBin(Utils.toArray(profileJson, 'utf8'));
87
+ }
88
+ }
89
+ // Add AIP signature data
90
+ if (this.algorithm != null && this.algorithm !== '') {
91
+ script.writeBin(Utils.toArray(this.algorithm, 'utf8'));
92
+ }
93
+ if (this.signerAddr != null && this.signerAddr !== '') {
94
+ script.writeBin(Utils.toArray(this.signerAddr, 'utf8'));
95
+ }
96
+ if (this.signature != null && this.signature !== '') {
97
+ script.writeBin(Utils.toArray(this.signature, 'utf8'));
98
+ }
99
+ // Create BitCom structure
100
+ const bitcom = new BitCom([
101
+ {
102
+ protocol: BAP_PROTOCOL_PREFIX,
103
+ script: script.toBinary(),
104
+ pos: 0,
105
+ },
106
+ ]);
107
+ return bitcom.lock();
108
+ }
109
+ /**
110
+ * Decodes a BAP protocol from BitCom structure
111
+ *
112
+ * @param bitcom - The BitCom decoded structure
113
+ * @returns BAP | null - The decoded BAP data, or null if not found
114
+ */
115
+ static decode(bitcom) {
116
+ if (bitcom == null ||
117
+ bitcom.protocols == null ||
118
+ bitcom.protocols.length === 0) {
119
+ return null;
120
+ }
121
+ // Find BAP protocol
122
+ const bapProtocol = bitcom.protocols.find((p) => p.protocol === BAP_PROTOCOL_PREFIX);
123
+ if (bapProtocol == null) {
124
+ return null;
125
+ }
126
+ try {
127
+ // Parse the protocol script data
128
+ const script = Script.fromBinary(bapProtocol.script);
129
+ const chunks = script.chunks;
130
+ if (chunks.length < 1) {
131
+ return null;
132
+ }
133
+ // Extract attestation type
134
+ const typeChunk = chunks[0];
135
+ if (typeChunk.data == null) {
136
+ return null;
137
+ }
138
+ const type = Utils.toUTF8(typeChunk.data);
139
+ // AIP signature data comes after type-specific data (no pipe delimiter)
140
+ const bapData = {
141
+ bitcomIndex: bapProtocol.pos,
142
+ type,
143
+ sequence: BigInt(0),
144
+ isSignedByID: false,
145
+ };
146
+ // Parse type-specific data
147
+ if (type === BAPAttestationType.ID) {
148
+ if (chunks.length > 1 && chunks[1].data != null) {
149
+ bapData.idKey = Utils.toUTF8(chunks[1].data);
150
+ }
151
+ if (chunks.length > 2 && chunks[2].data != null) {
152
+ bapData.address = Utils.toUTF8(chunks[2].data);
153
+ }
154
+ bapData.isSignedByID = true;
155
+ }
156
+ else if (type === BAPAttestationType.ATTEST ||
157
+ type === BAPAttestationType.REVOKE) {
158
+ if (chunks.length > 1 && chunks[1].data != null) {
159
+ bapData.idKey = Utils.toUTF8(chunks[1].data);
160
+ }
161
+ if (chunks.length > 2 && chunks[2].data != null) {
162
+ const sequenceStr = Utils.toUTF8(chunks[2].data);
163
+ bapData.sequence = BigInt(sequenceStr);
164
+ }
165
+ }
166
+ else if (type === BAPAttestationType.ALIAS) {
167
+ if (chunks.length > 1 && chunks[1].data != null) {
168
+ bapData.idKey = Utils.toUTF8(chunks[1].data);
169
+ }
170
+ if (chunks.length > 2 && chunks[2].data != null) {
171
+ try {
172
+ const profileJson = Utils.toUTF8(chunks[2].data);
173
+ bapData.profile = JSON.parse(profileJson);
174
+ }
175
+ catch {
176
+ // Invalid JSON, store as raw data
177
+ bapData.profile = Utils.toUTF8(chunks[2].data);
178
+ }
179
+ }
180
+ }
181
+ // Calculate where AIP data starts based on type (after type-specific fields)
182
+ const aipStartIdx = 3; // Default: after type, idKey, and one more field
183
+ // Parse AIP signature data if present (algorithm, signerAddr, signature)
184
+ if (chunks.length > aipStartIdx && chunks[aipStartIdx].data != null) {
185
+ bapData.algorithm = Utils.toUTF8(chunks[aipStartIdx].data);
186
+ }
187
+ if (chunks.length > aipStartIdx + 1 &&
188
+ chunks[aipStartIdx + 1].data != null) {
189
+ const signerData = chunks[aipStartIdx + 1].data;
190
+ if (signerData != null) {
191
+ bapData.signerAddr = Utils.toUTF8(signerData);
192
+ }
193
+ }
194
+ if (chunks.length > aipStartIdx + 2 &&
195
+ chunks[aipStartIdx + 2].data != null) {
196
+ const signatureData = chunks[aipStartIdx + 2].data;
197
+ if (signatureData != null) {
198
+ bapData.signature = Utils.toUTF8(signatureData);
199
+ }
200
+ }
201
+ // Set root address if we have signer address
202
+ if (bapData.signerAddr != null && bapData.signerAddr !== '') {
203
+ bapData.rootAddress = bapData.signerAddr;
204
+ }
205
+ // Set isSignedByID based on attestation type
206
+ if (type === BAPAttestationType.ID) {
207
+ bapData.isSignedByID = true; // ID attestations are always signed by the identity
208
+ }
209
+ else {
210
+ bapData.isSignedByID = false; // ATTEST/REVOKE/ALIAS are not signed by the ID itself
211
+ }
212
+ return new BAP(bapData);
213
+ }
214
+ catch {
215
+ return null;
216
+ }
217
+ }
218
+ /**
219
+ * Creates a BAP ID attestation
220
+ *
221
+ * @param identityKey - The identity public key
222
+ * @param address - The associated address
223
+ * @param algorithm - The AIP algorithm
224
+ * @param signerAddr - The signer address
225
+ * @param signature - The AIP signature
226
+ * @returns BAP - The ID attestation
227
+ */
228
+ static createID(identityKey, address, algorithm, signerAddr, signature) {
229
+ return new BAP({
230
+ type: BAPAttestationType.ID,
231
+ idKey: identityKey,
232
+ address,
233
+ sequence: BigInt(0),
234
+ algorithm,
235
+ signerAddr,
236
+ signature,
237
+ rootAddress: signerAddr,
238
+ isSignedByID: true,
239
+ });
240
+ }
241
+ /**
242
+ * Creates a BAP ATTEST attestation
243
+ *
244
+ * @param txid - The transaction ID being attested to
245
+ * @param sequence - The sequence number
246
+ * @param algorithm - The AIP algorithm
247
+ * @param signerAddr - The signer address
248
+ * @param signature - The AIP signature
249
+ * @returns BAP - The ATTEST attestation
250
+ */
251
+ static createAttest(txid, sequence, algorithm, signerAddr, signature) {
252
+ return new BAP({
253
+ type: BAPAttestationType.ATTEST,
254
+ idKey: txid,
255
+ sequence,
256
+ algorithm,
257
+ signerAddr,
258
+ signature,
259
+ rootAddress: signerAddr,
260
+ isSignedByID: false,
261
+ });
262
+ }
263
+ /**
264
+ * Creates a BAP REVOKE attestation
265
+ *
266
+ * @param txid - The transaction ID being revoked
267
+ * @param sequence - The sequence number
268
+ * @param algorithm - The AIP algorithm
269
+ * @param signerAddr - The signer address
270
+ * @param signature - The AIP signature
271
+ * @returns BAP - The REVOKE attestation
272
+ */
273
+ static createRevoke(txid, sequence, algorithm, signerAddr, signature) {
274
+ return new BAP({
275
+ type: BAPAttestationType.REVOKE,
276
+ idKey: txid,
277
+ sequence,
278
+ algorithm,
279
+ signerAddr,
280
+ signature,
281
+ rootAddress: signerAddr,
282
+ isSignedByID: false,
283
+ });
284
+ }
285
+ /**
286
+ * Creates a BAP ALIAS attestation
287
+ *
288
+ * @param alias - The human-readable alias
289
+ * @param profile - The profile data
290
+ * @param algorithm - The AIP algorithm
291
+ * @param signerAddr - The signer address
292
+ * @param signature - The AIP signature
293
+ * @returns BAP - The ALIAS attestation
294
+ */
295
+ static createAlias(alias, profile, algorithm, signerAddr, signature) {
296
+ return new BAP({
297
+ type: BAPAttestationType.ALIAS,
298
+ idKey: alias,
299
+ sequence: BigInt(0),
300
+ profile,
301
+ algorithm,
302
+ signerAddr,
303
+ signature,
304
+ rootAddress: signerAddr,
305
+ isSignedByID: false,
306
+ });
307
+ }
308
+ /**
309
+ * Verifies the AIP signature for the BAP attestation
310
+ *
311
+ * @param _protocolData - The protocol data for signature verification
312
+ * @returns boolean - True if signature is valid
313
+ */
314
+ verifySignature(_protocolData) {
315
+ if (this.algorithm == null ||
316
+ this.algorithm === '' ||
317
+ this.signerAddr == null ||
318
+ this.signerAddr === '' ||
319
+ this.signature == null ||
320
+ this.signature === '') {
321
+ return false;
322
+ }
323
+ // This would need to be implemented with actual AIP verification
324
+ // For now, return true if all signature components are present
325
+ return true;
326
+ }
327
+ /**
328
+ * Placeholder for unlock method - BAP is read-only
329
+ */
330
+ unlock() {
331
+ throw new Error('BAP attestations cannot be unlocked - they are read-only identity records');
332
+ }
333
+ }
334
+ //# sourceMappingURL=bap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bap.js","sourceRoot":"","sources":["../../src/bitcom/bap.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,MAAM,EAEN,KAAK,GACL,MAAM,UAAU,CAAA;AACjB,OAAO,MAA8B,MAAM,aAAa,CAAA;AAExD;;GAEG;AACH,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC7B,+BAAS,CAAA;IACT,uCAAiB,CAAA;I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,OAAO,KAAK,CAAA;QACb,CAAC;QAED,iEAAiE;QACjE,+DAA+D;QAC/D,OAAO,IAAI,CAAA;IACZ,CAAC;IAED;;OAEG;IACH,MAAM;QACL,MAAM,IAAI,KAAK,CACd,2EAA2E,CAC3E,CAAA;IACF,CAAC;CACD"}
@@ -0,0 +1,75 @@
1
+ import { LockingScript, Script } from '@bsv/sdk';
2
+ /**
3
+ * Represents a protocol within a transaction
4
+ */
5
+ export interface Protocol {
6
+ protocol: string;
7
+ script: number[];
8
+ pos: number;
9
+ }
10
+ /**
11
+ * Represents a BitCom protocol within a transaction (deprecated - use Protocol)
12
+ * @deprecated Use Protocol instead
13
+ */
14
+ export interface BitComProtocol extends Protocol {
15
+ protocol: string;
16
+ script: number[];
17
+ pos: number;
18
+ }
19
+ /**
20
+ * Represents the complete BitCom structure of a transaction
21
+ */
22
+ export interface BitComDecoded {
23
+ protocols: Protocol[];
24
+ scriptPrefix: number[];
25
+ }
26
+ /**
27
+ * BitCom template for handling multi-protocol Bitcoin transactions
28
+ *
29
+ * BitCom allows multiple protocols to be embedded in a single transaction output
30
+ * using the pipe ('|') delimiter to separate different protocol sections.
31
+ *
32
+ * This implementation mirrors the Go template structure and behavior.
33
+ */
34
+ export default class BitCom {
35
+ protocols: Protocol[];
36
+ scriptPrefix: number[];
37
+ constructor(protocols?: Protocol[], scriptPrefix?: number[]);
38
+ /**
39
+ * Decodes a script to extract BitCom protocol data
40
+ *
41
+ * Mirrors the Go implementation's decode algorithm exactly.
42
+ *
43
+ * @param script - The script to decode
44
+ * @returns BitComDecoded - The decoded BitCom structure, or null if no OP_RETURN found
45
+ */
46
+ static decode(script: Script | LockingScript): BitComDecoded | null;
47
+ /**
48
+ * Creates a locking script from the BitCom structure
49
+ *
50
+ * Mirrors the Go Lock() method exactly.
51
+ *
52
+ * @returns LockingScript - The BitCom locking script
53
+ */
54
+ lock(): LockingScript;
55
+ /**
56
+ * Finds the position of OP_RETURN in the script
57
+ *
58
+ * Mirrors the Go findReturn function exactly.
59
+ *
60
+ * @param scriptBytes - The script bytes to search
61
+ * @param from - Starting position
62
+ * @returns number - Position of OP_RETURN, or -1 if not found
63
+ */
64
+ private static findReturn;
65
+ /**
66
+ * Converts various input types to a Script object
67
+ *
68
+ * Mirrors the Go ToScript function exactly.
69
+ *
70
+ * @param data - The data to convert (Script, LockingScript, or byte array)
71
+ * @returns Script - The converted script, or null if conversion fails
72
+ */
73
+ static toScript(data: Script | LockingScript | number[]): Script | null;
74
+ }
75
+ //# sourceMappingURL=bitcom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bitcom.d.ts","sourceRoot":"","sources":["../../src/bitcom/bitcom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAM,MAAM,EAAS,MAAM,UAAU,CAAA;AAE3D;;GAEG;AACH,MAAM,WAAW,QAAQ;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;CACX;AAED;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC/C,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;CACX;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,SAAS,EAAE,QAAQ,EAAE,CAAA;IACrB,YAAY,EAAE,MAAM,EAAE,CAAA;CACtB;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IAC1B,SAAS,EAAE,QAAQ,EAAE,CAAA;IACrB,YAAY,EAAE,MAAM,EAAE,CAAA;gBAEV,SAAS,GAAE,QAAQ,EAAO,EAAE,YAAY,GAAE,MAAM,EAAO;IAKnE;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,aAAa,GAAG,IAAI;IA8FnE;;;;;;OAMG;IACH,IAAI,IAAI,aAAa;IA2CrB;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;IASzB;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI;CAevE"}