From cae6ae017ac8e8d1ef1fef8cad533e842bc86f42 Mon Sep 17 00:00:00 2001 From: "frankind.eth" Date: Fri, 23 Feb 2024 05:56:21 -0300 Subject: [PATCH 1/4] feat: add propeller heads support --- .../src/ui/action/views/swap/index.vue | 141 +++------ packages/swap/.env.example | 1 + packages/swap/src/configs.ts | 19 +- packages/swap/src/index.ts | 21 +- .../src/providers/propeller-heads/index.ts | 278 ++++++++++++++++++ .../src/providers/propeller-heads/types.ts | 34 +++ packages/swap/src/types/index.ts | 2 + packages/swap/tests/propeller-heads.test.ts | 77 +++++ packages/types/src/networks.ts | 1 + 9 files changed, 472 insertions(+), 102 deletions(-) create mode 100644 packages/swap/.env.example create mode 100644 packages/swap/src/providers/propeller-heads/index.ts create mode 100644 packages/swap/src/providers/propeller-heads/types.ts create mode 100644 packages/swap/tests/propeller-heads.test.ts diff --git a/packages/extension/src/ui/action/views/swap/index.vue b/packages/extension/src/ui/action/views/swap/index.vue index 8d92110f5..90fdf543f 100644 --- a/packages/extension/src/ui/action/views/swap/index.vue +++ b/packages/extension/src/ui/action/views/swap/index.vue @@ -10,112 +10,52 @@
- + - - - - - - - + + + + + + +
- +
- +
- - - - - - - - + + + + + + + + @@ -301,10 +241,10 @@ onMounted(async () => { if (props.network.name === net) { thisNetwork = swapToTokens.all[net as unknown as SupportedNetworkName].length === - 1 + 1 ? getNetworkInfoByName( - NetworkNames.Ethereum as unknown as SupportedNetworkName - ) + NetworkNames.Ethereum as unknown as SupportedNetworkName + ) : netInfo; } toNetworks.value.push(netInfo); @@ -626,13 +566,13 @@ const sendAction = async () => { const marketData = new MarketData(); const fromPrice = fromToken.value!.cgId ? await marketData - .getMarketData([fromToken.value!.cgId]) - .then((res) => res[0]!.current_price) + .getMarketData([fromToken.value!.cgId]) + .then((res) => res[0]!.current_price) : 0; const toPrice = toToken.value!.cgId ? await marketData - .getMarketData([toToken.value!.cgId]) - .then((res) => res[0]!.current_price) + .getMarketData([toToken.value!.cgId]) + .then((res) => res[0]!.current_price) : 0; const localFromToken = { ...fromToken.value! }; const localToToken = { ...toToken.value! }; @@ -710,6 +650,7 @@ const sendAction = async () => {