diff --git a/src/main.ts b/src/main.ts index 79484d11d..c1cb7c1fa 100644 --- a/src/main.ts +++ b/src/main.ts @@ -26,11 +26,11 @@ import { json } from 'express'; import packageJSON from '../package.json'; import App from './App'; -import tempTypesBundle from './overrideTypes/typesBundle'; import { getControllersForSpec } from './chains-config'; import { consoleOverride } from './logging/consoleOverride'; import { Log } from './logging/Log'; import * as middleware from './middleware'; +import tempTypesBundle from './override-types/typesBundle'; import { parseArgs } from './parseArgs'; import { SidecarConfig } from './SidecarConfig'; import Metrics_App from './util/metrics'; @@ -51,8 +51,8 @@ async function main() { : new WsProvider(config.SUBSTRATE.URL), /* eslint-disable @typescript-eslint/no-var-requires */ typesBundle: TYPES_BUNDLE - ? (tempTypesBundle as OverrideBundleType) - : undefined, + ? (require(TYPES_BUNDLE) as OverrideBundleType) + : (tempTypesBundle as OverrideBundleType), typesChain: TYPES_CHAIN ? (require(TYPES_CHAIN) as Record) : undefined, diff --git a/src/override-types/typesBundle.ts b/src/override-types/typesBundle.ts new file mode 100644 index 000000000..f587e8bea --- /dev/null +++ b/src/override-types/typesBundle.ts @@ -0,0 +1,59 @@ +import { OverrideBundleDefinition } from '@polkadot/types/types'; + +const definitionsWestmint: OverrideBundleDefinition = { + types: [ + { + minmax: [0, 9434], + types: { + TempAssetId: 'Option', + }, + }, + { + minmax: [9435, undefined], + types: { + TempAssetId: 'Option', + }, + }, + ], + signedExtensions: { + ChargeAssetTxPayment: { + extrinsic: { + tip: 'Compact', + // eslint-disable-next-line sort-keys + assetId: 'TempAssetId', + }, + payload: {}, + }, + }, +}; + +const definitionsStatemine: OverrideBundleDefinition = { + types: [ + { + minmax: [0, 9999], + types: { + TempAssetId: 'Option', + }, + }, + { + minmax: [10000, undefined], + types: { + TempAssetId: 'Option', + }, + }, + ], + signedExtensions: { + ChargeAssetTxPayment: { + extrinsic: { + tip: 'Compact', + // eslint-disable-next-line sort-keys + assetId: 'TempAssetId', + }, + payload: {}, + }, + }, +}; + +export default { + spec: { statemine: definitionsStatemine, westmint: definitionsWestmint }, +}; diff --git a/src/overrideTypes/typesBundle.ts b/src/overrideTypes/typesBundle.ts deleted file mode 100644 index a7f2d0ed6..000000000 --- a/src/overrideTypes/typesBundle.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { OverrideBundleDefinition } from "@polkadot/types/types"; - -const definitionsWestmint: OverrideBundleDefinition = { - types: [ - { - minmax: [0, 9434], - types: { - TempAssetId: "Option" - }, - }, - { - minmax: [9435, undefined], - types: { - TempAssetId: "Option" - }, - }, - ], - signedExtensions: { - ChargeAssetTxPayment: { - extrinsic: { - tip: 'Compact', - // eslint-disable-next-line sort-keys - assetId: 'TempAssetId' - }, - payload: {} - } - } -}; - -const definitionsStatemine: OverrideBundleDefinition = { - types: [ - { - minmax: [0, 9999], - types: { - TempAssetId: "Option" - }, - }, - { - minmax: [10000, undefined], - types: { - TempAssetId: "Option" - }, - }, - ], - signedExtensions: { - ChargeAssetTxPayment: { - extrinsic: { - tip: 'Compact', - // eslint-disable-next-line sort-keys - assetId: 'TempAssetId' - }, - payload: {} - } - } - }; - -export default { typesBundle: { spec: { "statemine": definitionsStatemine, "westmint": definitionsWestmint } } };