forked from jeasonstudio/runestone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunestone.js
76 lines (69 loc) · 1.42 KB
/
runestone.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import {
Edict,
Etching,
Range,
Rune,
RuneId,
Runestone,
SpacedRune,
Terms,
} from '../runestone/index.js';
const tx = {
output: [
{
script_pubkey:
'51203b8b3ab1453eb47e2d4903b963776680e30863df3625d3e74292338ae7928da1',
value: 1797928002,
},
{
script_pubkey:
'6a5d21020704b5e1d8e1c8eeb788a30705a02d039f3e01020680dc9afd2808c7e8430a64',
value: 0,
},
],
};
const runestone = Runestone.decipher(tx);
console.log('runestone etching:', runestone.toJSON());
console.log(runestone.encipher());
console.log(
'runestone mint:',
Runestone.decipher({
output: [
{
script_pubkey:
'51206da59bfd6b08756375d62e8e38e55db6edaaf20a12b3e6e7f3aa36afcfc3c931',
value: 0,
},
{
script_pubkey: '6a5d0914f8a83314f0031600',
value: 0,
},
],
}).toJSON()
);
console.log(
'runestone edicts:',
Runestone.decipher({
output: [
{
script_pubkey: '6a5d0800c0a23301d00f00',
value: 0,
},
],
}).toJSON()
);
const spacedRune = SpacedRune.fromString('HI•JEASON');
const etching = new Etching({
rune: 1n,
spacers: 2,
premine: 100n,
// terms: new Terms({ amount: 69n, cap: 420n }),
});
const rs = new Runestone({
etching,
});
console.log(rs.toJSON());
const edict = new Edict(new RuneId(840000n, 1), 10000n, 0);
rs.edicts = [edict];
console.log(rs.toJSON());
console.log(rs.encipher());