enkryptcom / enKrypt

Enkrypt: Ethereum, Polkadot and Web3 Wallet
https://www.enkrypt.com/
MIT License
332 stars 166 forks source link

Fix failing swap tests #533

Closed NickKelly1 closed 1 month ago

NickKelly1 commented 1 month ago

Changelly started returning zero maximum amount for swap between dai and usdc, breaking the tests.

curl https://partners.mewapi.io/changelly-v2 -sL \
  -X POST \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "getFixRate",
    "params": {
      "from": "dai",
      "to": "usdc"
    }
  }' | jq .

# {
#   "jsonrpc": "2.0",
#   "result": [
#     {
#       "id": "...",
#       "from": "dai",
#       "to": "usdc",
#       "result": "0.000000000000",
#       "networkFee": "2.645967",
#       "max": "0",
#       "maxFrom": "0",
#       "maxTo": "0",
#       "min": "0",
#       "minFrom": "0",
#       "minTo": "0",
#       "expiredAt": 1729131334
#     }
#   ],
#   "id": "1"
# }

I switched Changelly to use usdt to usdc instead wherein Changelly returns a greater-than-zero maximum amount, fixing the tests.

curl https://partners.mewapi.io/changelly-v2 -sL \
  -X POST \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "getFixRate",
    "params": {
      "from": "usdt20",
      "to": "usdc"
    }
  }' | jq .

# {
#   "jsonrpc": "2.0",
#   "result": [
#     {
#       "id": "...",
#       "from": "usdt20",
#       "to": "usdc",
#       "result": "0.978823121892",
#       "networkFee": "3.034319",
#       "max": "160016.000000",
#       "maxFrom": "160016.000000",
#       "maxTo": "160000.000000",
#       "min": "95.769576",
#       "minFrom": "95.769576",
#       "minTo": "95.760000",
#       "expiredAt": 1729131374
#     }
#   ],
#   "id": "1"
# }