Skip to content

Commit

Permalink
Update type definitions in types.ts to include additional configurati…
Browse files Browse the repository at this point in the history
…on options for web3modal
  • Loading branch information
kolirt committed Mar 8, 2024
1 parent ef4d330 commit f2fc6bb
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 315 deletions.
10 changes: 1 addition & 9 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,10 @@
"singleQuote": true,
"endOfLine": "auto",
"plugins": [
"@trivago/prettier-plugin-sort-imports",
"prettier-plugin-organize-imports",
"prettier-plugin-organize-attributes",
"prettier-plugin-tailwindcss"
],
"importOrder": [
"^./App.vue$",
"<THIRD_PARTY_MODULES>",
"^@/(.*)$",
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"attributeGroups": [
"^ref",
"^v-if",
Expand Down
12 changes: 1 addition & 11 deletions examples/vue-cli-service/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,5 @@
"printWidth": 120,
"semi": false,
"singleQuote": true,
"endOfLine": "auto",
"plugins": [
"@trivago/prettier-plugin-sort-imports",
"prettier-plugin-tailwindcss"
],
"importOrder": [
"<THIRD_PARTY_MODULES>",
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
"endOfLine": "auto"
}
4 changes: 1 addition & 3 deletions examples/vue-cli-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"prettier": "3.0.3",
"prettier-plugin-tailwindcss": "^0.5.5"
"prettier": "3.0.3"
},
"eslintConfig": {
"root": true,
Expand Down
78 changes: 9 additions & 69 deletions examples/vue-cli-service/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
dependencies:
"@babel/highlight" "^7.10.4"

"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.16.7", "@babel/code-frame@^7.22.13":
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.22.13":
version "7.22.13"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.13.tgz#e3c1c099402598483b7a8c46a721d1038803755e"
integrity sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==
Expand Down Expand Up @@ -79,16 +79,7 @@
eslint-visitor-keys "^2.1.0"
semver "^6.3.1"

"@babel/[email protected]":
version "7.17.7"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.17.7.tgz#8da2599beb4a86194a3b24df6c085931d9ee45ad"
integrity sha512-oLcVCTeIFadUoArDTwpluncplrYBmTCCZZgXCbgNGvOBBiSDDK3eWO4b/+eOTli5tKv1lg+a5/NAXg+nTcei1w==
dependencies:
"@babel/types" "^7.17.0"
jsesc "^2.5.1"
source-map "^0.5.0"

"@babel/generator@^7.17.3", "@babel/generator@^7.23.0":
"@babel/generator@^7.23.0":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.0.tgz#df5c386e2218be505b34837acbcb874d7a983420"
integrity sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==
Expand Down Expand Up @@ -158,20 +149,20 @@
lodash.debounce "^4.0.8"
resolve "^1.14.2"

"@babel/helper-environment-visitor@^7.16.7", "@babel/helper-environment-visitor@^7.22.20", "@babel/helper-environment-visitor@^7.22.5":
"@babel/helper-environment-visitor@^7.22.20", "@babel/helper-environment-visitor@^7.22.5":
version "7.22.20"
resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167"
integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==

"@babel/helper-function-name@^7.16.7", "@babel/helper-function-name@^7.22.5", "@babel/helper-function-name@^7.23.0":
"@babel/helper-function-name@^7.22.5", "@babel/helper-function-name@^7.23.0":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759"
integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==
dependencies:
"@babel/template" "^7.22.15"
"@babel/types" "^7.23.0"

"@babel/helper-hoist-variables@^7.16.7", "@babel/helper-hoist-variables@^7.22.5":
"@babel/helper-hoist-variables@^7.22.5":
version "7.22.5"
resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb"
integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==
Expand Down Expand Up @@ -247,7 +238,7 @@
dependencies:
"@babel/types" "^7.22.5"

"@babel/helper-split-export-declaration@^7.16.7", "@babel/helper-split-export-declaration@^7.22.6":
"@babel/helper-split-export-declaration@^7.22.6":
version "7.22.6"
resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c"
integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==
Expand All @@ -259,7 +250,7 @@
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f"
integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==

"@babel/helper-validator-identifier@^7.16.7", "@babel/helper-validator-identifier@^7.22.20":
"@babel/helper-validator-identifier@^7.22.20":
version "7.22.20"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0"
integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==
Expand Down Expand Up @@ -296,7 +287,7 @@
chalk "^2.4.2"
js-tokens "^4.0.0"

"@babel/parser@^7.17.3", "@babel/parser@^7.20.15", "@babel/parser@^7.20.5", "@babel/parser@^7.21.3", "@babel/parser@^7.22.15", "@babel/parser@^7.23.0":
"@babel/parser@^7.20.15", "@babel/parser@^7.21.3", "@babel/parser@^7.22.15", "@babel/parser@^7.23.0":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.0.tgz#da950e622420bf96ca0d0f2909cdddac3acd8719"
integrity sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==
Expand Down Expand Up @@ -998,22 +989,6 @@
"@babel/parser" "^7.22.15"
"@babel/types" "^7.22.15"

"@babel/[email protected]":
version "7.17.3"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.17.3.tgz#0ae0f15b27d9a92ba1f2263358ea7c4e7db47b57"
integrity sha512-5irClVky7TxRWIRtxlh2WPUUOLhcPN06AGgaQSB8AEwuyEBgJVuJ5imdHm5zxk8w0QS5T+tDfnDxAlhWjpb7cw==
dependencies:
"@babel/code-frame" "^7.16.7"
"@babel/generator" "^7.17.3"
"@babel/helper-environment-visitor" "^7.16.7"
"@babel/helper-function-name" "^7.16.7"
"@babel/helper-hoist-variables" "^7.16.7"
"@babel/helper-split-export-declaration" "^7.16.7"
"@babel/parser" "^7.17.3"
"@babel/types" "^7.17.0"
debug "^4.1.0"
globals "^11.1.0"

"@babel/traverse@^7.22.5", "@babel/traverse@^7.23.0":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.0.tgz#18196ddfbcf4ccea324b7f6d3ada00d8c5a99c53"
Expand All @@ -1030,15 +1005,7 @@
debug "^4.1.0"
globals "^11.1.0"

"@babel/[email protected]":
version "7.17.0"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.17.0.tgz#a826e368bccb6b3d84acd76acad5c0d87342390b"
integrity sha512-TmKSNO4D5rzhL5bjWFcVHHLETzfQ/AmbKpKPOSjlP0WoHZ6L911fgoOKY4Alp/emzG4cHJdyN49zpgkbXFEHHw==
dependencies:
"@babel/helper-validator-identifier" "^7.16.7"
to-fast-properties "^2.0.0"

"@babel/types@^7.17.0", "@babel/types@^7.22.15", "@babel/types@^7.22.19", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.4.4":
"@babel/types@^7.22.15", "@babel/types@^7.22.19", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.4.4":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.0.tgz#8c1f020c9df0e737e4e247c0619f58c68458aaeb"
integrity sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==
Expand Down Expand Up @@ -1607,18 +1574,6 @@
"@tanstack/query-core" "4.35.7"
use-sync-external-store "^1.2.0"

"@trivago/prettier-plugin-sort-imports@^4.2.0":
version "4.2.0"
resolved "https://registry.yarnpkg.com/@trivago/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-4.2.0.tgz#b240366f9e2bda8e14edb18b14ea084e0ec25968"
integrity sha512-YBepjbt+ZNBVmN3ev1amQH3lWCmHyt5qTbLCp/syXJRu/Kw2koXh44qayB1gMRxcL/gV8egmjN5xWSrYyfUtyw==
dependencies:
"@babel/generator" "7.17.7"
"@babel/parser" "^7.20.5"
"@babel/traverse" "7.17.3"
"@babel/types" "7.17.0"
javascript-natural-sort "0.7.1"
lodash "^4.17.21"

"@trysound/[email protected]":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad"
Expand Down Expand Up @@ -5083,11 +5038,6 @@ isomorphic-ws@^4.0.1:
resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc"
integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==

[email protected]:
version "0.7.1"
resolved "https://registry.yarnpkg.com/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz#f9e2303d4507f6d74355a73664d1440fb5a0ef59"
integrity sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==

javascript-stringify@^2.0.1:
version "2.1.0"
resolved "https://registry.yarnpkg.com/javascript-stringify/-/javascript-stringify-2.1.0.tgz#27c76539be14d8bd128219a2d731b09337904e79"
Expand Down Expand Up @@ -6378,11 +6328,6 @@ prelude-ls@^1.2.1:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==

prettier-plugin-tailwindcss@^0.5.5:
version "0.5.5"
resolved "https://registry.yarnpkg.com/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.5.5.tgz#2860de31772235231339ca5e8c745969532fab95"
integrity sha512-voy0CjWv/CM8yeaduv5ZwovovpTGMR5LbzlhGF+LtEvMJt9wBeVTVnW781hL38R/RcDXCJwN2rolsgr94B/n0Q==

[email protected]:
version "3.0.3"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643"
Expand Down Expand Up @@ -6999,11 +6944,6 @@ source-map-support@~0.5.20:
buffer-from "^1.0.0"
source-map "^0.6.0"

source-map@^0.5.0:
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==

source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
Expand Down
11 changes: 1 addition & 10 deletions lib/actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
export { watchAsset } from './asset'

export { fetchBalance, useFetchBalance } from './balance'

export { fetchBlockNumber } from './block'

export { readContract, writeContract, estimateWriteContractGas } from './contract'

export { estimateWriteContractGas, readContract, writeContract } from './contract'
export { parseEvents, watchContractEvent } from './event'

export { fetchGasPrice } from './gas'

export { signMessage } from './message'

export { multicall } from './multicall'

export { fetchToken } from './token'

export {
fetchTransaction,
fetchTransactionReceipt,
Expand Down
2 changes: 1 addition & 1 deletion lib/actions/multicall.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type MulticallResult, multicall as masterMulticall } from '@wagmi/core'
import { multicall as masterMulticall, type MulticallResult } from '@wagmi/core'
import { type MulticallParameters } from 'viem/actions'
import { type ContractFunctionConfig } from 'viem/types/contract'

Expand Down
19 changes: 5 additions & 14 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import * as Chains from '@wagmi/core/chains'

export { account, accountDetails, connect, disconnect, shortAddressFilter } from './account'
export * from './actions'

export * from './utils/abi'

export { connect, disconnect, accountDetails, shortAddressFilter, account } from './account'

export { selectChain, switchChain, getAvailableChains, chain } from './chain'

export { chain, getAvailableChains, selectChain, switchChain } from './chain'
export { Events } from './enums'

export { $on, $off } from './event'

export { $off, $on } from './event'
export { createWeb3Auth } from './plugin'

export type { Chain, Options, MulticallArgs, MulticallContract } from './types'

export type { Chain, MulticallArgs, MulticallContract, Options } from './types'
export * from './utils/abi'
export { init } from './wc'

export { Chains }
17 changes: 15 additions & 2 deletions lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
Unit,
WaitForTransactionArgs
} from '@wagmi/core'
import type { ThemeCtrlState } from '@web3modal/core'
import type { ConfigCtrlState, ThemeCtrlState } from '@web3modal/core'
import type { EthereumClient } from '@web3modal/ethereum'
import type { WatchAssetParams } from 'viem/types/eip1193'

Expand Down Expand Up @@ -39,7 +39,20 @@ export type Options = {
* if true, the w3m provider will be disabled and a custom rpc based on the rpc from the chain configuration will be activated
*/
enableCustomProvider?: boolean
web3modalOptions?: ThemeCtrlState
web3modalOptions?: Pick<
ConfigCtrlState,
| 'mobileWallets'
| 'desktopWallets'
| 'walletImages'
| 'chainImages'
| 'tokenImages'
| 'tokenContracts'
| 'explorerRecommendedWalletIds'
| 'explorerExcludedWalletIds'
| 'termsOfServiceUrl'
| 'privacyPolicyUrl'
> &
ThemeCtrlState
}

export type { Chain }
Expand Down
2 changes: 1 addition & 1 deletion lib/wc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type GetNetworkResult, configureChains, createConfig, watchAccount, watchNetwork } from '@wagmi/core'
import { configureChains, createConfig, watchAccount, watchNetwork, type GetNetworkResult } from '@wagmi/core'
import { EthereumClient, w3mConnectors, w3mProvider } from '@web3modal/ethereum'
import { reactive, toRaw, watch } from 'vue'
import { publicProvider } from 'wagmi/providers/public'
Expand Down
4 changes: 2 additions & 2 deletions lib/web3Modal.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ModalCtrlState, ThemeCtrlState } from '@web3modal/core/dist/_types/src/types/controllerTypes'
import { type EthereumClient } from '@web3modal/ethereum'
import { Web3Modal } from '@web3modal/html'
import { type Ref, ref } from 'vue'
import { ref, type Ref } from 'vue'

