Skip to content

Commit

Permalink
fix: handle updated 1inch api
Browse files Browse the repository at this point in the history
  • Loading branch information
shrpne committed Feb 13, 2024
1 parent 80312e4 commit ac34ec9
Show file tree
Hide file tree
Showing 17 changed files with 3,641 additions and 27,510 deletions.
3 changes: 2 additions & 1 deletion api/web3-loans.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Big from 'minterjs-util/src/big.js';
import {fromErcDecimals, getProviderByChain} from 'minter-js-web3-sdk/src/web3.js';
import {fromErcDecimals} from 'minter-js-web3-sdk/src/web3-abi.js';
import {getProviderByChain} from 'minter-js-web3-sdk/src/web3.js';
import {LOANS_BSC_CONTRACT_ADDRESS_LIST} from '~/assets/variables.js';
import loansABI from '~/assets/abi/loans.json';

Expand Down
3 changes: 2 additions & 1 deletion api/web3-old.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {HUB_CHAIN_BY_ID, HUB_DEPOSIT_TX_PURPOSE} from '~/assets/variables.js';
import Utils from 'web3-utils';
import {fromErcDecimals, getProviderByChain, web3Abi} from 'minter-js-web3-sdk/src/web3.js';
import {fromErcDecimals} from 'minter-js-web3-sdk/src/web3-abi.js';
import {getProviderByChain, web3Abi} from 'minter-js-web3-sdk/src/web3.js';
import {getExternalCoinList, getTokenDecimals} from '~/api/web3.js';

