vulpemventures / nigiri

🍣 A delicious docker box for special Bitcoin, Lightning and Liquid cookings
https://nigiri.vulpem.com
MIT License
273 stars 44 forks source link

nigiri mint not always returning object keys in same order #114

Open Janaka-Steph opened 3 years ago

Janaka-Steph commented 3 years ago

Example

$ nigiri mint $(nigiri rpc --liquid getnewaddress) 100000 A Aaa
asset: 9ea078c11a20f0d9494bc75548d0b7125605e5a5fca8ec372106c2275b159091
issuance_txin:
  txid: 859c1dd51e7c82fc53415cc31d14e903e7fbe8966c4a5fc5bd41bfc95a22224e
  vin: 0
txId: 2466c0bde0df998fda2f74ff5f671f90db45cc74281452aaff2750a3523e37fd
$ nigiri mint $(nigiri rpc --liquid getnewaddress) 100000 A Aaa
issuance_txin:
  txid: f8a8b14ce9b9799ec3efa277e5987fa9a1127420ed6e5680aef6d5aa853b3df1
  vin: 0
txId: b640c1d6a467812849d54787037c51ee28df42a684abba28ede68fbbd0762e04
asset: fd192a7f3884c7d0ee18afa3529a2019d2b77e5b63ea13c9b2e78e0e77395466

This is annoying when command is used in bash script.

louisinger commented 3 years ago

I encountered the same problem: I used this command --> shitcoin=$(nigiri mint $addressmarket 100 | grep '^asset: ' | cut -d ':' -f 2 | tr -d ' ')

tiero commented 3 years ago

That's because we unmarshal the returning JSON (from chopsticks endpoint) in a golang map[string]interface{} which namely do not maintain order of keys.

Would be maybe easier to just return the asset hash information in the nigiri mint command