Skip to content

Commit

Permalink
chore: update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
jeasonstudio committed Apr 30, 2024
1 parent 8ba038e commit 3bee972
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
.DS_Store

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ const toHexString = (bytes) =>

// decipher
// See https://mempool.space/tx/2bb85f4b004be6da54f766c17c1e855187327112c231ef2ff35ebad0ea67c69e
const runestone = Runestone.decipher(
fromHexString(
// OP_RETURN OP_PUSHNUM_13 ...
'6a5d21020704b5e1d8e1c8eeb788a30705a02d039f3e01020680dc9afd2808c7e8430a64'
)
);
const tx = {
output: [{
// // OP_RETURN OP_PUSHNUM_13 ...
script_pubkey: fromHexString('6a5d1f02010480bbb180c5ddf4ede90303a40805b5e9070680809dd085bedd031601'),
value: 0,
}],
};
const runestone = Runestone.decipher(tx);

console.log('edicts:', runestone.edicts); // []
const etching = runestone.etching;
Expand Down
35 changes: 32 additions & 3 deletions examples/runestone.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,38 @@
</head>
<body>
<script type="module">
import { Rune } from 'https://esm.sh/@ordjs/runestone@latest/bundle';
const rune = new Rune(1n);
console.log(rune.toString());
import { Runestone } from 'https://esm.sh/@ordjs/runestone@latest/bundle';

const fromHexString = (hexString) =>
Uint8Array.from(
hexString.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))
);

const tx = {
output: [
{
script_pubkey: fromHexString(
'6a5d1f02010480bbb180c5ddf4ede90303a40805b5e9070680809dd085bedd031601'
),
value: 0,
},
{
script_pubkey: fromHexString(
'5120f74ffbe050dae50a5564d8c9ff57e5bc2fc931225402e4fa751bb21c7da53560'
),
value: 546,
},
{
script_pubkey: fromHexString(
'0014e08b4212e2a63e1cce78e1ccfbe326a0b8380968'
),
value: 2158,
},
],
input: [],
};
const runestone = Runestone.decipher(tx);
console.log(runestone);
</script>
</body>
</html>
14 changes: 13 additions & 1 deletion examples/runestone.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,22 @@ const tx = {
output: [
{
script_pubkey: fromHexString(
'6a5d21020704b5e1d8e1c8eeb788a30705a02d039f3e01020680dc9afd2808c7e8430a64'
'6a5d1f02010480bbb180c5ddf4ede90303a40805b5e9070680809dd085bedd031601'
),
value: 0,
},
{
script_pubkey: fromHexString(
'5120f74ffbe050dae50a5564d8c9ff57e5bc2fc931225402e4fa751bb21c7da53560'
),
value: 546,
},
{
script_pubkey: fromHexString(
'0014e08b4212e2a63e1cce78e1ccfbe326a0b8380968'
),
value: 2158,
},
],
input: [],
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ordjs/runestone",
"version": "1.1.0",
"version": "1.2.0",
"description": "Ordinals runestone javascript implementation",
"type": "module",
"scripts": {
Expand Down

0 comments on commit 3bee972

Please sign in to comment.