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

feat(sdk): migrate to ethers v6 #2374

Open
wants to merge 117 commits into
base: feat/major-poc
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
4338547
retrigger checks
zaidarain1 Sep 19, 2024
7ae1def
retrigger checks
zaidarain1 Sep 19, 2024
b583323
pnpm, tsup migration and fix builds/errors
zaidarain1 Sep 16, 2024
5e26b1c
fix examples
zaidarain1 Sep 17, 2024
61c8d68
update playwright configs and fix zkevm tests
zaidarain1 Sep 18, 2024
6e44143
retrigger checks
zaidarain1 Sep 19, 2024
7acfd0c
update publish workflow to nx release, clean up and allow pre publish…
zaidarain1 Sep 20, 2024
46d3eb4
update checkout build process, update publish process to handle sdk v…
zaidarain1 Oct 2, 2024
b9a1645
refine sdk bundling and improve treeshaking
zaidarain1 Dec 3, 2024
5960ffa
fix vite build errors
zaidarain1 Dec 5, 2024
86ba4b1
pnpm, tsup migration and fix builds/errors
zaidarain1 Sep 16, 2024
dd5086c
fix examples
zaidarain1 Sep 17, 2024
b49b8a9
retrigger checks
zaidarain1 Sep 19, 2024
d3ca996
retrigger checks
zaidarain1 Sep 19, 2024
7de8612
retrigger checks
zaidarain1 Sep 19, 2024
1c58e3c
pnpm, tsup migration and fix builds/errors
zaidarain1 Sep 16, 2024
5663097
retrigger checks
zaidarain1 Sep 19, 2024
d3f6d74
update publish workflow to nx release, clean up and allow pre publish…
zaidarain1 Sep 20, 2024
cf8e08d
fix release syntax error
zaidarain1 Sep 20, 2024
c418718
update checkout build process, update publish process to handle sdk v…
zaidarain1 Oct 2, 2024
7dffa4c
Update readmes and contributing docs
zaidarain1 Oct 14, 2024
870dff8
migrate to ethers v6
zaidarain1 Nov 7, 2024
2eaa1f6
fix bridge sdk tests
zaidarain1 Nov 11, 2024
780e4fa
complete passport ethers migration and fix failing tests,builds and l…
zaidarain1 Nov 12, 2024
cab0ded
migrate sample apps and func tests to ethers v6
zaidarain1 Nov 13, 2024
3db31b4
fix some incorrect migrations, migrate examples and fix func tests
zaidarain1 Nov 13, 2024
e66a9b5
fix breaking tests
zaidarain1 Nov 14, 2024
0aea0cd
pushed namedbrowserprovider migration
zaidarain1 Nov 18, 2024
12b5732
pushed namedbrowserprovider migration
zaidarain1 Nov 18, 2024
d15beea
fix browser provider type errors
zaidarain1 Nov 18, 2024
640589c
Remove parseChainId
luads Nov 18, 2024
732f9d2
Remove unnecessary wrapping
luads Nov 19, 2024
3d1ed56
fix chainid typeerrors
zaidarain1 Nov 19, 2024
f5c3b5d
Update chainId calls in Swap and Bridge widgets
luads Nov 19, 2024
28a58c7
Expose underlying Ethereum provider in NamedBrowserProvider
luads Nov 20, 2024
90e87ae
underlyingprovider chainid changes
zaidarain1 Nov 20, 2024
3e6cb75
push tests updates and fixes
zaidarain1 Nov 20, 2024
0bad89c
fix transaction tests
zaidarain1 Nov 20, 2024
38bc221
Overall chainId, wallet and connect fixes
luads Nov 20, 2024
af27b4e
Remove event debugging code
luads Nov 20, 2024
3f6ddcf
fix signActions tests
zaidarain1 Nov 20, 2024
82d7be9
fix dex typeerror for calculate gas fee
zaidarain1 Nov 20, 2024
d87094a
Fix chainId type for allowed balances
luads Nov 20, 2024
d4784c5
Refactor how we determine EIP1193 providers
luads Nov 20, 2024
8f69bab
Add more type fixes
luads Nov 20, 2024
68aa800
fixed sdk tests
zaidarain1 Nov 21, 2024
c729ba0
Refactor name out of WrappedBrowserProvider
luads Nov 21, 2024
6d40904
fix rebase issues
zaidarain1 Nov 21, 2024
d52ea25
fix func tests and examples, update to ethers v6 and handle breaking …
zaidarain1 Nov 21, 2024
cb472e1
skip checkout func tests until v2 is released
zaidarain1 Nov 22, 2024
a97b00f
update hardhat versions for zkemv tests
zaidarain1 Nov 22, 2024
9a3cf3f
debug orderbook tests
zaidarain1 Nov 24, 2024
0094ec7
cleanup migration changes
zaidarain1 Nov 26, 2024
5e2385f
update biom3
zaidarain1 Nov 26, 2024
36147fc
workaround biom3 typeerrors and fix final checkout widgets tests
zaidarain1 Nov 26, 2024
ba7ab2e
fix syncpack
zaidarain1 Nov 26, 2024
ed999c3
todo contracts examples tests
zaidarain1 Nov 26, 2024
0af6167
fix contracts tests
zaidarain1 Nov 26, 2024
803025d
update lockfile
zaidarain1 Nov 26, 2024
24cd76f
Add eip1193 provider type to provider params for checkout sdk functions
zaidarain1 Nov 27, 2024
0b222a6
Feat/ethers v6 migration moo (#2424)
glomotion Nov 27, 2024
7942742
add missing uuid module
zaidarain1 Nov 27, 2024
022d6ba
update lock
zaidarain1 Nov 29, 2024
91be58c
update rebased changes to ethers v6
zaidarain1 Dec 2, 2024
2164bd5
update lockfile
zaidarain1 Dec 5, 2024
0ab00b8
update lockfile
zaidarain1 Dec 5, 2024
eae0939
fix typedoc comments for checkout and clean up changes
zaidarain1 Dec 6, 2024
f974f46
fix checkout sdk test
zaidarain1 Dec 6, 2024
689c0b9
fix orderbook variable v5 names
zaidarain1 Dec 9, 2024
d665919
revert publish pr changes
zaidarain1 Dec 9, 2024
a38b893
first release flag for publish
zaidarain1 Dec 9, 2024
e3f13f7
verbose publish
zaidarain1 Dec 9, 2024
1fc4efd
update nx
zaidarain1 Dec 9, 2024
d05f6b2
readd verbose
zaidarain1 Dec 9, 2024
40d7372
set auth for pnpm instead of npm
zaidarain1 Dec 9, 2024
b1604af
fix npmrc auth token set
zaidarain1 Dec 9, 2024
40c96ef
use echo instead of config set
zaidarain1 Dec 9, 2024
19234d7
pass npm auth token as env var
zaidarain1 Dec 9, 2024
96af810
set public config access to public for provenance
zaidarain1 Dec 9, 2024
9125ae5
add npm_token env var
zaidarain1 Dec 9, 2024
7d6bb7f
fix alpha tagging for prereleases
zaidarain1 Dec 10, 2024
cea19fc
use rollup for checkout widgets cdn bundle
zaidarain1 Dec 11, 2024
d53292c
set pre-release as default
zaidarain1 Dec 12, 2024
768776a
update lockfile
zaidarain1 Dec 12, 2024
32a5d7e
revert sdk prep changes
zaidarain1 Dec 12, 2024
a7191c7
add validation for pr title
zaidarain1 Dec 12, 2024
207387a
fix uniswap router contracts
zaidarain1 Dec 12, 2024
5b07e62
fix nx versioning
zaidarain1 Dec 12, 2024
2c0bb00
fix dev mode
zaidarain1 Dec 13, 2024
3a291fd
fix syncpack
zaidarain1 Dec 13, 2024
49b704d
update lockfile
zaidarain1 Dec 13, 2024
4feeb2e
set the correct global name for the cdn sdk js file
zaidarain1 Dec 13, 2024
de6b3b0
add doc for passport evm login outside component
zaidarain1 Dec 13, 2024
cb49bec
rename to correct browser provider types
zaidarain1 Dec 13, 2024
d285831
rename to correct browser provider types for renaming items
zaidarain1 Dec 13, 2024
6cd04e3
update lock
zaidarain1 Jan 30, 2025
9ad4dab
push rebase fixes
zaidarain1 Jan 30, 2025
0c425f9
fix ci build sdk command
zaidarain1 Jan 30, 2025
aabe193
reset nx before build
zaidarain1 Jan 30, 2025
1bf586d
fix build errors
zaidarain1 Jan 30, 2025
36f069a
fix examples
zaidarain1 Jan 31, 2025
b06f96e
check correct version after publishing
zaidarain1 Jan 31, 2025
313ed85
convert bigint chainids to enum
zaidarain1 Feb 2, 2025
e1bf11b
fix tests
zaidarain1 Feb 3, 2025
d4a2f5b
debug minification
zaidarain1 Feb 3, 2025
3e152ab
fix build error
zaidarain1 Feb 3, 2025
f9b34bf
re-enable minification and remove checkout widgets external bundles
zaidarain1 Feb 4, 2025
4a35cc2
use rollup for widgets-lib
zaidarain1 Feb 4, 2025
15e503d
fix widgets-lib exports
zaidarain1 Feb 4, 2025
6c401d6
fix widgets-lib exports
zaidarain1 Feb 4, 2025
58b8db1
clean widgets build
zaidarain1 Feb 4, 2025
bc87fd1
fix widgets lib build command
zaidarain1 Feb 4, 2025
73f8b4e
fix production node env
zaidarain1 Feb 5, 2025
e9598d5
fix process node env replace
zaidarain1 Feb 5, 2025
64aa614
test minify widgets lib output
zaidarain1 Feb 5, 2025
6ad2165
remove widgets minification
zaidarain1 Feb 6, 2025
06040eb
cleanup widgets build and update watch mode
zaidarain1 Feb 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Hi👋, please prefix this PR's title with:
### Hi👋, please ensure the PR title follows the below standards:
<!-- This will allow for auto-generated changelog entries in Github releases -->
<!-- Valid types: feat, fix, refactor, style, test, docs, build, ops, chore -->
<!-- refactor, style, test, docs, build, ops, chore types won't be included in changelogs -->
- [ ] PR is titled with conventional commit style naming: `type(scope): message`. For example: `feat(passport): my new feature`
- [ ] If you have introduced modification that necessitates immediate adjustments by this SDK's users to their applications, clients, or integrations to avert disruptions to existing features or functionalities, add a `!` after the `type(scope)`, for example `feat(passport)!: my new breaking feature`

Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ on:
type: choice
description: Release Type
options:
- prerelease
- prepatch
- preminor
- premajor
- patch
- minor
- major
required: true
default: prepatch
default: prerelease
dry_run:
type: boolean
description: "(Optional) Dry run"
Expand Down Expand Up @@ -89,6 +90,9 @@ jobs:
run: |
git config user.name "platform-sa"
git config user.email "[email protected]"

- name: Initialize current versions
run: pnpm --filter @imtbl/sdk... --filter @imtbl/checkout-widgets... exec sh -c "jq --arg version \"$(npm view @imtbl/metrics versions --json | jq -r '.[-1]')\" '.version = \$version' package.json > package.tmp.json && mv package.tmp.json package.json"

- name: Setup new package versions
run: pnpm nx release version --specifier ${{ env.RELEASE_TYPE }} $( ${{ env.DRY_RUN }} && echo "--dry-run" || echo "")
Expand All @@ -102,9 +106,6 @@ jobs:
with:
subject-path: './sdk, !./sdk/node_modules'

- name: Authenticate NPM
run: npm config set //registry.npmjs.org/:_authToken ${{ secrets.TS_IMMUTABLE_SDK_NPM_TOKEN }}

- name: Generate version.json
if: (env.DRY_RUN) == 'false'
run: |
Expand All @@ -118,8 +119,10 @@ jobs:
- name: Release to NPM
id: npm_release
env:
NODE_AUTH_TOKEN: ${{ secrets.TS_IMMUTABLE_SDK_NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm nx release publish $( ${{ env.DRY_RUN }} && echo "--dry-run" || echo "")
run: pnpm nx release publish $( ${{ env.DRY_RUN }} && echo "--dry-run" || echo "") $( ${{ startsWith(env.RELEASE_TYPE, 'pre') }} && echo "--tag alpha" || echo "")

- name: Warm up CDN
id: warm_up_cdn
Expand Down Expand Up @@ -160,7 +163,7 @@ jobs:
echo "Waiting for NPM registry to reflect version: $VERSION"

for i in {1..20}; do
LATEST_VERSION=$(npm view @imtbl/sdk@latest version)
LATEST_VERSION=$(if [[ "${{ startsWith(env.RELEASE_TYPE, 'pre') }}" == "true" ]]; then npm view @imtbl/sdk@alpha version; else npm view @imtbl/sdk@latest version; fi)
if [[ "$LATEST_VERSION" == "$VERSION" ]]; then
echo "NPM registry updated to version: $LATEST_VERSION"
exit 0
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/title-validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Title Validation

on:
pull_request:
branches:
- '**'
types:
- opened
- edited
merge_group:
branches:
- main

permissions:
pull-requests: read

env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.TS_IMMUTABLE_SDK_NX_TOKEN }}

jobs:
title-validation:
name: Validate PR title
if: ${{ github.event.action == 'opened' || github.event.changes.title.from }}
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
requireScope: true
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Install `@imtbl/sdk` and any other dependencies your example needs e.g.
```bash
pnpm add @imtbl/sdk
pnpm add @biom3/react
pnpm add @ethersproject/providers@^5.7.2
pnpm add ethers@^6.13.4
```

You should use `@biom3/react` to style your app so it matches the immutable branding. A good example of how to use Biome can be found in the [Checkout SDK Connect](/examples/checkout/sdk-connect-with-nextjs) example.
Expand Down
2 changes: 1 addition & 1 deletion examples/_deprecated/identity-with-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"dependencies": {
"@imtbl/sdk": "workspace:*",
"ethers": "^5.7.2",
"ethers": "^6.13.4",
"next": "14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
useMemo,
} from 'react';
import { config, passport } from '@imtbl/sdk';
import { ethers } from 'ethers';
import { BrowserProvider } from 'ethers';

type PassportContextType = {
passportInstance?: passport.Passport;
Expand All @@ -25,7 +25,7 @@ const PassportContext = createContext<PassportContextType>({});

export function PassportProvider({ children }: { children: ReactNode }) {
// #doc passport-instance
const passportInstance = new passport.Passport({
const passportInstance = useMemo(() => new passport.Passport({
baseConfig: {
environment: config.Environment.SANDBOX, // or config.Environment.SANDBOX
publishableKey:
Expand All @@ -36,11 +36,11 @@ export function PassportProvider({ children }: { children: ReactNode }) {
logoutRedirectUri: 'http://localhost:3000/logout', // replace with one of your logout URIs from Hub
audience: 'platform_api',
scope: 'openid offline_access email transact',
});
}), []);
// #enddoc passport-instance

// #doc passport-silent-instance
const passportSilentInstance = new passport.Passport({
const passportSilentInstance = useMemo(() => new passport.Passport({
baseConfig: {
environment: config.Environment.SANDBOX, // or config.Environment.SANDBOX
publishableKey:
Expand All @@ -52,13 +52,13 @@ export function PassportProvider({ children }: { children: ReactNode }) {
logoutMode: 'silent',
audience: 'platform_api',
scope: 'openid offline_access email transact',
});
}), []);
// #enddoc passport-silent-instance

const login = useCallback(async () => {
if (!passportInstance) return;
// #doc passport-evm-login
const provider = passportInstance.connectEvm();
const provider = await passportInstance.connectEvm();
const accounts = await provider.request({ method: 'eth_requestAccounts' });
// #enddoc passport-evm-login
window.alert(`accounts: ${accounts}`);
Expand Down Expand Up @@ -89,14 +89,14 @@ export function PassportProvider({ children }: { children: ReactNode }) {
const loginWithEthersjs = useCallback(async () => {
if (!passportInstance) return;
// #doc passport-login-with-ethersjs
const passportProvider = passportInstance.connectEvm();
const passportProvider = await passportInstance.connectEvm();

const web3Provider = new ethers.providers.Web3Provider(passportProvider);
const browserProvider = new BrowserProvider(passportProvider);

const accounts = await web3Provider.send('eth_requestAccounts', []);
const accounts = await browserProvider.send('eth_requestAccounts', []);
// #enddoc passport-login-with-ethersjs

const signer = web3Provider.getSigner();
const signer = await browserProvider.getSigner();

window.alert(
`accounts: ${accounts} signer: ${JSON.stringify(signer)}`,
Expand Down
1 change: 0 additions & 1 deletion examples/checkout/commerce-widget-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
},
"dependencies": {
"@biom3/react": "^0.25.21",
"@ethersproject/providers": "^5.7.2",
"@imtbl/sdk": "workspace:*",
"next": "14.2.7",
"react": "^18",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import path from 'path';

export const interceptWidgets = async (page: Page, widgetsVersion: string | 'latest' | '*' = 'latest') => {

return page.route(`https://cdn.jsdelivr.net/npm/@imtbl/sdk@${widgetsVersion}/dist/browser/checkout/**`, async route => {
return page.route(`https://cdn.jsdelivr.net/npm/@imtbl/checkout-widgets@${widgetsVersion}/dist/browser/**`, async route => {
const url = new URL(route.request().url());
const fileName = path.basename(url.pathname);
let filePath = path.join(__dirname, 'local-widgets-js', fileName);
Expand Down
2 changes: 1 addition & 1 deletion examples/checkout/sdk-connect-with-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
},
"dependencies": {
"@biom3/react": "^0.25.21",
"@ethersproject/providers": "^5.7.2",
"@imtbl/sdk": "workspace:*",
"ethers": "^6.13.4",
"next": "14.2.7",
"react": "^18",
"react-dom": "^18"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
import { checkout } from '@imtbl/sdk';
import { checkoutSDK } from '../utils/setupDefault';
import { useState } from 'react';
import { Web3Provider } from '@ethersproject/providers';
import { WalletInfo, WalletProviderName } from '@imtbl/sdk/checkout';
import { Button, Heading, Body, Link, Table } from '@biom3/react';
import { Button, Heading, Link, Table } from '@biom3/react';
import NextLink from 'next/link';
import { BrowserProvider } from 'ethers';

export default function ConnectWithMetamask() {

const [provider, setProvider] = useState<Web3Provider>();
const [provider, setProvider] = useState<BrowserProvider>();
const [walletProviderName, setWalletProviderName] = useState<WalletProviderName>();
const [supportedWallets, setSupportedWallets] = useState<WalletInfo[]>();
const [connectedProvider, setConnectedProvider] = useState<Web3Provider>();
const [connectedProvider, setConnectedProvider] = useState<BrowserProvider>();
const [isValidProvider, setIsValidProvider] = useState<boolean>();
const [isConnected, setIsConnected] = useState<boolean>();
const [walletAddress, setWalletAddress] = useState<string>();
Expand Down Expand Up @@ -42,8 +42,8 @@ const connectWithMetamask = async (connectWithPerms:boolean) => {
setWalletProviderName(providerRes.walletProviderName);

// #doc check-is-valid-provider
// Check if the provider if a Web3Provider
const isProviderRes = await checkout.Checkout.isWeb3Provider(providerRes.provider);
// Check if the provider if a BrowserProvider
const isProviderRes = checkout.Checkout.isWrappedBrowserProvider(providerRes.provider);
// #enddoc check-is-valid-provider

setIsValidProvider(isProviderRes);
Expand Down Expand Up @@ -71,7 +71,7 @@ const connectWithMetamask = async (connectWithPerms:boolean) => {
}

// #doc check-is-connected
// Check if the provider if a Web3Provider
// Check if the provider if a BrowserProvider
const isConnectedRes = await checkoutSDK.checkIsWalletConnected({
provider: providerRes.provider
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
},
"dependencies": {
"@biom3/react": "^0.25.21",
"@ethersproject/providers": "^5.7.2",
"@imtbl/sdk": "workspace:*",
"ethers": "^6.13.4",
"next": "14.2.7",
"react": "^18",
"react-dom": "^18"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { checkout } from "@imtbl/sdk";
import { GasEstimateSwapResult, GasEstimateBridgeToL2Result } from "@imtbl/sdk/checkout";
import { checkoutSDK } from "../utils/setupDefault";
import { useState } from "react";
import { Web3Provider } from "@ethersproject/providers";
import { Button, Heading, Body, Link, Table } from "@biom3/react";
import { Button, Heading, Link, Table } from "@biom3/react";
import NextLink from "next/link";
import { toBeHex } from "ethers";

// Function to convert hex to decimal
const hexToDecimal = (hex: string) => {
Expand Down Expand Up @@ -80,7 +80,7 @@ export default function ConnectWithMetamask() {
<Table.Cell>
{swapGasEstimate ? (
<>
<div><b>Total Fees:</b> {swapGasEstimate.fees.totalFees ? hexToDecimal(swapGasEstimate.fees.totalFees._hex) : 'N/A'}</div>
<div><b>Total Fees:</b> {swapGasEstimate.fees.totalFees ? hexToDecimal(toBeHex(swapGasEstimate.fees.totalFees)) : 'N/A'}</div>
<div><b>Token:</b> {swapGasEstimate.fees.token?.name} ({swapGasEstimate.fees.token?.symbol})</div>
</>
) : ' (not estimated)'}
Expand All @@ -91,11 +91,11 @@ export default function ConnectWithMetamask() {
<Table.Cell>
{bridgeGasEstimate ? (
<>
<div><b>Source Chain Gas:</b> {hexToDecimal(bridgeGasEstimate.fees.sourceChainGas._hex)}</div>
<div><b>Approval Fee:</b> {hexToDecimal(bridgeGasEstimate.fees.approvalFee._hex)}</div>
<div><b>Bridge Fee:</b> {hexToDecimal(bridgeGasEstimate.fees.bridgeFee._hex)}</div>
<div><b>IMTBL Fee:</b> {hexToDecimal(bridgeGasEstimate.fees.imtblFee._hex)}</div>
<div><b>Total Fees:</b> {hexToDecimal(bridgeGasEstimate.fees.totalFees._hex)}</div>
<div><b>Source Chain Gas:</b> {hexToDecimal(toBeHex(bridgeGasEstimate.fees.sourceChainGas))}</div>
<div><b>Approval Fee:</b> {hexToDecimal(toBeHex(bridgeGasEstimate.fees.approvalFee))}</div>
<div><b>Bridge Fee:</b> {hexToDecimal(toBeHex(bridgeGasEstimate.fees.bridgeFee))}</div>
<div><b>IMTBL Fee:</b> {hexToDecimal(toBeHex(bridgeGasEstimate.fees.imtblFee))}</div>
<div><b>Total Fees:</b> {hexToDecimal(toBeHex(bridgeGasEstimate.fees.totalFees))}</div>
<div><b>Token:</b> {bridgeGasEstimate.token?.name} ({bridgeGasEstimate.token?.symbol})</div>
</>
) : ' (not estimated)'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
},
"dependencies": {
"@biom3/react": "^0.25.21",
"@ethersproject/providers": "^5.7.2",
"@imtbl/sdk": "workspace:*",
"ethers": "^6.13.4",
"next": "14.2.7",
"react": "^18",
"react-dom": "^18"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import { checkout } from "@imtbl/sdk";
import { checkoutSDK } from "../utils/setupDefault";
import { useState } from "react";
import { Web3Provider } from "@ethersproject/providers";
import { Button, Heading, Body, Link, Table } from "@biom3/react";
import NextLink from "next/link";
import { WrappedBrowserProvider } from "@imtbl/sdk/checkout";

export default function ConnectWithMetamask() {
const [isConnected, setIsConnected] = useState<boolean>();
Expand All @@ -13,11 +13,11 @@ export default function ConnectWithMetamask() {
const [nativeCurrency, setNativeCurrency] = useState<string>();
// setup the loading state to enable/disable buttons when loading
const [loading, setLoadingState] = useState<boolean>(false);
const [connectedProvider, setConnectedProvider] = useState<Web3Provider>();
const [connectedProvider, setConnectedProvider] = useState<WrappedBrowserProvider>();
const [supportedNetworks, setSupportedNetworks] = useState<string[]>();
const [switchNetworkLoading, setSwitchNetworkLoading] = useState<boolean>(false);

const updateNetworkInfo = async (provider: Web3Provider) => {
const updateNetworkInfo = async (provider: WrappedBrowserProvider) => {
try {
// #doc get-network-details
// Get the network details
Expand Down Expand Up @@ -62,7 +62,7 @@ export default function ConnectWithMetamask() {
setConnectedProvider(connectRes.provider);

// #doc check-is-connected
// Check if the provider if a Web3Provider
// Check if the provider if a BrowserProvider
const isConnectedRes = await checkoutSDK.checkIsWalletConnected({
provider: providerRes.provider,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
},
"dependencies": {
"@biom3/react": "^0.25.21",
"@ethersproject/providers": "^5.7.2",
"@imtbl/sdk": "workspace:*",
"ethers": "^6.13.4",
"next": "14.2.10",
"react": "^18",
"react-dom": "^18"
Expand Down
Loading