diff --git a/ops/mainnet/prod/backend/config.tf b/ops/mainnet/prod/backend/config.tf index 2ac7ecde1c..e9cf39bd4e 100644 --- a/ops/mainnet/prod/backend/config.tf +++ b/ops/mainnet/prod/backend/config.tf @@ -51,7 +51,8 @@ locals { providers = ["https://rpc.ankr.com/gnosis"] } "1818848877" = { - providers = ["https://rpc.linea.build"] + providers = ["https://rpc.linea.build"] + disabledAssets = ["0xA219439258ca9da29E9Cc4cE5596924745e12B93", "0x4AF15ec2A0BD43Db75dd04E62FAA3B8EF36b00d5"] } } @@ -84,7 +85,7 @@ locals { "1634886255" = { confirmations = 1 } "6450786" = { confirmations = 50 } "6778479" = { confirmations = 100 } - "1818848877" = { confirmations = 10 } + "1818848877" = { confirmations = 10 } } environment = var.stage healthUrls = { diff --git a/packages/agents/sdk-wrapper/CHANGELOG.md b/packages/agents/sdk-wrapper/CHANGELOG.md index 32131a71f4..22e89781d0 100644 --- a/packages/agents/sdk-wrapper/CHANGELOG.md +++ b/packages/agents/sdk-wrapper/CHANGELOG.md @@ -2,6 +2,14 @@ ## Next Release +## v2.2.0-alpha.4 + +- `getSupported`: Filters out disabled assets/chains from config + +## v2.2.0-alpha.3 + +- `getTransfers`: Fix query syntax + ## v2.2.0-alpha.0 - Linea mainnet support diff --git a/packages/agents/sdk-wrapper/package.json b/packages/agents/sdk-wrapper/package.json index 64342ba1ea..2964b75bfb 100644 --- a/packages/agents/sdk-wrapper/package.json +++ b/packages/agents/sdk-wrapper/package.json @@ -1,6 +1,6 @@ { "name": "@connext/sdk", - "version": "2.2.0-alpha.1", + "version": "2.2.0-alpha.4", "description": "Client-side package for interacting with the Connext protocol", "author": "Connext", "license": "MIT", diff --git a/packages/agents/sdk-wrapper/src/config.ts b/packages/agents/sdk-wrapper/src/config.ts index 101607b820..d17dbd9552 100644 --- a/packages/agents/sdk-wrapper/src/config.ts +++ b/packages/agents/sdk-wrapper/src/config.ts @@ -29,7 +29,8 @@ export const TChainConfig = Type.Object({ confirmations: Type.Optional(Type.Integer({ minimum: 1 })), // What we consider the "safe confirmations" number for this chain. chainId: Type.Optional(Type.Number()), deployments: Type.Optional(TChainDeployments), - assets: Type.Optional(Type.Array(TAssetDescription)), /// Not Being Used + disabled: Type.Optional(Type.Boolean()), + disabledAssets: Type.Optional(Type.Array(TAddress)), // By adopted address }); export type ChainConfig = Static; @@ -105,6 +106,9 @@ export const getEnvConfig = ( : (`${nxtpConfig.environment![0].toUpperCase()}${nxtpConfig.environment!.slice(1)}` as ContractPostfix); // add contract deployments if they exist Object.entries(nxtpConfig.chains).forEach(([domainId, chainConfig]) => { + nxtpConfig.chains[domainId].disabled = chainConfig.disabled ?? false; + nxtpConfig.chains[domainId].disabledAssets = chainConfig.disabledAssets ?? []; + const chainDataForChain = chainData.get(domainId); const chainRecommendedConfirmations = chainDataForChain?.confirmations ?? defaultConfirmations; const chainRecommendedGasStations = chainDataForChain?.gasStations ?? []; diff --git a/packages/agents/sdk/CHANGELOG.md b/packages/agents/sdk/CHANGELOG.md index 57459b264c..dadc25b37a 100644 --- a/packages/agents/sdk/CHANGELOG.md +++ b/packages/agents/sdk/CHANGELOG.md @@ -2,6 +2,14 @@ ## Next Release +## v2.2.0-alpha.4 + +- `getSupported`: Filters out disabled assets/chains from config + +## v2.2.0-alpha.3 + +- `getTransfers`: Fix query syntax + ## v2.2.0-alpha.0 - Linea mainnet support diff --git a/packages/agents/sdk/package.json b/packages/agents/sdk/package.json index 529a8192ee..a4b65c3c74 100644 --- a/packages/agents/sdk/package.json +++ b/packages/agents/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@connext/sdk-core", - "version": "2.2.0-alpha.1", + "version": "2.2.0-alpha.4", "description": "Client-side package for interacting with the Connext protocol", "author": "Connext", "license": "MIT", diff --git a/packages/agents/sdk/src/config.ts b/packages/agents/sdk/src/config.ts index 4058693297..2aefc6f1df 100644 --- a/packages/agents/sdk/src/config.ts +++ b/packages/agents/sdk/src/config.ts @@ -29,7 +29,8 @@ export const TChainConfig = Type.Object({ confirmations: Type.Optional(Type.Integer({ minimum: 1 })), // What we consider the "safe confirmations" number for this chain. chainId: Type.Optional(Type.Number()), deployments: Type.Optional(TChainDeployments), - assets: Type.Optional(Type.Array(TAssetDescription)), /// Not Being Used + disabled: Type.Optional(Type.Boolean()), + disabledAssets: Type.Optional(Type.Array(TAddress)), // By adopted address }); export type ChainConfig = Static; @@ -105,6 +106,9 @@ export const getEnvConfig = ( : (`${nxtpConfig.environment![0].toUpperCase()}${nxtpConfig.environment!.slice(1)}` as ContractPostfix); // add contract deployments if they exist Object.entries(nxtpConfig.chains).forEach(([domainId, chainConfig]) => { + nxtpConfig.chains[domainId].disabled = chainConfig.disabled ?? false; + nxtpConfig.chains[domainId].disabledAssets = chainConfig.disabledAssets ?? []; + const chainDataForChain = chainData.get(domainId); const chainRecommendedConfirmations = chainDataForChain?.confirmations ?? defaultConfirmations; const chainRecommendedGasStations = chainDataForChain?.gasStations ?? []; diff --git a/packages/agents/sdk/src/sdkShared.ts b/packages/agents/sdk/src/sdkShared.ts index dab01546b3..596bbb46d4 100644 --- a/packages/agents/sdk/src/sdkShared.ts +++ b/packages/agents/sdk/src/sdkShared.ts @@ -362,21 +362,23 @@ export class SdkShared { */ async getSupported(): Promise { const data: AssetData[] = await this.getAssetsData(); - const supported: Map = new Map(); for (const asset of data) { - const support = supported.get(asset.domain); - if (support) { - support.assets.push(asset.adopted); - } else { - const entry: ConnextSupport = { - name: domainsToChainNames[asset.domain], - chainId: _domainToChainId(+asset.domain), - domainId: asset.domain, - assets: [asset.adopted], - }; - supported.set(asset.domain, entry); + const chainConfig = this.config.chains[asset.domain]; + if (!chainConfig.disabled && !chainConfig.disabledAssets?.includes(utils.getAddress(asset.adopted))) { + const support = supported.get(asset.domain); + if (support) { + support.assets.push(asset.adopted); + } else { + const entry: ConnextSupport = { + name: domainsToChainNames[asset.domain], + chainId: _domainToChainId(+asset.domain), + domainId: asset.domain, + assets: [asset.adopted], + }; + supported.set(asset.domain, entry); + } } } diff --git a/packages/agents/sdk/test/sdkShared.spec.ts b/packages/agents/sdk/test/sdkShared.spec.ts index 79861d73ee..034c36d221 100644 --- a/packages/agents/sdk/test/sdkShared.spec.ts +++ b/packages/agents/sdk/test/sdkShared.spec.ts @@ -52,6 +52,9 @@ describe("SdkShared", () => { stub(SharedFns, "axiosGetRequest").resolves([]); sdkShared = new SdkShared(mockConfig, logger, mockChainData); + // console.log(sdkShared.config.chains); + // console.log(sdkShared.config.chains[13337]); + // console.log(sdkShared.config.chains[13338]); }); afterEach(() => { @@ -133,14 +136,6 @@ describe("SdkShared", () => { }); }); - describe("#getSupported", () => { - it("happy: should work", async () => { - (sdkShared as any).config.cartographerUrl = config.cartographerUrl; - const connext = await sdkShared.getSupported(); - expect(connext).to.not.be.undefined; - }); - }); - describe("#providerSanityCheck", () => { it("happy: should return true with a domain in existing config", async () => { const params = { domains: [mock.domain.A] }; @@ -322,6 +317,7 @@ describe("SdkShared", () => { describe("#getAssetsData", () => { it("happy: should work", async () => { + sdkShared.config.cartographerUrl = config.cartographerUrl; restore(); stub(SharedFns, "axiosGetRequest").resolves([mockAssetData]); const res = await sdkShared.getAssetsData(); @@ -427,9 +423,22 @@ describe("SdkShared", () => { describe("#getSupported", () => { it("happy: should work", async () => { - (sdkShared as any).config.cartographerUrl = config.cartographerUrl; - const connext = await sdkShared.getSupported(); - expect(connext).to.not.be.undefined; + sdkShared.config.cartographerUrl = config.cartographerUrl; + restore(); + stub(sdkShared, "getAssetsData").resolves([mockAssetData]); + + const supported = await sdkShared.getSupported(); + expect(supported.length).to.be.eq(1); + }); + + it("happy: should filter out assets disabled in config", async () => { + sdkShared.config.cartographerUrl = config.cartographerUrl; + restore(); + stub(sdkShared, "getAssetsData").resolves([mockAssetData]); + sdkShared.config.chains[mock.domain.A].disabledAssets = [mock.asset.B.address]; + + const supported = await sdkShared.getSupported(); + expect(supported.length).to.be.eq(0); }); });