/**
Expand Down
2 changes: 1 addition & 1 deletion components/ActionSendWeb3.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import maxLength from 'vuelidate/src/validators/maxLength';
import minValue from 'vuelidate/src/validators/minValue.js';
import maxValue from 'vuelidate/src/validators/maxValue.js';
import Big from 'minterjs-util/src/big.js';
import {buildTransferTx, toErcDecimals} from 'minter-js-web3-sdk/src/web3.js';
import {buildTransferTx, toErcDecimals} from 'minter-js-web3-sdk/src/web3-abi.js';
import {pretty} from '~/assets/utils.js';
import {HUB_NETWORK_SLUG, HUB_CHAIN_DATA} from '~/assets/variables.js';
import useHubOracle from '~/composables/use-hub-oracle.js';
Expand Down
3 changes: 2 additions & 1 deletion components/HubBuyForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import minLength from 'vuelidate/src/validators/minLength.js';
import withParams from 'vuelidate/src/withParams.js';
import autosize from 'v-autosize';
import {TX_TYPE} from 'minterjs-util/src/tx-types.js';
import {AbiMethodEncoder, toErcDecimals, getHubDestinationAddressBytes, getHubDestinationChainBytes, buildWethUnwrap} from 'minter-js-web3-sdk/src/web3.js';
import {AbiMethodEncoder, toErcDecimals, buildWethUnwrap} from 'minter-js-web3-sdk/src/web3-abi.js';
import {getHubDestinationAddressBytes, getHubDestinationChainBytes} from 'minter-js-web3-sdk/src/web3.js';
import {isValidAmount} from '~/assets/utils/validators.js';
import Big from 'minterjs-util/src/big.js';
import initRampPurchase, {fiatRampPurchaseNetwork} from '~/assets/fiat-ramp.js';
Expand Down
3 changes: 2 additions & 1 deletion components/LoansBorrowForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import maxLength from 'vuelidate/src/validators/maxLength';
import minValue from 'vuelidate/src/validators/minValue.js';
import maxValue from 'vuelidate/src/validators/maxValue.js';
import Big from 'minterjs-util/src/big.js';
import {toErcDecimals, AbiMethodEncoder, addApproveTx, buildDepositWithApproveTxList} from 'minter-js-web3-sdk/src/web3.js';
import {toErcDecimals, AbiMethodEncoder} from 'minter-js-web3-sdk/src/web3-abi.js';
import {addApproveTx, buildDepositWithApproveTxList} from 'minter-js-web3-sdk/src/web3.js';
import {LOAN_MIN_AMOUNT, LOAN_MAX_AMOUNT, LEND_COIN, getCollateralPrice, getAvailableAmountToBorrow, COLLATERAL_RATE} from '~/api/web3-loans.js';
import {pretty} from '~/assets/utils.js';
import {HUB_NETWORK_SLUG, HUB_CHAIN_DATA, NATIVE_COIN_ADDRESS, LOANS_BSC_CONTRACT_ADDRESS_LIST} from '~/assets/variables.js';
Expand Down
3 changes: 2 additions & 1 deletion components/LoansLendForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import maxLength from 'vuelidate/src/validators/maxLength';
import minValue from 'vuelidate/src/validators/minValue.js';
import maxValue from 'vuelidate/src/validators/maxValue.js';
import Big from 'minterjs-util/src/big.js';
import {toErcDecimals, AbiMethodEncoder, addApproveTx} from 'minter-js-web3-sdk/src/web3.js';
import {toErcDecimals, AbiMethodEncoder} from 'minter-js-web3-sdk/src/web3-abi.js';
import {addApproveTx} from 'minter-js-web3-sdk/src/web3.js';
import {pretty} from '~/assets/utils.js';
import {HUB_NETWORK_SLUG, HUB_CHAIN_DATA, LOANS_BSC_CONTRACT_ADDRESS_LIST} from '~/assets/variables.js';
import loansABI from '~/assets/abi/loans.json';
Expand Down
3 changes: 2 additions & 1 deletion components/LoansLendWithdrawForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import maxLength from 'vuelidate/src/validators/maxLength';
import minValue from 'vuelidate/src/validators/minValue.js';
import maxValue from 'vuelidate/src/validators/maxValue.js';
import Big from 'minterjs-util/src/big.js';
import {AbiMethodEncoder, buildDepositWithApproveTxList} from 'minter-js-web3-sdk/src/web3.js';
import {AbiMethodEncoder} from 'minter-js-web3-sdk/src/web3-abi.js';
import {buildDepositWithApproveTxList} from 'minter-js-web3-sdk/src/web3.js';
import {LEND_COIN, getLend} from '~/api/web3-loans.js';
import {pretty} from '~/assets/utils.js';
import {HUB_NETWORK_SLUG, HUB_CHAIN_DATA, NATIVE_COIN_ADDRESS, LOANS_BSC_CONTRACT_ADDRESS_LIST} from '~/assets/variables.js';
Expand Down
3 changes: 2 additions & 1 deletion components/LoansLiquidateForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import maxLength from 'vuelidate/src/validators/maxLength';
import minValue from 'vuelidate/src/validators/minValue.js';
import maxValue from 'vuelidate/src/validators/maxValue.js';
import Big from 'minterjs-util/src/big.js';
import {AbiMethodEncoder, buildDepositWithApproveTxList} from 'minter-js-web3-sdk/src/web3.js';
import {AbiMethodEncoder} from 'minter-js-web3-sdk/src/web3.js';
import {buildDepositWithApproveTxList} from 'minter-js-web3-sdk/src/web3.js';
import {LEND_COIN, getLoan} from '~/api/web3-loans.js';
import {pretty} from '~/assets/utils.js';
import {HUB_NETWORK_SLUG, HUB_CHAIN_DATA, NATIVE_COIN_ADDRESS, LOANS_BSC_CONTRACT_ADDRESS_LIST} from '~/assets/variables.js';
Expand Down
2 changes: 1 addition & 1 deletion components/LoansManage.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
import { createReusableTemplate } from '@vueuse/core';
import {getProviderByChain, fromErcDecimals} from 'minter-js-web3-sdk/src/web3.js';
// import {getProviderByChain, fromErcDecimals} from 'minter-js-web3-sdk/src/web3.js';
import {getLoanList, getLendList, LEND_COIN, getCollateralPrice} from '~/api/web3-loans.js';
import loansABI from '~/assets/abi/loans.json';
import {pretty, getDate, getTime} from '~/assets/utils.js';
Expand Down
3 changes: 2 additions & 1 deletion components/LoansRepayForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import maxLength from 'vuelidate/src/validators/maxLength';
import minValue from 'vuelidate/src/validators/minValue.js';
import maxValue from 'vuelidate/src/validators/maxValue.js';
import Big from 'minterjs-util/src/big.js';
import {toErcDecimals, AbiMethodEncoder, addApproveTx, buildDepositWithApproveTxList} from 'minter-js-web3-sdk/src/web3.js';
import {toErcDecimals, AbiMethodEncoder} from 'minter-js-web3-sdk/src/web3-abi.js';
import {addApproveTx, buildDepositWithApproveTxList} from 'minter-js-web3-sdk/src/web3.js';
import {LEND_COIN, getLoan} from '~/api/web3-loans.js';
import {pretty} from '~/assets/utils.js';
import {HUB_NETWORK_SLUG, HUB_CHAIN_DATA, NATIVE_COIN_ADDRESS, LOANS_BSC_CONTRACT_ADDRESS_LIST} from '~/assets/variables.js';
Expand Down
3 changes: 2 additions & 1 deletion composables/use-tx-service.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {reactive, computed, set} from 'vue';
import {deepMerge} from '~/assets/utils/collection.js';
import {getProviderByChain, web3Utils, toErcDecimals} from 'minter-js-web3-sdk/src/web3.js';
import {toErcDecimals} from 'minter-js-web3-sdk/src/web3-abi.js';
import {getProviderByChain, web3Utils} from 'minter-js-web3-sdk/src/web3.js';
import {subscribeTransaction} from '~/api/web3.js';
import {postTx} from '~/api/gate.js';
import {HUB_BUY_STAGE as LOADING_STAGE, CHAIN_ID as MINTER_CHAIN_ID} from '~/assets/variables.js';
Expand Down
3 changes: 2 additions & 1 deletion composables/use-web3-balance.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {reactive, set} from 'vue';
import {getProviderByChain, getAllowance as _getAllowance, web3Utils, fromErcDecimals} from 'minter-js-web3-sdk/src/web3.js';
import {fromErcDecimals} from 'minter-js-web3-sdk/src/web3-abi.js';
import {getProviderByChain, getAllowance as _getAllowance, web3Utils} from 'minter-js-web3-sdk/src/web3.js';
import erc20ABI from 'minter-js-web3-sdk/src/abi/erc20.js';
import {HUB_CHAIN_BY_ID, HUB_CHAIN_DATA} from '~/assets/variables.js';

Expand Down
3 changes: 2 additions & 1 deletion composables/use-web3-deposit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {ref, reactive, computed, watch} from 'vue';

import {waitHubTransferToMinter} from '~/api/hub.js';
import {getProviderByChain, toErcDecimals, buildDepositTx, getFeeAmount as getFee, buildWethUnwrap} from 'minter-js-web3-sdk/src/web3.js';
import {toErcDecimals, buildWethUnwrap} from 'minter-js-web3-sdk/src/web3-abi.js';
import {getProviderByChain, buildDepositTx, getFeeAmount as getFee} from 'minter-js-web3-sdk/src/web3.js';
import {HUB_BUY_STAGE as LOADING_STAGE, HUB_CHAIN_BY_ID, HUB_TRANSFER_STATUS, MAINNET, NETWORK} from '~/assets/variables.js';
import Big from 'minterjs-util/src/big.js';
import useHubOracle from '~/composables/use-hub-oracle.js';
Expand Down
3 changes: 2 additions & 1 deletion composables/use-web3-uniswap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import IUniswapV2Router from '@uniswap/v2-periphery/build/IUniswapV2Router02.jso
import {CloudflareProvider, JsonRpcProvider} from '@ethersproject/providers';
import Big from 'minterjs-util/src/big.js';
import {ETHEREUM_API_URL, ETHEREUM_CHAIN_ID, MAINNET, NETWORK} from '~/assets/variables.js';
import {web3Abi, toErcDecimals} from 'minter-js-web3-sdk/src/web3.js';
import {toErcDecimals} from 'minter-js-web3-sdk/src/web3-abi.js';
import {web3Abi} from 'minter-js-web3-sdk/src/web3.js';

const wethToken = WETH_TOKEN_DATA[ETHEREUM_CHAIN_ID];
const uniswapV2Abi = IUniswapV2Router.abi;
Expand Down
3 changes: 3 additions & 0 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ module.exports = {
'vuelidate/src',
'lodash-es',
'camelcase-keys',
'@ethereumjs/util',
'@noble/curves',
'micro-ftch',
'web3-core-method',
// 'nuxt-i18n/src',
'@shrpne/utils/src',
Expand Down
Loading

0 comments on commit ac34ec9

Please sign in to comment.