Skip to content

Commit 7c0d84e

Browse files
authored
Use create transaction hash for mayan swaps (#58)
1 parent 6d09d0c commit 7c0d84e

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

chains/evm/message/mayan.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func (h *MayanMessageHandler) HandleMessage(m *message.Message) (*proposal.Propo
150150
err = h.confirmationWatcher.WaitForConfirmations(
151151
context.Background(),
152152
h.chainID,
153-
common.HexToHash(swap.SourceTxHash),
153+
common.HexToHash(swap.CreateTxHash),
154154
tokenIn,
155155
new(big.Int).SetUint64(msg.PromisedAmount))
156156
if err != nil {

protocol/mayan/api.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type MayanSwap struct {
2525
Trader string
2626
MinAmountOut64 string
2727
SourceTxHash string
28+
CreateTxHash string
2829
}
2930

3031
type MayanExplorer struct {
@@ -40,7 +41,7 @@ func NewMayanExplorer() *MayanExplorer {
4041
}
4142

4243
func (c *MayanExplorer) GetSwap(hash string) (*MayanSwap, error) {
43-
url := fmt.Sprintf("%s/v3/swap/order-id/SWIFT_%s", MAYAN_EXPLORER_URL, hash)
44+
url := fmt.Sprintf("%s/v3/swap/order-id/%s", MAYAN_EXPLORER_URL, hash)
4445
resp, err := c.HTTPClient.Get(url)
4546
if err != nil {
4647
return nil, fmt.Errorf("request failed: %w", err)

protocol/mayan/api_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ func Test_MayanExplorer_GetSwap(t *testing.T) {
4040
"refundRelayerFee": "0.05",
4141
"trader": "0xTrader",
4242
"minAmountOut64": "100",
43-
"sourceTxHash": "0xhash"
43+
"sourceTxHash": "0xhash",
44+
"createTxHash": "0xcreatehash"
4445
}`),
4546
statusCode: http.StatusOK,
4647
wantResult: &mayan.MayanSwap{
@@ -53,6 +54,7 @@ func Test_MayanExplorer_GetSwap(t *testing.T) {
5354
Trader: "0xTrader",
5455
MinAmountOut64: "100",
5556
SourceTxHash: "0xhash",
57+
CreateTxHash: "0xcreatehash",
5658
},
5759
},
5860
{
@@ -82,7 +84,7 @@ func Test_MayanExplorer_GetSwap(t *testing.T) {
8284
client := mayan.NewMayanExplorer()
8385
client.HTTPClient.Transport = roundTripperFunc(func(req *http.Request) (*http.Response, error) {
8486
// Verify URL construction
85-
expectedURL := fmt.Sprintf("%s/v3/swap/order-id/SWIFT_%s", mayan.MAYAN_EXPLORER_URL, tc.hash)
87+
expectedURL := fmt.Sprintf("%s/v3/swap/order-id/%s", mayan.MAYAN_EXPLORER_URL, tc.hash)
8688
if req.URL.String() != expectedURL {
8789
return nil, fmt.Errorf("unexpected URL: got %s, want %s", req.URL.String(), expectedURL)
8890
}

0 commit comments

Comments
 (0)