{{ $t("home.swapNeed") }}
@@ -1308,7 +1460,9 @@
{{
- $t("home.swapDestination")
+ swapFromChain == swapToChain
+ ? $t("home.destination")
+ : $t("home.swapDestination")
}}
@@ -1365,12 +1519,18 @@
>
{{
- $t("home.swapInProgressTitle")
+ swapFromChain === swapToChain
+ ? $t("home.sendInProgress")
+ : $t("home.swapInProgressTitle")
}}
- {{ $t("home.swapBeingProcessed") }}
- {{ swapFromChain == "ethereum" ? $t("home.needsConfirmations") : "" }}
+ {{
+ swapFromChain === swapToChain
+ ? $t("home.sendBeingProcessed")
+ : $t("home.swapBeingProcessed")
+ }}
+ {{ swapFromChain == "eth" ? $t("home.needsConfirmations") : "" }}
{{ $t("home.checkTransaction") }}
{{
$t("home.here")
@@ -1461,6 +1621,43 @@
+
+
+ {{
+ $t("wallets.titlePrivateKey")
+ }}
+
+
+
+ {{ $t("wallets.keyExplanation") }}
+
+
+
+
+
+
+
+
+
+
+ {{ $t("home.continue") }}
+
+
+
+
+
b.symbol == "SOUL"
);
- if (soulBalance && parseFloat(soulBalance.amount) < 0.02) return false
+ if (soulBalance && parseFloat(soulBalance.amount) < 0.02) return false;
if (!kcalBalance?.amount || !soulBalance?.amount) return true;
@@ -1697,7 +1896,7 @@ export default class extends Vue {
}
getFeeEth(gwei: number, symbol: string) {
- const gasLimit = symbol == "ETH" ? 21000 : 10000;
+ const gasLimit = symbol == "ETH" ? 21000 : 100000;
const currencyPrice = state.getRate("ETH");
const decimals = 18;
const decimalsGas = 9;
@@ -1891,13 +2090,29 @@ export default class extends Vue {
}
isSwappable(symbol: string, swapToChain: string) {
+ const isSwappableToken = state.isSwappable(symbol, swapToChain);
+ if (isSwappableToken) return true;
if (swapToChain == "eth")
- return symbol == "KCAL" || symbol == "SOUL" || symbol == "ETH";
+ return (
+ symbol == "KCAL" ||
+ symbol == "SOUL" ||
+ symbol == "ETH" ||
+ symbol == "DANK"
+ );
else if (swapToChain == "neo")
return symbol == "SOUL" || symbol == "NEO" || symbol == "GAS";
return false;
}
+ openWindow(url: string) {
+ window.open(url, "_blank");
+ }
+
+ askExportPrivateKeyHex() {
+ this.signTxDialog = true;
+ this.signTxCallback = this.exportPrivateKeyHex;
+ }
+
askClaimKcal() {
this.claimDialog = false;
this.signTxDialog = true;
@@ -1935,9 +2150,9 @@ export default class extends Vue {
onSwapAmountClick() {
this.swapAmountDialog = false;
- if (this.swapToChain == "neo" || this.swapToChain == "eth") {
- this.swapFromChain = "phantasma";
- }
+ // if (this.swapToChain == "neo" || this.swapToChain == "eth") {
+ // this.swapFromChain = "phantasma";
+ // }
console.log(
"onSwapAmountClick",
this.sendAmount,
@@ -1947,6 +2162,17 @@ export default class extends Vue {
"to",
this.swapToChain
);
+
+ // send from chain to same chain
+ if (this.swapFromChain == this.swapToChain) {
+ this.destinationSwapDialog = true;
+ this.sendDestination = "";
+ if (this.swapToChain == "eth") this.signTxCallback = this.sendFromEth;
+ else this.signTxCallback = this.sendFromNeo;
+ return;
+ }
+
+ // send to swap
if (this.swapFromChain == "eth") {
console.log("next => sendFromEth");
this.signTxDialog = true;
@@ -1995,6 +2221,19 @@ export default class extends Vue {
this.cosmicSwap();
}
+ exportPrivateKeyHex() {
+ try {
+ this.wif = state.getWifFromPassword(this.password, this.account!);
+ this.hexPk = getPrivateKeyFromWif(this.wif);
+ this.showPrivateKeyDialog = true;
+ this.closeSignTx();
+ } catch (err) {
+ this.errorMessage = err;
+ this.errorDialog = true;
+ }
+ this.password = "";
+ }
+
doGenerateSwapAddress() {
try {
if (this.needsWif) state.addSwapAddress(this.wif);
@@ -2148,6 +2387,35 @@ export default class extends Vue {
);
}
+ async askSendEth(bal: ISymbolAmount) {
+ this.sendSymbol = bal.symbol;
+ this.swapFromChain = "eth";
+ this.swapToChain = "eth";
+ this.sendMaxAmount = parseFloat(
+ this.formatBalance(
+ bal.amount.toString(),
+ state.decimals(bal.symbol)
+ ).replace(/ /gi, "")
+ ) as number;
+ if (this.sendSymbol == "ETH") {
+ const ethFee = (
+ Math.round(21000 * this.ethGasPrices[1] * 1.2) / 1e9
+ ).toFixed(4);
+ this.sendMaxAmount -= parseFloat(parseFloat(ethFee).toFixed(3));
+ }
+ this.swapAmountDialog = true;
+
+ const res = await fetch("https://gasprice.poa.network/");
+
+ const resJson = await res.json();
+
+ this.ethGasPrices[0] = resJson.slow;
+ this.ethGasPrices[1] = resJson.standard;
+ this.ethGasPrices[2] = parseFloat(
+ ((resJson.fast + resJson.instant) / 2).toFixed(2)
+ );
+ }
+
askSwapFromNeo(bal: ISymbolAmount) {
this.sendSymbol = bal.symbol;
this.swapFromChain = "neo";
@@ -2161,11 +2429,26 @@ export default class extends Vue {
this.swapAmountDialog = true;
}
- async sendFromNeo() {
- const platforms = await state.api.getPlatforms();
- const interopAddr = platforms.find((p) => p.platform == "neo")?.interop[0];
+ askSendNeo(bal: ISymbolAmount) {
+ this.sendSymbol = bal.symbol;
+ this.swapFromChain = "neo";
+ this.swapToChain = "neo";
+ this.sendMaxAmount = parseFloat(
+ this.formatBalance(
+ bal.amount.toString(),
+ state.decimals(bal.symbol)
+ ).replace(/ /gi, "")
+ ) as number;
+ this.swapAmountDialog = true;
+ }
- this.sendDestination = interopAddr!.external;
+ async sendFromNeo() {
+ if (this.swapToChain === "phantasma") {
+ const platforms = await state.api.getPlatforms();
+ const interopAddr = platforms.find((p) => p.platform == "neo")
+ ?.interop[0];
+ this.sendDestination = interopAddr!.external;
+ }
console.log(
"swap from neo to pha",
@@ -2253,17 +2536,25 @@ export default class extends Vue {
const gasPrice = this.ethGasPrices[this.swapGasIndex] * 10 ** 9; //100000000000;
const gasLimit = this.sendSymbol == "ETH" ? 21000 : 100000;
- const platforms = await state.api.getPlatforms();
- const interopAddr = platforms.find((p) => p.platform == "ethereum")
- ?.interop[0];
+ if (this.swapToChain === "phantasma") {
+ const platforms = await state.api.getPlatforms();
+ const interopAddr = platforms.find((p) => p.platform == "ethereum")
+ ?.interop[0];
- if (!interopAddr) {
- throw new Error("No available interop address for swap");
+ if (!interopAddr) {
+ throw new Error("No available interop address for swap");
+ }
+ console.log("Interop address is ", interopAddr.external);
+ this.sendDestination = interopAddr.external;
}
- console.log("Interop address is ", interopAddr.external);
+ if (this.sendDestination == "") {
+ this.errorDialog = true;
+ this.errorMessage = "Error in destination address";
+ return;
+ }
- const destAddr = interopAddr.external //"0x259D17A3E6658B79CE7F6F87CAC614A696056E79"
+ const destAddr = this.sendDestination // interopAddr.external //"0x259D17A3E6658B79CE7F6F87CAC614A696056E79"
.substring(2)
.padStart(64, "0")
.toLowerCase();
@@ -2275,7 +2566,7 @@ export default class extends Vue {
nonce: nonceRes,
gasPrice: "0x" + gasPrice.toString(16), //"0x09184e72a000",
gasLimit: "0x" + gasLimit.toString(16), //"0x2710",
- to: interopAddr.external,
+ to: this.sendDestination, // interopAddr.external,
value: "0x" + amount.toString(16),
};
} else {
@@ -2283,7 +2574,7 @@ export default class extends Vue {
nonce: nonceRes,
gasPrice: "0x" + gasPrice.toString(16), //"0x09184e72a000",
gasLimit: "0x" + gasLimit.toString(16), //"0x2710",
- to: "0x" + state.getEthContract(this.sendSymbol), // ropsten SOUL contract
+ to: "0x" + state.getEthContract(this.sendSymbol),
value: "0x0", // no eth to transfer
data: "0xa9059cbb" + destAddr + amountStr,
};
@@ -2310,6 +2601,13 @@ export default class extends Vue {
);
this.closeSignTx();
+
+ if (txRes.error) {
+ this.errorDialog = true;
+ this.errorMessage = txRes.error;
+ return;
+ }
+
this.swapInProgressDialog = true;
this.lastSwapTx = txRes;
@@ -2396,7 +2694,8 @@ export default class extends Vue {
console.log("tx successful: " + tx);
this.$root.$emit("checkTx", tx);
- // await state.addPendingSwap("ethereum", this.sendDestination, tx);
+ if (this.swapToCustomDest)
+ await state.addPendingSwap("ethereum", this.sendDestination, tx);
} catch (err) {
this.errorDialog = true;
this.errorMessage = err;
@@ -2492,7 +2791,8 @@ export default class extends Vue {
console.log("tx successful: " + tx);
this.$root.$emit("checkTx", tx);
- // await state.addPendingSwap("neo", this.sendDestination, tx);
+ if (this.swapToCustomDest)
+ await state.addPendingSwap("neo", this.sendDestination, tx);
} catch (err) {
this.errorDialog = true;
this.errorMessage = err;
@@ -2722,11 +3022,7 @@ export default class extends Vue {
event.stopImmediatePropagation();
console.log("Going to transfer: " + item.symbol);
- if (
- item.symbol == "TTRS" ||
- item.symbol == "CROWN" ||
- item.symbol == "GHOST"
- ) {
+ if (state.isNFT(item.symbol)) {
this.goto("/nfts/" + item.symbol + "/send");
return;
}
@@ -2745,11 +3041,7 @@ export default class extends Vue {
event.stopImmediatePropagation();
console.log("Going to burn: " + item.symbol);
- if (
- item.symbol == "TTRS" ||
- item.symbol == "CROWN" ||
- item.symbol == "GHOST"
- ) {
+ if (state.isNFT(item.symbol) && state.isBurnable(item.symbol)) {
this.goto("/nfts/" + item.symbol + "/burn");
return;
}
@@ -2873,12 +3165,13 @@ export default class extends Vue {
}
selectAssetToSwap(chain: string, customDest: boolean) {
+ this.swapFromChain = "phantasma";
this.swapToCustomDest = customDest;
this.swapToChain = chain;
this.selectAssetToSwapDialog = true;
}
- askAmountToSwap(bal: Balance) {
+ async askAmountToSwap(bal: Balance) {
this.selectAssetToSwapDialog = false;
this.sendSymbol = bal.symbol;
this.sendAmount = 0;
@@ -2889,14 +3182,25 @@ export default class extends Vue {
bal.symbol == "ETH" ? 3 : 2
).replace(/ /gi, "")
);
+
+ const res = await fetch("https://gasprice.poa.network/");
+
+ const resJson = await res.json();
+
+ this.ethGasPrices[0] = resJson.slow;
+ this.ethGasPrices[1] = resJson.standard;
+ this.ethGasPrices[2] = parseFloat(
+ ((resJson.fast + resJson.instant) / 2).toFixed(2)
+ );
+
if (this.sendSymbol == "GAS") {
this.sendMaxAmount -= 0.1;
}
if (this.sendSymbol == "ETH") {
const ethFee = (
- Math.round(100000 * this.ethGasPrices[1] * 1.2) / 1e9
+ Math.round(21000 * this.ethGasPrices[1] * 1.2) / 1e9
).toFixed(4);
- this.sendMaxAmount -= parseFloat(parseFloat(ethFee).toFixed(4));
+ this.sendMaxAmount -= parseFloat(parseFloat(ethFee).toFixed(3));
}
if (this.sendMaxAmount < 0) this.sendMaxAmount = 0;
this.swapAmountDialog = true;
@@ -2922,6 +3226,18 @@ export default class extends Vue {
}
}
+ async onSwapsTab() {
+ const res = await fetch("https://gasprice.poa.network/");
+
+ const resJson = await res.json();
+
+ this.ethGasPrices[0] = resJson.slow;
+ this.ethGasPrices[1] = resJson.standard;
+ this.ethGasPrices[2] = parseFloat(
+ ((resJson.fast + resJson.instant) / 2).toFixed(2)
+ );
+ }
+
async loadMoreTxs() {
if (!this.account) return;
@@ -2954,7 +3270,23 @@ export default class extends Vue {
diff --git a/src/views/Nfts.vue b/src/views/Nfts.vue
index 07ff607..9fcb98a 100644
--- a/src/views/Nfts.vue
+++ b/src/views/Nfts.vue
@@ -27,7 +27,7 @@
style="z-index:7777;position:absolute;"
>
-
+
- {{
- $t("nfts.burnTitle")
- }}
+ {{ $t("nfts.burnTitle") }}
@@ -754,8 +752,7 @@ export default class extends Vue {
console.log(
"sending",
- this.sendAmount * 10 ** this.sendDecimals,
- "of",
+ this.nftsToSend.length,
this.sendSymbol,
"to",
this.sendDestination
@@ -824,12 +821,7 @@ export default class extends Vue {
async burnNFTs() {
if (!this.account) return;
- console.log(
- "burning",
- this.burnAmount * 10 ** this.burnDecimals,
- "of",
- this.burnSymbol
- );
+ console.log("burning", this.nftsToBurn.length, this.burnSymbol);
const address = this.account.address;
const gasPrice = 100000;
@@ -840,18 +832,9 @@ export default class extends Vue {
sb.beginScript();
sb.allowGas(address, sb.nullAddress, gasPrice, minGasLimit);
this.nftsToBurn.forEach((nft) => {
- sb.callInterop("Runtime.BurnToken", [
- address,
- this.sendSymbol,
- nft.id,
- ]);
+ sb.callInterop("Runtime.BurnToken", [address, this.sendSymbol, nft.id]);
- console.log(
- "nft to burn",
- nft.id,
- "of",
- this.sendSymbol
- );
+ console.log("nft to burn", nft.id, "of", this.sendSymbol);
});
sb.spendGas(address);
const script = sb.endScript();
diff --git a/src/views/Wallets.vue b/src/views/Wallets.vue
index ae7e691..11026c6 100644
--- a/src/views/Wallets.vue
+++ b/src/views/Wallets.vue
@@ -44,7 +44,7 @@
- {{
+ {{
$t("wallets.add")
}}
@@ -52,7 +52,9 @@
- {{ $t("wallets.enterPassword") }}
+ {{
+ $t("wallets.enterPassword")
+ }}
@@ -99,7 +101,9 @@
- {{ $t("wallets.titlePrivateKey") }}
+ {{
+ $t("wallets.titlePrivateKey")
+ }}
@@ -261,7 +265,6 @@ export default class extends Vue {
}
exportPrivateKey() {
- console.log("export private key", this.reqAccount, this.password);
if (!this.reqAccount) return;
try {
diff --git a/vue.config.js b/vue.config.js
index e577f60..fca2267 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -35,5 +35,17 @@ module.exports = {
config.plugins.push(new CopyWebpackPlugin(plugins));
config.output.filename = 'js/[name].js';
config.output.chunkFilename = 'js/[name].js';
+ },
+ chainWebpack: config => {
+ config.plugin('copy')
+ .tap(args => {
+ args[0].push({
+ from: path.resolve(__dirname, 'src/_locales'),
+ to: path.resolve(__dirname, 'dist/_locales'),
+ toType: 'dir',
+ ignore: ['.DS_Store']
+ })
+ return args
+ })
}
};