Repository navigation
Expand file tree
/
Copy pathtypes.ss
More file actions
79 lines (64 loc) · 1.44 KB
/
Copy pathtypes.ss
File metadata and controls
79 lines (64 loc) · 1.44 KB
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
(export #t)
(import
:std/sugar
:std/misc/alist
:std/text/json)
; Transactions
(defclass TxInput
(txid vout sequence))
(defmethod {:json TxInput}
(lambda (self)
(list->hash-table
[(cons "txid" (@ self txid))
(cons "vout" (@ self vout))
(cons "sequence" (@ self sequence))])))
(defclass (TxOutput JSON) ())
(defclass (TxAddressOutput TxOutput) (address amount asset))
(defmethod {:json TxAddressOutput}
(lambda (self)
(list->hash-table
[(cons (@ self address) (@ self amount))
(cons "asset" (@ self asset))])))
(defclass (TxDataOutput TxOutput) (data))
(defclass (TxVDataOutput TxOutput) (vdata))
(defclass (TxBurnOutput TxOutput) (amount))
(defclass (TxFeeOutput TxOutput) (amount))
(defmethod {:json TxFeeOutput}
(lambda (self)
(list->hash-table
[(cons "fee" (@ self amount))])))
(defclass (TxAnyFeeOutput TxFeeOutput) (asset))
(defmethod {:json TxAnyFeeOutput}
(lambda (self)
(list->hash-table
[(cons "fee" (@ self amount))
(cons "fee_asset" (@ self asset))])))
; Utxo
(defclass (Utxo JSON)
(txid
vout
address
label
scriptPubKey
amount
amountcommitment
asset
assetcommitment
amountblinder
assetblinder
confirmations
; redeemScript
; witnessScript
spendable
solvable
; reused
desc
safe))
; Issuance
(defclass (Issuance JSON)
(asset_amount
asset_address
token_amount
token_address
blind
contract_hash))