From 574461e7387be4010f8ec65d13a624c6ada4bc9d Mon Sep 17 00:00:00 2001 From: AZbang Date: Wed, 31 Jul 2024 18:37:37 +0300 Subject: [PATCH 1/5] feat: update @here-wallet/core --- package.json | 2 +- packages/here-wallet/src/index.ts | 1 - packages/here-wallet/src/lib/index.ts | 26 ++-------- packages/here-wallet/src/lib/selector.ts | 43 +++++----------- packages/here-wallet/src/lib/types.ts | 19 ++------ yarn.lock | 62 +++++++++--------------- 6 files changed, 43 insertions(+), 110 deletions(-) diff --git a/package.json b/package.json index b63032a06..52a91eed5 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "@angular/platform-browser": "16.1.9", "@angular/platform-browser-dynamic": "16.1.9", "@angular/router": "16.1.9", - "@here-wallet/core": "1.6.6", + "@here-wallet/core": "3.3.1", "@jscutlery/semver": "3.1.0", "@ledgerhq/hw-transport": "6.30.3", "@ledgerhq/hw-transport-webhid": "6.28.6", diff --git a/packages/here-wallet/src/index.ts b/packages/here-wallet/src/index.ts index c9dc716d7..11eddcf8e 100644 --- a/packages/here-wallet/src/index.ts +++ b/packages/here-wallet/src/index.ts @@ -1,2 +1 @@ -export type { HereWallet } from "./lib/types"; export { setupHereWallet } from "./lib"; diff --git a/packages/here-wallet/src/lib/index.ts b/packages/here-wallet/src/lib/index.ts index 3224b4da6..96889ab93 100644 --- a/packages/here-wallet/src/lib/index.ts +++ b/packages/here-wallet/src/lib/index.ts @@ -1,10 +1,5 @@ -import { - waitInjectedHereWallet, - type HereProvider, - type HereStrategy, -} from "@here-wallet/core"; -import type { WalletModuleFactory } from "@near-wallet-selector/core"; -import type { HereWallet } from "./types"; +import { HereInitializeOptions, waitInjectedHereWallet } from "@here-wallet/core"; +import type { WalletModuleFactory, InjectedWallet } from "@near-wallet-selector/core"; import { initHereWallet } from "./selector"; import icon from "./icon"; @@ -13,16 +8,10 @@ export { icon }; interface Options { deprecated?: boolean; iconUrl?: string; - defaultStrategy?: () => HereStrategy; - defaultProvider?: HereProvider; + walletOptions?: HereInitializeOptions; } -export function setupHereWallet({ - deprecated = false, - iconUrl = icon, - defaultStrategy, - defaultProvider, -}: Options = {}): WalletModuleFactory { +export function setupHereWallet({ deprecated = false, iconUrl = icon, walletOptions }: Options = {}): WalletModuleFactory { return async () => { const isInjected = await waitInjectedHereWallet; @@ -39,12 +28,7 @@ export function setupHereWallet({ deprecated, available: true, }, - init: (config) => - initHereWallet({ - ...config, - defaultStrategy, - defaultProvider, - }), + init: (config) => initHereWallet({ ...config, walletOptions }), }; }; } diff --git a/packages/here-wallet/src/lib/selector.ts b/packages/here-wallet/src/lib/selector.ts index eff5a67c4..f6e2abaa3 100644 --- a/packages/here-wallet/src/lib/selector.ts +++ b/packages/here-wallet/src/lib/selector.ts @@ -1,17 +1,12 @@ -import type { NetworkId } from "@near-wallet-selector/core"; -import { HereWallet, waitInjectedHereWallet } from "@here-wallet/core"; - +import { HereWallet, waitInjectedHereWallet, WidgetStrategy } from "@here-wallet/core"; import type { SelectorInit } from "./types"; export const initHereWallet: SelectorInit = async (config) => { - const { store, logger, emitter, options, defaultProvider, defaultStrategy } = - config; - - const here = new HereWallet({ - networkId: options.network.networkId as NetworkId, - nodeUrl: options.network.nodeUrl, - defaultProvider, - defaultStrategy, + const { store, logger, emitter, options, walletOptions } = config; + const here = await HereWallet.connect({ + defaultStrategy: new WidgetStrategy({ + widget: "http://localhost:4173/connector/index.html" + }) }); async function getAccounts() { @@ -20,16 +15,10 @@ export const initHereWallet: SelectorInit = async (config) => { const accounts = []; for (let i = 0; i < accountIds.length; i++) { - accounts.push({ - accountId: accountIds[i], - publicKey: ( - await here.signer.getPublicKey( - accountIds[i], - options.network.networkId - ) - ).toString(), - }); + const pub = await here.signer.getPublicKey(accountIds[i], options.network.networkId) + accounts.push({ accountId: accountIds[i], publicKey: pub.toString() }); } + return accounts; } @@ -42,12 +31,12 @@ export const initHereWallet: SelectorInit = async (config) => { return `https://my.herewallet.app/import?network=${options.network.networkId}`; }, - async account(id) { + async account(id: string) { logger.log("HereWallet:account"); return await here.account(id); }, - async switchAccount(id) { + async switchAccount(id: string) { logger.log("HereWallet:switchAccount"); await here.switchAccount(id); }, @@ -80,16 +69,6 @@ export const initHereWallet: SelectorInit = async (config) => { return await getAccounts(); }, - async getHereBalance() { - logger.log("HereWallet:getHereBalance"); - return await here.getHereBalance(); - }, - - async getAvailableBalance(): Promise { - logger.log("HereWallet:getAvailableBalance"); - return await here.getAvailableBalance(); - }, - async signOut() { logger.log("HereWallet:signOut"); await here.signOut(); diff --git a/packages/here-wallet/src/lib/types.ts b/packages/here-wallet/src/lib/types.ts index 431d26f3e..492489159 100644 --- a/packages/here-wallet/src/lib/types.ts +++ b/packages/here-wallet/src/lib/types.ts @@ -1,17 +1,4 @@ -import type { - HereInitializeOptions, - HereWalletProtocol, -} from "@here-wallet/core"; +import type { HereInitializeOptions } from "@here-wallet/core"; +import type { WalletBehaviourFactory, InjectedWallet } from "@near-wallet-selector/core"; -import type { - WalletBehaviourFactory, - InjectedWallet, -} from "@near-wallet-selector/core"; - -export type HereWallet = InjectedWallet & - Omit, "signIn">, "signMessage">; - -export type SelectorInit = WalletBehaviourFactory< - HereWallet, - HereInitializeOptions ->; +export type SelectorInit = WalletBehaviourFactory; diff --git a/yarn.lock b/yarn.lock index 904263775..4c2aa15b8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3290,12 +3290,16 @@ resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6" integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw== -"@here-wallet/core@1.6.6": - version "1.6.6" - resolved "https://registry.yarnpkg.com/@here-wallet/core/-/core-1.6.6.tgz#db31fcd048c4977da3bc6923fcf25113a32b5a49" - integrity sha512-avh/PRNl3CbgrcbqIezVrNPAa4fqKvonl/mguSoUAfTwfA5jWnfq81Udd8QzOAIzBIGx5gSabzEkh9CRDH7yDA== - dependencies: - near-api-js "^3.0.1" +"@here-wallet/core@3.3.1": + version "3.3.1" + resolved "https://registry.yarnpkg.com/@here-wallet/core/-/core-3.3.1.tgz#41af535794903d4ac04ef06ac0bbee7b7bbaef8b" + integrity sha512-UcokwayE9J8HR+QUHotvpFGcZ6Xlpc1sjyzSOOeknkt2se56anJZdIPczhkwwNfYR7qAOj2fo3LTLbnmfj7GwA== + dependencies: + "@near-js/accounts" "^1.2.1" + "@near-js/crypto" "^1.2.4" + "@near-js/types" "^0.2.1" + "@near-js/utils" "^0.2.2" + js-sha256 "^0.11.0" sha1 "^1.1.1" uuid4 "2.0.3" @@ -4230,7 +4234,7 @@ lru_map "0.4.1" near-abi "0.1.1" -"@near-js/accounts@1.2.1": +"@near-js/accounts@1.2.1", "@near-js/accounts@^1.2.1": version "1.2.1" resolved "https://registry.yarnpkg.com/@near-js/accounts/-/accounts-1.2.1.tgz#6e5c0315a07997bbaacbe7b9021ac23974a80ea0" integrity sha512-j6+9n/p0vVLAahmN3YRFve+j0ammOALC9ZUfFhdE3kqtJESbSWMviC5qF/s2m0JQjpJGDtEv/dTADosIJoanWw== @@ -4269,7 +4273,7 @@ borsh "1.0.0" randombytes "2.1.0" -"@near-js/crypto@1.2.4": +"@near-js/crypto@1.2.4", "@near-js/crypto@^1.2.4": version "1.2.4" resolved "https://registry.yarnpkg.com/@near-js/crypto/-/crypto-1.2.4.tgz#fad977d6a6d2c0c836ef42db8c8d355c1f433ec0" integrity sha512-hcSj0ygvTcXlW9ftwEd9dbvQUWBCHNWNDLou9NLfmZERW9dr0gH8kUJPZUWfpJFlUPicb+jTiMpNwDTvP7VW4A== @@ -4465,7 +4469,7 @@ dependencies: bn.js "5.2.1" -"@near-js/types@0.2.1": +"@near-js/types@0.2.1", "@near-js/types@^0.2.1": version "0.2.1" resolved "https://registry.yarnpkg.com/@near-js/types/-/types-0.2.1.tgz#a298f0e70dbe059ee8c762dfac05c2eae3e0ae0e" integrity sha512-YygQEGMdFe6d2e/6dtNZer9paH396XeAdIKEhY/RPXDUnjDdfiDQ5DK4mM130sEeID2bAH9X1LQ+7vXGRjvyWw== @@ -4491,7 +4495,7 @@ depd "2.0.0" mustache "4.0.0" -"@near-js/utils@0.2.2": +"@near-js/utils@0.2.2", "@near-js/utils@^0.2.2": version "0.2.2" resolved "https://registry.yarnpkg.com/@near-js/utils/-/utils-0.2.2.tgz#a42c29db9ccd5a02ad583319028fdb7231821ab2" integrity sha512-ZAJo/cN6AHY7/gckf8DLHwjAn0z4UwG6rhLxs+QDyNYMMSx9SBg2pOQtBBv7ORWJaPhWD2q7wFhUz4SdTZi43A== @@ -16186,6 +16190,11 @@ js-sha256@0.9.0, js-sha256@^0.9.0: resolved "https://registry.yarnpkg.com/js-sha256/-/js-sha256-0.9.0.tgz#0b89ac166583e91ef9123644bd3c5334ce9d0966" integrity sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA== +js-sha256@^0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/js-sha256/-/js-sha256-0.11.0.tgz#256a921d9292f7fe98905face82e367abaca9576" + integrity sha512-6xNlKayMZvds9h1Y1VWc0fQHQ82BxTXizWPEtEeGvmOUYpBRy4gbWroHLpzowe6xiQhHpelCQiE7HEdznyBL9Q== + js-sha3@0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" @@ -17934,7 +17943,7 @@ near-api-js@^2.1.1: node-fetch "^2.6.1" tweetnacl "^1.0.1" -near-api-js@^3.0.0, near-api-js@^3.0.1: +near-api-js@^3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/near-api-js/-/near-api-js-3.0.4.tgz#5ee094ce53e30239cc817ca942ec3e9739296dbb" integrity sha512-qKWjnugoB7kSFhzZ5GXyH/eABspCQYWBmWnM4hpV5ctnQBt89LqgEu9yD1z4sa89MvUu8BuCxwb1m00BE8iofg== @@ -21940,16 +21949,7 @@ string-range@~1.2, string-range@~1.2.1: resolved "https://registry.yarnpkg.com/string-range/-/string-range-1.2.2.tgz#a893ed347e72299bc83befbbf2a692a8d239d5dd" integrity sha512-tYft6IFi8SjplJpxCUxyqisD3b+R2CSkomrtJYCkvuf1KuCAWgz7YXt4O0jip7efpfCemwHEzTEAO8EuOYgh3w== -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -22048,14 +22048,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -23863,7 +23856,7 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -23881,15 +23874,6 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From b2a6b29544bb51b80a612d59c51a9377a52e955c Mon Sep 17 00:00:00 2001 From: Pavel Ivanov Date: Thu, 1 Aug 2024 09:41:55 +0300 Subject: [PATCH 2/5] [fix] - fix lint --- packages/here-wallet/src/lib/index.ts | 14 +++++++++++--- packages/here-wallet/src/lib/selector.ts | 17 ++++++++++++----- packages/here-wallet/src/lib/types.ts | 10 ++++++++-- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/packages/here-wallet/src/lib/index.ts b/packages/here-wallet/src/lib/index.ts index 96889ab93..b4e195689 100644 --- a/packages/here-wallet/src/lib/index.ts +++ b/packages/here-wallet/src/lib/index.ts @@ -1,5 +1,9 @@ -import { HereInitializeOptions, waitInjectedHereWallet } from "@here-wallet/core"; -import type { WalletModuleFactory, InjectedWallet } from "@near-wallet-selector/core"; +import type { HereInitializeOptions } from "@here-wallet/core"; +import { waitInjectedHereWallet } from "@here-wallet/core"; +import type { + WalletModuleFactory, + InjectedWallet, +} from "@near-wallet-selector/core"; import { initHereWallet } from "./selector"; import icon from "./icon"; @@ -11,7 +15,11 @@ interface Options { walletOptions?: HereInitializeOptions; } -export function setupHereWallet({ deprecated = false, iconUrl = icon, walletOptions }: Options = {}): WalletModuleFactory { +export function setupHereWallet({ + deprecated = false, + iconUrl = icon, + walletOptions, +}: Options = {}): WalletModuleFactory { return async () => { const isInjected = await waitInjectedHereWallet; diff --git a/packages/here-wallet/src/lib/selector.ts b/packages/here-wallet/src/lib/selector.ts index f6e2abaa3..f6eedc73e 100644 --- a/packages/here-wallet/src/lib/selector.ts +++ b/packages/here-wallet/src/lib/selector.ts @@ -1,12 +1,16 @@ -import { HereWallet, waitInjectedHereWallet, WidgetStrategy } from "@here-wallet/core"; +import { + HereWallet, + waitInjectedHereWallet, + WidgetStrategy, +} from "@here-wallet/core"; import type { SelectorInit } from "./types"; export const initHereWallet: SelectorInit = async (config) => { - const { store, logger, emitter, options, walletOptions } = config; + const { store, logger, emitter, options } = config; const here = await HereWallet.connect({ defaultStrategy: new WidgetStrategy({ - widget: "http://localhost:4173/connector/index.html" - }) + widget: "http://localhost:4173/connector/index.html", + }), }); async function getAccounts() { @@ -15,7 +19,10 @@ export const initHereWallet: SelectorInit = async (config) => { const accounts = []; for (let i = 0; i < accountIds.length; i++) { - const pub = await here.signer.getPublicKey(accountIds[i], options.network.networkId) + const pub = await here.signer.getPublicKey( + accountIds[i], + options.network.networkId + ); accounts.push({ accountId: accountIds[i], publicKey: pub.toString() }); } diff --git a/packages/here-wallet/src/lib/types.ts b/packages/here-wallet/src/lib/types.ts index 492489159..914201eb1 100644 --- a/packages/here-wallet/src/lib/types.ts +++ b/packages/here-wallet/src/lib/types.ts @@ -1,4 +1,10 @@ import type { HereInitializeOptions } from "@here-wallet/core"; -import type { WalletBehaviourFactory, InjectedWallet } from "@near-wallet-selector/core"; +import type { + WalletBehaviourFactory, + InjectedWallet, +} from "@near-wallet-selector/core"; -export type SelectorInit = WalletBehaviourFactory; +export type SelectorInit = WalletBehaviourFactory< + InjectedWallet, + { walletOptions?: HereInitializeOptions } +>; From 5299f6b967bac6bfc2b6a8a77e78a97f082b85f5 Mon Sep 17 00:00:00 2001 From: AZbang Date: Thu, 1 Aug 2024 20:59:12 +0300 Subject: [PATCH 3/5] fix(here-wallet): remove debug code --- packages/here-wallet/src/lib/selector.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/here-wallet/src/lib/selector.ts b/packages/here-wallet/src/lib/selector.ts index f6eedc73e..6667afeed 100644 --- a/packages/here-wallet/src/lib/selector.ts +++ b/packages/here-wallet/src/lib/selector.ts @@ -1,17 +1,12 @@ import { HereWallet, waitInjectedHereWallet, - WidgetStrategy, } from "@here-wallet/core"; import type { SelectorInit } from "./types"; export const initHereWallet: SelectorInit = async (config) => { - const { store, logger, emitter, options } = config; - const here = await HereWallet.connect({ - defaultStrategy: new WidgetStrategy({ - widget: "http://localhost:4173/connector/index.html", - }), - }); + const { store, logger, emitter, options, walletOptions } = config; + const here = await HereWallet.connect(walletOptions); async function getAccounts() { logger.log("HereWallet:getAccounts"); From 847c28e3f33882fda3633ece686a68c14bbb3311 Mon Sep 17 00:00:00 2001 From: Pavel Ivanov Date: Fri, 2 Aug 2024 08:52:09 +0300 Subject: [PATCH 4/5] show alert message for here-wallet 'Here Wallet is not supported on testnet' --- packages/modal-ui/src/lib/components/WalletOptions.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/modal-ui/src/lib/components/WalletOptions.tsx b/packages/modal-ui/src/lib/components/WalletOptions.tsx index 971ff7667..614b07ffb 100644 --- a/packages/modal-ui/src/lib/components/WalletOptions.tsx +++ b/packages/modal-ui/src/lib/components/WalletOptions.tsx @@ -94,6 +94,13 @@ export const WalletOptions: React.FC = ({ } sidebar ${module.id}`} key={module.id} onClick={() => { + if ( + selector.options.network.networkId === "testnet" && + module.id === "here-wallet" + ) { + alert("Here Wallet is not supported on testnet"); + return; + } if (module.id === modulesToRender[index].id) { setActiveWalletId(module.id!); } From 0403785d810b6459299542f53aedaa70f1342aee Mon Sep 17 00:00:00 2001 From: Pavel Ivanov Date: Fri, 2 Aug 2024 09:09:09 +0300 Subject: [PATCH 5/5] [fix] - fix lint --- packages/here-wallet/src/lib/selector.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/here-wallet/src/lib/selector.ts b/packages/here-wallet/src/lib/selector.ts index 6667afeed..f57930419 100644 --- a/packages/here-wallet/src/lib/selector.ts +++ b/packages/here-wallet/src/lib/selector.ts @@ -1,7 +1,4 @@ -import { - HereWallet, - waitInjectedHereWallet, -} from "@here-wallet/core"; +import { HereWallet, waitInjectedHereWallet } from "@here-wallet/core"; import type { SelectorInit } from "./types"; export const initHereWallet: SelectorInit = async (config) => {