-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodels.go
123 lines (109 loc) · 2.9 KB
/
models.go
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package rum
type AccountInfo struct {
Active bool
PoolId *string
Balance string
Rewards string
Withdrawals string
}
type AssetMetadata = map[string]interface{}
type BlockInfo struct {
Time int
Hash string
Slot string
Epoch int
EpochSlot string
SlotLeader string
Size int
TxCount int
Output string
Fees string
PreviousBlock string
NextBlock string
Confirmations int
OperationalCertificate string
VRFKey string
}
type Network string
const (
Testnet Network = "testnet"
Preview Network = "preview"
Preprod Network = "preprod"
Mainnet Network = "mainnet"
)
var AllNetworks = []Network{Testnet, Preview, Preprod, Mainnet}
func (n Network) String() string {
return string(n)
}
func IsNetwork(value string) bool {
for _, network := range AllNetworks {
if value == network.String() {
return true
}
}
return false
}
type Protocol struct {
Epoch int
MinFeeA int
MinFeeB int
MaxBlockSize int
MaxTxSize int
MaxBlockHeaderSize int
KeyDeposit int
PoolDeposit int
Decentralisation float64
MinPoolCost string
PriceMem float64
PriceStep float64
MaxTxExMem string
MaxTxExSteps string
MaxBlockExMem string
MaxBlockExSteps string
MaxValSize int
CollateralPercent int
MaxCollateralInputs int
CoinsPerUtxoSize int
MinFeeRefScriptCostPerByte int
}
type TransactionInfo struct {
Index int
Block string
Hash string
Slot string
Fees string
Size int
Deposit string
InvalidBefore string
InvalidAfter string
}
type Input struct {
OutputIndex int `json:"output_index" binding:"required"`
TxHash string `json:"tx_hash" binding:"required"`
}
type Output struct {
Address string `json:"address" binding:"required"`
Amount []Asset `json:"amount" binding:"required"`
DataHash string `json:"data_hash,omitempty"`
PlutusData string `json:"plutus_data,omitempty"`
ScriptRef string `json:"script_ref,omitempty"`
ScriptHash string `json:"script_hash,omitempty"`
}
type UTxO struct {
Input Input `json:"input" binding:"required"`
Output Output `json:"output" binding:"required"`
}
func MakeScriptUtxo(txHash string, outputIndex int, address string, amount []Asset, plutusData string, dataHash string) UTxO {
return UTxO{
Input: Input{
OutputIndex: outputIndex,
TxHash: txHash,
},
Output: Output{
Address: address,
Amount: amount,
DataHash: dataHash,
PlutusData: plutusData,
},
}
}