diff --git a/package.json b/package.json index d9ce72f4b..1dfed6c47 100644 --- a/package.json +++ b/package.json @@ -42,8 +42,5 @@ "resolutions": { "@ledgerhq/compressjs": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.2.1.tgz", "@noble/hashes": "^1.4.0" - }, - "dependencies": { - "@bonfida/sns-warp-evm": "^0.0.4" } } diff --git a/packages/extension/src/libs/name-resolver/index.ts b/packages/extension/src/libs/name-resolver/index.ts index 84083538a..9afcf9498 100644 --- a/packages/extension/src/libs/name-resolver/index.ts +++ b/packages/extension/src/libs/name-resolver/index.ts @@ -11,9 +11,6 @@ class GenericNameResolver { arb: "https://nodes.mewapi.io/rpc/arb", }, }, - sns: { - network: "mainnet", - }, }); } diff --git a/packages/name-resolution/src/index.ts b/packages/name-resolution/src/index.ts index b2b34220f..936ab6325 100644 --- a/packages/name-resolution/src/index.ts +++ b/packages/name-resolution/src/index.ts @@ -1,5 +1,4 @@ import ENSResolver from "./ens"; -import SNSResolver from "./sns"; import { CoinType, NameResolverOptions } from "./types"; import UDResolver from "./ud"; import RNSResolver from "./rns"; @@ -8,8 +7,6 @@ import SIDResolver from "./sid"; class NameResolver { ens: ENSResolver; - sns: SNSResolver; - rns: RNSResolver; ud: UDResolver; @@ -20,13 +17,11 @@ class NameResolver { constructor(options: NameResolverOptions) { this.ens = new ENSResolver(options.ens); - this.sns = new SNSResolver(options.sns); this.rns = new RNSResolver(); this.ud = new UDResolver(); this.sid = new SIDResolver(options.sid); this.initDone = Promise.all([ this.ens.init(), - this.sns.init(), this.rns.init(), this.ud.init(), this.sid.init(), @@ -37,7 +32,6 @@ class NameResolver { return this.initDone.then(() => Promise.all([ this.ens.resolveReverseName(address), - this.sns.resolveReverseName(address), this.sid.resolveReverseName(address), this.rns.resolveReverseName(address), this.ud.resolveReverseName(address), @@ -56,8 +50,6 @@ class NameResolver { coin: CoinType = "ETH" ): Promise { return this.initDone.then(() => { - if (this.sns.isSupportedName(name)) - return this.sns.resolveAddress(name, coin); if (this.sid.isSupportedName(name)) return this.sid.resolveAddress(name); if (this.rns.isSupportedName(name)) return this.rns.resolveAddress(name, coin); @@ -70,5 +62,5 @@ class NameResolver { }); } } -export { ENSResolver, SNSResolver, UDResolver, CoinType }; +export { ENSResolver, UDResolver, CoinType }; export default NameResolver; diff --git a/packages/name-resolution/src/sns/index.ts b/packages/name-resolution/src/sns/index.ts deleted file mode 100644 index f494313c8..000000000 --- a/packages/name-resolution/src/sns/index.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { SupportedChains, SNS } from "@bonfida/sns-warp-evm"; -import { BaseResolver, CoinType } from "../types"; -import { getTLD } from "../utils"; -import { ChainMap, Resolvers, SNSOptions } from "./types"; - -const MAINNET_CHAIN_MAP: ChainMap = { - "BASE": SupportedChains.BASE, - "BNB": SupportedChains.BNBMainnet -} - -const TESTNET_CHAIN_MAP: ChainMap = { - "BASE": SupportedChains.BASESepolia, - "BNB": SupportedChains.BNBTestNet -} - -class SNSResolver implements BaseResolver { - options: SNSOptions; - - name: string; - - chainMap: ChainMap; - - chainResolvers: Resolvers; - - constructor(options: SNSOptions) { - this.options = options; - this.name = "sns"; - this.chainMap = options.network === "testnet" - ? TESTNET_CHAIN_MAP - : MAINNET_CHAIN_MAP; - this.chainResolvers = Object.fromEntries( - Object.entries(this.chainMap).map(([key, val]) => ( - [key, new SNS(val)] - )) - ); - } - - // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-empty-function - public async init(): Promise { } - - // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars - public async resolveReverseName(_address: string): Promise { - return null - } - - public async resolveAddress( - name: string, - coin: CoinType = "ETH" - ): Promise { - const resolver = this.chainResolvers[coin]; - if (resolver) { - return resolver.resolveName(name) - .then((address) => address ?? null) - .catch(() => null) - } - - return null - } - - // eslint-disable-next-line class-methods-use-this - public isSupportedName(name: string): boolean { - return getTLD(name) === "sol"; - } -} - -export default SNSResolver; diff --git a/packages/name-resolution/src/sns/types.ts b/packages/name-resolution/src/sns/types.ts deleted file mode 100644 index 842392adc..000000000 --- a/packages/name-resolution/src/sns/types.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { SupportedChains, SNS } from "@bonfida/sns-warp-evm"; - -type SupportedNetwork = "BASE" | "BNB"; - -export interface SNSOptions { - network: "testnet" | "mainnet"; -} - -export type ChainMap = Record; - -export type Resolvers = Record; diff --git a/packages/name-resolution/src/types.ts b/packages/name-resolution/src/types.ts index 456c3babb..242f5320d 100644 --- a/packages/name-resolution/src/types.ts +++ b/packages/name-resolution/src/types.ts @@ -1,6 +1,5 @@ import { ENSOptions } from "./ens/types"; import { SIDOptions } from "./sid/types"; -import { SNSOptions } from "./sns/types"; export type CoinType = | "BTC" @@ -138,9 +137,7 @@ export type CoinType = | "NRG" | "ARB1" | "CELO" - | "AVAXC" - | "BASE"; - + | "AVAXC"; export abstract class BaseResolver { name: string; @@ -160,5 +157,4 @@ export abstract class BaseResolver { export interface NameResolverOptions { ens: ENSOptions; sid: SIDOptions; - sns: SNSOptions; } diff --git a/packages/name-resolution/tests/resolver.test.ts b/packages/name-resolution/tests/resolver.test.ts index 45f5d6c64..971992857 100644 --- a/packages/name-resolution/tests/resolver.test.ts +++ b/packages/name-resolution/tests/resolver.test.ts @@ -14,9 +14,6 @@ describe("Name Resolver resolving", () => { arb: "https://nodes.mewapi.io/rpc/arb", }, }, - sns: { - network: "testnet", - }, }); let address = await resolver.resolveAddress("test.eth", "ETH"); expect(address).to.be.eq("0xeefB13C7D42eFCc655E528dA6d6F7bBcf9A2251d"); @@ -37,9 +34,6 @@ describe("Name Resolver resolving", () => { arb: "https://nodes.mewapi.io/rpc/arb", }, }, - sns: { - network: "testnet", - }, }); let name = await resolver.resolveReverseName( "0xe5dc07bdcdb8c98850050c7f67de7e164b1ea391" diff --git a/packages/name-resolution/tests/sns.test.ts b/packages/name-resolution/tests/sns.test.ts deleted file mode 100644 index a37e75950..000000000 --- a/packages/name-resolution/tests/sns.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { expect } from "chai"; -import SNSResolver from "../src/sns" - -describe("SNS Name resolving", () => { - // the tests container - it("it should properly resolve address", async () => { - const resolver = new SNSResolver({ network: "testnet" }); - await resolver.init(); - const address = await resolver.resolveAddress("mock3.sol", "BNB"); - expect(address).to.be.eq("0x1D719d2dB763f905b1924F46a5185e001Dd93786"); - }).timeout(10000); - - it("it should return null if not found", async () => { - const resolver = new SNSResolver({ network: "testnet" }); - await resolver.init(); - const name = await resolver.resolveReverseName( - "0xe5dc07bdcdb8c98850050c7f67de7e164b1ea392" - ); - expect(name).to.be.eq(null); - const address = await resolver.resolveAddress( - "sdfsfsdfsdfsdf.sol", - "BASE" - ); - expect(address).to.be.eq(null); - }).timeout(10000); -}); diff --git a/yarn.lock b/yarn.lock index 29d0374d2..ff2ba5c0d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1754,17 +1754,6 @@ __metadata: languageName: node linkType: hard -"@bonfida/sns-warp-evm@npm:^0.0.4": - version: 0.0.4 - resolution: "@bonfida/sns-warp-evm@npm:0.0.4" - peerDependencies: - "@ethersproject/address": ^5.7.0 - "@ethersproject/hash": ^5.7.0 - "@ethersproject/providers": ^5.7.2 - checksum: ad7e8c8a157f3c79668d8704eecb96708384f54f07088aaabcfb4798984d5d93082ddc80bb5b020e114d6bf9769781205aad53a1a9aa3c652558a6985b24a36f - languageName: node - linkType: hard - "@cardano-foundation/ledgerjs-hw-app-cardano@npm:^6.0.1": version: 6.0.1 resolution: "@cardano-foundation/ledgerjs-hw-app-cardano@npm:6.0.1" @@ -14886,7 +14875,6 @@ __metadata: version: 0.0.0-use.local resolution: "enkrypt@workspace:." dependencies: - "@bonfida/sns-warp-evm": ^0.0.4 "@commitlint/cli": ^19.3.0 "@commitlint/config-conventional": ^19.2.2 "@swc/core": ^1.6.3