From 9bb92144646b1949542844a3ab19d13d3d3ac195 Mon Sep 17 00:00:00 2001 From: Gkirito Date: Mon, 15 Apr 2024 00:04:48 +0800 Subject: [PATCH] feat(core/btc): add json tag --- core/btc/runes/edict.go | 6 +++--- core/btc/runes/etching.go | 14 +++++++------- core/btc/runes/rune_id.go | 4 ++-- core/btc/runes/runestone.go | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/core/btc/runes/edict.go b/core/btc/runes/edict.go index 5e555f8..d28deb7 100644 --- a/core/btc/runes/edict.go +++ b/core/btc/runes/edict.go @@ -6,9 +6,9 @@ import ( ) type Edict struct { - Id RuneId - Amount big.Int - Output uint32 + Id RuneId `json:"id"` + Amount big.Int `json:"amount"` + Output uint32 `json:"output"` } func NewEdictFromIntegers(tx *wire.MsgTx, id RuneId, amount big.Int, output big.Int) *Edict { diff --git a/core/btc/runes/etching.go b/core/btc/runes/etching.go index 8fbefcb..d2d4059 100644 --- a/core/btc/runes/etching.go +++ b/core/btc/runes/etching.go @@ -3,13 +3,13 @@ package runes import "math/big" type Etching struct { - Divisibility *byte - Premine *big.Int - Rune *Rune - Spacers *uint32 - Symbol *rune - Terms *Terms - Turbo bool + Divisibility *uint8 `json:"divisibility"` + Premine *big.Int `json:"premine"` + Rune *Rune `json:"rune"` + Spacers *uint32 `json:"spacers"` + Symbol *rune `json:"symbol"` + Terms *Terms `json:"terms"` + Turbo bool `json:"turbo"` } const ( diff --git a/core/btc/runes/rune_id.go b/core/btc/runes/rune_id.go index 047c6bd..7cea289 100644 --- a/core/btc/runes/rune_id.go +++ b/core/btc/runes/rune_id.go @@ -13,8 +13,8 @@ var ( ) type RuneId struct { - Block uint64 - Tx uint32 + Block uint64 `json:"block"` + Tx uint32 `json:"tx"` } func (r *RuneId) Next(block big.Int, tx big.Int) *RuneId { diff --git a/core/btc/runes/runestone.go b/core/btc/runes/runestone.go index 0657af3..3a5731d 100644 --- a/core/btc/runes/runestone.go +++ b/core/btc/runes/runestone.go @@ -25,10 +25,10 @@ type Artifact interface { } type Runestone struct { - Edicts []Edict - Etching *Etching - Mint *RuneId - Pointer *uint32 + Edicts []Edict `json:"edicts"` + Etching *Etching `json:"etching"` + Mint *RuneId `json:"mint"` + Pointer *uint32 `json:"pointer"` } func (r Runestone) artifact() {