diff --git a/src/blockchain/wallet.js b/src/blockchain/wallet.js index c6f7dbf..1c361db 100644 --- a/src/blockchain/wallet.js +++ b/src/blockchain/wallet.js @@ -156,16 +156,6 @@ export async function connectWallet(chainId) { } -export async function switchChain(chainId) { - if (useWalletStore().chainId === chainId) - return - await window.ethereum.request({ - "method": "wallet_switchEthereumChain", - "params": [{"chainId": '0x' + chainId.toString(16)}] - }) -} - - function discoverVaults(owner) { const s = useStore() console.log('discoverVaults', owner) @@ -522,7 +512,67 @@ function upgradeError(e) { console.error('error while upgrading vault', e) } + export async function upgradeVault(vault, impl) { pendTransaction(upgradeSender(vault, impl), upgradeError) } + +const _chainInfos = { + // Arbitrum One + 42161: { + "chainId": "0xa4b1", + "chainName": "Arbitrum One", + "rpcUrls": ["https://arbitrum-mainnet.infura.io"], + "blockExplorerUrls": ['https://explorer.arbitrum.io'], + "nativeCurrency": { + "name": "Ethereum", + "symbol": "ETH", + "decimals": 18 + } + }, + 1337: { + "chainId": "0x539", + "chainName": "Dexorder Alpha Testnet", + "rpcUrls": ["https://rpc.alpha.dexorder.trade"], + "nativeCurrency": { + "name": "Test Ethereum", + "symbol": "TETH", + "decimals": 18 + } + }, + 31337: { + "chainId": "0x7a69", + "chainName": "Mockchain", + "rpcUrls": ["http://localhost:8545"], + "nativeCurrency": { + "name": "Test Ethereum", + "symbol": "TETH", + "decimals": 18 + } + }, +} + + +export async function switchChain(chainId) { + if (useWalletStore().chainId === chainId) + return + await window.ethereum.request({ + "method": "wallet_switchEthereumChain", + "params": [{"chainId": '0x' + chainId.toString(16)}] + }) +} + + +export async function addNetwork(chainId) { + const info = _chainInfos[chainId] + if (!info) { + console.log(`No info to add chain ${chainId}`) + return + } + await window.ethereum.request({ + "method": "wallet_addEthereumChain", + "params": [info] + }); +} + diff --git a/src/charts/chart.js b/src/charts/chart.js index 90d5ecd..55d8acd 100644 --- a/src/charts/chart.js +++ b/src/charts/chart.js @@ -26,11 +26,11 @@ function symbolChanged(symbol) { if (symbol===null) co.selectedSymbol = null else { - updateFeeDropdown() const info = lookupSymbol(symbol.ticker) symbolChangedCbs.forEach((cb) => cb(info)) co.selectedSymbol = info } + updateFeeDropdown() } @@ -109,7 +109,10 @@ export function updateFeeDropdown() { const [_addr, fee] = p return { title: (fee / 10000).toFixed(2) + '%', - onSelect: fee === symbolItem.fee ? ()=>{} : () => selectPool(fee), + onSelect: ()=>{ + if (fee !== symbolItem.fee) + selectPool(fee) + }, } }) } @@ -460,7 +463,7 @@ export function deleteShapeId(id) { chart.removeEntity(id) } -const MEAN_RANGE_MULTIPLIER = 10 +const MEAN_RANGE_MULTIPLIER = 3 function chartMeanRange() { let range = 0 diff --git a/src/charts/shape.js b/src/charts/shape.js index 8ce40ad..1d9241b 100644 --- a/src/charts/shape.js +++ b/src/charts/shape.js @@ -207,7 +207,7 @@ export class Shape { // return an object with property defaults, e.g. { "linetoolhorzline.linecolor": "#7f11e0" } // https://www.tradingview.com/charting-library-docs/latest/api/modules/Charting_Library#drawingoverrides drawingOverrides() { - return this.colorProps() + return mixin(this.colorProps(), this.creationOptions) } create() { @@ -547,8 +547,8 @@ export class DLine extends Line { // Model this.model.pointA = null // {time:..., price:...} this.model.pointB = null - this.model.extendLeft = false - this.model.extendRight = false + this.model.extendLeft = true + this.model.extendRight = true this.setModel(model) // call setModel at the end } diff --git a/src/components/NativeRow.vue b/src/components/NativeRow.vue index b4160a7..58b3541 100644 --- a/src/components/NativeRow.vue +++ b/src/components/NativeRow.vue @@ -23,7 +23,7 @@ + @click="onWithdraw"/> diff --git a/src/components/NativeWrap.vue b/src/components/NativeWrap.vue index aeb2045..0e70af8 100644 --- a/src/components/NativeWrap.vue +++ b/src/components/NativeWrap.vue @@ -33,7 +33,7 @@ import {FixedNumber} from "ethers"; const s = useStore() const props = defineProps(['modelValue', 'vault', 'maxAmount']) const emit = defineEmits(['update:modelValue']) -const balanceFloat = computed(() => Number(props.maxAmount)/1e18) +const balanceFloat = computed(() => Number(props.maxAmount)/1e18) // todo configurable native decimals const floatAmount = ref(0) function wrapNative() { diff --git a/src/components/NeedsSigner.vue b/src/components/NeedsSigner.vue index b640354..6343ef6 100644 --- a/src/components/NeedsSigner.vue +++ b/src/components/NeedsSigner.vue @@ -23,7 +23,7 @@
- Please connect your wallet to the Arbitrum-Sepolia test network to continue. + Please connect your wallet to the Arbitrum One network to continue.
@@ -39,7 +39,7 @@