Skip to content

Commit 8bf404a

Browse files
authored
Merge pull request #1539 from blocknative/release/2.20.2
Release 2.20.2
2 parents 41da903 + 5abb9c9 commit 8bf404a

File tree

10 files changed

+79
-27
lines changed

10 files changed

+79
-27
lines changed

docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"dependencies": {
5757
"bnc-sdk": "^4.6.6",
5858
"@web3-onboard/coinbase": "^2.1.4",
59-
"@web3-onboard/core": "^2.15.1-alpha.1",
59+
"@web3-onboard/core": "^2.15.2-alpha.1",
6060
"@web3-onboard/dcent": "^2.2.3",
6161
"@web3-onboard/enkrypt": "^2.0.0",
6262
"@web3-onboard/fortmatic": "^2.0.14",
@@ -72,7 +72,7 @@
7272
"@web3-onboard/sequence": "^2.0.4",
7373
"@web3-onboard/tallyho": "^2.0.1",
7474
"@web3-onboard/torus": "^2.2.0",
75-
"@web3-onboard/transaction-preview": "^2.0.3-alpha.1",
75+
"@web3-onboard/transaction-preview": "^2.0.4-alpha.1",
7676
"@web3-onboard/trezor": "^2.3.3",
7777
"@web3-onboard/trust": "^2.0.0",
7878
"@web3-onboard/uauth": "^2.0.1",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "web3-onboard-monorepo",
3-
"version": "2.20.1",
3+
"version": "2.20.2",
44
"private": true,
55
"workspaces": {
66
"packages": [

packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/core",
3-
"version": "2.15.1",
3+
"version": "2.15.2",
44
"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.",
55
"keywords": [
66
"Ethereum",
@@ -70,7 +70,7 @@
7070
"@typescript-eslint/eslint-plugin": "^4.31.1",
7171
"@typescript-eslint/parser": "^4.31.1",
7272
"@web3-onboard/gas": "^2.0.0",
73-
"@web3-onboard/transaction-preview": "^2.0.3",
73+
"@web3-onboard/transaction-preview": "^2.0.4",
7474
"eslint": "^7.32.0",
7575
"eslint-config-prettier": "^8.3.0",
7676
"eslint-plugin-svelte3": "^3.2.1",

packages/core/src/views/Index.svelte

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@
440440
{/await}
441441
{/if}
442442
{#if $accountCenter$.position.includes('bottom')}
443-
<div id="transaction-preview-container" style="margin-bottom: 8px;" />
443+
<div id="w3o-transaction-preview-container" style="margin-bottom: 8px;" />
444444
{/if}
445445
<div
446446
style={!$accountCenter$.expanded &&
@@ -461,7 +461,7 @@
461461
{/await}
462462
</div>
463463
{#if $accountCenter$.position.includes('top')}
464-
<div id="transaction-preview-container" style="margin-top: 8px;" />
464+
<div id="w3o-transaction-preview-container" style="margin-top: 8px;" />
465465
{/if}
466466
{#if $notify$.position.includes('top') && $accountCenter$.position.includes('top') && samePositionOrMobile}
467467
{#await notifyComponent then Notify}
@@ -489,7 +489,7 @@
489489
: ''} "
490490
>
491491
{#if $accountCenter$.position.includes('bottom')}
492-
<div id="transaction-preview-container" style="margin-bottom: 8px;" />
492+
<div id="w3o-transaction-preview-container" style="margin-bottom: 8px;" />
493493
{/if}
494494
<div
495495
style={!$accountCenter$.expanded &&
@@ -511,7 +511,7 @@
511511
{/if}
512512
</div>
513513
{#if $accountCenter$.position.includes('top')}
514-
<div id="transaction-preview-container" style="margin-top: 8px;" />
514+
<div id="w3o-transaction-preview-container" style="margin-top: 8px;" />
515515
{/if}
516516
</div>
517517
{/if}
@@ -527,7 +527,7 @@
527527
: ''} "
528528
>
529529
{#if $notify$.position.includes('top')}
530-
<div id="transaction-preview-container" />
530+
<div id="w3o-transaction-preview-container" />
531531
{/if}
532532
{#await notifyComponent then Notify}
533533
{#if Notify}
@@ -540,7 +540,7 @@
540540
{/if}
541541
{/await}
542542
{#if $notify$.position.includes('bottom')}
543-
<div id="transaction-preview-container" />
543+
<div id="w3o-transaction-preview-container" />
544544
{/if}
545545
</div>
546546
{/if}

packages/demo/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
"webpack-dev-server": "4.7.4"
2424
},
2525
"dependencies": {
26-
"@web3-onboard/core": "^2.15.1",
26+
"@web3-onboard/core": "^2.15.2",
2727
"@web3-onboard/coinbase": "^2.1.4",
28-
"@web3-onboard/transaction-preview": "^2.0.3",
28+
"@web3-onboard/transaction-preview": "^2.0.4",
2929
"@web3-onboard/dcent": "^2.2.3",
3030
"@web3-onboard/frontier": "^2.0.0",
3131
"@web3-onboard/fortmatic": "^2.0.14",

packages/demo/src/App.svelte

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
new VConsole()
4343
}
4444
45-
const apiKey = '0fcf74ed-b95b-4b8d-a8d8-4d655ae479d9'
45+
const apiKey = '7ed5f4aa-fb90-4124-8ef9-f69e3e8e666d'
4646
const infura_key = '80633e48116943128cbab25e402764ab'
4747
4848
let defaultTransactionObject = JSON.stringify(
@@ -384,6 +384,56 @@
384384
console.log(transactionHash)
385385
}
386386
387+
388+
const swapTokens = async (provider) => {
389+
const ethersProvider = new ethers.providers.Web3Provider(provider, 'any')
390+
391+
const signer = ethersProvider.getSigner()
392+
393+
const addressFrom = '0xc572779D7839B998DF24fc316c89BeD3D450ED13'
394+
395+
const CONTRACT_ADDRESS = '0x7a250d5630b4cf539739df2c5dacb4c659f2488d'
396+
397+
const uniswapV2router_interface = [
398+
'function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts)'
399+
]
400+
401+
const weth = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
402+
const oneInch = '0x111111111117dc0aa78b770fa6a738034120c302'
403+
let swapTxData
404+
const swapContract = new ethers.Contract(
405+
CONTRACT_ADDRESS,
406+
uniswapV2router_interface
407+
)
408+
const tokenAmount = ethers.BigNumber.from(`1000000000000000000`)
409+
410+
const amountOutMin = 0
411+
const amountOutMinHex = ethers.BigNumber.from(amountOutMin.toString())._hex
412+
413+
const path = [oneInch, weth]
414+
const deadline = Math.floor(Date.now() / 1000) + 60 * 1 // 1 minutes from the current Unix time
415+
416+
const inputAmountHex = tokenAmount.toHexString()
417+
418+
swapTxData = await swapContract.populateTransaction.swapExactTokensForETH(
419+
inputAmountHex,
420+
amountOutMinHex,
421+
path,
422+
addressFrom,
423+
deadline
424+
)
425+
const uniswapV2Router = '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D'
426+
427+
const popTransaction = await signer.populateTransaction(swapTxData)
428+
429+
await signer.sendTransaction({
430+
...popTransaction,
431+
from: addressFrom,
432+
to: uniswapV2Router,
433+
value: 0
434+
})
435+
}
436+
387437
const signMessage = async (provider, address) => {
388438
const ethersProvider = new ethers.providers.Web3Provider(provider, 'any')
389439
@@ -664,7 +714,7 @@
664714
placeholder="0x..."
665715
bind:value={toAddress}
666716
/>
667-
<button on:click={sendTransaction(provider)}>
717+
<button on:click={() => swapTokens(provider)}>
668718
Send Transaction
669719
</button>
670720
</div>

packages/react/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/react",
3-
"version": "2.6.3",
3+
"version": "2.6.4",
44
"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.",
55
"keywords": [
66
"Ethereum",
@@ -62,7 +62,7 @@
6262
"typescript": "^4.5.5"
6363
},
6464
"dependencies": {
65-
"@web3-onboard/core": "^2.15.1",
65+
"@web3-onboard/core": "^2.15.2",
6666
"@web3-onboard/common": "^2.2.3",
6767
"use-sync-external-store": "1.0.0"
6868
},

packages/transaction-preview/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/transaction-preview",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"description": "In app preview of Ethereum transactions",
55
"keywords": [
66
"Ethereum",

packages/transaction-preview/src/views/Maximized.svelte

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@
5757
simResponse.gasUsed[index] * simResponse.transactions[index].gasPrice
5858
)
5959
}
60-
if (simResponse.transactions[index].type === 2) {
61-
totalGasInEth += cleanGas(
62-
simResponse.gasUsed[index] *
63-
(simResponse.transactions[index].baseFeePerGasGwei +
64-
simResponse.transactions[index].maxPriorityFeePerGasGwei)
65-
)
66-
}
60+
// if (simResponse.transactions[index].type === 2) {
61+
// totalGasInEth += cleanGas(
62+
// simResponse.gasUsed[index] *
63+
// (simResponse.transactions[index].baseFeePerGasGwei +
64+
// simResponse.transactions[index].maxPriorityFeePerGasGwei)
65+
// )
66+
// }
6767
}
6868
6969
const gasUsed = (index: number) => {
@@ -291,6 +291,7 @@
291291
</tr>
292292
{/each}
293293
{/each}
294+
{#if totalGasInEth && totalGasUsed}
294295
<tr>
295296
<td class="token-text">ETH</td>
296297
<td class="negative"
@@ -303,6 +304,7 @@
303304
</div></td
304305
>
305306
</tr>
307+
{/if}
306308
{/if}
307309
</tbody>
308310
</table>

packages/vue/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/vue",
3-
"version": "2.5.3",
3+
"version": "2.5.4",
44
"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.",
55
"keywords": [
66
"Ethereum",
@@ -63,7 +63,7 @@
6363
"@vueuse/core": "^8.4.2",
6464
"@vueuse/rxjs": "^8.2.0",
6565
"@web3-onboard/common": "^2.2.3",
66-
"@web3-onboard/core": "^2.15.1",
66+
"@web3-onboard/core": "^2.15.2",
6767
"vue-demi": "^0.12.4"
6868
},
6969
"peerDependencies": {

0 commit comments

Comments
 (0)