@@ -2,7 +2,8 @@ package bridge
2
2
3
3
import (
4
4
"context"
5
- "encoding/base64"
5
+ "encoding/binary"
6
+ "encoding/hex"
6
7
"fmt"
7
8
"strconv"
8
9
@@ -88,8 +89,7 @@ func (provider *ErgoToErgoExtractionBridge) ExtractDirectTransferRequest(ctx con
88
89
return nil , extractors .NotFoundErr
89
90
}
90
91
91
- rqInt , _ := strconv .ParseInt (rq .RequestId , 10 , 64 )
92
- rqBigInt := big .NewInt (rqInt )
92
+ rqId , _ := strconv .ParseInt (rq .RequestId , 10 , 64 )
93
93
amount , _ := strconv .ParseInt (rq .Amount , 10 , 64 )
94
94
95
95
sourceDecimals := big .NewInt (10 )
@@ -106,16 +106,18 @@ func (provider *ErgoToErgoExtractionBridge) ExtractDirectTransferRequest(ctx con
106
106
107
107
result := []byte {'m' }
108
108
var newAmountBytes [32 ]byte
109
- var RequestIdBytes [32 ]byte
110
- result = append (result , rqBigInt .FillBytes (RequestIdBytes [:])... )
109
+ var RequestIdBytes = make ([]byte , 32 )
110
+ binary .PutVarint (RequestIdBytes , rqId )
111
+ result = append (result , RequestIdBytes [:]... )
111
112
result = append (result , newAmount .FillBytes (newAmountBytes [:])... )
112
- result = append (result , []byte (rq .Receiver )... )
113
+ receiver , _ := hex .DecodeString (rq .Receiver )
114
+ result = append (result , receiver [:]... )
113
115
114
116
println (newAmount .String ())
115
- println (base64 . StdEncoding .EncodeToString (result ))
117
+ println (hex .EncodeToString (result ))
116
118
return & extractors.Data {
117
- Type : extractors .Base64 ,
118
- Value : base64 . StdEncoding .EncodeToString (result ),
119
+ Type : extractors .String ,
120
+ Value : hex .EncodeToString (result ),
119
121
}, err
120
122
}
121
123
@@ -131,8 +133,7 @@ func (provider *ErgoToErgoExtractionBridge) ExtractReverseTransferRequest(ctx co
131
133
return nil , extractors .NotFoundErr
132
134
}
133
135
134
- rqInt , _ := strconv .ParseInt (rq .RequestId , 10 , 64 )
135
- rqBigInt := big .NewInt (rqInt )
136
+ rqId , _ := strconv .ParseInt (rq .RequestId , 10 , 64 )
136
137
amount , _ := strconv .ParseInt (rq .Amount , 10 , 64 )
137
138
138
139
sourceDecimals := big .NewInt (10 )
@@ -149,15 +150,17 @@ func (provider *ErgoToErgoExtractionBridge) ExtractReverseTransferRequest(ctx co
149
150
150
151
result := []byte {'u' }
151
152
var newAmountBytes [32 ]byte
152
- var RequestIdBytes [32 ]byte
153
- result = append (result , rqBigInt .FillBytes (RequestIdBytes [:])... )
153
+ var RequestIdBytes = make ([]byte , 32 )
154
+ binary .PutVarint (RequestIdBytes , rqId )
155
+ result = append (result , RequestIdBytes [:]... )
154
156
result = append (result , newAmount .FillBytes (newAmountBytes [:])... )
155
- result = append (result , []byte (rq .Receiver )... )
157
+ receiver , _ := hex .DecodeString (rq .Receiver )
158
+ result = append (result , receiver [:]... )
156
159
157
160
println (newAmount .String ())
158
- println (base64 . StdEncoding .EncodeToString (result ))
161
+ println (hex .EncodeToString (result ))
159
162
return & extractors.Data {
160
- Type : extractors .Base64 ,
161
- Value : base64 . StdEncoding .EncodeToString (result ),
163
+ Type : extractors .String ,
164
+ Value : hex .EncodeToString (result ),
162
165
}, err
163
166
}
0 commit comments