import { Events } from './enums'
import { $emit } from './event'
Expand All @@ -22,7 +22,7 @@ export function initWeb3Modal(ethereumClient: EthereumClient) {
web3Modal.value = new Web3Modal(
{
projectId: optionsState.projectId,
...(optionsState?.web3modalOptions || [])
...(optionsState?.web3modalOptions || {})
},
ethereumClient
)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kolirt/vue-web3-auth",
"version": "2.3.0",
"version": "2.3.1",
"description": "Web3 authentication for Vue3 apps based on WalletConnect Web3Modal v2",
"author": "kolirt",
"license": "MIT",
Expand Down Expand Up @@ -76,7 +76,6 @@
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.2.0",
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"@tsconfig/node18": "^2.0.1",
"@types/node": "^18.16.8",
"@vitejs/plugin-vue": "^4.2.3",
Expand All @@ -89,6 +88,7 @@
"pre-commit": "^1.2.2",
"prettier": "^3.0.3",
"prettier-plugin-organize-attributes": "^1.0.0",
"prettier-plugin-organize-imports": "^3.2.4",
"prettier-plugin-tailwindcss": "^0.5.5",
"typescript": "~5.0.4",
"vite": "^4.3.5",
Expand Down
Loading

1 comment on commit f2fc6bb

@kolirt
Copy link
Owner Author

@kolirt kolirt commented on f2fc6bb Mar 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#17

Please sign in to comment.