|
1 | 1 | import "@src/utils/protobuf"; |
2 | 2 |
|
3 | | -import { getAkashTypeRegistry } from "@akashnetwork/akashjs/build/stargate"; |
| 3 | +import * as v1 from "@akashnetwork/chain-sdk/private-types/akash.v1"; |
| 4 | +import * as v1beta4 from "@akashnetwork/chain-sdk/private-types/akash.v1beta4"; |
| 5 | +import * as v1beta5 from "@akashnetwork/chain-sdk/private-types/akash.v1beta5"; |
| 6 | +import * as cosmosv1 from "@akashnetwork/chain-sdk/private-types/cosmos.v1"; |
| 7 | +import * as cosmosv1alpha1 from "@akashnetwork/chain-sdk/private-types/cosmos.v1alpha1"; |
| 8 | +import * as cosmosv1beta1 from "@akashnetwork/chain-sdk/private-types/cosmos.v1beta1"; |
| 9 | +import * as cosmosv2alpha1 from "@akashnetwork/chain-sdk/private-types/cosmos.v2alpha1"; |
| 10 | +import type { GeneratedType } from "@cosmjs/proto-signing"; |
4 | 11 | import { Registry } from "@cosmjs/proto-signing"; |
5 | | -import { defaultRegistryTypes } from "@cosmjs/stargate"; |
| 12 | +import type { InjectionToken } from "tsyringe"; |
6 | 13 | import { container, inject } from "tsyringe"; |
7 | 14 |
|
8 | | -const registry = new Registry([...defaultRegistryTypes, ...getAkashTypeRegistry()]); |
| 15 | +const newAkashTypes: ReadonlyArray<[string, GeneratedType]> = [ |
| 16 | + ...Object.values(v1), |
| 17 | + ...Object.values(v1beta4), |
| 18 | + ...Object.values(v1beta5), |
| 19 | + ...Object.values(cosmosv1), |
| 20 | + ...Object.values(cosmosv1beta1), |
| 21 | + ...Object.values(cosmosv1alpha1), |
| 22 | + ...Object.values(cosmosv2alpha1) |
| 23 | +] |
| 24 | + .filter(x => "$type" in x) |
| 25 | + .map(x => ["/" + x.$type, x as unknown as GeneratedType]); |
9 | 26 |
|
10 | | -export const TYPE_REGISTRY = "TYPE_REGISTRY"; |
| 27 | +const registry = new Registry(newAkashTypes); |
| 28 | + |
| 29 | +export const TYPE_REGISTRY: InjectionToken<Registry> = "TYPE_REGISTRY"; |
11 | 30 |
|
12 | 31 | container.register(TYPE_REGISTRY, { useValue: registry }); |
13 | 32 | export const InjectTypeRegistry = () => inject(TYPE_REGISTRY); |
0 commit comments