Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot fix : revert tp gasUsed addition for Type2 transactions #1537

Merged
merged 3 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"dependencies": {
"bnc-sdk": "^4.6.6",
"@web3-onboard/coinbase": "^2.1.4",
"@web3-onboard/core": "^2.15.1-alpha.1",
"@web3-onboard/core": "^2.15.2-alpha.1",
"@web3-onboard/dcent": "^2.2.3",
"@web3-onboard/enkrypt": "^2.0.0",
"@web3-onboard/fortmatic": "^2.0.14",
Expand All @@ -72,7 +72,7 @@
"@web3-onboard/sequence": "^2.0.4",
"@web3-onboard/tallyho": "^2.0.1",
"@web3-onboard/torus": "^2.2.0",
"@web3-onboard/transaction-preview": "^2.0.3-alpha.1",
"@web3-onboard/transaction-preview": "^2.0.4-alpha.1",
"@web3-onboard/trezor": "^2.3.3",
"@web3-onboard/trust": "^2.0.0",
"@web3-onboard/uauth": "^2.0.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/core",
"version": "2.15.1",
"version": "2.15.2-alpha.1",
"description": "Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
"keywords": [
"Ethereum",
Expand Down Expand Up @@ -70,7 +70,7 @@
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1",
"@web3-onboard/gas": "^2.0.0",
"@web3-onboard/transaction-preview": "^2.0.3",
"@web3-onboard/transaction-preview": "^2.0.4-alpha.1",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-svelte3": "^3.2.1",
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/views/Index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@
{/await}
{/if}
{#if $accountCenter$.position.includes('bottom')}
<div id="transaction-preview-container" style="margin-bottom: 8px;" />
<div id="w3o-transaction-preview-container" style="margin-bottom: 8px;" />
{/if}
<div
style={!$accountCenter$.expanded &&
Expand All @@ -461,7 +461,7 @@
{/await}
</div>
{#if $accountCenter$.position.includes('top')}
<div id="transaction-preview-container" style="margin-top: 8px;" />
<div id="w3o-transaction-preview-container" style="margin-top: 8px;" />
{/if}
{#if $notify$.position.includes('top') && $accountCenter$.position.includes('top') && samePositionOrMobile}
{#await notifyComponent then Notify}
Expand Down Expand Up @@ -489,7 +489,7 @@
: ''} "
>
{#if $accountCenter$.position.includes('bottom')}
<div id="transaction-preview-container" style="margin-bottom: 8px;" />
<div id="w3o-transaction-preview-container" style="margin-bottom: 8px;" />
{/if}
<div
style={!$accountCenter$.expanded &&
Expand All @@ -511,7 +511,7 @@
{/if}
</div>
{#if $accountCenter$.position.includes('top')}
<div id="transaction-preview-container" style="margin-top: 8px;" />
<div id="w3o-transaction-preview-container" style="margin-top: 8px;" />
{/if}
</div>
{/if}
Expand All @@ -527,7 +527,7 @@
: ''} "
>
{#if $notify$.position.includes('top')}
<div id="transaction-preview-container" />
<div id="w3o-transaction-preview-container" />
{/if}
{#await notifyComponent then Notify}
{#if Notify}
Expand All @@ -540,7 +540,7 @@
{/if}
{/await}
{#if $notify$.position.includes('bottom')}
<div id="transaction-preview-container" />
<div id="w3o-transaction-preview-container" />
{/if}
</div>
{/if}
4 changes: 2 additions & 2 deletions packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"webpack-dev-server": "4.7.4"
},
"dependencies": {
"@web3-onboard/core": "^2.15.1",
"@web3-onboard/core": "^2.15.2-alpha.1",
"@web3-onboard/coinbase": "^2.1.4",
"@web3-onboard/transaction-preview": "^2.0.3",
"@web3-onboard/transaction-preview": "^2.0.4-alpha.1",
"@web3-onboard/dcent": "^2.2.3",
"@web3-onboard/frontier": "^2.0.0",
"@web3-onboard/fortmatic": "^2.0.14",
Expand Down
54 changes: 52 additions & 2 deletions packages/demo/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
new VConsole()
}

const apiKey = '0fcf74ed-b95b-4b8d-a8d8-4d655ae479d9'
const apiKey = '7ed5f4aa-fb90-4124-8ef9-f69e3e8e666d'
const infura_key = '80633e48116943128cbab25e402764ab'

let defaultTransactionObject = JSON.stringify(
Expand Down Expand Up @@ -384,6 +384,56 @@
console.log(transactionHash)
}


const swapTokens = async (provider) => {
const ethersProvider = new ethers.providers.Web3Provider(provider, 'any')

const signer = ethersProvider.getSigner()

const addressFrom = '0xc572779D7839B998DF24fc316c89BeD3D450ED13'

const CONTRACT_ADDRESS = '0x7a250d5630b4cf539739df2c5dacb4c659f2488d'

const uniswapV2router_interface = [
'function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts)'
]

const weth = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
const oneInch = '0x111111111117dc0aa78b770fa6a738034120c302'
let swapTxData
const swapContract = new ethers.Contract(
CONTRACT_ADDRESS,
uniswapV2router_interface
)
const tokenAmount = ethers.BigNumber.from(`1000000000000000000`)

const amountOutMin = 0
const amountOutMinHex = ethers.BigNumber.from(amountOutMin.toString())._hex

const path = [oneInch, weth]
const deadline = Math.floor(Date.now() / 1000) + 60 * 1 // 1 minutes from the current Unix time

const inputAmountHex = tokenAmount.toHexString()

swapTxData = await swapContract.populateTransaction.swapExactTokensForETH(
inputAmountHex,
amountOutMinHex,
path,
addressFrom,
deadline
)
const uniswapV2Router = '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D'

const popTransaction = await signer.populateTransaction(swapTxData)

await signer.sendTransaction({
...popTransaction,
from: addressFrom,
to: uniswapV2Router,
value: 0
})
}

const signMessage = async (provider, address) => {
const ethersProvider = new ethers.providers.Web3Provider(provider, 'any')

Expand Down Expand Up @@ -664,7 +714,7 @@
placeholder="0x..."
bind:value={toAddress}
/>
<button on:click={sendTransaction(provider)}>
<button on:click={() => swapTokens(provider)}>
Send Transaction
</button>
</div>
Expand Down
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/react",
"version": "2.6.3",
"version": "2.6.4-alpha.1",
"description": "A collection of React hooks for integrating Web3-Onboard in to React and Next.js projects. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
"keywords": [
"Ethereum",
Expand Down Expand Up @@ -62,7 +62,7 @@
"typescript": "^4.5.5"
},
"dependencies": {
"@web3-onboard/core": "^2.15.1",
"@web3-onboard/core": "^2.15.2-alpha.1",
"@web3-onboard/common": "^2.2.3",
"use-sync-external-store": "1.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/transaction-preview/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/transaction-preview",
"version": "2.0.3",
"version": "2.0.4-alpha.1",
"description": "In app preview of Ethereum transactions",
"keywords": [
"Ethereum",
Expand Down
16 changes: 9 additions & 7 deletions packages/transaction-preview/src/views/Maximized.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@
simResponse.gasUsed[index] * simResponse.transactions[index].gasPrice
)
}
if (simResponse.transactions[index].type === 2) {
totalGasInEth += cleanGas(
simResponse.gasUsed[index] *
(simResponse.transactions[index].baseFeePerGasGwei +
simResponse.transactions[index].maxPriorityFeePerGasGwei)
)
}
// if (simResponse.transactions[index].type === 2) {
// totalGasInEth += cleanGas(
// simResponse.gasUsed[index] *
// (simResponse.transactions[index].baseFeePerGasGwei +
// simResponse.transactions[index].maxPriorityFeePerGasGwei)
// )
// }
}

const gasUsed = (index: number) => {
Expand Down Expand Up @@ -291,6 +291,7 @@
</tr>
{/each}
{/each}
{#if totalGasInEth && totalGasUsed}
<tr>
<td class="token-text">ETH</td>
<td class="negative"
Expand All @@ -303,6 +304,7 @@
</div></td
>
</tr>
{/if}
{/if}
</tbody>
</table>
Expand Down
4 changes: 2 additions & 2 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/vue",
"version": "2.5.3",
"version": "2.5.4-alpha.1",
"description": "A collection of Vue Composables for integrating Web3-Onboard in to a Vue or Nuxt project. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized spec compliant web3 providers for all supported wallets, modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
"keywords": [
"Ethereum",
Expand Down Expand Up @@ -63,7 +63,7 @@
"@vueuse/core": "^8.4.2",
"@vueuse/rxjs": "^8.2.0",
"@web3-onboard/common": "^2.2.3",
"@web3-onboard/core": "^2.15.1",
"@web3-onboard/core": "^2.15.2-alpha.1",
"vue-demi": "^0.12.4"
},
"peerDependencies": {
Expand Down