Skip to content

Commit

Permalink
HubWithdraw: filter coins by network, use current address by default
Browse files Browse the repository at this point in the history
  • Loading branch information
shrpne committed May 16, 2022
1 parent b6b7d18 commit b4404d8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 111 deletions.
6 changes: 3 additions & 3 deletions .env.testnet
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ APP_EXPLORER_STATIC_HOST=https://explorer-static.testnet.minter.network
APP_HUB_API_URL=https://hub-api.kubernetes.icu/
APP_ETHEREUM_API_URL=https://ropsten.infura.io/v3/7b534be6f59742f9843c7e7562924f44
APP_BSC_API_URL=https://data-seed-prebsc-2-s3.binance.org:8545/
APP_HUB_ETHEREUM_CONTRACT_ADDRESS=0xfA47d158e14CCf7629A8e3955e180Edcb562B04c
APP_HUB_BSC_CONTRACT_ADDRESS=0x346a642b155089C0E6A0b3bD39ccB537dCE3b127
APP_HUB_MINTER_MULTISIG_ADDRESS=Mx89ae7d396549e915f4de0ae43fadc73a84ff5903
APP_HUB_ETHEREUM_CONTRACT_ADDRESS=0x3fb52C4d1aCA95B11F4C34CD3FACA2A4B35dCc47
APP_HUB_BSC_CONTRACT_ADDRESS=0x2f73843A6B174c55a13D88f772157d235e30bA3a
APP_HUB_MINTER_MULTISIG_ADDRESS=Mx44dbdbb93b7c1cf366e0dc5fe0a99bbf9854575b
7 changes: 4 additions & 3 deletions api/web3.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ export function toErcDecimals(balance, ercDecimals = 18) {

/**
* @param {string} hash
* @param {number} [confirmationCount = CONFIRMATION_COUNT]
* @param {number} [chainId]
* @param {object} options
* @param {number} [options.confirmationCount = CONFIRMATION_COUNT]
* @param {number} [options.chainId]
* @return {PromiseWithEmitter<Web3Tx>}
*/
export function subscribeTransaction(hash, {
Expand All @@ -65,7 +66,7 @@ export function subscribeTransaction(hash, {
const providerHost = getProviderHostByChain(chainId);
if (providerHost) {
// keep provider for this tx, because later it can be changed
const ethSaved = new Eth(getProviderHostByChain(chainId));
const ethSaved = new Eth(providerHost);
txPromise = _subscribeTransaction(hash, confirmationCount, ethSaved, emitter);
} else {
txPromise = Promise.reject(new Error(`Can't subscribe to tx, chainId ${chainId} is not supported`));
Expand Down
8 changes: 6 additions & 2 deletions components/HubWithdrawForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ export default {
form: {
coin: '',
amount: "",
address: "",
// @TODO use eth address from deposit form
address: this.$store.getters.address.replace('Mx', '0x'),
speed: SPEED_FAST,
networkTo: HUB_CHAIN_ID.ETHEREUM,
},
Expand Down Expand Up @@ -167,7 +168,10 @@ export default {
}
},
suggestionList() {
return this.hubCoinList.map((item) => item.symbol);
return this.hubCoinList
// show only available coins for selected network
.filter((item) => !!item[this.form.networkTo])
.map((item) => item.symbol);
// intersection of address balance and hub supported coins
/*
return this.$store.getters.balance.filter((balanceItem) => {
Expand Down
101 changes: 0 additions & 101 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@
"electron-debug": "^3.2.0",
"es-check": "^6.2.1",
"eslint": "^8.14.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^4.0.2",
"eslint-plugin-vue": "^8.7.1",
"fancy-log": "^1.3.3",
"gulp": "^4.0.2",
Expand Down

0 comments on commit b4404d8

Please sign in to comment.