From 3fa939658f7f1083a0281a15c9254aa779d246a4 Mon Sep 17 00:00:00 2001 From: stephenson080 Date: Tue, 15 Oct 2024 13:27:17 -0700 Subject: [PATCH 1/2] BTC transfer fix --- frontend/src/components/bridge/BridgeCard.vue | 4 ++-- frontend/src/store/contracts/bridge.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/bridge/BridgeCard.vue b/frontend/src/components/bridge/BridgeCard.vue index 9e8eba0..b4d9f98 100644 --- a/frontend/src/components/bridge/BridgeCard.vue +++ b/frontend/src/components/bridge/BridgeCard.vue @@ -273,7 +273,7 @@ const balanceAfterReceive = computed(() => { const hasAllowance = computed(() => { if (!token || !token.symbol) return false - if ((token.symbol === "RWA" && from.value === '42421') || (token.symbol === "RWA" && from.value === '42420') || (token.symbol === "BTC" && from.value === '200810') || (token.symbol === "BTC" && from.value === '200810')) return true + if ((token.symbol === "RWA" && from.value === '42421') || (token.symbol === "RWA" && from.value === '42420') || (token.symbol === "BTC" && from.value === '200810') || (token.symbol === "BTC" && from.value === '200901')) return true return allowance(bridgeUI.from) }) @@ -349,7 +349,7 @@ const isValid = computed(() => { // return true return ( ( - amount.gt(0) && (token.symbol === 'BTC' && bridgeUI.from !== '200810' && bridgeUI.from !== '200901') && + amount.gt(0) && amount.lte(balanceToken(from.value)?.toString().toBigNumber(unref(decimals))) && bridgeUI.inputAmount.split('.').length <= 2 && (bridgeUI.inputAmount.split('.').length === 2 diff --git a/frontend/src/store/contracts/bridge.ts b/frontend/src/store/contracts/bridge.ts index c5fcaf5..d0db1af 100644 --- a/frontend/src/store/contracts/bridge.ts +++ b/frontend/src/store/contracts/bridge.ts @@ -224,6 +224,7 @@ export const useBridge = defineContractStore ({ ...d, From 9ee5f97384c32f42c24a9534b6e0eda7d1bf1265 Mon Sep 17 00:00:00 2001 From: stephenson080 Date: Tue, 15 Oct 2024 14:18:23 -0700 Subject: [PATCH 2/2] fix btc-backend error --- backend-wbtc/src/services/blockchain.ts | 19 +++++++++---------- frontend/src/api/history.ts | 2 -- frontend/src/store/contracts/bridge.ts | 1 - 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/backend-wbtc/src/services/blockchain.ts b/backend-wbtc/src/services/blockchain.ts index 5e5a49b..0bb8b3b 100644 --- a/backend-wbtc/src/services/blockchain.ts +++ b/backend-wbtc/src/services/blockchain.ts @@ -26,7 +26,6 @@ async function signHashedTransaction( signerIndex: number ) { const wallet = getWallet(signerIndex) - console.log(wallet.address, 'addess', signerIndex) const domain = { name: EIP712DOMAIN_NAME, version: EIP712DOMAIN_VERSION, @@ -79,15 +78,15 @@ export const signTransaction = async ( 0 ) signatures.push(signer0) - - const signer1 = await signHashedTransaction( - extractFulfillTransaction(tx), - chainId, - toBridgeAddress, - 1 - ) - signatures.push(signer1) - + if (process.env.PRIVATE_KEY2){ + const signer1 = await signHashedTransaction( + extractFulfillTransaction(tx), + chainId, + toBridgeAddress, + 1 + ) + signatures.push(signer1) + } return signatures } else { throw Error('bad contract params') diff --git a/frontend/src/api/history.ts b/frontend/src/api/history.ts index dbc379d..2f89fca 100644 --- a/frontend/src/api/history.ts +++ b/frontend/src/api/history.ts @@ -31,7 +31,6 @@ const getUrl = (symbol: Symbol) => { } const axiosClientToken = (token: Symbol) =>{ - console.log(token, getUrl(token), 'saklsa') return axios.create({ baseURL: getUrl(token), transformResponse: [ @@ -87,7 +86,6 @@ export async function getTokenSignature( fromUser: string, index: number ): Promise { - console.log(symbol, 'sdkd') const [response, error] = await safe( axiosClientToken(symbol).get<{ signature: string | string[] }>(SIGN, { params: { fromBridgeAddress, toBridgeAssistAddress, fromChain, fromUser, index }, diff --git a/frontend/src/store/contracts/bridge.ts b/frontend/src/store/contracts/bridge.ts index d0db1af..05cbca0 100644 --- a/frontend/src/store/contracts/bridge.ts +++ b/frontend/src/store/contracts/bridge.ts @@ -224,7 +224,6 @@ export const useBridge = defineContractStore