@polkadot/types/types#OverrideBundleType TypeScript Examples
The following examples show how to use
@polkadot/types/types#OverrideBundleType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.ts From moonbeam with GNU General Public License v3.0 | 5 votes |
typesBundlePre900 = {
spec: {
moonbeam: moonbeamDefinitions,
moonbeamDefinitions,
moonbase: moonbeamDefinitions,
moonriver: moonbeamDefinitions,
},
} as OverrideBundleType
Example #2
Source File: index.ts From moonbeam with GNU General Public License v3.0 | 5 votes |
typesBundleDeprecated = {
spec: {
moonbeam: moonbeamDefinitionsDeprecated,
moonbeamDefinitions: moonbeamDefinitionsDeprecated,
moonbase: moonbeamDefinitionsDeprecated,
moonriver: moonbeamDefinitionsDeprecated,
},
} as OverrideBundleType
Example #3
Source File: index.ts From crust-apps with Apache License 2.0 | 5 votes |
typesBundle: OverrideBundleType = { spec }
Example #4
Source File: index.ts From squid with GNU General Public License v3.0 | 5 votes |
export async function getApiPromise(): Promise<ApiPromise> {
if (apiPromise) {
return apiPromise
}
debug(`Creating new Api Promise`)
const conf = getConfig()
const provider = new WsProvider(conf.WS_PROVIDER_ENDPOINT_URI)
const names = Object.keys(conf.TYPES_JSON)
names.length && debug(`Injected types: ${names.join(', ')}`)
apiPromise = await pRetry(
async () =>
new ApiPromise({
provider,
types: conf.TYPES_JSON as RegistryTypes,
typesAlias: conf.TYPES_ALIAS as Record<string, OverrideModuleType>,
typesBundle: conf.BUNDLE_TYPES as OverrideBundleType,
typesSpec: conf.SPEC_TYPES as Record<string, RegistryTypes>,
typesChain: conf.CHAIN_TYPES as Record<string, RegistryTypes>,
}).isReadyOrError,
{
retries: 99, // large enough
onFailedAttempt: (error) =>
debug(`API failed to connect: ${JSON.stringify(error)}`),
}
)
apiPromise.on('error', async (e) => {
debug(`Api error: ${JSON.stringify(e)}, reconnecting....`)
apiPromise = await getApiPromise()
})
apiPromise.on('connected', () => {
debug(`Api connected`)
eventEmitter.emit(IndexerEvents.API_CONNECTED)
})
return apiPromise
}