Skip to content

Commit

Permalink
feat(synapse-interface): upgrade wagmi, viem, rainbowkit to support s…
Browse files Browse the repository at this point in the history
…martwallet (#2674)

* Upgrade rainbowkit, wagmi, viem

* Bump node required version

* Node

* Update .nvmrc

* Update for bumped versions
  • Loading branch information
bigboydiamonds authored Jun 5, 2024
1 parent 5de3ede commit ab26028
Show file tree
Hide file tree
Showing 10 changed files with 288 additions and 359 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.17.0
v18.18.0
3 changes: 2 additions & 1 deletion packages/synapse-interface/actions/approveErc20Token.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
type SimulateContractParameters,
simulateContract,
waitForTransactionReceipt,
writeContract,
Expand Down Expand Up @@ -36,7 +37,7 @@ export const approveErc20Token = async ({
abi,
functionName: 'approve',
args: [spender, amount ?? MAX_UINT256],
})
} as SimulateContractParameters)

const hash = await writeContract(wagmiConfig, request)

Expand Down
3 changes: 2 additions & 1 deletion packages/synapse-interface/actions/harvestLpPool.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
type SimulateContractParameters,
simulateContract,
waitForTransactionReceipt,
writeContract,
Expand All @@ -25,7 +26,7 @@ export const harvestLpPool = async ({
abi: MINICHEF_ABI,
functionName: 'harvest',
args: [poolId, address],
})
} as SimulateContractParameters)

const hash = await writeContract(wagmiConfig, request)
const txReceipt = await waitForTransactionReceipt(wagmiConfig, { hash })
Expand Down
3 changes: 2 additions & 1 deletion packages/synapse-interface/actions/stakeLpToken.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
type SimulateContractParameters,
simulateContract,
waitForTransactionReceipt,
writeContract,
Expand Down Expand Up @@ -27,7 +28,7 @@ export const stakeLpToken = async ({
abi: MINICHEF_ABI,
functionName: 'deposit',
args: [poolId, amount, address],
})
} as SimulateContractParameters)

const hash = await writeContract(wagmiConfig, request)
const txReceipt = await waitForTransactionReceipt(wagmiConfig, { hash })
Expand Down
6 changes: 5 additions & 1 deletion packages/synapse-interface/actions/swapPoolAddLiquidity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
type SimulateContractParameters,
simulateContract,
waitForTransactionReceipt,
writeContract,
Expand Down Expand Up @@ -42,7 +43,10 @@ export const swapPoolAddLiquidity = async ({
pwcConfig = pwcBaseConfig
}

const { request } = await simulateContract(wagmiConfig, pwcConfig)
const { request } = await simulateContract(
wagmiConfig,
pwcConfig as SimulateContractParameters
)

const hash = await writeContract(wagmiConfig, request)
const txReceipt = await waitForTransactionReceipt(wagmiConfig, { hash })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ALL } from '@constants/withdrawTypes'
import {
type SimulateContractParameters,
simulateContract,
waitForTransactionReceipt,
writeContract,
Expand Down Expand Up @@ -42,7 +43,7 @@ export const swapPoolRemoveLiquidity = async ({
),
Math.round(new Date().getTime() / 1000 + 60 * 10),
],
})
} as SimulateContractParameters)

const hash = await writeContract(wagmiConfig, request)
const txReceipt = await waitForTransactionReceipt(wagmiConfig, { hash })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
type SimulateContractParameters,
simulateContract,
waitForTransactionReceipt,
writeContract,
Expand Down Expand Up @@ -43,7 +44,7 @@ export const swapPoolRemoveLiquidityOneToken = async ({
),
Math.round(new Date().getTime() / 1000 + 60 * 10),
],
})
} as SimulateContractParameters)

const hash = await writeContract(wagmiConfig, request)
const txReceipt = await waitForTransactionReceipt(wagmiConfig, {
Expand Down
3 changes: 2 additions & 1 deletion packages/synapse-interface/actions/unstakeLpToken.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
type SimulateContractParameters,
simulateContract,
waitForTransactionReceipt,
writeContract,
Expand Down Expand Up @@ -27,7 +28,7 @@ export const unstakeLpToken = async ({
abi: MINICHEF_ABI,
functionName: 'withdraw',
args: [poolId, amount, address],
})
} as SimulateContractParameters)

const hash = await writeContract(wagmiConfig, request)
const txReceipt = await waitForTransactionReceipt(wagmiConfig, { hash })
Expand Down
12 changes: 6 additions & 6 deletions packages/synapse-interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.24.2",
"private": true,
"engines": {
"node": ">=18.17.0"
"node": ">=18.18.0"
},
"scripts": {
"cf:build": "npx @cloudflare/next-on-pages",
Expand All @@ -29,7 +29,7 @@
"@ethersproject/units": "5.7.0",
"@headlessui/react": "^1.7.15",
"@heroicons/react": "1.0.6",
"@rainbow-me/rainbowkit": "^2.0.4",
"@rainbow-me/rainbowkit": "^2.1.2",
"@reduxjs/toolkit": "^1.9.5",
"@rtk-query/graphql-request-base-query": "^2.2.0",
"@segment/analytics-next": "^1.53.0",
Expand All @@ -42,8 +42,8 @@
"@types/web3": "^1.2.2",
"@visx/chord": "^3.0.0",
"@visx/shape": "^3.0.0",
"@wagmi/connectors": "^4.1.24",
"@wagmi/core": "^2.6.15",
"@wagmi/connectors": "^5.0.0",
"@wagmi/core": "^2.10.5",
"babel-plugin-transform-bigint": "^1.0.32",
"eslint": "^8.37.0",
"eslint-config-next": "^13.5.6",
Expand All @@ -70,8 +70,8 @@
"tailwindcss-border-gradient-radius": "^3.0.1",
"typescript": "5.1.6",
"use-persisted-state": "^0.3.3",
"viem": "^2.9.8",
"wagmi": "^2.5.18",
"viem": "^2.13.6",
"wagmi": "^2.9.8",
"yarn": "^1.22.19"
},
"browserslist": {
Expand Down
Loading

0 comments on commit ab26028

Please sign in to comment.