@@ -33,7 +33,9 @@ type ResolvedTransactionOutput struct {
33
33
AssetsField * common.MultiAsset [uint64 ] `json:"assets,omitempty"`
34
34
}
35
35
36
- func ExtractAssetDetailsFromMatch (match kugo.Match ) (common.MultiAsset [uint64 ], uint64 , error ) {
36
+ func ExtractAssetDetailsFromMatch (
37
+ match kugo.Match ,
38
+ ) (common.MultiAsset [uint64 ], uint64 , error ) {
37
39
// Initialize the map that will store the assets
38
40
assetsMap := map [common.Blake2b224 ]map [cbor.ByteString ]uint64 {}
39
41
totalLovelace := uint64 (0 )
@@ -43,7 +45,12 @@ func ExtractAssetDetailsFromMatch(match kugo.Match) (common.MultiAsset[uint64],
43
45
// Decode policyId if not ADA
44
46
policyIdBytes , err := hex .DecodeString (policyId )
45
47
if err != nil {
46
- slog .Debug (fmt .Sprintf ("PolicyId %s is not a valid hex string\n " , policyId ))
48
+ slog .Debug (
49
+ fmt .Sprintf (
50
+ "PolicyId %s is not a valid hex string\n " ,
51
+ policyId ,
52
+ ),
53
+ )
47
54
policyIdBytes = []byte (policyId )
48
55
}
49
56
policyBlake := common .NewBlake2b224 (policyIdBytes )
@@ -56,15 +63,24 @@ func ExtractAssetDetailsFromMatch(match kugo.Match) (common.MultiAsset[uint64],
56
63
// Check if this is the ADA (lovelace) asset
57
64
if policyId == "ada" && assetName == "lovelace" {
58
65
totalLovelace = amount .Uint64 ()
59
- slog .Debug (fmt .Sprintf ("Found ADA (lovelace): %d\n " , totalLovelace ))
66
+ slog .Debug (
67
+ fmt .Sprintf ("Found ADA (lovelace): %d\n " , totalLovelace ),
68
+ )
60
69
continue // Skip adding "lovelace" to assetsMap, as it is handled separately
61
70
}
62
71
63
72
byteStringAssetName := cbor .NewByteString ([]byte (assetName ))
64
73
assetAmount := amount .Uint64 ()
65
74
policyAssets [byteStringAssetName ] = assetAmount
66
75
slog .Debug ("Get policyId, assetName, assetAmount from match.Value" )
67
- slog .Debug (fmt .Sprintf ("policyId: %s, assetName: %s, amount: %d\n " , policyId , assetName , assetAmount ))
76
+ slog .Debug (
77
+ fmt .Sprintf (
78
+ "policyId: %s, assetName: %s, amount: %d\n " ,
79
+ policyId ,
80
+ assetName ,
81
+ assetAmount ,
82
+ ),
83
+ )
68
84
}
69
85
70
86
// Only add non-empty policyAssets to the assetsMap
@@ -77,7 +93,9 @@ func ExtractAssetDetailsFromMatch(match kugo.Match) (common.MultiAsset[uint64],
77
93
return assets , totalLovelace , nil
78
94
}
79
95
80
- func NewResolvedTransactionOutput (match kugo.Match ) (ledger.TransactionOutput , error ) {
96
+ func NewResolvedTransactionOutput (
97
+ match kugo.Match ,
98
+ ) (ledger.TransactionOutput , error ) {
81
99
// Get common.Address from base58 or bech32 string
82
100
addr , err := common .NewAddress (match .Address )
83
101
if err != nil {
@@ -86,10 +104,20 @@ func NewResolvedTransactionOutput(match kugo.Match) (ledger.TransactionOutput, e
86
104
87
105
assets , amount , err := ExtractAssetDetailsFromMatch (match )
88
106
if err != nil {
89
- return nil , fmt .Errorf ("failed to extract asset details from match: %w" , err )
107
+ return nil , fmt .Errorf (
108
+ "failed to extract asset details from match: %w" ,
109
+ err ,
110
+ )
90
111
}
91
112
92
- slog .Debug (fmt .Sprintf ("ResolvedTransactionOutput: address: %s, amount: %d, assets: %#v\n " , addr , amount , assets ))
113
+ slog .Debug (
114
+ fmt .Sprintf (
115
+ "ResolvedTransactionOutput: address: %s, amount: %d, assets: %#v\n " ,
116
+ addr ,
117
+ amount ,
118
+ assets ,
119
+ ),
120
+ )
93
121
return & ResolvedTransactionOutput {
94
122
AddressField : addr ,
95
123
AmountField : amount ,
0 commit comments