Skip to content

Commit

Permalink
fix transaction decode format
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricfung committed Oct 14, 2023
1 parent 2e1883b commit f5522f9
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -845,10 +845,11 @@ func setupTestNetCmd(c *cli.Context) error {
"balance": "13439",
})
}
custodian := randomPubAccount()
genesis := map[string]any{
"epoch": time.Now().Unix(),
"nodes": inputs,
"custodian": randomPubAccount(),
"custodian": custodian,
}
genesisData, err := json.MarshalIndent(genesis, "", " ")
if err != nil {
Expand All @@ -862,6 +863,9 @@ func setupTestNetCmd(c *cli.Context) error {
}
peersList := `"` + strings.Join(peers, `","`) + `"`
fmt.Println(peers)
fmt.Printf("custodian:\t%s\n", custodian.String())
fmt.Printf("view key:\t%s\n", custodian.PrivateViewKey.String())
fmt.Printf("spend key:\t%s\n", custodian.PrivateSpendKey.String())

for i, a := range signers {
dir := fmt.Sprintf("/tmp/mixin-700%d", i+1)
Expand All @@ -876,8 +880,6 @@ signer-key = "%s"
consensus-only = true
memory-cache-size = 128
cache-ttl = 3600
ring-cache-size = 4096
ring-final-size = 16384
[network]
listener = "%s"
peers = [%s]
Expand Down Expand Up @@ -1019,13 +1021,23 @@ func transactionToMap(tx *common.VersionedTransaction) map[string]any {
inputs = append(inputs, map[string]any{
"genesis": hex.EncodeToString(in.Genesis),
})
} else if in.Deposit != nil {
} else if d := in.Deposit; d != nil {
inputs = append(inputs, map[string]any{
"deposit": in.Deposit,
"deposit": map[string]any{
"chain": d.Chain,
"asset": d.AssetKey,
"transaction": d.Transaction,
"index": d.Index,
"amount": d.Amount,
},
})
} else if in.Mint != nil {
} else if m := in.Mint; m != nil {
inputs = append(inputs, map[string]any{
"mint": in.Mint,
"mint": map[string]any{
"group": m.Group,
"batch": m.Batch,
"amount": m.Amount,
},
})
}
}
Expand Down

0 comments on commit f5522f9

Please sign in to comment.