@@ -20,8 +20,6 @@ import (
20
20
"log/slog"
21
21
22
22
"github.com/SundaeSwap-finance/kugo"
23
- "github.com/blinklabs-io/gouroboros/base58"
24
- "github.com/blinklabs-io/gouroboros/bech32"
25
23
"github.com/blinklabs-io/gouroboros/cbor"
26
24
"github.com/blinklabs-io/gouroboros/ledger"
27
25
"github.com/blinklabs-io/gouroboros/ledger/common"
@@ -80,21 +78,10 @@ func ExtractAssetDetailsFromMatch(match kugo.Match) (common.MultiAsset[uint64],
80
78
}
81
79
82
80
func NewResolvedTransactionOutput (match kugo.Match ) (ledger.TransactionOutput , error ) {
83
- // FIXME - This is a patch to fix the issue with the address
84
- // Attempt to create an address using Bech32
81
+ // Get common.Address from base58 or bech32 string
85
82
addr , err := common .NewAddress (match .Address )
86
83
if err != nil {
87
- // If Bech32 fails, try to convert from Base58 to Bech32
88
- bech32addr , err := ConvertBase58ToBech32 (match .Address , "addr" )
89
- if err != nil {
90
- return nil , fmt .Errorf ("failed to convert base58 to bech32: %w" , err )
91
- }
92
-
93
- // Try to create the address again with the converted Bech32 address
94
- addr , err = common .NewAddress (bech32addr )
95
- if err != nil {
96
- return nil , fmt .Errorf ("failed to create address from base58-converted bech32 address: %w" , err )
97
- }
84
+ return nil , fmt .Errorf ("failed to convert base58 to bech32: %w" , err )
98
85
}
99
86
100
87
assets , amount , err := ExtractAssetDetailsFromMatch (match )
@@ -147,19 +134,3 @@ func (txOut ResolvedTransactionOutput) Utxorpc() *utxorpc.TxOutput {
147
134
// Placeholder for UTXO RPC representation
148
135
return & utxorpc.TxOutput {}
149
136
}
150
-
151
- // ConvertBase58ToBech32 converts a Base58 string to a Bech32 string
152
- // using the given human-readable part (hrp) required for Bech32 encoding
153
- func ConvertBase58ToBech32 (base58Str , hrp string ) (string , error ) {
154
- data := base58 .Decode (base58Str )
155
- converted , err := bech32 .ConvertBits (data , 8 , 5 , true )
156
- if err != nil {
157
- return "" , fmt .Errorf ("failed to convert bits: %w" , err )
158
- }
159
- bech32Str , err := bech32 .Encode (hrp , converted )
160
- if err != nil {
161
- return "" , fmt .Errorf ("failed to encode Bech32: %w" , err )
162
- }
163
-
164
- return bech32Str , nil
165
- }
0 commit comments