diff --git a/.circleci/config.yml b/.circleci/config.yml index aa511a3ff..84e7397fc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -454,6 +454,12 @@ jobs: working_directory: ~/web3-onboard-monorepo/packages/particle-network steps: - node-build-steps + build-finoaconnect: + docker: + - image: cimg/node:18.0.0 + working_directory: ~/web3-onboard-monorepo/packages/finoaconnect + steps: + - node-build-steps build-wagmi: docker: - image: cimg/node:18.0.0 @@ -780,6 +786,12 @@ jobs: working_directory: ~/web3-onboard-monorepo/packages/bloom steps: - node-staging-build-steps + build-staging-finoaconnect: + docker: + - image: cimg/node:18.0.0 + working_directory: ~/web3-onboard-monorepo/packages/finoaconnect + steps: + - node-staging-build-steps workflows: version: 2 @@ -1091,3 +1103,9 @@ workflows: <<: *deploy_production_filters - build-staging-bloom: <<: *deploy_staging_filters + finoaconnect: + jobs: + - build-finoaconnect: + <<: *deploy_production_filters + - build-staging-finoaconnect: + <<: *deploy_staging_filters diff --git a/README.md b/README.md index 8602ac61a..b483974f9 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,9 @@ For full documentation, check out the README.md for each package or the [docs pa - [Frame](packages/frame/README.md) - [Blocto](packages/blocto/README.md) - [Particle Network](packages/particle-network/README.md) +- [MetaMask](packages/metamask/README.md) +- [Bitget](packages/bitget/README.md) +- [FinoaConnect](packages/finoaconnect/README.md) **Hardware Wallets** diff --git a/docs/package.json b/docs/package.json index f85f0dc21..c7d3ee996 100644 --- a/docs/package.json +++ b/docs/package.json @@ -36,7 +36,6 @@ "prettier-plugin-svelte": "^2.8.1", "react": "^18.2.0", "react-dom": "^18.2.0", - "rollup-plugin-polyfill-node": "^0.13.0", "shiki": "^0.12.0", "stream-browserify": "^3.0.0", "stream-http": "^3.2.0", @@ -46,7 +45,8 @@ "tslib": "^2.4.1", "typescript": "^5.4.5", "unplugin-icons": "^0.14.0", - "vite": "^4.5.3" + "vite": "^4.5.3", + "vite-plugin-node-polyfills": "^0.22.0" }, "type": "module", "dependencies": { @@ -54,6 +54,7 @@ "@safe-global/safe-apps-sdk": "^8.1.0", "@web3-onboard/bitget": "^2.1.1", "@web3-onboard/blocto": "^2.1.1", + "@web3-onboard/capsule": "^2.3.0", "@web3-onboard/cede-store": "^2.3.1", "@web3-onboard/coinbase": "^2.3.1", "@web3-onboard/core": "^2.22.1", @@ -72,7 +73,7 @@ "@web3-onboard/magic": "^2.2.1", "@web3-onboard/metamask": "^2.1.1", "@web3-onboard/mew-wallet": "^2.1.1", - "@web3-onboard/okx": "2.0.0-alpha.1", + "@web3-onboard/okx": "2.0.0", "@web3-onboard/particle-network": "^2.1.1", "@web3-onboard/phantom": "^2.1.1", "@web3-onboard/portis": "^2.2.1", diff --git a/docs/src/lib/services/onboard.js b/docs/src/lib/services/onboard.js index a8c5f3e44..b57b0d9f2 100644 --- a/docs/src/lib/services/onboard.js +++ b/docs/src/lib/services/onboard.js @@ -59,7 +59,8 @@ const intiOnboard = async (theme) => { const { default: bloctoModule } = await import('@web3-onboard/blocto') const { default: venlyModule } = await import('@web3-onboard/venly') const { default: bitgetModule } = await import('@web3-onboard/bitget') - // // const { default: capsuleModule, Environment } = await import('@web3-onboard/capsule') + const { default: finoaConnectModule } = await import('@web3-onboard/finoaconnect') + const { default: capsuleModule, Environment } = await import('@web3-onboard/capsule') const { default: particleAuthModule } = await import('@web3-onboard/particle-network') const INFURA_ID = '8b60d52405694345a99bcb82e722e0af' @@ -113,6 +114,9 @@ const intiOnboard = async (theme) => { } const trezor = trezorModule(trezorOptions) + const finoaConnectOptions = {}; + const finoaconnect = finoaConnectModule(finoaConnectOptions); + const uauthOptions = { clientID: 'a25c3a65-a1f2-46cc-a515-a46fe7acb78c', redirectUri: 'http://localhost:8080/', @@ -133,10 +137,10 @@ const intiOnboard = async (theme) => { environment: 'staging' }) - // // const capsule = capsuleModule({ - // // environment: Environment.DEVELOPMENT, - // // apiKey: '992bbd9146d5de8ad0419f141d9a7ca7' - // // }) + const capsule = capsuleModule({ + environment: Environment.DEVELOPMENT, + apiKey: '992bbd9146d5de8ad0419f141d9a7ca7' + }) const particle = particleAuthModule({ projectId: 'b385ccf0-73c3-485a-9941-159b7855b806', @@ -176,8 +180,9 @@ const intiOnboard = async (theme) => { infinityWallet, blocto, particle, - venly - // capsule + venly, + finoaconnect, + capsule ], chains: [ { diff --git a/docs/src/routes/docs/[...3]modules/[...1]core/+page.md b/docs/src/routes/docs/[...3]modules/[...1]core/+page.md index e6ee59706..72ea627bf 100644 --- a/docs/src/routes/docs/[...3]modules/[...1]core/+page.md +++ b/docs/src/routes/docs/[...3]modules/[...1]core/+page.md @@ -441,6 +441,7 @@ const sendTransaction = async () => { console.log(result) } ``` + --- #### disableFontDownload @@ -1902,7 +1903,9 @@ export default { '@web3-onboard/gas', '@web3-onboard/sequence', 'js-sha3', - '@ethersproject/bignumber' + '@ethersproject/bignumber', + '@safe-global/safe-apps-sdk', + '@safe-global/safe-apps-provider' ], esbuildOptions: { // Node.js global to browser globalThis diff --git a/docs/src/routes/docs/[...3]modules/[...5]transaction-preview/+page.md b/docs/src/routes/docs/[...3]modules/[...5]transaction-preview/+page.md index caf5647f1..d1adcf5d3 100644 --- a/docs/src/routes/docs/[...3]modules/[...5]transaction-preview/+page.md +++ b/docs/src/routes/docs/[...3]modules/[...5]transaction-preview/+page.md @@ -1,400 +1,9 @@ --- -title: Transaction Preview +title: Transaction Preview - Deprecated --- - - # {$frontmatter.title} :::admonition type=warning -_Transaction Preview support is sunset on July 1st 2024 and will no longer work after that date_ +_Transaction Preview support has ended and is not longer supported within Web3-Onboard. Please remove Transaction Preview to avoid console errors and unexpected behavior._ ::: - -A modular UI for previewing a single or set of unsigned Ethereum transactions. - -Transaction Preview Flow image - -### Try Transaction Preview - -Preview Vitalik swapping 100 UNI tokens for ETH using Transaction Preview - - -Full Simulation Platform API documentation can be found [here](https://docs.blocknative.com/transaction-preview-api) - -### Install - - - - -```sh copy -yarn add @web3-onboard/core @web3-onboard/injected-wallets @web3-onboard/transaction-preview -``` - - - - -```sh copy -npm i @web3-onboard/core @web3-onboard/injected-wallets @web3-onboard/transaction-preview -``` - - - - -### Usage with Web3-Onboard Core package - -Transaction Preview Flow gif - -To use the Transaction Preview package with Web3 Onboard all a developer needs to do is initialize web3-onboard with their [Blocknative API key](https://onboard.blocknative.com/docs/overview/introduction#optional-use-an-api-key-to-fetch-real-time-transaction-data-balances-gas) and pass in the module as shown below. - -```typescript copy -import Onboard from '@web3-onboard/core' -import injectedModule from '@web3-onboard/injected-wallets' -import transactionPreviewModule from '@web3-onboard/transaction-preview' - -const injected = injectedModule() -const transactionPreview = transactionPreviewModule( - // Optional initialization object - // { - // Optional: Require balance change approval prior to sending transaction to wallet - // Defaults to true - // requireTransactionApproval?: false - - // i18n?: i18nOptions - Internationalization options - // } -) - -const onboard = Onboard({ - transactionPreview, - apiKey: 'xxx387fb-bxx1-4xxc-a0x3-9d37e426xxxx' - wallets: [injected], - chains: [ - { - id: '0x1', - token: 'ETH', - label: 'Ethereum', - rpcUrl: 'https://mainnet.infura.io/v3/17c1e1500e384acfb6a72c5d2e67742e' - } - ] - // ... other Onboard options -}) - -// Transaction code here using Ether.js or Web3.js or custom -// The transaction will automatically be picked up and simulated with a UI displaying in the upper right corner -``` - -### Standalone Usage - -To use the Transaction Preview package without Web3 Onboard all a developer needs to do is: - -- Execute the entry function from the `@web3-onboard/transaction-preview` package and optional params -- Run the returned `init` function with their [Blocknative API key](https://onboard.blocknative.com/docs/overview/introduction#optional-use-an-api-key-to-fetch-real-time-transaction-data-balances-gas), an initialized instance of their [Blocknative SDK](https://www.npmjs.com/package/bnc-sdk), and a containerElement string with the html ID of the target element to append the visualization to -- Finally pass a transaction meant for a wallet provider (created using libraries like Ethers or Web3) - -With the above steps a UI will be rendered with the balance changes and gas used. - -```typescript copy -import transactionPreviewModule from '@web3-onboard/transaction-preview' - -const {init, previewTransaction} = transactionPreviewModule({ - // Optional: Require balance change approval prior to sending transaction to wallet - // Defaults to true - // requireTransactionApproval?: false - - // i18n?: i18nOptions - Internationalization options -}) -await init({ -/** - * Blocknative API key (https://explorer.blocknative.com/account) - */ -apiKey: string -/** - * Your Blocknative SDK instance - * */ -sdk: SDK -/** - * Optional dom query string to mount UI to - * */ -containerElement: string}) - -// Transaction code here using Ether.js or Web3.js or construct your own transactions -const simulate = async provider => { - // if using ethers v6 this is: - // ethersProvider = new ethers.BrowserProvider(wallet.provider, 'any') - const ethersProvider = new ethers.providers.Web3Provider(provider, 'any') - - const signer = ethersProvider.getSigner() - const addressFrom = '0xcxxxxxx11111999991111' - - // Uniswap V2 - const CONTRACT_ADDRESS = '0x7a250d5630b4cf539739df2c5dacb4c659f2488d' - const erc20_interface = [ - 'function approve(address _spender, uint256 _value) public returns (bool success)', - 'function transferFrom(address sender, address recipient, uint256 amount) external returns (bool)', - 'function balanceOf(address owner) view returns (uint256)' - ] - - 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 - let approveTxData - const swapContract = new ethers.Contract( - CONTRACT_ADDRESS, - uniswapV2router_interface - ) - const erc20_contract = new ethers.Contract(oneInch, erc20_interface) - const oneEther = ethers.BigNumber.from('9000000000000000000') - approveTxData = await erc20_contract.populateTransaction.approve( - CONTRACT_ADDRESS, - oneEther - ) - - const amountOutMin = 0 - const amountOutMinHex = ethers.BigNumber.from(amountOutMin).toHexString() - - const path = [oneInch, weth] - const deadline = Math.floor(Date.now() / 1000) + 60 * 1 // 1 minutes from the current Unix time - - const inputAmountHex = oneEther.toHexString() - - swapTxData = await swapContract.populateTransaction.swapExactTokensForETH( - inputAmountHex, - amountOutMinHex, - path, - addressFrom, - deadline - ) - const uniswapV2Router = '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D' - - const popApproveTransaction = await signer.populateTransaction(approveTxData) - const popTransaction = await signer.populateTransaction(swapTxData) - const transactions = [ - { ...popApprovedTransaction, value: 0 }, - { - ...popTransaction, - from: addressFrom, - to: uniswapV2Router, - value: 0 - } - ] - await previewTransaction(transactions) -} - - return await previewTransaction(transactions) -} - -const simData = simulate(ethereumProvider) -console.log(simData) -``` - -### Options & Types - -```typescript -export type TransactionPreviewModule = (options: TransactionPreviewOptions) => TransactionPreviewAPI - -export type FullPreviewOptions = TransactionPreviewOptions & TransactionPreviewInitOptions - -export type TransactionPreviewAPI = { - /** - * This Method accepts a standard EIP1193 provider - * (such as an injected wallet from window.ethereum) - * and it will be patched to allow for transaction previewing - */ - patchProvider: (provider: PatchedEIP1193Provider) => PatchedEIP1193Provider - - /** - * This Method accepts: - * apiKey: string - Blocknative API key (https://explorer.blocknative.com/) - * sdk: instance of an initialized bnc-sdk (www.npmjs.com/package/bnc-sdk) - * containerElement: string of an html id selector (e.g. "#my-html-el") - */ - init: (initializationOptions: TransactionPreviewInitOptions) => void - - /** - * This method accepts a transaction meant for a wallet provider - * (created using libraries like Ethers or Web3), - * simulates the transaction and generates a corresponding UI and - * return a response from the Blocknative Transaction Preview API. - * Note: the package will need to initialized with the `init` - * function prior to usage - */ - previewTransaction: (transaction: TransactionForSim[]) => Promise -} - -export type PatchedEIP1193Provider = EIP1193Provider & { simPatched: boolean } - -export interface ProviderReq { - method: string - params?: Array -} - -export type RequestOptions = Pick - -export type TransactionPreviewInitOptions = { - /** - * Blocknative API key (https://explorer.blocknative.com/account) - */ - apiKey: string - /** - * Your Blocknative SDK instance (https://www.npmjs.com/package/bnc-sdk) - * */ - sdk: SDK - /** - * Optional dom query string to mount UI to - * */ - containerElement: string -} - -export type TransactionPreviewOptions = { - /** - * Optional requirement for user to accept transaction balance changes - * prior to sending the transaction to the wallet - * Defaults to true - * */ - requireTransactionApproval?: boolean - /** - * An optional internationalization object that defines the display - * text for different locales. Can also be used to override the default text. - * To override the default text, pass in a object for the en locale - */ - i18n?: i18nOptions -} - -export type Locale = string -export type i18nOptions = Record -export type i18n = typeof en - -export type DeviceNotBrowser = { - type: null - os: null - browser: null -} - -export type TransactionForSim = SimulationTransaction & { - data?: string -} - -export interface SimulationTransaction { - from: string - to: string - value: number - gas: number - input: string - // Either Type 1 Gas (gasPrice) or Type 2 Gas (maxPriorityFeePerGas & maxFeePerGas) - // must be included in the payload - gasPrice?: number - maxPriorityFeePerGas?: number - maxFeePerGas?: number -} - -export type MultiSimOutput = { - id?: string - contractCall: ContractCall[] - error?: any - gasUsed: number[] - internalTransactions: InternalTransaction[][] - netBalanceChanges: NetBalanceChange[][] - network: Network - simDetails: SimDetails - serverVersion: string - system: System - status: Status - simulatedBlockNumber: number - transactions: InternalTransaction[] -} - -export interface ContractCall { - contractType?: string - contractAddress?: string - contractAlias?: string - methodName: string - params: Record - contractName?: string - contractDecimals?: number - decimalValue?: string -} - -export interface InternalTransaction { - type: string - from: string - to: string - input: string - gas: number - gasUsed: number - value: string - contractCall: ContractCall - error?: string - errorReason?: string -} - -export interface NetBalanceChange { - address: string - balanceChanges: BalanceChange[] -} - -export interface BalanceChange { - delta: string - asset: Asset - breakdown: BreakDown[] -} - -export interface Asset { - type: string - symbol: string - contractAddress: string -} - -export interface BreakDown { - counterparty: string - amount: string -} - -export interface InternalTransaction { - type: string - from: string - to: string - input: string - gas: number - gasUsed: number - value: string - contractCall: ContractCall -} - -export type System = 'bitcoin' | 'ethereum' -export type Network = - | 'main' - | 'testnet' - | 'sepolia' - | 'xdai' - | 'bsc-main' - | 'matic-main' - | 'fantom-main' - | 'matic-mumbai' - | 'local' - -export type Status = - | 'pending' - | 'confirmed' - | 'speedup' - | 'cancel' - | 'failed' - | 'dropped' - | 'simulated' - -export interface SimDetails { - blockNumber: number - e2eMs: number - performanceProfile: any -} -``` - -## Build Environments - -For build env configurations and setups please see the Build Env section [here](/docs/modules/core#build-environments) diff --git a/docs/src/routes/docs/[...3]modules/[...7]vue/+page.md b/docs/src/routes/docs/[...3]modules/[...7]vue/+page.md index df335698a..50c9b85d8 100644 --- a/docs/src/routes/docs/[...3]modules/[...7]vue/+page.md +++ b/docs/src/routes/docs/[...3]modules/[...7]vue/+page.md @@ -503,6 +503,9 @@ export default { commonjsOptions: { transformMixedEsModules: true } + }, + optimizeDeps: { + include: ['@safe-global/safe-apps-sdk', '@safe-global/safe-apps-provider'] } } ``` diff --git a/docs/src/routes/docs/[...4]wallets/[...12]gnosis/+page.md b/docs/src/routes/docs/[...4]wallets/[...12]gnosis/+page.md index 81d9c083f..e4612b4d8 100644 --- a/docs/src/routes/docs/[...4]wallets/[...12]gnosis/+page.md +++ b/docs/src/routes/docs/[...4]wallets/[...12]gnosis/+page.md @@ -79,4 +79,27 @@ Note: With the `safeTxGas` you will see additional value on the `gasLimit` displ ## Build Environments -For build env configurations and setups please see the Build Env section [here](/docs/modules/core#build-environments) +For build env configurations and setups please see the Build Env section [here](/docs/modules/core#build-environments). + + +## Local testing within the Safe app + +Ensure the application is building and working properly within the browser and then add or enable your cors blocker extension or script of choice. An example is the `Allow CORS` browser extension. + +## Vue Build Configuration + +If using Vue be sure to include the necessary peerDeps in the `vite.config.ts` specifically within the `optimizeDeps.include` list and install the necessary peer deps `npm i @safe-global/safe-apps-provider @safe-global/safe-apps-sdk`. + +```typescript +export default defineConfig({ + plugins: [vue(), vueJsx(), VueDevTools()], + resolve: { + alias: { + '@': fileURLToPath(new URL('./src', import.meta.url)) + } + }, + optimizeDeps: { + include: ['@safe-global/safe-apps-sdk', '@safe-global/safe-apps-provider'] + } +}) +``` \ No newline at end of file diff --git a/docs/src/routes/docs/[...4]wallets/[...36]finoaconnect/+page.md b/docs/src/routes/docs/[...4]wallets/[...36]finoaconnect/+page.md new file mode 100644 index 000000000..555dca1cf --- /dev/null +++ b/docs/src/routes/docs/[...4]wallets/[...36]finoaconnect/+page.md @@ -0,0 +1,57 @@ +--- +title: FinoaConnect +--- + +## Wallet module for connecting FinoaConnect SDK to web3-onboard + +## Install + + + + +```sh copy +yarn add @web3-onboard/core @web3-onboard/finoaconnect +``` + + + + +```sh copy +npm install @web3-onboard/core @web3-onboard/finoaconnect +``` + + + + +## Usage + +Optional initialization object +```typescript +/** Optional object provided to the initiation of the wallet connector. + * When not included, the wallet connector service connects to FinoaConnect production systems. + * @field {url} URL of the FinoaConnect backend systems to be used + * @field {labelSuffix} arbitrary string label to denote the context of the URL field */ +export interface FinoaWalletOption { + url?: string + labelSuffix?: string +} +``` + +```typescript +import Onboard from '@web3-onboard/core' +import finoaConnectModule from '@web3-onboard/finoaconnect' + +// initialize the module with options +const finoaConnect = finoaConnectModule() + +const onboard = Onboard({ + // ... other Onboard options + wallets: [ + finoaConnect + //... other wallets + ] +}) + +const connectedWallets = await onboard.connectWallet() +console.log(connectedWallets) +``` diff --git a/docs/src/routes/docs/[...4]wallets/[...38]keplr/+page.md b/docs/src/routes/docs/[...4]wallets/[...38]keplr/+page.md new file mode 100644 index 000000000..65817538a --- /dev/null +++ b/docs/src/routes/docs/[...4]wallets/[...38]keplr/+page.md @@ -0,0 +1,50 @@ +--- +title: Keplr Wallet +--- + +# {$frontmatter.title} + +## Wallet module for connecting Keplr Wallet through Web3 Onboard + +### Install + + + + +```sh copy +yarn add @web3-onboard/keplr +``` + + + + +```sh copy +npm install @web3-onboard/keplr +``` + + + + +## Usage + +```typescript +import Onboard from '@web3-onboard/core' +import KeplrWallet from '@web3-onboard/keplr' + +const keplr = KeplrWallet() + +const onboard = Onboard({ + // ... other Onboard options + wallets: [ + keplr + //... other wallets + ] +}) + +const connectedWallets = await onboard.connectWallet() +console.log(connectedWallets) +``` + +## Build Environments + +For build env configurations and setups please see the Build Env section [here](/docs/modules/core#build-environments) diff --git a/docs/vite.config.js b/docs/vite.config.js index 59699ae9b..478309846 100644 --- a/docs/vite.config.js +++ b/docs/vite.config.js @@ -1,12 +1,12 @@ import { sveltekit } from '@sveltejs/kit/vite' import icons from 'unplugin-icons/vite' import kitDocs from '@svelteness/kit-docs/node' -import nodePolyfills from 'rollup-plugin-polyfill-node' +import {nodePolyfills} from 'vite-plugin-node-polyfills' import react from '@vitejs/plugin-react'; /** @type {import('vite').UserConfig} */ const config = { - plugins: [react(), icons({ compiler: 'svelte' }), kitDocs(), sveltekit()], + plugins: [react(), icons({ compiler: 'svelte' }), kitDocs(), sveltekit(), nodePolyfills()], resolve: { alias: { crypto: 'crypto-browserify', @@ -19,7 +19,6 @@ const config = { build: { rollupOptions: { external: ['@web3-onboard/*'], - plugins: [nodePolyfills({ crypto: true, http: true })] }, commonjsOptions: { transformMixedEsModules: true diff --git a/docs/yarn.lock b/docs/yarn.lock index 379289a7c..5c045f94b 100644 --- a/docs/yarn.lock +++ b/docs/yarn.lock @@ -2544,6 +2544,20 @@ resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-3.1.1.tgz#e89b840a7af8097a8ed4953d8dc8470d1302d3ef" integrity sha512-ihb3B0T/wJm1eUuArYP4lCTSEoZsClHhuWyfo/kMX3m/odpqNcPfsz5O2A3NT7dXCAgWPGDQGPqygCpgeniKMw== +"@metamask/sdk-communication-layer@0.14.3": + version "0.14.3" + resolved "https://registry.yarnpkg.com/@metamask/sdk-communication-layer/-/sdk-communication-layer-0.14.3.tgz#0e7ec8e472641273da5802f3b357687ce12369c3" + integrity sha512-yjSbj8y7fFbQXv2HBzUX6D9C8BimkCYP6BDV7hdw53W8b/GlYCtXVxUFajQ9tuO1xPTRjR/xt/dkdr2aCi6WGw== + dependencies: + bufferutil "^4.0.8" + cross-fetch "^3.1.5" + date-fns "^2.29.3" + eciesjs "^0.3.16" + eventemitter2 "^6.4.5" + socket.io-client "^4.5.1" + utf-8-validate "^6.0.3" + uuid "^8.3.2" + "@metamask/sdk-communication-layer@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@metamask/sdk-communication-layer/-/sdk-communication-layer-0.20.2.tgz#7f7fd334b2d26abd1a5a1ec1ffadf823a9589344" diff --git a/package.json b/package.json index 313cad240..5371f6bb6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "web3-onboard-monorepo", - "version": "2.26.2", + "version": "2.27.0", "private": true, "workspaces": { "packages": [ diff --git a/packages/capsule/package.json b/packages/capsule/package.json index 3a0ca31ba..98b2884f0 100644 --- a/packages/capsule/package.json +++ b/packages/capsule/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/capsule", - "version": "2.2.0", + "version": "2.3.0", "description": "Capsule SDK wallet module for connecting to Web3-Onboard. 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, 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.", "module": "dist/index.js", "browser": "dist/index.js", @@ -57,8 +57,8 @@ ], "dependencies": { "@tanstack/react-query": "^5.29.0", - "@usecapsule/react-sdk": "^3.7.0", - "@usecapsule/wagmi-v2-integration": "^2.8.0", + "@usecapsule/react-sdk": "^3.17.0", + "@usecapsule/wagmi-v2-integration": "^2.18.0", "@wagmi/chains": "^1.8.0", "@web3-onboard/common": "^2.4.1", "react-dom": "^18.2.0", diff --git a/packages/core/README.md b/packages/core/README.md index ebaaa4b5d..d6a0b299a 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -1670,7 +1670,9 @@ const config: UserConfig = { '@web3-onboard/gas', '@web3-onboard/sequence', 'js-sha3', - '@ethersproject/bignumber' + '@ethersproject/bignumber', + '@safe-global/safe-apps-sdk', + '@safe-global/safe-apps-provider' ], esbuildOptions: { // Node.js global to browser globalThis diff --git a/packages/core/package.json b/packages/core/package.json index f7634651c..f7768a00c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -72,7 +72,6 @@ "@typescript-eslint/parser": "^4.31.1", "@web3-onboard/gas": "^2.1.5", "@web3-onboard/wagmi": "2.0.0", - "@web3-onboard/transaction-preview": "^2.0.5", "@web3-onboard/unstoppable-resolution": "^2.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", diff --git a/packages/core/src/configuration.ts b/packages/core/src/configuration.ts index 94c86db52..d4a55d88e 100644 --- a/packages/core/src/configuration.ts +++ b/packages/core/src/configuration.ts @@ -8,7 +8,6 @@ export let configuration: Configuration = { initialWalletInit: [], gas: undefined, containerElements: { accountCenter: undefined, connectModal: undefined }, - transactionPreview: undefined, unstoppableResolution: undefined, wagmi: undefined } diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 3d785ffb6..21714d289 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -37,7 +37,6 @@ import { updateChain, updateWallet } from './store/actions.js' -import type { PatchedEIP1193Provider } from '@web3-onboard/transaction-preview' import { getBlocknativeSdk } from './services.js' import type { WagmiModuleAPI } from '@web3-onboard/wagmi' import { wagmiProviderMethods } from './provider' @@ -241,7 +240,6 @@ function init(options: InitOptions): OnboardAPI { apiKey, initialWalletInit: wallets, gas, - transactionPreview, unstoppableResolution, wagmi: wagmiApi }) @@ -249,24 +247,9 @@ function init(options: InitOptions): OnboardAPI { appMetadata && updateAppMetadata(appMetadata) if (apiKey && transactionPreview) { - console.warn( - 'Transaction Preview support is going to be sunset on July 1st 2024 and will no longer work after that date' + console.error( + 'Transaction Preview support has been removed and is no longer supported within Web3-Onboard' ) - const getBnSDK = async () => { - const sdk = await getBlocknativeSdk() - if (!sdk) return - transactionPreview.init({ - containerElement: '#w3o-transaction-preview-container', - sdk, - apiKey - }) - wallets$.subscribe(wallets => { - wallets.forEach(({ provider }) => { - transactionPreview.patchProvider(provider as PatchedEIP1193Provider) - }) - }) - } - getBnSDK() } theme && updateTheme(theme) diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 2fbc11b8f..9f6183a80 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -15,7 +15,6 @@ import type { import type gas from '@web3-onboard/gas' import type unstoppableResolution from '@web3-onboard/unstoppable-resolution' -import type { TransactionPreviewAPI } from '@web3-onboard/transaction-preview' import type en from './i18n/en.json' import type { EthereumTransactionData, Network } from 'bnc-sdk' @@ -71,9 +70,12 @@ export interface InitOptions { */ containerElements?: Partial /** - * Transaction Preview module + * @deprecated Transaction Preview support has ended and Transaction Preview + * is no longer supported as part of Web3-Onboard. + * Please remove from your onboard config to avoid + * console errors and un-expected behavior */ - transactionPreview?: TransactionPreviewAPI + transactionPreview?: unknown /** * Custom or predefined theme for Web3Onboard * BuiltInThemes: ['default', 'dark', 'light', 'system'] @@ -204,7 +206,7 @@ export type Configuration = { gas?: typeof gas wagmi?: WagmiModuleAPI containerElements?: ContainerElements - transactionPreview?: TransactionPreviewAPI + transactionPreview?: unknown unstoppableResolution?: typeof unstoppableResolution } diff --git a/packages/core/src/validation.ts b/packages/core/src/validation.ts index da3882516..904a06620 100644 --- a/packages/core/src/validation.ts +++ b/packages/core/src/validation.ts @@ -249,11 +249,10 @@ const initOptions = Joi.object({ wagmi: Joi.function(), connect: connectModalOptions, containerElements: containerElements, - transactionPreview: Joi.object({ - patchProvider: Joi.function().required(), - init: Joi.function().required(), - previewTransaction: Joi.function() - }), + // transactionPreview is deprecated but is still allowed to + // avoid breaking dapps a console error is shown although + // transactionPreview functionality has been removed + transactionPreview: Joi.any(), theme: theme, disableFontDownload: Joi.boolean(), unstoppableResolution: Joi.function() diff --git a/packages/core/src/views/Index.svelte b/packages/core/src/views/Index.svelte index ae1c81818..fa53a11aa 100644 --- a/packages/core/src/views/Index.svelte +++ b/packages/core/src/views/Index.svelte @@ -407,16 +407,6 @@ {/if} -{#if !$accountCenter$.enabled && !$notify$.enabled} -
-{/if} - {#if displayAccountCenterNotifySameContainer}
- {/if}
{#await accountCenterComponent then AccountCenter} {#if AccountCenter} @@ -450,9 +437,6 @@ {/if} {/await}
- {#if $accountCenter$.position.includes('top')} -
- {/if} {#if $notify$.position.includes('top') && $accountCenter$.position.includes('top') && samePositionOrMobile} {#await notifyComponent then Notify} {#if Notify} @@ -478,9 +462,6 @@ ? 'padding-top:0;' : ''} " > - {#if $accountCenter$.position.includes('bottom')} -
- {/if}
{#if $accountCenter$.enabled && $wallets$.length} {#await accountCenterComponent then AccountCenter} @@ -490,9 +471,6 @@ {/await} {/if}
- {#if $accountCenter$.position.includes('top')} -
- {/if}
{/if} {#if displayNotifySeparate} @@ -506,9 +484,6 @@ ? 'padding-top:0;' : ''} " > - {#if $notify$.position.includes('top')} -
- {/if} {#await notifyComponent then Notify} {#if Notify} {/if} {/await} - {#if $notify$.position.includes('bottom')} -
- {/if}
{/if} diff --git a/packages/demo/package.json b/packages/demo/package.json index cc564fd3a..bf7254b5f 100644 --- a/packages/demo/package.json +++ b/packages/demo/package.json @@ -32,23 +32,26 @@ "@web3-onboard/bitget": "2.1.1", "@web3-onboard/blocto": "^2.1.1", "@web3-onboard/bloom": "2.0.0", + "@web3-onboard/capsule": "^2.3.0", "@web3-onboard/cede-store": "^2.3.1", "@web3-onboard/core": "2.22.2", "@web3-onboard/coinbase": "^2.4.1", "@web3-onboard/dcent": "^2.2.7", "@web3-onboard/enkrypt": "^2.1.1", + "@web3-onboard/finoaconnect": "2.0.0", "@web3-onboard/fortmatic": "^2.1.1", "@web3-onboard/frame": "^2.1.1", "@web3-onboard/frontier": "^2.1.1", "@web3-onboard/gas": "^2.2.1", "@web3-onboard/gnosis": "^2.3.1", "@web3-onboard/infinity-wallet": "^2.1.1", - "@web3-onboard/injected-wallets": "^2.11.1", + "@web3-onboard/injected-wallets": "^2.11.2", "@web3-onboard/keepkey": "^2.3.8", + "@web3-onboard/keplr": "2.0.0", "@web3-onboard/keystone": "^2.3.8", "@web3-onboard/ledger": "^2.7.1", "@web3-onboard/magic": "^2.2.1", - "@web3-onboard/metamask": "^2.1.2", + "@web3-onboard/metamask": "^2.1.3", "@web3-onboard/mew-wallet": "^2.1.1", "@web3-onboard/okx": "2.0.0", "@web3-onboard/particle-network": "^2.1.1", @@ -58,7 +61,7 @@ "@web3-onboard/sequence": "^2.1.1", "@web3-onboard/taho": "^2.1.1", "@web3-onboard/torus": "^2.3.1", - "@web3-onboard/transaction-preview": "^2.1.1", + "@web3-onboard/transaction-preview": "^2.1.2", "@web3-onboard/trezor": "^2.4.4", "@web3-onboard/trust": "^2.1.1", "@web3-onboard/uauth": "^2.2.1", diff --git a/packages/demo/src/App.svelte b/packages/demo/src/App.svelte index 39191c635..cfbc5de47 100644 --- a/packages/demo/src/App.svelte +++ b/packages/demo/src/App.svelte @@ -38,6 +38,8 @@ import bitgetModule from '@web3-onboard/bitget' import bloomModule from '@web3-onboard/bloom' import particleAuthModule from '@web3-onboard/particle-network' + import finoaConnectModule from '@web3-onboard/finoaconnect' + import keplrModule from '@web3-onboard/keplr' import capsuleModule, { Environment, OAuthMethod @@ -227,6 +229,7 @@ fallbackProvider: '' // insert your alchemy / infura url here // encryptionSecret: '' // encryption secret is optional, but advised to securely store values in browser storage }) + const finoaConnect = finoaConnectModule() const trezorOptions = { email: 'test@test.com', @@ -257,6 +260,7 @@ clientKey: 'cSTLqhvONB5j588Wz6E5WJLMPrHeUlGbymf1DFhO', appId: 'b1f0239a-edb0-41f9-b0f5-ab780bb02a9e' }) + const keplr = keplrModule() const dcent = dcentModule() const bitget = bitgetModule() @@ -275,7 +279,7 @@ environment: Environment.DEVELOPMENT, apiKey: '992bbd9146d5de8ad0419f141d9a7ca7', modalProps: { - oAuthMethods: [OAuthMethod.GOOGLE, OAuthMethod.TWITTER] + oAuthMethods: [OAuthMethod.GOOGLE, OAuthMethod.TWITTER, OAuthMethod.APPLE,OAuthMethod.DISCORD] }, constructorOpts: { portalBackgroundColor: '#5e5656', @@ -322,7 +326,9 @@ blocto, venly, particle, - passport + passport, + finoaConnect, + keplr ], transactionPreview, gas, diff --git a/packages/finoaconnect/README.md b/packages/finoaconnect/README.md new file mode 100644 index 000000000..046db71ef --- /dev/null +++ b/packages/finoaconnect/README.md @@ -0,0 +1,51 @@ +# @web3-onboard/finoaconnect + +## Wallet module for connecting FinoaConnect SDK to web3-onboard + +#### Install + +`npm i @web3-onboard/core @web3-onboard/finoaconnect` + +## Usage + +Optional initialization object +```typescript +/** Optional object provided to the initiation of the wallet connector. + * When not included, the wallet connector service connects to FinoaConnect production systems. + * @field {url} URL of the FinoaConnect backend systems to be used + * @field {labelSuffix} arbitrary string label to denote the context of the URL field */ +export interface FinoaWalletOption { + url?: string + labelSuffix?: string +} +``` + +```typescript +import Onboard from '@web3-onboard/core'; +import finoaConnectModule from '@web3-onboard/finoaconnect'; + +const onboard = Onboard({ + // ... other Onboard options + wallets: [ + finoaConnectModule() + //... other wallets + ] +}) + +// alternatively to connect to a localised development environment +const onboard = Onboard({ + // ... other Onboard options + wallets: [ + finoaConnectModule([ + { + labelSuffix: 'localhost', + url: 'http://localhost:8080', + } + ]) + //... other wallets + ] +}) + +const connectedWallets = await onboard.connectWallet() +console.log(connectedWallets) +``` diff --git a/packages/finoaconnect/package.json b/packages/finoaconnect/package.json new file mode 100644 index 000000000..7e04ac695 --- /dev/null +++ b/packages/finoaconnect/package.json @@ -0,0 +1,66 @@ +{ + "name": "@web3-onboard/finoaconnect", + "version": "2.0.0", + "description": "FinoaConnect enables DApp users to use Finoa's Institutional Custody services.", + "keywords": [ + "Ethereum", + "Web3", + "EVM", + "dapp", + "Multichain", + "Wallet", + "Transaction", + "Provider", + "Hardware Wallet", + "Notifications", + "React", + "Svelte", + "Vue", + "Next", + "Nuxt", + "MetaMask", + "Coinbase", + "WalletConnect", + "Ledger", + "Trezor", + "Connect Wallet", + "Ethereum Hooks", + "Blocknative", + "Mempool", + "pending", + "confirmed", + "Injected Wallet", + "Crypto", + "Crypto Wallet", + "Tally Ho", + "FinoaConnect" + ], + "repository": { + "type": "git", + "url": "https://github.com/blocknative/web3-onboard.git", + "directory": "packages/finoaconnect" + }, + "homepage": "https://onboard.blocknative.com", + "bugs": "https://github.com/blocknative/web3-onboard/issues", + "module": "dist/index.js", + "browser": "dist/index.js", + "main": "dist/index.js", + "type": "module", + "typings": "dist/index.d.ts", + "files": [ + "dist" + ], + "scripts": { + "build": "tsc", + "dev": "tsc -w", + "type-check": "tsc --noEmit" + }, + "devDependencies": { + "typescript": "^5.4.5" + }, + "dependencies": { + "@finoa/finoa-connect-sdk": "^1.0.4", + "@web3-onboard/core": "^2.20.4" + } + + } \ No newline at end of file diff --git a/packages/finoaconnect/src/icon.ts b/packages/finoaconnect/src/icon.ts new file mode 100644 index 000000000..2282313a8 --- /dev/null +++ b/packages/finoaconnect/src/icon.ts @@ -0,0 +1,6 @@ +export default ` + + + + +` \ No newline at end of file diff --git a/packages/finoaconnect/src/index.ts b/packages/finoaconnect/src/index.ts new file mode 100644 index 000000000..f49015a3c --- /dev/null +++ b/packages/finoaconnect/src/index.ts @@ -0,0 +1,72 @@ +import { FinoaEIP1193Provider } from '@finoa/finoa-connect-sdk' +import { ProviderRpcError, ProviderRpcErrorCode, type WalletInit } from '@web3-onboard/common' + +/** Optional object provided to the initiation of the wallet connector. + * When not included, the wallet connector service connects to FinoaConnect production systems. + * @field {url} URL of the FinoaConnect backend systems to be used + * @field {labelSuffix} arbitrary string label to denote the context of the URL field */ +export interface FinoaWalletOption { + url?: string + labelSuffix?: string +} + +function finoaConnect(option?: string | FinoaWalletOption): WalletInit { + const { url, labelSuffix }: FinoaWalletOption = + typeof option === 'string' ? { url: option } : !option ? {} : option + + return () => { + return { + label: `FinoaConnect${labelSuffix == null ? '' : ' - ' + labelSuffix}`, + getIcon: async () => (await import('./icon')).default, + getInterface: async ({ chains }) => { + const { + FinoaEIP1193Provider, + FinoaBrowserClient, + UnsupportedRequestError + } = await import('@finoa/finoa-connect-sdk') + + const client = new FinoaBrowserClient({ + windowUrl: url + }) + const provider = new FinoaEIP1193Provider({ + client + }) + + const proxyProvider = new Proxy(provider, { + get(target, property: keyof FinoaEIP1193Provider) { + const source = target[property] + if (property === 'request') { + return async function ( + this: FinoaEIP1193Provider, + ...args: Parameters + ) { + + try { + return await (source as FinoaEIP1193Provider['request']).call( + this, + ...args + ) + } catch (err) { + if (err instanceof UnsupportedRequestError) { + throw new ProviderRpcError({ + code: ProviderRpcErrorCode.UNSUPPORTED_METHOD, + message: `FinoaConnect Provider does not support the requested method: ${args[0].method}` + }) + } + throw err + } + } + } + return source + } + }) + + return { + provider: proxyProvider + } + } + } + } +} + +export default finoaConnect \ No newline at end of file diff --git a/packages/finoaconnect/tsconfig.json b/packages/finoaconnect/tsconfig.json new file mode 100644 index 000000000..ec0c86c1f --- /dev/null +++ b/packages/finoaconnect/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.json", + "include": ["src/**/*"], + + "compilerOptions": { + "outDir": "dist", + "rootDir": "src", + "declaration": true, + "declarationDir": "dist", + "allowSyntheticDefaultImports": true, + "paths": { + "*": ["./src/*", "./node_modules/*"] + } + } + } \ No newline at end of file diff --git a/packages/gnosis/README.md b/packages/gnosis/README.md index 435b7768f..3e4a79c16 100644 --- a/packages/gnosis/README.md +++ b/packages/gnosis/README.md @@ -57,3 +57,26 @@ let trans = await wallet.instance.txs.send({txs:[tx], params}) ``` Note: With the `safeTxGas` you will see additional value on the `gasLimit` displayed in the Safe. Check [Safe docs](https://github.com/safe-global/safe-contracts/blob/a6504a9afdeac186a8cdb29ad68b189523c80eda/docs/safe_tx_gas.md) for full details on that computation. + + +## Local testing within the Safe app + +Ensure the application is building and working properly within the browser and then add or enable your cors blocker extension or script of choice. An example is the `Allow CORS` browser extension. + +## Vue Build Configuration + +If using Vue be sure to include the necessary peerDeps in the `vite.config.ts` specifically within the `optimizeDeps.include` list and install the necessary peer deps `npm i @safe-global/safe-apps-provider @safe-global/safe-apps-sdk`. + +```typescript +export default defineConfig({ + plugins: [vue(), vueJsx(), VueDevTools()], + resolve: { + alias: { + '@': fileURLToPath(new URL('./src', import.meta.url)) + } + }, + optimizeDeps: { + include: ['@safe-global/safe-apps-sdk', '@safe-global/safe-apps-provider'] + } +}) +``` \ No newline at end of file diff --git a/packages/gnosis/package.json b/packages/gnosis/package.json index 9fd40516e..b0a3ea0f6 100644 --- a/packages/gnosis/package.json +++ b/packages/gnosis/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/gnosis", - "version": "2.3.1", + "version": "2.3.2", "description": "Safe module for connecting to Web3-Onboard. 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, 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", diff --git a/packages/injected/package.json b/packages/injected/package.json index 9d9db5416..7c3c0ae91 100644 --- a/packages/injected/package.json +++ b/packages/injected/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/injected-wallets", - "version": "2.11.1", + "version": "2.11.2", "description": "Injected wallet module for connecting browser extension and mobile wallets to Web3-Onboard. 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, 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", diff --git a/packages/injected/src/icons/keplr.ts b/packages/injected/src/icons/keplr.ts new file mode 100644 index 000000000..e8d0943e6 --- /dev/null +++ b/packages/injected/src/icons/keplr.ts @@ -0,0 +1,33 @@ +export default ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +` diff --git a/packages/injected/src/icons/trust.ts b/packages/injected/src/icons/trust.ts index 28895808f..7a8650026 100644 --- a/packages/injected/src/icons/trust.ts +++ b/packages/injected/src/icons/trust.ts @@ -1,8 +1,19 @@ export default ` - - - + + + + + + + + + + + + + + ` + + diff --git a/packages/injected/src/types.ts b/packages/injected/src/types.ts index 42c750b2b..150e61e3a 100644 --- a/packages/injected/src/types.ts +++ b/packages/injected/src/types.ts @@ -71,7 +71,8 @@ export enum ProviderIdentityFlag { Lif3Wallet = 'isLif3Wallet', ZodiacPilot = 'isZodiacPilot', StableWallet = 'isStableWallet', - Echooo = 'isEchooo' + Echooo = 'isEchooo', + Keplr = 'keplr' } /** @@ -101,7 +102,8 @@ export enum ProviderExternalUrl { Lif3Wallet = 'https://lif3.com', Rabby = 'https://rabby.io', ZodiacPilot = 'https://pilot.gnosisguild.org/', - Echooo = 'https://www.echooo.xyz' + Echooo = 'https://www.echooo.xyz', + Keplr = 'https://www.keplr.app/download' } export enum ProviderLabel { @@ -164,7 +166,8 @@ export enum ProviderLabel { Lif3Wallet = 'Lif3 Wallet', ZodiacPilot = 'Zodiac Pilot', StableWallet = 'StableWallet', - Echooo = 'Echooo' + Echooo = 'Echooo', + Keplr = 'Keplr' } export interface MeetOneProvider extends ExternalProvider { @@ -291,7 +294,7 @@ export interface InjectedWalletOptions { walletUnavailableMessage?: (wallet: WalletModule) => string /**Function that can be used to sort the order of wallets that are displayed */ sort?: (wallets: WalletModule[]) => WalletModule[] - /** A boolean that can be passed to disable supporting 6963 (https://eips.ethereum.org/EIPS/eip-6963) + /** A boolean that can be passed to disable supporting 6963 (https://eips.ethereum.org/EIPS/eip-6963) * which will display wallets available on the browser */ disable6963Support?: boolean diff --git a/packages/injected/src/wallets.ts b/packages/injected/src/wallets.ts index ee69450f3..77e7544dc 100644 --- a/packages/injected/src/wallets.ts +++ b/packages/injected/src/wallets.ts @@ -920,6 +920,17 @@ const echooo: InjectedWalletModule = { externalUrl: ProviderExternalUrl.Echooo } +const keplr: InjectedWalletModule = { + label: ProviderLabel.Keplr, + injectedNamespace: InjectedNameSpace.Ethereum, + checkProviderIdentity: ({ provider }) => + !!provider && !!provider[ProviderIdentityFlag.Keplr], + getIcon: async () => (await import('./icons/keplr.js')).default, + getInterface: getInjectedInterface(ProviderIdentityFlag.Keplr), + platforms: ['all'], + externalUrl: ProviderExternalUrl.Keplr +} + const wallets = [ zeal, exodus, @@ -978,7 +989,8 @@ const wallets = [ Lif3Wallet, zodiacPilot, stablewallet, - echooo + echooo, + keplr ] export default wallets diff --git a/packages/keplr/README.md b/packages/keplr/README.md new file mode 100644 index 000000000..698ed01db --- /dev/null +++ b/packages/keplr/README.md @@ -0,0 +1,33 @@ +# @web3-onboard/keplr + +## Wallet module for connecting keplr Wallet through web3-onboard + +Keplr Wallet SDK wallet module for connecting to Web3-Onboard. 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. + +### Install + +**NPM** +`npm i @web3-onboard/core @web3-onboard/keplr` + +**Yarn** +`yarn add @web3-onboard/core @web3-onboard/keplr` + +## Usage + +```typescript +import Onboard from '@web3-onboard/core' +import keplrModule from '@web3-onboard/keplr' + +const keplr = keplrModule() + +const onboard = Onboard({ + // ... other Onboard options + wallets: [ + keplr + //... other wallets + ] +}) + +const connectedWallets = await onboard.connectWallet() +console.log(connectedWallets) +``` diff --git a/packages/keplr/package.json b/packages/keplr/package.json new file mode 100644 index 000000000..632f24616 --- /dev/null +++ b/packages/keplr/package.json @@ -0,0 +1,66 @@ +{ + "name": "@web3-onboard/keplr", + "version": "2.0.0", + "description": "Keplr Wallet SDK wallet module for connecting to Web3-Onboard. 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", + "Web3", + "EVM", + "dapp", + "Multichain", + "Wallet", + "Transaction", + "Provider", + "Hardware Wallet", + "Notifications", + "React", + "Svelte", + "Vue", + "Next", + "Nuxt", + "MetaMask", + "Coinbase", + "WalletConnect", + "Ledger", + "Trezor", + "Connect Wallet", + "Ethereum Hooks", + "Blocknative", + "Mempool", + "pending", + "confirmed", + "Injected Wallet", + "Crypto", + "Crypto Wallet", + "Enkrypt", + "Keplr" + ], + "repository": { + "type": "git", + "url": "https://github.com/blocknative/web3-onboard.git", + "directory": "packages/keplr" + }, + "homepage": "https://www.blocknative.com/onboard", + "bugs": "https://github.com/blocknative/web3-onboard/issues", + "module": "dist/index.js", + "browser": "dist/index.js", + "main": "dist/index.js", + "type": "module", + "typings": "dist/index.d.ts", + "files": [ + "dist" + ], + "scripts": { + "build": "tsc", + "dev": "tsc -w", + "type-check": "tsc --noEmit" + }, + "license": "MIT", + "devDependencies": { + "@types/node": "^17.0.21", + "typescript": "^5.4.5" + }, + "dependencies": { + "@web3-onboard/common": "^2.4.1" + } +} diff --git a/packages/keplr/src/icon.ts b/packages/keplr/src/icon.ts new file mode 100644 index 000000000..e8d0943e6 --- /dev/null +++ b/packages/keplr/src/icon.ts @@ -0,0 +1,33 @@ +export default ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +` diff --git a/packages/keplr/src/index.ts b/packages/keplr/src/index.ts new file mode 100644 index 000000000..f8e4182e0 --- /dev/null +++ b/packages/keplr/src/index.ts @@ -0,0 +1,38 @@ +import { + type WalletInit, + type EIP1193Provider, + createDownloadMessage +} from '@web3-onboard/common' +import { createEIP1193Provider } from '@web3-onboard/common' + +import { CustomWindow } from './types.js' + +declare const window: CustomWindow + +function keplr(): WalletInit { + if (typeof window === 'undefined') return () => null + + return () => { + return { + label: 'Keplr Wallet', + getIcon: async () => (await import('./icon.js')).default, + getInterface: async () => { + const keplrwalletInjectionExists = window.hasOwnProperty('keplr') + + let provider: EIP1193Provider + + if (keplrwalletInjectionExists) { + provider = createEIP1193Provider(window['keplr']) + } else { + const downloadUrl = 'https://www.keplr.app/download' + throw new Error(createDownloadMessage('keplr Wallet', downloadUrl)) + } + return { + provider + } + } + } + } +} + +export default keplr diff --git a/packages/keplr/src/types.ts b/packages/keplr/src/types.ts new file mode 100644 index 000000000..40a88c5f8 --- /dev/null +++ b/packages/keplr/src/types.ts @@ -0,0 +1,5 @@ +import type { EIP1193Provider } from '@web3-onboard/common' + +export interface CustomWindow extends Window { + keplr?: EIP1193Provider +} diff --git a/packages/keplr/tsconfig.json b/packages/keplr/tsconfig.json new file mode 100644 index 000000000..09ae989f9 --- /dev/null +++ b/packages/keplr/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.json", + "include": ["src/**/*"], + + "compilerOptions": { + "outDir": "dist", + "rootDir": "src", + "declaration": true, + "declarationDir": "dist", + "paths": { + "*": ["./src/*", "./node_modules/*"] + }, + "typeRoots": ["node_modules/@types"] + } +} \ No newline at end of file diff --git a/packages/metamask/package.json b/packages/metamask/package.json index 6a87e1f72..702c45d25 100644 --- a/packages/metamask/package.json +++ b/packages/metamask/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/metamask", - "version": "2.1.2", + "version": "2.1.3", "description": "MetaMask SDK wallet module for connecting to Web3-Onboard. 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, 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", @@ -60,7 +60,7 @@ "typescript": "^5.2.2" }, "dependencies": { - "@metamask/sdk": "^0.26.1", + "@metamask/sdk": "^0.27.0", "@web3-onboard/common": "^2.4.1" }, "engines": { diff --git a/packages/passport/package.json b/packages/passport/package.json index d71be7fb5..6682a917a 100644 --- a/packages/passport/package.json +++ b/packages/passport/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/passport", - "version": "2.1.1", + "version": "2.1.2", "description": "passport", "module": "dist/index.js", "browser": "dist/index.js", diff --git a/packages/passport/src/index.ts b/packages/passport/src/index.ts index 4ce260cbb..36827d15b 100644 --- a/packages/passport/src/index.ts +++ b/packages/passport/src/index.ts @@ -202,7 +202,7 @@ function passport(options: PassportOptions): WalletInit { return { label: 'Passport', getIcon: async () => (await import('./icon')).default, - getInterface: async () => { + getInterface: async ({ EventEmitter }) => { const { Passport, Network } = await import('@0xpass/passport') const { createPassportClient } = await import('@0xpass/passport-viem') const { http } = await import('viem') @@ -288,6 +288,9 @@ function passport(options: PassportOptions): WalletInit { const provider = createEIP1193Provider(client) + const events = new EventEmitter() + provider.on = events.on.bind(events) + return { instance: passport, provider: provider diff --git a/packages/transaction-preview/README.md b/packages/transaction-preview/README.md index ef73578cd..f3a3ee3ff 100644 --- a/packages/transaction-preview/README.md +++ b/packages/transaction-preview/README.md @@ -1,368 +1,3 @@ # @web3-onboard/transaction-preview -## (Deprecated) Transaction Preview support is going to be sunset on July 1st 2024 and will no longer work after that date - -## A modular UI for previewing a single or set of unsigned Ethereum transactions. - -![Transaction Preview Flow](https://github.com/blocknative/web3-onboard/blob/develop/assets/transaction-preview.gif?raw=true 'Transaction Preview Flow') - -#### Give Transaction Preview a test run by previewing Vitalik swapping tokens and find full package documentation [here](https://onboard.blocknative.com/docs/packages/transaction-preview) - -Full Simulation Platform API documentation can be found [here](https://docs.blocknative.com/transaction-preview-api) - -### Install - -**NPM** -`npm i @web3-onboard/core @web3-onboard/injected-wallets @web3-onboard/transaction-preview` - -**Yarn** -`yarn add @web3-onboard/core @web3-onboard/injected-wallets @web3-onboard/transaction-preview` - -### Usage with Web3-Onboard Core package - -![Transaction Preview Image with Account Center](https://github.com/blocknative/web3-onboard/blob/develop/assets/transaction-preview.png?raw=true 'Transaction Preview Image with Account Center') - -To use the Transaction Preview package with web3-onboard all a developer needs to do is initialize web3-onboard with their [Blocknative API key](https://onboard.blocknative.com/docs/overview/introduction#optional-use-an-api-key-to-fetch-real-time-transaction-data-balances-gas) and pass in the module as shown below. - -```typescript -import Onboard from '@web3-onboard/core' -import injectedModule from '@web3-onboard/injected-wallets' -import transactionPreviewModule from '@web3-onboard/transaction-preview' - -const injected = injectedModule() -const transactionPreview = transactionPreviewModule({ - // Optional: Require balance change approval prior to sending transaction to wallet - // Defaults to true - // requireTransactionApproval?: false - - // i18n?: i18nOptions - Internationalization options -}) - -const onboard = Onboard({ - transactionPreview, - apiKey: 'xxx387fb-bxx1-4xxc-a0x3-9d37e426xxxx' - wallets: [injected], - chains: [ - { - id: '0x1', - token: 'ETH', - label: 'Ethereum', - rpcUrl: 'https://mainnet.infura.io/v3/17c1e1500e384acfb6a72c5d2e67742e' - } - ] - // ... other Onboard options -}) - -// Transaction code here using Ether.js or Web3.js or custom -// The transaction will automatically be picked up and simulated with a UI displaying in the upper right corner -``` - -### Standalone Usage - -To use the Transaction Preview package without web3-onboard all a developer needs to do is: -- Execute the entry function from the `@web3-onboard/transaction-preview` package and optional params -- Run the returned `init` function with their [Blocknative API key](https://onboard.blocknative.com/docs/overview/introduction#optional-use-an-api-key-to-fetch-real-time-transaction-data-balances-gas), an initialized instance of their [Blocknative SDK](https://www.npmjs.com/package/bnc-sdk) and a containerElement string with the html ID of the target element to append the visualization to -- Finally pass a transaction meant for a wallet provider (created using libraries like Ethers or Web3) - -With the above steps a UI will be rendered with the balance changes and gas used. - -```typescript -import transactionPreviewModule from '@web3-onboard/transaction-preview' - -const {init, previewTransaction} = transactionPreviewModule({ - // Optional: Require balance change approval prior to sending transaction to wallet - // Defaults to true - // requireTransactionApproval?: false - - // i18n?: i18nOptions - Internationalization options -}) -await init({ -/** - * Blocknative API key (https://explorer.blocknative.com/account) - */ -apiKey: string -/** - * Your Blocknative SDK instance - * */ -sdk: SDK -/** - * Optional dom query string to mount UI to - * */ -containerElement: string}) - -// Transaction code here using Ether.js or Web3.js or construct your own transactions -const simulate = async provider => { - // if using ethers v6 this is: - // ethersProvider = new ethers.BrowserProvider(wallet.provider, 'any') - const ethersProvider = new ethers.providers.Web3Provider(provider, 'any') - - const signer = ethersProvider.getSigner() - const addressFrom = '0xcxxxxxx11111999991111' - - // Uniswap V2 - const CONTRACT_ADDRESS = '0x7a250d5630b4cf539739df2c5dacb4c659f2488d' - const erc20_interface = [ - 'function approve(address _spender, uint256 _value) public returns (bool success)', - 'function transferFrom(address sender, address recipient, uint256 amount) external returns (bool)', - 'function balanceOf(address owner) view returns (uint256)' - ] - - 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 - let approveTxData - const swapContract = new ethers.Contract( - CONTRACT_ADDRESS, - uniswapV2router_interface - ) - const erc20_contract = new ethers.Contract(oneInch, erc20_interface) - const oneEther = ethers.BigNumber.from('9000000000000000000') - approveTxData = await erc20_contract.populateTransaction.approve( - CONTRACT_ADDRESS, - oneEther - ) - - const amountOutMin = 0 - const amountOutMinHex = ethers.BigNumber.from(amountOutMin).toHexString() - - const path = [oneInch, weth] - const deadline = Math.floor(Date.now() / 1000) + 60 * 1 // 1 minutes from the current Unix time - - const inputAmountHex = oneEther.toHexString() - - swapTxData = await swapContract.populateTransaction.swapExactTokensForETH( - inputAmountHex, - amountOutMinHex, - path, - addressFrom, - deadline - ) - const uniswapV2Router = '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D' - - const popApproveTransaction = await signer.populateTransaction(approveTxData) - const popTransaction = await signer.populateTransaction(swapTxData) - const transactions = [ - { ...popApprovedTransaction, value: 0 }, - { - ...popTransaction, - from: addressFrom, - to: uniswapV2Router, - value: 0 - } - ] - return await previewTransaction(transactions) -} - -const simData = simulate(ethereumProvider) -console.log(simData) -``` - -### Options & Types - -```typescript -export type TransactionPreviewModule = ( - options: TransactionPreviewOptions -) => TransactionPreviewAPI - -export type FullPreviewOptions = TransactionPreviewOptions & - TransactionPreviewInitOptions - -export type TransactionPreviewAPI = { - /** - * This Method accepts a standard EIP1193 provider - * (such as an injected wallet from window.ethereum) - * and it will be patched to allow for transaction previewing - */ - patchProvider: (provider: PatchedEIP1193Provider) => PatchedEIP1193Provider - - /** - * This Method accepts: - * apiKey: string - Blocknative API key (https://explorer.blocknative.com/) - * sdk: instance of an initialized bnc-sdk (www.npmjs.com/package/bnc-sdk) - * containerElement: string of an html id selector (e.g. "#my-html-el") - */ - init: (initializationOptions: TransactionPreviewInitOptions) => void - - /** - * This method accepts a transaction meant for a wallet provider - * (created using libraries like Ethers or Web3), - * simulates the transaction and generates a corresponding UI and - * return a response from the Blocknative Transaction Preview API. - * Note: the package will need to initialized with the `init` - * function prior to usage - */ - previewTransaction: ( - transaction: TransactionForSim[] - ) => Promise -} - -export type PatchedEIP1193Provider = EIP1193Provider & { simPatched: boolean } - -export interface ProviderReq { - method: string - params?: Array -} - -export type RequestOptions = Pick - -export type TransactionPreviewInitOptions = { - /** - * Blocknative API key (https://explorer.blocknative.com/account) - */ - apiKey: string - /** - * Your Blocknative SDK instance (https://www.npmjs.com/package/bnc-sdk) - * */ - sdk: SDK - /** - * Optional dom query string to mount UI to - * */ - containerElement: string -} - -export type TransactionPreviewOptions = { - /** - * Optional requirement for user to accept transaction balance changes - * prior to sending the transaction to the wallet - * Defaults to true - * */ - requireTransactionApproval?: boolean - /** - * An optional internationalization object that defines the display - * text for different locales. Can also be used to override the default text. - * To override the default text, pass in a object for the en locale - */ - i18n?: i18nOptions -} - -export type Locale = string -export type i18nOptions = Record -export type i18n = typeof en - -export type DeviceNotBrowser = { - type: null - os: null - browser: null -} - -export type TransactionForSim = SimulationTransaction & { - data?: string -} - -export interface SimulationTransaction { - from: string - to: string - value: number - gas: number - input: string - // Either Type 1 Gas (gasPrice) or Type 2 Gas (maxPriorityFeePerGas & maxFeePerGas) - // must be included in the payload - gasPrice?: number - maxPriorityFeePerGas?: number - maxFeePerGas?: number -} - -export type MultiSimOutput = { - id?: string - contractCall: ContractCall[] - error?: any - gasUsed: number[] - internalTransactions: InternalTransaction[][] - netBalanceChanges: NetBalanceChange[][] - network: Network - simDetails: SimDetails - serverVersion: string - system: System - status: Status - simulatedBlockNumber: number - transactions: InternalTransaction[] -} - -export interface ContractCall { - contractType?: string - contractAddress?: string - contractAlias?: string - methodName: string - params: Record - contractName?: string - contractDecimals?: number - decimalValue?: string -} - -export interface InternalTransaction { - type: string - from: string - to: string - input: string - gas: number - gasUsed: number - value: string - contractCall: ContractCall - error?: string - errorReason?: string -} - -export interface NetBalanceChange { - address: string - balanceChanges: BalanceChange[] -} - -export interface BalanceChange { - delta: string - asset: Asset - breakdown: BreakDown[] -} - -export interface Asset { - type: string - symbol: string - contractAddress: string -} - -export interface BreakDown { - counterparty: string - amount: string -} - -export interface InternalTransaction { - type: string - from: string - to: string - input: string - gas: number - gasUsed: number - value: string - contractCall: ContractCall -} - -export type System = 'bitcoin' | 'ethereum' -export type Network = - | 'main' - | 'testnet' - | 'sepolia' - | 'xdai' - | 'bsc-main' - | 'matic-main' - | 'fantom-main' - | 'matic-mumbai' - | 'local' - -export type Status = - | 'pending' - | 'confirmed' - | 'speedup' - | 'cancel' - | 'failed' - | 'dropped' - | 'simulated' - -export interface SimDetails { - blockNumber: number - e2eMs: number - performanceProfile: any -} -``` +## (Deprecated) Transaction Preview support has ended and is not longer supported within Web3-Onboard. Please remove Transaction Preview to avoid console errors and unexpected behavior. diff --git a/packages/transaction-preview/package.json b/packages/transaction-preview/package.json index aae27f489..b22fc958a 100644 --- a/packages/transaction-preview/package.json +++ b/packages/transaction-preview/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/transaction-preview", - "version": "2.1.1", + "version": "2.1.2", "description": "In app preview of Ethereum transactions", "keywords": [ "Ethereum", diff --git a/packages/trust/package.json b/packages/trust/package.json index 8855d3510..75436fd07 100644 --- a/packages/trust/package.json +++ b/packages/trust/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/trust", - "version": "2.1.1", + "version": "2.1.2", "description": "Trust Wallet SDK wallet module for connecting to Web3-Onboard. 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", diff --git a/packages/trust/src/icon.ts b/packages/trust/src/icon.ts index 64890a79d..8553daad6 100644 --- a/packages/trust/src/icon.ts +++ b/packages/trust/src/icon.ts @@ -1,8 +1,17 @@ export default ` - - + + + + + + + + + + + + + ` diff --git a/yarn.lock b/yarn.lock index 970b45441..719d8f96a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1770,6 +1770,11 @@ dependencies: keccak "^3.0.0" +"@finoa/finoa-connect-sdk@^1.0.4": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@finoa/finoa-connect-sdk/-/finoa-connect-sdk-1.0.5.tgz#95e9707a8382e8c80b44342aa49e74b07eb04e28" + integrity sha512-Dzp8fCZVODtG+xirXjy7JFAqvOgU9fRMFISiUr5N53XW+hsOsjYTi7IO/HApoXSAq9vFtVw7CMHG2+M0PlX+wg== + "@formatjs/ecma402-abstract@1.11.3": version "1.11.3" resolved "https://registry.yarnpkg.com/@formatjs/ecma402-abstract/-/ecma402-abstract-1.11.3.tgz#f25276dfd4ef3dac90da667c3961d8aa9732e384" @@ -2103,12 +2108,21 @@ "@metamask/safe-event-emitter" "^3.0.0" "@metamask/utils" "^8.3.0" -"@metamask/json-rpc-middleware-stream@^6.0.2": - version "6.0.2" - resolved "https://registry.yarnpkg.com/@metamask/json-rpc-middleware-stream/-/json-rpc-middleware-stream-6.0.2.tgz#75852ce481f8f9f091edbfc04ffdf964f8f3cabd" - integrity sha512-jtyx3PRfc1kqoLpYveIVQNwsxYKefc64/LCl9h9Da1m3nUKEvypbYuXSIwi237qvOjKmNHQKsDOZg6f4uBf62Q== +"@metamask/json-rpc-engine@^8.0.1", "@metamask/json-rpc-engine@^8.0.2": + version "8.0.2" + resolved "https://registry.yarnpkg.com/@metamask/json-rpc-engine/-/json-rpc-engine-8.0.2.tgz#29510a871a8edef892f838ee854db18de0bf0d14" + integrity sha512-IoQPmql8q7ABLruW7i4EYVHWUbF74yrp63bRuXV5Zf9BQwcn5H9Ww1eLtROYvI1bUXwOiHZ6qT5CWTrDc/t/AA== dependencies: - "@metamask/json-rpc-engine" "^7.3.2" + "@metamask/rpc-errors" "^6.2.1" + "@metamask/safe-event-emitter" "^3.0.0" + "@metamask/utils" "^8.3.0" + +"@metamask/json-rpc-middleware-stream@^7.0.1": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@metamask/json-rpc-middleware-stream/-/json-rpc-middleware-stream-7.0.2.tgz#2e8b2cbc38968e3c6239a9144c35bbb08a8fb57d" + integrity sha512-yUdzsJK04Ev98Ck4D7lmRNQ8FPioXYhEUZOMS01LXW8qTvPGiRVXmVltj2p4wrLkh0vW7u6nv0mNl5xzC5Qmfg== + dependencies: + "@metamask/json-rpc-engine" "^8.0.2" "@metamask/safe-event-emitter" "^3.0.0" "@metamask/utils" "^8.3.0" readable-stream "^3.6.2" @@ -2153,6 +2167,24 @@ "@metamask/utils" "^5.0.0" readable-stream "2.3.3" +"@metamask/providers@16.1.0": + version "16.1.0" + resolved "https://registry.yarnpkg.com/@metamask/providers/-/providers-16.1.0.tgz#7da593d17c541580fa3beab8d9d8a9b9ce19ea07" + integrity sha512-znVCvux30+3SaUwcUGaSf+pUckzT5ukPRpcBmy+muBLC0yaWnBcvDqGfcsw6CBIenUdFrVoAFa8B6jsuCY/a+g== + dependencies: + "@metamask/json-rpc-engine" "^8.0.1" + "@metamask/json-rpc-middleware-stream" "^7.0.1" + "@metamask/object-multiplex" "^2.0.0" + "@metamask/rpc-errors" "^6.2.1" + "@metamask/safe-event-emitter" "^3.1.1" + "@metamask/utils" "^8.3.0" + detect-browser "^5.2.0" + extension-port-stream "^3.0.0" + fast-deep-equal "^3.1.3" + is-stream "^2.0.0" + readable-stream "^3.6.2" + webextension-polyfill "^0.10.0" + "@metamask/providers@^10.2.1": version "10.2.1" resolved "https://registry.yarnpkg.com/@metamask/providers/-/providers-10.2.1.tgz#61304940adeccc7421dcda30ffd1d834273cc77b" @@ -2171,24 +2203,6 @@ pump "^3.0.0" webextension-polyfill-ts "^0.25.0" -"@metamask/providers@^15.0.0": - version "15.0.0" - resolved "https://registry.yarnpkg.com/@metamask/providers/-/providers-15.0.0.tgz#e8957bb89d2f3379b32b60117d79a141e44db2bc" - integrity sha512-FXvL1NQNl6I7fMOJTfQYcBlBZ33vSlm6w80cMpmn8sJh0Lb7wcBpe02UwBsNlARnI+Qsr26XeDs6WHUHQh8CuA== - dependencies: - "@metamask/json-rpc-engine" "^7.3.2" - "@metamask/json-rpc-middleware-stream" "^6.0.2" - "@metamask/object-multiplex" "^2.0.0" - "@metamask/rpc-errors" "^6.2.1" - "@metamask/safe-event-emitter" "^3.0.0" - "@metamask/utils" "^8.3.0" - detect-browser "^5.2.0" - extension-port-stream "^3.0.0" - fast-deep-equal "^3.1.3" - is-stream "^2.0.0" - readable-stream "^3.6.2" - webextension-polyfill "^0.10.0" - "@metamask/providers@^8.1.1": version "8.1.1" resolved "https://registry.yarnpkg.com/@metamask/providers/-/providers-8.1.1.tgz#7b0dbb54700c949aafba24c9b98e6f4e9d81f325" @@ -2233,6 +2247,11 @@ resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-3.0.0.tgz#8c2b9073fe0722d48693143b0dc8448840daa3bd" integrity sha512-j6Z47VOmVyGMlnKXZmL0fyvWfEYtKWCA9yGZkU3FCsGZUT5lHGmvaV9JA5F2Y+010y7+ROtR3WMXIkvl/nVzqQ== +"@metamask/safe-event-emitter@^3.1.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-3.1.1.tgz#e89b840a7af8097a8ed4953d8dc8470d1302d3ef" + integrity sha512-ihb3B0T/wJm1eUuArYP4lCTSEoZsClHhuWyfo/kMX3m/odpqNcPfsz5O2A3NT7dXCAgWPGDQGPqygCpgeniKMw== + "@metamask/sdk-communication-layer@0.14.3": version "0.14.3" resolved "https://registry.yarnpkg.com/@metamask/sdk-communication-layer/-/sdk-communication-layer-0.14.3.tgz#0e7ec8e472641273da5802f3b357687ce12369c3" @@ -2247,15 +2266,15 @@ utf-8-validate "^6.0.3" uuid "^8.3.2" -"@metamask/sdk-communication-layer@0.26.0": - version "0.26.0" - resolved "https://registry.yarnpkg.com/@metamask/sdk-communication-layer/-/sdk-communication-layer-0.26.0.tgz#4578138328823762ee5b25f7943bb7910b888aa6" - integrity sha512-Pu9y2YoQMC7mnaVyr2MddUUofPqqE+rZL1NFk30lJbNCVGopWSubWoF8fJZw54fWngNEN0HXPNkTokd5UCvwjQ== +"@metamask/sdk-communication-layer@0.27.0": + version "0.27.0" + resolved "https://registry.yarnpkg.com/@metamask/sdk-communication-layer/-/sdk-communication-layer-0.27.0.tgz#8d618fadd39f11627d5b3ef1bc72867439e33ff4" + integrity sha512-G9LCaQzIqp5WmUmvHN6UUdjWrBh67MbRobmbbs5fcc2+9XFhj3vBgtyleUYjun91jSlPHoZeo+f/Pj4/WoPIJg== dependencies: bufferutil "^4.0.8" date-fns "^2.29.3" debug "^4.3.4" - utf-8-validate "^6.0.3" + utf-8-validate "^5.0.2" uuid "^8.3.2" "@metamask/sdk-install-modal-web@0.14.1": @@ -2271,10 +2290,10 @@ react-dom "^18.2.0" react-i18next "^13.2.2" -"@metamask/sdk-install-modal-web@0.26.0": - version "0.26.0" - resolved "https://registry.yarnpkg.com/@metamask/sdk-install-modal-web/-/sdk-install-modal-web-0.26.0.tgz#412a89747a96e94233eb59d2779ab26656096688" - integrity sha512-LyDQFIsWWyU0ZgZR3O9LzRqKzXcYUEGJRCNfb26IjFOquvmQosbhQV0jDNlVa8Tk2Fg4ykTPoaauANh6sVJYVQ== +"@metamask/sdk-install-modal-web@0.26.5": + version "0.26.5" + resolved "https://registry.yarnpkg.com/@metamask/sdk-install-modal-web/-/sdk-install-modal-web-0.26.5.tgz#b696c78818adaff85d01a4f41fecc8fd2c80bc59" + integrity sha512-qVA9Nk+NorGx5hXyODy5wskptE8R7RNYTYt49VbQpJogqbbVe1dnJ98+KaA43PBN4XYMCXmcIhULNiEHGsLynA== dependencies: qr-code-styling "^1.6.0-rc.1" @@ -2309,15 +2328,15 @@ util "^0.12.4" uuid "^8.3.2" -"@metamask/sdk@^0.26.1": - version "0.26.1" - resolved "https://registry.yarnpkg.com/@metamask/sdk/-/sdk-0.26.1.tgz#9484c868a4826058781a037237959f3fe2b669d6" - integrity sha512-WLlCBtqqsi+DEqW7DfBq0k1Hu3fqIkiNFH0EehUix0UDPWnpv6a6acrOFoeB4ga/lbaQK2CrlIfUp0shaYdZbA== +"@metamask/sdk@^0.27.0": + version "0.27.0" + resolved "https://registry.yarnpkg.com/@metamask/sdk/-/sdk-0.27.0.tgz#38617985b8305a0f5d482cdd7af8ddec87968bb7" + integrity sha512-6sMjr/0qR700X1svPGEQ4rBdtccidBLeTC27fYQc7r9ROgSixB1DUUAyu/LoySVqt3Hu/Zm7NnAHXuT228ht7A== dependencies: "@metamask/onboarding" "^1.0.1" - "@metamask/providers" "^15.0.0" - "@metamask/sdk-communication-layer" "0.26.0" - "@metamask/sdk-install-modal-web" "0.26.0" + "@metamask/providers" "16.1.0" + "@metamask/sdk-communication-layer" "0.27.0" + "@metamask/sdk-install-modal-web" "0.26.5" "@types/dom-screen-wake-lock" "^1.0.0" bowser "^2.9.0" cross-fetch "^4.0.0" @@ -2325,7 +2344,7 @@ eciesjs "^0.3.15" eth-rpc-errors "^4.0.3" eventemitter2 "^6.4.7" - i18next "22.5.1" + i18next "23.11.5" i18next-browser-languagedetector "7.1.0" obj-multiplex "^1.0.0" pump "^3.0.0" @@ -3536,6 +3555,16 @@ resolved "https://registry.yarnpkg.com/@stencil/core/-/core-4.16.0.tgz#79c430d5875e0ce3a7666607b6fb53512890577b" integrity sha512-gXaC5IrquV/Hw5JIZTCWkM5lJEbBQtnvHLhDebjar6A6+YBqxah04dardS+YUNVuRbnE6Hcja7KKiAXT3oVsvw== +"@stripe/crypto@^0.0.4": + version "0.0.4" + resolved "https://registry.yarnpkg.com/@stripe/crypto/-/crypto-0.0.4.tgz#51dbcb3750c75a6b8a6c8775381af82367359146" + integrity sha512-gcD/aG0N90ZrNVppWYf9ADPECptw6PVtF67VIeaFP7fhgd2NvNx8erkzlcvk3VIVSY+bZ6YGX7c7cASoySX74Q== + +"@stripe/stripe-js@^3.4.0": + version "3.5.0" + resolved "https://registry.yarnpkg.com/@stripe/stripe-js/-/stripe-js-3.5.0.tgz#7fff3d9d931e972c24dcc8ee25f7481a58879b2b" + integrity sha512-pKS3wZnJoL1iTyGBXAvCwduNNeghJHY6QSRSNNvpYnrrQrLZ6Owsazjyynu0e0ObRgks0i7Rv+pe2M7/MBTZpQ== + "@szmarczak/http-timer@^4.0.5": version "4.0.6" resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-4.0.6.tgz#b4a914bb62e7c272d4e5989fe4440f812ab1d807" @@ -4480,80 +4509,84 @@ crypto-js "^4.1.1" elliptic "^6.5.4" -"@usecapsule/core-components@^2.0.9": - version "2.0.9" - resolved "https://registry.yarnpkg.com/@usecapsule/core-components/-/core-components-2.0.9.tgz#e61de457ccbe13ed5f2e4ea6672f6750460a8e5f" - integrity sha512-4kWXBMQkTN/ZInMFrSCNHSylxgiRAGtW4Lf7kxyA22ZhGCiyJjRjg38C6kYGD2mLmKlVIfUrLnpxX85fq1tlRA== +"@usecapsule/core-components@^3.1.3": + version "3.1.3" + resolved "https://registry.yarnpkg.com/@usecapsule/core-components/-/core-components-3.1.3.tgz#f4bcd159092813db1e9610acfb276b0855e775d8" + integrity sha512-ga+yxMdAf1j4CJe9uuXTg+HbXmkkz9MqP7no+RFF5Smjx7B6D0IriFT4+MKFIfEHeVLScMz0LmDsu33zwprvkA== dependencies: "@stencil/core" "^4.7.0" + color-blend "^4.0.0" color2k "^2.0.3" gsap "^3.12.5" lottie-web "^5.12.2" qr-code-styling "^1.6.0-rc.1" -"@usecapsule/core-sdk@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@usecapsule/core-sdk/-/core-sdk-1.11.1.tgz#9078a7deb517d76afb9c2c1e20f8e7bbd4093502" - integrity sha512-ekmgJqMJIQUQxHA4REr5F7mSpX+NAJ7zJk2Oivqlqu835IdDudwrVuZSoFzPDnj/q9b7id+viiz5hKSie2aeJQ== +"@usecapsule/core-sdk@1.21.0": + version "1.21.0" + resolved "https://registry.yarnpkg.com/@usecapsule/core-sdk/-/core-sdk-1.21.0.tgz#f792fe57093e472461c22c6be0fcbb0643d2983c" + integrity sha512-zblf/9A5jyVhB2gEdUkkJsq9JLZ5EwsaSH+vWCJL+SqOFk2xD4TgfQoWymxtxtrbSbChrqLB68rrBtsevQNuuw== dependencies: "@celo/utils" "^3.2.0" - "@usecapsule/user-management-client" "1.8.1" + "@usecapsule/user-management-client" "1.18.0" base64url "^3.0.1" buffer "6.0.3" ethereumjs-util "7.1.5" + libphonenumber-js "1.11.2" node-forge "^1.3.1" -"@usecapsule/react-components@^2.0.9": - version "2.0.9" - resolved "https://registry.yarnpkg.com/@usecapsule/react-components/-/react-components-2.0.9.tgz#0058209c96fde052f0617e74b46fce7778d3d906" - integrity sha512-xXP+Upgl/fe2r5dDYXACpgcAxmUAH8VVYctwnr/spsIxr92oG5JNRaED/TeILK2MmMDHrDgT7DFbXrhq0KJ19g== +"@usecapsule/react-components@^3.1.3": + version "3.1.3" + resolved "https://registry.yarnpkg.com/@usecapsule/react-components/-/react-components-3.1.3.tgz#7d71dbba9eee525c3c8564c2a3428d97a1024f9d" + integrity sha512-DDTApV13h6cJXTqVwF9x+Mk4eqMaFy67IvJlpsXcpnzJp4/FSE1Q0WkqO6oF/9VaoUoPk8SHZZok5axZeEub7w== dependencies: - "@usecapsule/core-components" "^2.0.9" + "@usecapsule/core-components" "^3.1.3" -"@usecapsule/react-sdk@3.7.1", "@usecapsule/react-sdk@^3.7.0": - version "3.7.1" - resolved "https://registry.yarnpkg.com/@usecapsule/react-sdk/-/react-sdk-3.7.1.tgz#06ce68c6c91b89e05df12119cc6a7163e28cca80" - integrity sha512-4FQt7YjglpxnAlFNsNucXIgXlSPEsYYJVI9H1I+5rBfTCF8NGURiN/J9OKJT0c7Slxfb7/djJ80LXwzowF8QuQ== +"@usecapsule/react-sdk@3.17.0", "@usecapsule/react-sdk@^3.17.0": + version "3.17.0" + resolved "https://registry.yarnpkg.com/@usecapsule/react-sdk/-/react-sdk-3.17.0.tgz#9db376dd80b321a41e15219d5285355deeee525c" + integrity sha512-KpweheO9/1Y0HUBOXCdcaiWtzDsbkaSfLeQ+ukBu2rJyApSP1igPxosmJnv2WZJqDtd279iKchJa2aNc5U7P2g== dependencies: "@gsap/react" "^2.1.0" "@ramp-network/ramp-instant-sdk" "^4.0.2" - "@usecapsule/react-components" "^2.0.9" - "@usecapsule/web-sdk" "1.13.1" + "@stripe/crypto" "^0.0.4" + "@stripe/stripe-js" "^3.4.0" + "@usecapsule/react-components" "^3.1.3" + "@usecapsule/web-sdk" "1.23.0" gsap "^3.12.5" libphonenumber-js "^1.11.1" styled-components "^6.1.8" zustand "^4.5.2" -"@usecapsule/user-management-client@1.8.1": - version "1.8.1" - resolved "https://registry.yarnpkg.com/@usecapsule/user-management-client/-/user-management-client-1.8.1.tgz#c2bbedcc5a83194c08a6e5ee253349eabed2e4e1" - integrity sha512-dKdhx3E/pA/JeYktMylReRpItLcUzXXxQxmbNByzML+tJe5pqVgrVxmyWUH2Hkee5Zkl74JdrYi+CfG3m1YRNQ== +"@usecapsule/user-management-client@1.18.0": + version "1.18.0" + resolved "https://registry.yarnpkg.com/@usecapsule/user-management-client/-/user-management-client-1.18.0.tgz#54d58150538b2608afe32ba8e7985665374c2252" + integrity sha512-F0q5OQV2GiXQ0US8hnEPaCQ3fITSaubodalhw83wLlYUnC9BY0Xd1hXfGh2lcru17TKQYWIoImWf3aZnwN3LnA== dependencies: axios "^1.6.3" qs "^6.12.0" -"@usecapsule/viem-v2-integration@1.10.1": - version "1.10.1" - resolved "https://registry.yarnpkg.com/@usecapsule/viem-v2-integration/-/viem-v2-integration-1.10.1.tgz#b03428c348e4fcbd344c924acf04ad7b5ccf9dce" - integrity sha512-0bFZO62rMmIlu7SWOfjlH0IqPb6Ll1E1UJxmARpuiD29l2ZBLKOSbVWhAp3jDLIboDAZ9g+2S2jr40UMKIZtFA== +"@usecapsule/viem-v2-integration@1.20.0": + version "1.20.0" + resolved "https://registry.yarnpkg.com/@usecapsule/viem-v2-integration/-/viem-v2-integration-1.20.0.tgz#092bc04c0f767bdb5300fb03c329adc04d2092ab" + integrity sha512-SkSsHEBFAAJoQMZVj0CPtsU487LMbr/cdkTgV26Obq91+nNoKMoc5cWAmcpI9+UgSQt9fbFo5IA4UacjSSvD2g== dependencies: - "@usecapsule/core-sdk" "1.11.1" + "@usecapsule/core-sdk" "1.21.0" -"@usecapsule/wagmi-v2-integration@^2.8.0": - version "2.8.1" - resolved "https://registry.yarnpkg.com/@usecapsule/wagmi-v2-integration/-/wagmi-v2-integration-2.8.1.tgz#012e551f50dd8fe4e5e49e22b9bab60fef849846" - integrity sha512-meiWm2hArdoog6AhTIXwzL5OFu1j2FPEHcCbWL/UR8iemTm/uEK5J9a4hMuPZBiuDFOJv9dtpvirJZok1yuCaQ== +"@usecapsule/wagmi-v2-integration@^2.18.0": + version "2.18.0" + resolved "https://registry.yarnpkg.com/@usecapsule/wagmi-v2-integration/-/wagmi-v2-integration-2.18.0.tgz#f030f9d090e3eb58882442e831a054d4c7ee0361" + integrity sha512-7Ho2EKq8/72w/RvbhRqNVdWdObm3pPOzwACq7GaqdVVuq1U3fwMrJOHUybiUC9iAJY6RseB6AhB5LKlTggZeGw== dependencies: - "@usecapsule/react-sdk" "3.7.1" - "@usecapsule/viem-v2-integration" "1.10.1" + "@usecapsule/react-sdk" "3.17.0" + "@usecapsule/viem-v2-integration" "1.20.0" -"@usecapsule/web-sdk@1.13.1": - version "1.13.1" - resolved "https://registry.yarnpkg.com/@usecapsule/web-sdk/-/web-sdk-1.13.1.tgz#d0e93bcd84929f7893b0aeb5929ce07a86497883" - integrity sha512-I97udXg9YTjt96n9vKZDL0x/L3qYR1Su3DEOl83nDc/4gg63LzHkAgV0KdGktzUd0wSep8rXgDAS5xpYbV/5+g== +"@usecapsule/web-sdk@1.23.0": + version "1.23.0" + resolved "https://registry.yarnpkg.com/@usecapsule/web-sdk/-/web-sdk-1.23.0.tgz#b359653892300299b1898acf5241a4537d787da8" + integrity sha512-d0gG/CZR/zuJlpyGBNidfHrkQI1B7PRwRDkXFJrJEOBGX4oOUUUtRvhGxeK9l2fIdWjNO7hZ01V5hkm1u00YFw== dependencies: - "@usecapsule/core-sdk" "1.11.1" - "@usecapsule/user-management-client" "1.8.1" + "@usecapsule/core-sdk" "1.21.0" + "@usecapsule/user-management-client" "1.18.0" assert "^2.1.0" base64url "3.0.1" buffer "6.0.3" @@ -7113,6 +7146,11 @@ code-point-at@^1.0.0: resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= +color-blend@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/color-blend/-/color-blend-4.0.0.tgz#e9950e9fa5d6e552ff8bb107c39f7e83a0c1a3bb" + integrity sha512-fYODTHhI/NG+B5GnzvuL3kiFrK/UnkUezWFTgEPBTY5V+kpyfAn95Vn9sJeeCX6omrCOdxnqCL3CvH+6sXtIbw== + color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" @@ -10016,7 +10054,7 @@ i18next@22.5.1: dependencies: "@babel/runtime" "^7.20.6" -i18next@^23.11.5: +i18next@23.11.5, i18next@^23.11.5: version "23.11.5" resolved "https://registry.yarnpkg.com/i18next/-/i18next-23.11.5.tgz#d71eb717a7e65498d87d0594f2664237f9e361ef" integrity sha512-41pvpVbW9rhZPk5xjCX2TPJi2861LEig/YRhUkY+1FQ2IQPS0bKUDYnEqY8XPPbB48h1uIwLnP9iiEfuSl20CA== @@ -11003,6 +11041,11 @@ levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +libphonenumber-js@1.11.2: + version "1.11.2" + resolved "https://registry.yarnpkg.com/libphonenumber-js/-/libphonenumber-js-1.11.2.tgz#9ddd7d1a1e1be0e7c596c7e09487c362b4f1210c" + integrity sha512-V9mGLlaXN1WETzqQvSu6qf6XVAr3nFuJvWsHcuzCCCo6xUKawwSxOPTpan5CGOSKTn5w/bQuCZcLPJkyysgC3w== + libphonenumber-js@^1.11.1: version "1.11.3" resolved "https://registry.yarnpkg.com/libphonenumber-js/-/libphonenumber-js-1.11.3.tgz#18126a2eec754eacd36f1f0d58590077fa5539ff"