xpi-ts 0.2.21 → 0.2.22
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/cjs/index.js +2 -2
- package/dist/cjs/lib/bitcore/crypto/schnorr.js +1 -5
- package/dist/cjs/lib/bitcore/script/taproot.js +1 -1
- package/dist/cjs/lib/lokad.js +604 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/lib/bitcore/crypto/schnorr.js +1 -5
- package/dist/esm/lib/bitcore/script/taproot.js +1 -1
- package/dist/esm/lib/lokad.js +586 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/schnorr.d.ts +0 -1
- package/dist/types/lib/bitcore/crypto/schnorr.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script/taproot.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/input.d.ts.map +1 -1
- package/dist/types/lib/lokad.d.ts +136 -0
- package/dist/types/lib/lokad.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
import { BufferUtil, Opcode, Script } from './bitcore';
|
|
2
|
+
import { MAX_OP_RETURN_DATA, RNKC_MIN_DATA_LENGTH, RNKC_MIN_FEE_RATE, } from '../utils/constants.js';
|
|
3
|
+
import { toHex } from '../utils/string';
|
|
4
|
+
export const LOKAD_PREFIX_RANK = 0x52414e4b;
|
|
5
|
+
export const LOKAD_PREFIX_RNKC = 0x524e4b43;
|
|
6
|
+
export const LOKAD_PREFIX_RNKE = 0x524e4b45;
|
|
7
|
+
export const SCRIPT_CHUNK_LOKAD = new Map();
|
|
8
|
+
SCRIPT_CHUNK_LOKAD.set(LOKAD_PREFIX_RANK, 'RANK');
|
|
9
|
+
SCRIPT_CHUNK_LOKAD.set(LOKAD_PREFIX_RNKC, 'RNKC');
|
|
10
|
+
SCRIPT_CHUNK_LOKAD.set(LOKAD_PREFIX_RNKE, 'RNKE');
|
|
11
|
+
export const RANK_SENTIMENT_NEUTRAL = Opcode.OP_16;
|
|
12
|
+
export const RANK_SENTIMENT_POSITIVE = Opcode.OP_1;
|
|
13
|
+
export const RANK_SENTIMENT_NEGATIVE = Opcode.OP_0;
|
|
14
|
+
export const SCRIPT_CHUNK_SENTIMENT = new Map();
|
|
15
|
+
SCRIPT_CHUNK_SENTIMENT.set(RANK_SENTIMENT_NEUTRAL, 'neutral');
|
|
16
|
+
SCRIPT_CHUNK_SENTIMENT.set(RANK_SENTIMENT_POSITIVE, 'positive');
|
|
17
|
+
SCRIPT_CHUNK_SENTIMENT.set(RANK_SENTIMENT_NEGATIVE, 'negative');
|
|
18
|
+
export const RANK_SENTIMENT_OP_CODES = new Map();
|
|
19
|
+
RANK_SENTIMENT_OP_CODES.set('neutral', 'OP_16');
|
|
20
|
+
RANK_SENTIMENT_OP_CODES.set('positive', 'OP_1');
|
|
21
|
+
RANK_SENTIMENT_OP_CODES.set('negative', 'OP_0');
|
|
22
|
+
export const SCRIPT_CHUNK_PLATFORM = new Map();
|
|
23
|
+
SCRIPT_CHUNK_PLATFORM.set(0x00, 'lotusia');
|
|
24
|
+
SCRIPT_CHUNK_PLATFORM.set(0x01, 'twitter');
|
|
25
|
+
export const ScriptChunksRNKCMap = new Map();
|
|
26
|
+
ScriptChunksRNKCMap.set('platform', {
|
|
27
|
+
offset: 7,
|
|
28
|
+
len: 1,
|
|
29
|
+
map: SCRIPT_CHUNK_PLATFORM,
|
|
30
|
+
});
|
|
31
|
+
ScriptChunksRNKCMap.set('profileId', {
|
|
32
|
+
offset: 9,
|
|
33
|
+
len: null,
|
|
34
|
+
});
|
|
35
|
+
ScriptChunksRNKCMap.set('postId', {
|
|
36
|
+
offset: null,
|
|
37
|
+
len: null,
|
|
38
|
+
});
|
|
39
|
+
ScriptChunksRNKCMap.set('comment', {
|
|
40
|
+
offset: null,
|
|
41
|
+
len: null,
|
|
42
|
+
});
|
|
43
|
+
export const RANK_SCRIPT_REQUIRED_LENGTH = 10;
|
|
44
|
+
export const ScriptChunksRANKMap = new Map();
|
|
45
|
+
ScriptChunksRANKMap.set('sentiment', {
|
|
46
|
+
offset: 6,
|
|
47
|
+
len: 1,
|
|
48
|
+
map: SCRIPT_CHUNK_SENTIMENT,
|
|
49
|
+
});
|
|
50
|
+
ScriptChunksRANKMap.set('platform', {
|
|
51
|
+
offset: 8,
|
|
52
|
+
len: 1,
|
|
53
|
+
map: SCRIPT_CHUNK_PLATFORM,
|
|
54
|
+
});
|
|
55
|
+
ScriptChunksRANKMap.set('profileId', {
|
|
56
|
+
offset: 10,
|
|
57
|
+
len: null,
|
|
58
|
+
});
|
|
59
|
+
export const ScriptChunksOptionalRANKMap = new Map();
|
|
60
|
+
ScriptChunksOptionalRANKMap.set('postId', {
|
|
61
|
+
offset: null,
|
|
62
|
+
len: null,
|
|
63
|
+
});
|
|
64
|
+
ScriptChunksOptionalRANKMap.set('instanceId', {
|
|
65
|
+
offset: null,
|
|
66
|
+
len: null,
|
|
67
|
+
});
|
|
68
|
+
export const PlatformConfiguration = new Map();
|
|
69
|
+
PlatformConfiguration.set('lotusia', {
|
|
70
|
+
profileId: {
|
|
71
|
+
len: 33,
|
|
72
|
+
regex: /^[0-9a-fA-F]{40,66}$/,
|
|
73
|
+
},
|
|
74
|
+
postId: {
|
|
75
|
+
len: 32,
|
|
76
|
+
regex: /^[0-9a-f]{64}$/,
|
|
77
|
+
type: 'String',
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
PlatformConfiguration.set('twitter', {
|
|
81
|
+
profileId: {
|
|
82
|
+
len: 16,
|
|
83
|
+
regex: /^[a-z0-9_]{1,16}$/,
|
|
84
|
+
},
|
|
85
|
+
postId: {
|
|
86
|
+
len: 8,
|
|
87
|
+
regex: /^[0-9]+$/,
|
|
88
|
+
type: 'BigInt',
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
export function isOpReturn(script) {
|
|
92
|
+
if (typeof script === 'string') {
|
|
93
|
+
script = BufferUtil.from(script, 'hex');
|
|
94
|
+
}
|
|
95
|
+
return script.readUInt8(0) === Opcode.OP_RETURN;
|
|
96
|
+
}
|
|
97
|
+
export function toProfileIdBuf(platform, profileId) {
|
|
98
|
+
const platformSpec = PlatformConfiguration.get(platform);
|
|
99
|
+
if (!platformSpec) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
const profileIdSpec = platformSpec.profileId;
|
|
103
|
+
if (!profileIdSpec) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
if (profileIdSpec.regex && !profileIdSpec.regex.test(profileId)) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
switch (platform) {
|
|
110
|
+
case 'lotusia': {
|
|
111
|
+
const profileIdHex = BufferUtil.from(profileId, 'hex');
|
|
112
|
+
const actualLen = profileIdHex.length;
|
|
113
|
+
if (actualLen !== 20 && actualLen !== 33) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
const profileBuf = BufferUtil.alloc(actualLen);
|
|
117
|
+
profileIdHex.copy(profileBuf, 0);
|
|
118
|
+
return profileBuf;
|
|
119
|
+
}
|
|
120
|
+
case 'twitter': {
|
|
121
|
+
const profileBuf = BufferUtil.alloc(profileIdSpec.len);
|
|
122
|
+
BufferUtil.from(profileId, 'utf8').copy(profileBuf, profileIdSpec.len - profileId.length);
|
|
123
|
+
return profileBuf;
|
|
124
|
+
}
|
|
125
|
+
default:
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
export function toProfileIdUTF8(profileIdBuf) {
|
|
130
|
+
return new TextDecoder('utf-8').decode(profileIdBuf.filter(byte => byte != 0x00));
|
|
131
|
+
}
|
|
132
|
+
export function toPostIdBuf(platform, postId) {
|
|
133
|
+
switch (platform) {
|
|
134
|
+
case 'lotusia':
|
|
135
|
+
return BufferUtil.from(postId, 'hex');
|
|
136
|
+
case 'twitter':
|
|
137
|
+
return BufferUtil.from(BigInt(postId).toString(16), 'hex');
|
|
138
|
+
default:
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
export function toPlatformBuf(platform) {
|
|
143
|
+
for (const [byte, platformName] of SCRIPT_CHUNK_PLATFORM) {
|
|
144
|
+
if (platformName == platform) {
|
|
145
|
+
return BufferUtil.from([byte]);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
export function toPlatformUTF8(platformBuf) {
|
|
150
|
+
return SCRIPT_CHUNK_PLATFORM.get(platformBuf.readUInt8(0));
|
|
151
|
+
}
|
|
152
|
+
export function toSentimentOpCode(sentiment) {
|
|
153
|
+
return RANK_SENTIMENT_OP_CODES.get(sentiment);
|
|
154
|
+
}
|
|
155
|
+
export function toSentimentUTF8(sentimentBuf) {
|
|
156
|
+
return SCRIPT_CHUNK_SENTIMENT.get(sentimentBuf.readUInt8(0));
|
|
157
|
+
}
|
|
158
|
+
export function toCommentUTF8(commentBuf) {
|
|
159
|
+
return new TextDecoder('utf-8').decode(commentBuf);
|
|
160
|
+
}
|
|
161
|
+
export function isValidLokad(scriptChunk, lokadType) {
|
|
162
|
+
let result = scriptChunk.buf !== undefined &&
|
|
163
|
+
scriptChunk.buf.length === 4 &&
|
|
164
|
+
SCRIPT_CHUNK_LOKAD.has(scriptChunk.buf.readUInt32BE(0));
|
|
165
|
+
if (lokadType) {
|
|
166
|
+
result =
|
|
167
|
+
result &&
|
|
168
|
+
scriptChunk.buf !== undefined &&
|
|
169
|
+
SCRIPT_CHUNK_LOKAD.get(scriptChunk.buf?.readUInt32BE(0)) === lokadType;
|
|
170
|
+
}
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
export function fromScriptRANK(scriptBuf) {
|
|
174
|
+
const script = typeof scriptBuf === 'string'
|
|
175
|
+
? Script.fromString(scriptBuf)
|
|
176
|
+
: Script.fromBuffer(scriptBuf);
|
|
177
|
+
if (!script.isDataOut()) {
|
|
178
|
+
throw new Error('Script is not OP_RETURN');
|
|
179
|
+
}
|
|
180
|
+
if (!isValidLokad(script.chunks[1], 'RANK')) {
|
|
181
|
+
throw new Error('LOKAD chunk is either invalid or unsupported');
|
|
182
|
+
}
|
|
183
|
+
const sentiment = SCRIPT_CHUNK_SENTIMENT.get(script.chunks[2].opcodenum);
|
|
184
|
+
if (!sentiment) {
|
|
185
|
+
throw new Error('Invalid sentiment chunk');
|
|
186
|
+
}
|
|
187
|
+
const platform = SCRIPT_CHUNK_PLATFORM.get(script.chunks[3].buf?.readUInt8(0));
|
|
188
|
+
if (!platform) {
|
|
189
|
+
throw new Error('Invalid platform chunk');
|
|
190
|
+
}
|
|
191
|
+
const platformSpec = PlatformConfiguration.get(platform);
|
|
192
|
+
if (!platformSpec) {
|
|
193
|
+
throw new Error('Invalid platform spec');
|
|
194
|
+
}
|
|
195
|
+
const profileIdChunk = script.chunks[4];
|
|
196
|
+
if (profileIdChunk.buf === undefined ||
|
|
197
|
+
profileIdChunk.buf.length !== platformSpec.profileId.len) {
|
|
198
|
+
throw new Error(`Invalid profileId chunk (profileId chunk missing or length does not match platform ${platform})`);
|
|
199
|
+
}
|
|
200
|
+
const profileId = toProfileIdUTF8(profileIdChunk.buf);
|
|
201
|
+
if (!platformSpec.profileId.regex.test(profileId)) {
|
|
202
|
+
throw new Error(`Invalid profileId "${profileId}" (regex does not match for platform ${platform})`);
|
|
203
|
+
}
|
|
204
|
+
const data = {
|
|
205
|
+
sentiment,
|
|
206
|
+
platform,
|
|
207
|
+
profileId,
|
|
208
|
+
};
|
|
209
|
+
if (script.chunks.length > 5) {
|
|
210
|
+
const postIdChunk = script.chunks[5];
|
|
211
|
+
if (postIdChunk.buf === undefined) {
|
|
212
|
+
throw new Error('Invalid postId chunk (postId chunk missing)');
|
|
213
|
+
}
|
|
214
|
+
if (platformSpec.postId?.type === 'BigInt') {
|
|
215
|
+
data.postId = postIdChunk.buf.readBigUInt64BE(0).toString();
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
data.postId = postIdChunk.buf.toString('hex');
|
|
219
|
+
}
|
|
220
|
+
if (platformSpec.postId?.regex &&
|
|
221
|
+
!platformSpec.postId.regex.test(data.postId)) {
|
|
222
|
+
throw new Error(`Invalid postId "${data.postId}" (regex does not match for platform ${platform})`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return data;
|
|
226
|
+
}
|
|
227
|
+
export function toScriptRANK(sentiment, platform, profileId, postId) {
|
|
228
|
+
if (!sentiment || !platform || !profileId) {
|
|
229
|
+
throw new Error('Must specify sentiment, platform, and profileId');
|
|
230
|
+
}
|
|
231
|
+
const platformSpec = PlatformConfiguration.get(platform);
|
|
232
|
+
if (!platformSpec || !platformSpec.profileId) {
|
|
233
|
+
throw new Error(`RANK outputs for platform ${platform} are not supported`);
|
|
234
|
+
}
|
|
235
|
+
const script = Script.empty()
|
|
236
|
+
.add(Opcode.OP_RETURN)
|
|
237
|
+
.add(BufferUtil.from(toHex(LOKAD_PREFIX_RANK), 'hex'));
|
|
238
|
+
switch (sentiment) {
|
|
239
|
+
case 'neutral':
|
|
240
|
+
script.add(RANK_SENTIMENT_NEUTRAL);
|
|
241
|
+
break;
|
|
242
|
+
case 'positive':
|
|
243
|
+
script.add(RANK_SENTIMENT_POSITIVE);
|
|
244
|
+
break;
|
|
245
|
+
case 'negative':
|
|
246
|
+
script.add(RANK_SENTIMENT_NEGATIVE);
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
script.add(toPlatformBuf(platform));
|
|
250
|
+
const profileIdBuf = toProfileIdBuf(platform, profileId);
|
|
251
|
+
script.add(profileIdBuf);
|
|
252
|
+
if (postId) {
|
|
253
|
+
if (!platformSpec.postId) {
|
|
254
|
+
throw new Error('Post ID provided, but no platform post specification defined');
|
|
255
|
+
}
|
|
256
|
+
script.add(toPostIdBuf(platform, postId));
|
|
257
|
+
}
|
|
258
|
+
return script.toBuffer();
|
|
259
|
+
}
|
|
260
|
+
export function fromScriptRNKC(scriptBuf, supplementalScriptBufs, burnedSats, options) {
|
|
261
|
+
const script = typeof scriptBuf === 'string'
|
|
262
|
+
? Script.fromString(scriptBuf)
|
|
263
|
+
: Script.fromBuffer(scriptBuf);
|
|
264
|
+
if (!script.isDataOut()) {
|
|
265
|
+
throw new Error('Script is not OP_RETURN');
|
|
266
|
+
}
|
|
267
|
+
if (!isValidLokad(script.chunks[1], 'RNKC')) {
|
|
268
|
+
throw new Error('LOKAD chunk is either invalid or unsupported');
|
|
269
|
+
}
|
|
270
|
+
const supplementalScripts = supplementalScriptBufs.map(s => typeof s === 'string' ? Script.fromString(s) : Script.fromBuffer(s));
|
|
271
|
+
const platform = SCRIPT_CHUNK_PLATFORM.get(script.chunks[2].buf?.readUInt8(0));
|
|
272
|
+
if (!platform) {
|
|
273
|
+
throw new Error('Invalid platform chunk');
|
|
274
|
+
}
|
|
275
|
+
const platformSpec = PlatformConfiguration.get(platform);
|
|
276
|
+
if (!platformSpec) {
|
|
277
|
+
throw new Error('Platform configuration not found');
|
|
278
|
+
}
|
|
279
|
+
const profileIdChunk = script.chunks[3];
|
|
280
|
+
if (!profileIdChunk?.buf) {
|
|
281
|
+
throw new Error('Invalid profileId chunk');
|
|
282
|
+
}
|
|
283
|
+
const profileId = toProfileIdUTF8(profileIdChunk.buf);
|
|
284
|
+
if (!platformSpec.profileId.regex.test(profileId)) {
|
|
285
|
+
throw new Error('Invalid profileId format for platform');
|
|
286
|
+
}
|
|
287
|
+
let postId;
|
|
288
|
+
if (script.chunks.length > 4 && script.chunks[4]?.buf) {
|
|
289
|
+
if (!platformSpec.postId) {
|
|
290
|
+
throw new Error('Post ID found but platform does not support post IDs');
|
|
291
|
+
}
|
|
292
|
+
postId = script.chunks[4].buf.toString('utf8');
|
|
293
|
+
if (!platformSpec.postId.regex.test(postId)) {
|
|
294
|
+
throw new Error('Invalid postId format for platform');
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
let commentBuf = BufferUtil.alloc(0);
|
|
298
|
+
for (const supplementalScript of supplementalScripts) {
|
|
299
|
+
if (!supplementalScript.isDataOut()) {
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
const chunks = supplementalScript.chunks;
|
|
303
|
+
if (chunks.length < 2 || !chunks[1]?.buf) {
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
commentBuf = BufferUtil.concat([commentBuf, chunks[1].buf]);
|
|
307
|
+
}
|
|
308
|
+
if (commentBuf.length === 0) {
|
|
309
|
+
throw new Error('No comment data found in supplemental scripts');
|
|
310
|
+
}
|
|
311
|
+
const minDataLength = options?.minDataLength ?? RNKC_MIN_DATA_LENGTH;
|
|
312
|
+
const minFeeRate = options?.minFeeRate ?? RNKC_MIN_FEE_RATE;
|
|
313
|
+
if (commentBuf.length < minDataLength) {
|
|
314
|
+
throw new Error(`Comment data length ${commentBuf.length} is below minimum ${minDataLength}`);
|
|
315
|
+
}
|
|
316
|
+
const burnedSatsNum = typeof burnedSats === 'bigint' ? Number(burnedSats) : burnedSats;
|
|
317
|
+
if (burnedSatsNum < minFeeRate * commentBuf.length) {
|
|
318
|
+
throw new Error(`Fee rate too low: ${Math.floor(burnedSatsNum / commentBuf.length)} < ${minFeeRate}`);
|
|
319
|
+
}
|
|
320
|
+
const result = {
|
|
321
|
+
data: new Uint8Array(commentBuf),
|
|
322
|
+
feeRate: Math.floor(burnedSatsNum / commentBuf.length),
|
|
323
|
+
inReplyToPlatform: platform,
|
|
324
|
+
inReplyToProfileId: profileId,
|
|
325
|
+
inReplyToPostId: postId,
|
|
326
|
+
};
|
|
327
|
+
if (!result) {
|
|
328
|
+
throw new Error('Failed to process RNKC script');
|
|
329
|
+
}
|
|
330
|
+
return result;
|
|
331
|
+
}
|
|
332
|
+
export function toScriptRNKC({ platform, profileId, postId, comment, }) {
|
|
333
|
+
if (!platform || !profileId) {
|
|
334
|
+
throw new Error('Must specify platform and profileId');
|
|
335
|
+
}
|
|
336
|
+
const platformSpec = PlatformConfiguration.get(platform);
|
|
337
|
+
if (!platformSpec || !platformSpec.profileId) {
|
|
338
|
+
throw new Error(`RNKC outputs for platform ${platform} are not supported`);
|
|
339
|
+
}
|
|
340
|
+
if (!platformSpec.profileId.regex.test(profileId)) {
|
|
341
|
+
throw new Error(`Invalid profileId: ${profileId}`);
|
|
342
|
+
}
|
|
343
|
+
if (postId && !platformSpec.postId.regex.test(postId)) {
|
|
344
|
+
throw new Error(`Invalid postId: ${postId}`);
|
|
345
|
+
}
|
|
346
|
+
const commentBuf = BufferUtil.from(comment, 'utf8');
|
|
347
|
+
if (commentBuf.length < 1 || commentBuf.length > MAX_OP_RETURN_DATA * 2) {
|
|
348
|
+
throw new Error(`Comment must be between 1 and ${MAX_OP_RETURN_DATA * 2} bytes`);
|
|
349
|
+
}
|
|
350
|
+
const scriptBufs = [];
|
|
351
|
+
const script0 = Script.empty()
|
|
352
|
+
.add(Opcode.OP_RETURN)
|
|
353
|
+
.add(BufferUtil.from(toHex(LOKAD_PREFIX_RNKC), 'hex'))
|
|
354
|
+
.add(toPlatformBuf(platform))
|
|
355
|
+
.add(toProfileIdBuf(platform, profileId));
|
|
356
|
+
if (postId) {
|
|
357
|
+
script0.add(toPostIdBuf(platform, postId));
|
|
358
|
+
}
|
|
359
|
+
scriptBufs.push(script0.toBuffer());
|
|
360
|
+
const commentBuf1 = commentBuf.slice(0, MAX_OP_RETURN_DATA);
|
|
361
|
+
const script1 = Script.empty().add(Opcode.OP_RETURN).add(commentBuf1);
|
|
362
|
+
scriptBufs.push(script1.toBuffer());
|
|
363
|
+
if (commentBuf.length > MAX_OP_RETURN_DATA) {
|
|
364
|
+
const commentBuf2 = commentBuf.slice(MAX_OP_RETURN_DATA);
|
|
365
|
+
const script2 = Script.empty().add(Opcode.OP_RETURN).add(commentBuf2);
|
|
366
|
+
scriptBufs.push(script2.toBuffer());
|
|
367
|
+
}
|
|
368
|
+
return scriptBufs;
|
|
369
|
+
}
|
|
370
|
+
export class ScriptProcessor {
|
|
371
|
+
chunks = null;
|
|
372
|
+
script;
|
|
373
|
+
supplementalScripts = [];
|
|
374
|
+
constructor(script) {
|
|
375
|
+
this.script = script;
|
|
376
|
+
switch (this.lokadType) {
|
|
377
|
+
case 'RANK':
|
|
378
|
+
this.chunks = ScriptChunksRANKMap;
|
|
379
|
+
break;
|
|
380
|
+
case 'RNKC':
|
|
381
|
+
this.chunks = ScriptChunksRNKCMap;
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
addScript(script) {
|
|
386
|
+
if (!BufferUtil.isBuffer(script)) {
|
|
387
|
+
script = BufferUtil.from(script, 'hex');
|
|
388
|
+
}
|
|
389
|
+
if (!isOpReturn(script)) {
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
this.supplementalScripts.push(script);
|
|
393
|
+
return true;
|
|
394
|
+
}
|
|
395
|
+
get lokadType() {
|
|
396
|
+
return this.processLokad();
|
|
397
|
+
}
|
|
398
|
+
processLokad() {
|
|
399
|
+
const lokadBuf = this.script.slice(2, 6);
|
|
400
|
+
const lokad = SCRIPT_CHUNK_LOKAD.get(lokadBuf.readUInt32BE(0));
|
|
401
|
+
if (!lokad) {
|
|
402
|
+
return undefined;
|
|
403
|
+
}
|
|
404
|
+
return lokad;
|
|
405
|
+
}
|
|
406
|
+
processSentiment() {
|
|
407
|
+
const chunk = this.chunks?.get('sentiment');
|
|
408
|
+
if (!chunk || chunk.offset === null) {
|
|
409
|
+
return undefined;
|
|
410
|
+
}
|
|
411
|
+
const sentimentBuf = this.script.slice(chunk.offset, chunk.offset + chunk.len);
|
|
412
|
+
return SCRIPT_CHUNK_SENTIMENT.get(sentimentBuf.readUInt8(0));
|
|
413
|
+
}
|
|
414
|
+
processPlatform() {
|
|
415
|
+
const chunk = this.chunks?.get('platform');
|
|
416
|
+
if (!chunk || chunk.offset === null) {
|
|
417
|
+
return undefined;
|
|
418
|
+
}
|
|
419
|
+
const platformBuf = this.script.slice(chunk.offset, chunk.offset + chunk.len);
|
|
420
|
+
const platform = SCRIPT_CHUNK_PLATFORM.get(platformBuf.readUInt8(0));
|
|
421
|
+
if (!platform) {
|
|
422
|
+
return undefined;
|
|
423
|
+
}
|
|
424
|
+
return platform;
|
|
425
|
+
}
|
|
426
|
+
processProfileId(platform) {
|
|
427
|
+
const chunk = this.chunks?.get('profileId');
|
|
428
|
+
if (!chunk || chunk.offset === null) {
|
|
429
|
+
return undefined;
|
|
430
|
+
}
|
|
431
|
+
const platformSpec = PlatformConfiguration.get(platform);
|
|
432
|
+
if (!platformSpec || !platformSpec.profileId) {
|
|
433
|
+
return undefined;
|
|
434
|
+
}
|
|
435
|
+
const pushOpOffset = chunk.offset - 1;
|
|
436
|
+
if (pushOpOffset < 0 || pushOpOffset >= this.script.length) {
|
|
437
|
+
return undefined;
|
|
438
|
+
}
|
|
439
|
+
const actualLen = this.script.readUInt8(pushOpOffset);
|
|
440
|
+
if (platform === 'lotusia' && actualLen !== 20 && actualLen !== 33) {
|
|
441
|
+
return undefined;
|
|
442
|
+
}
|
|
443
|
+
const profileIdBuf = this.script.slice(chunk.offset, chunk.offset + actualLen);
|
|
444
|
+
if (profileIdBuf.length !== actualLen) {
|
|
445
|
+
return undefined;
|
|
446
|
+
}
|
|
447
|
+
switch (platform) {
|
|
448
|
+
case 'lotusia':
|
|
449
|
+
return toHex(profileIdBuf);
|
|
450
|
+
case 'twitter':
|
|
451
|
+
return toProfileIdUTF8(profileIdBuf);
|
|
452
|
+
default:
|
|
453
|
+
return undefined;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
processPostId(platform) {
|
|
457
|
+
if (!platform) {
|
|
458
|
+
return undefined;
|
|
459
|
+
}
|
|
460
|
+
const platformSpec = PlatformConfiguration.get(platform);
|
|
461
|
+
if (!platformSpec || !platformSpec.postId || !platformSpec.profileId) {
|
|
462
|
+
return undefined;
|
|
463
|
+
}
|
|
464
|
+
const profileIdChunk = this.chunks?.get('profileId');
|
|
465
|
+
if (!profileIdChunk?.offset) {
|
|
466
|
+
return undefined;
|
|
467
|
+
}
|
|
468
|
+
const profileIdPushOpOffset = profileIdChunk.offset - 1;
|
|
469
|
+
if (profileIdPushOpOffset < 0 ||
|
|
470
|
+
profileIdPushOpOffset >= this.script.length) {
|
|
471
|
+
return undefined;
|
|
472
|
+
}
|
|
473
|
+
const actualProfileIdLen = this.script.readUInt8(profileIdPushOpOffset);
|
|
474
|
+
const postIdSpec = platformSpec.postId;
|
|
475
|
+
const postIdOffset = profileIdChunk.offset + actualProfileIdLen + 1;
|
|
476
|
+
if (postIdOffset + postIdSpec.len > this.script.length) {
|
|
477
|
+
return undefined;
|
|
478
|
+
}
|
|
479
|
+
const postIdPushOpOffset = postIdOffset - 1;
|
|
480
|
+
if (postIdPushOpOffset >= this.script.length) {
|
|
481
|
+
return undefined;
|
|
482
|
+
}
|
|
483
|
+
const postIdPushOp = this.script.readUInt8(postIdPushOpOffset);
|
|
484
|
+
if (postIdPushOp !== postIdSpec.len) {
|
|
485
|
+
return undefined;
|
|
486
|
+
}
|
|
487
|
+
const postIdBuf = this.script.slice(postIdOffset, postIdOffset + postIdSpec.len);
|
|
488
|
+
try {
|
|
489
|
+
switch (platform) {
|
|
490
|
+
case 'lotusia':
|
|
491
|
+
return postIdBuf.toString('hex');
|
|
492
|
+
case 'twitter':
|
|
493
|
+
return postIdBuf.readBigUInt64BE(0).toString();
|
|
494
|
+
default:
|
|
495
|
+
return undefined;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
catch (e) {
|
|
499
|
+
return undefined;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
processComment(scripts) {
|
|
503
|
+
let commentBuf = BufferUtil.alloc(0);
|
|
504
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
505
|
+
const script = scripts[i];
|
|
506
|
+
if (script.readUInt8(1) !== Opcode.OP_PUSHDATA1) {
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
509
|
+
const dataSize = script.readUInt8(2);
|
|
510
|
+
if (isNaN(dataSize) || dataSize > MAX_OP_RETURN_DATA) {
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
commentBuf = BufferUtil.concat([
|
|
514
|
+
commentBuf,
|
|
515
|
+
script.slice(3, 3 + dataSize),
|
|
516
|
+
]);
|
|
517
|
+
}
|
|
518
|
+
if (!commentBuf) {
|
|
519
|
+
return null;
|
|
520
|
+
}
|
|
521
|
+
return new Uint8Array(commentBuf);
|
|
522
|
+
}
|
|
523
|
+
processScriptRANK() {
|
|
524
|
+
const sentiment = this.processSentiment();
|
|
525
|
+
if (!sentiment) {
|
|
526
|
+
return null;
|
|
527
|
+
}
|
|
528
|
+
const platform = this.processPlatform();
|
|
529
|
+
if (!platform) {
|
|
530
|
+
return null;
|
|
531
|
+
}
|
|
532
|
+
const profileId = this.processProfileId(platform);
|
|
533
|
+
if (!profileId) {
|
|
534
|
+
return null;
|
|
535
|
+
}
|
|
536
|
+
const output = {
|
|
537
|
+
sentiment,
|
|
538
|
+
platform,
|
|
539
|
+
profileId,
|
|
540
|
+
};
|
|
541
|
+
const postId = this.processPostId(platform);
|
|
542
|
+
if (postId) {
|
|
543
|
+
output.postId = postId;
|
|
544
|
+
}
|
|
545
|
+
return output;
|
|
546
|
+
}
|
|
547
|
+
processScriptRNKC(burnedSats, options) {
|
|
548
|
+
if (typeof burnedSats === 'bigint') {
|
|
549
|
+
burnedSats = Number(burnedSats);
|
|
550
|
+
}
|
|
551
|
+
if (this.supplementalScripts.length === 0 ||
|
|
552
|
+
this.supplementalScripts.length > 2) {
|
|
553
|
+
return null;
|
|
554
|
+
}
|
|
555
|
+
const inReplyToPlatform = this.processPlatform();
|
|
556
|
+
if (!inReplyToPlatform) {
|
|
557
|
+
return null;
|
|
558
|
+
}
|
|
559
|
+
const data = this.processComment(this.supplementalScripts);
|
|
560
|
+
if (!data) {
|
|
561
|
+
return null;
|
|
562
|
+
}
|
|
563
|
+
if (data.length < (options?.minDataLength ?? RNKC_MIN_DATA_LENGTH)) {
|
|
564
|
+
return null;
|
|
565
|
+
}
|
|
566
|
+
if (burnedSats < (options?.minFeeRate ?? RNKC_MIN_FEE_RATE) * data.length) {
|
|
567
|
+
return null;
|
|
568
|
+
}
|
|
569
|
+
const output = {
|
|
570
|
+
data,
|
|
571
|
+
feeRate: Math.floor(burnedSats / data.length),
|
|
572
|
+
inReplyToPlatform,
|
|
573
|
+
inReplyToProfileId: undefined,
|
|
574
|
+
inReplyToPostId: undefined,
|
|
575
|
+
};
|
|
576
|
+
const profileId = this.processProfileId(inReplyToPlatform);
|
|
577
|
+
if (profileId) {
|
|
578
|
+
output.inReplyToProfileId = profileId;
|
|
579
|
+
const postId = this.processPostId(inReplyToPlatform);
|
|
580
|
+
if (postId) {
|
|
581
|
+
output.inReplyToPostId = postId;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return output;
|
|
585
|
+
}
|
|
586
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './lib/rpc.js';
|
|
2
2
|
export * as Bitcore from './lib/bitcore/index.js';
|
|
3
|
-
export * as
|
|
3
|
+
export * as LOKAD from './lib/lokad.js';
|
|
4
4
|
export * from './utils/constants.js';
|
|
5
5
|
export * from './utils/env.js';
|
|
6
6
|
export * from './utils/string.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAKA,cAAc,cAAc,CAAA;AAC5B,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AACjD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAKA,cAAc,cAAc,CAAA;AAC5B,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AACjD,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schnorr.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/crypto/schnorr.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAA;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAKrC,MAAM,WAAW,WAAW;IAE1B,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,MAAM,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAA;IAEzB,OAAO,CAAC,EAAE,UAAU,CAAA;IAEpB,MAAM,CAAC,EAAE,SAAS,CAAA;IAElB,GAAG,CAAC,EAAE,SAAS,CAAA;IAEf,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;
|
|
1
|
+
{"version":3,"file":"schnorr.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/crypto/schnorr.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAA;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAKrC,MAAM,WAAW,WAAW;IAE1B,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,MAAM,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAA;IAEzB,OAAO,CAAC,EAAE,UAAU,CAAA;IAEpB,MAAM,CAAC,EAAE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