forked from 5haman/maltego-btc
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtx.go
More file actions
42 lines (35 loc) · 822 Bytes
/
tx.go
File metadata and controls
42 lines (35 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"encoding/json"
"log"
)
type Input struct {
Address string `json:"address"`
WalletId string `json:"wallet_id"`
Amount float64 `json:"amount"`
}
type Output struct {
Address string `json:"address"`
WalletId string `json:"wallet_id"`
Amount float64 `json:"amount"`
}
type Tx struct {
Time uint64 `json:"time"`
WalletId string `json:"wallet_id"`
Label string `json:"label"`
In []Input `json:"in"`
Out []Output `json:"out"`
}
func GetTx(query string) (tx Tx) {
log.Println("http: get tx", query)
url := ApiUrl + "/tx?txid=" + query + "&caller=" + ApiAgent
txsIn := []Input{}
bytes := HttpRequest(url)
_ = json.Unmarshal(bytes, &tx)
for _, in := range tx.In {
in.WalletId = tx.WalletId
txsIn = append(txsIn, in)
}
tx.In = txsIn
return
}