Skip to content

Commit

Permalink
docs: modify readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jeasonstudio committed May 17, 2024
1 parent 50c70fa commit 33fd565
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 40 deletions.
34 changes: 15 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ const tx: Transaction = {
};

const runestone = Runestone.decipher(tx);
// runestone.divisibility => 2
// runestone.premine => 11000000000
// runestone.symbol => ᚠ
// runestone.terms.amount => 100
// runestone.etching.divisibility => 2
// runestone.etching.premine => 11000000000
// runestone.etching.symbol => ᚠ
// runestone.etching.terms.amount => 100
```

#### Encipher Runestones
Expand All @@ -81,15 +81,15 @@ To deploy a new rune ticker, this will require a commitment in an input script.
```typescript
import { Runestone, Etching, SpacedRune, Terms } from '@ordjs/runestone';

const etching = new Etching(SpacedRune.fromString('HI•JEASON'));
etching.terms = new Terms(69n, 420n);
etching.divisibility = 0;
etching.premine = 0n;
etching.symbol = '$';

const runestone = new Runestone();
runestone.etching = etching;
const etching = new Etching({
spacedRune: SpacedRune.fromString('Hi•JEASON'),
premine: 0n,
terms: new Terms({ amount: 69n, cap: 420n }),
divisibility: 0,
symbol: '$',
});

const runestone = new Runestone({ etching });
console.log(runestone.encipher());
// 6a5d16020704b7fcb396fa0101000302052406000a4508a403
// send runestone.encipher() to the blockchain
Expand All @@ -100,9 +100,7 @@ To mint `UNCOMMON•GOODS`:
```typescript
import { Runestone, RuneId } from '@ordjs/runestone';

const runestone = new Runestone();
runestone.mint = new RuneId(1n, 0);

const runestone = new Runestone({ mint: new RuneId(1n, 0) });
console.log(runestone.encipher());
// 6a5d0414011400
// send runestone.encipher() to the blockchain
Expand All @@ -114,9 +112,7 @@ Transfer 10 `UNCOMMON•GOODS` to output 1:
import { Runestone, Edict, RuneId } from '@ordjs/runestone';

const edict = new Edict(new RuneId(1n, 0), 10n, 1);
const runestone = new Runestone();
runestone.edicts = [edict];

const runestone = new Runestone({ edicts: [edict] });
console.log(runestone.encipher());
// 6a5d050001000a01
// send runestone.encipher() to the blockchain
Expand All @@ -131,7 +127,7 @@ We provide the output format of ESM bundles for easy use in browsers directly:
import { Runestone } from 'https://esm.sh/@ordjs/runestone/bundle';
const rs = Runestone.decipher({...});
console.log(JSON.stringify(rs));
// rs.xxx
</script>
```

Expand Down
36 changes: 17 additions & 19 deletions documents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ $ npm install @ordjs/runestone
## Usage

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/jeasonstudio/runestone/tree/main/examples)

### Runestone

Rune protocol messages, called runestones, are stored in Bitcoin transaction outputs.
Expand All @@ -68,10 +70,10 @@ const tx: Transaction = {
};

const runestone = Runestone.decipher(tx);
// runestone.divisibility => 2
// runestone.premine => 11000000000
// runestone.symbol => ᚠ
// runestone.terms.amount => 100
// runestone.etching.divisibility => 2
// runestone.etching.premine => 11000000000
// runestone.etching.symbol => ᚠ
// runestone.etching.terms.amount => 100
```

#### Encipher Runestones
Expand All @@ -81,15 +83,15 @@ To deploy a new rune ticker, this will require a commitment in an input script.
```typescript
import { Runestone, Etching, SpacedRune, Terms } from '@ordjs/runestone';

const etching = new Etching(SpacedRune.fromString('HI•JEASON'));
etching.terms = new Terms(69n, 420n);
etching.divisibility = 0;
etching.premine = 0n;
etching.symbol = '$';

const runestone = new Runestone();
runestone.etching = etching;
const etching = new Etching({
spacedRune: SpacedRune.fromString('Hi•JEASON'),
premine: 0n,
terms: new Terms({ amount: 69n, cap: 420n }),
divisibility: 0,
symbol: '$',
});

const runestone = new Runestone({ etching });
console.log(runestone.encipher());
// 6a5d16020704b7fcb396fa0101000302052406000a4508a403
// send runestone.encipher() to the blockchain
Expand All @@ -100,9 +102,7 @@ To mint `UNCOMMON•GOODS`:
```typescript
import { Runestone, RuneId } from '@ordjs/runestone';

const runestone = new Runestone();
runestone.mint = new RuneId(1n, 0);

const runestone = new Runestone({ mint: new RuneId(1n, 0) });
console.log(runestone.encipher());
// 6a5d0414011400
// send runestone.encipher() to the blockchain
Expand All @@ -114,9 +114,7 @@ Transfer 10 `UNCOMMON•GOODS` to output 1:
import { Runestone, Edict, RuneId } from '@ordjs/runestone';

const edict = new Edict(new RuneId(1n, 0), 10n, 1);
const runestone = new Runestone();
runestone.edicts = [edict];

const runestone = new Runestone({ edicts: [edict] });
console.log(runestone.encipher());
// 6a5d050001000a01
// send runestone.encipher() to the blockchain
Expand All @@ -131,7 +129,7 @@ We provide the output format of ESM bundles for easy use in browsers directly:
import { Runestone } from 'https://esm.sh/@ordjs/runestone/bundle';
const rs = Runestone.decipher({...});
console.log(JSON.stringify(rs));
// rs.xxx
</script>
```

Expand Down
3 changes: 1 addition & 2 deletions examples/runestone.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ console.log(

const spacedRune = SpacedRune.fromString('HI•JEASON');
const etching = new Etching({
rune: 1n,
spacers: 2,
spacedRune,
premine: 100n,
terms: new Terms({ amount: 69n, cap: 420n }),
});
Expand Down

0 comments on commit 33fd565

Please sign in to comment.