diff --git a/packages/core/abstract.config.ts b/packages/core/abstract.config.ts index 7621a85c..822abe43 100644 --- a/packages/core/abstract.config.ts +++ b/packages/core/abstract.config.ts @@ -7,7 +7,7 @@ const contractsConfig = [ version: '0.24.0-test.1', }, { - name: 'version-control', + name: 'registry', version: '0.24.0-rc.1', }, { diff --git a/packages/core/src/actions/account/public/get-account-address-from-api.ts b/packages/core/src/actions/account/public/get-account-address-from-api.ts index 8a3dbbcd..e13d5c58 100644 --- a/packages/core/src/actions/account/public/get-account-address-from-api.ts +++ b/packages/core/src/actions/account/public/get-account-address-from-api.ts @@ -1,10 +1,10 @@ import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { VersionControlTypes } from '../../../codegen/abstract' +import { RegistryTypes } from '../../../codegen/abstract' import { accountIdToParameter } from '../../../utils/account-id' -import { getVersionControlQueryClientFromApi } from '../../public/get-version-control-query-client-from-api' +import { getRegistryQueryClientFromApi } from '../../public/get-registry-query-client-from-api' export type GetAccountAddressFromApiParameters = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId cosmWasmClient: CosmWasmClient apiUrl: string } @@ -14,11 +14,11 @@ export async function getAccountAddressFromApi({ cosmWasmClient, apiUrl, }: GetAccountAddressFromApiParameters) { - const versionControlQueryClient = await getVersionControlQueryClientFromApi({ + const registryQueryClient = await getRegistryQueryClientFromApi({ cosmWasmClient, apiUrl, }) - const { account } = await versionControlQueryClient.account({ + const { account } = await registryQueryClient.account({ accountId: accountIdToParameter(accountId), }) return { diff --git a/packages/core/src/actions/account/public/get-account-instantiate2-address-from-api.ts b/packages/core/src/actions/account/public/get-account-instantiate2-address-from-api.ts index 284a3345..071a9aa8 100644 --- a/packages/core/src/actions/account/public/get-account-instantiate2-address-from-api.ts +++ b/packages/core/src/actions/account/public/get-account-instantiate2-address-from-api.ts @@ -4,15 +4,15 @@ import { getInstantiate2Address, } from '@abstract-money/core' import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { VersionControlTypes } from '../../../codegen/abstract' +import { RegistryTypes } from '../../../codegen/abstract' import { abstractModuleId } from '../../../utils/modules/abstract-module-id' -import { getVersionControlAddressFromApi } from '../../get-version-control-address-from-api' -import { getAppModuleCodeIdFromVersionControl } from '../../public/get-app-module-code-id-from-version-control' -import { getModuleFactoryAddressFromVersionControl } from '../../public/get-module-factory-address-from-version-control' +import { getRegistryAddressFromApi } from '../../get-registry-address-from-api' +import { getAppModuleCodeIdFromRegistry } from '../../public/get-app-module-code-id-from-registry' +import { getModuleFactoryAddressFromRegistry } from '../../public/get-module-factory-address-from-registry' import { CommonModuleNames } from '../../public/types' export type GetAccountInstantiate2AddressFromApi = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId cosmWasmClient: CosmWasmClient apiUrl: string } @@ -31,21 +31,21 @@ export async function getAccountInstantiate2AddressFromApi({ const chainId = await cosmWasmClient.getChainId() const chainName = chainIdToName(chainId) - const versionControlAddress = await getVersionControlAddressFromApi({ + const registryAddress = await getRegistryAddressFromApi({ apiUrl, chainName, }) - const moduleFactoryAddress = await getModuleFactoryAddressFromVersionControl({ + const moduleFactoryAddress = await getModuleFactoryAddressFromRegistry({ cosmWasmClient, - versionControlAddress, + registryAddress, }) - const accountCodeId = await getAppModuleCodeIdFromVersionControl({ + const accountCodeId = await getAppModuleCodeIdFromRegistry({ moduleId: abstractModuleId(CommonModuleNames.ACCOUNT), version: 'latest', cosmWasmClient, - versionControlAddress, + registryAddress, }) const moduleCodeDetails = await cosmWasmClient.getCodeDetails(accountCodeId) diff --git a/packages/core/src/actions/account/public/get-account-query-client-from-api.ts b/packages/core/src/actions/account/public/get-account-query-client-from-api.ts index 75c4b729..5b84bd7e 100644 --- a/packages/core/src/actions/account/public/get-account-query-client-from-api.ts +++ b/packages/core/src/actions/account/public/get-account-query-client-from-api.ts @@ -1,10 +1,10 @@ import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { VersionControlTypes } from '../../../codegen/abstract' +import { RegistryTypes } from '../../../codegen/abstract' import { getAccountQueryClient } from '../../public/get-account-query-client' import { getAccountAddressFromApi } from './get-account-address-from-api' export type GetAccountQueryClientFromApiParameters = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId cosmWasmClient: CosmWasmClient apiUrl: string } diff --git a/packages/core/src/actions/account/public/get-account-settings.ts b/packages/core/src/actions/account/public/get-account-settings.ts index c6316df8..23cfa20a 100644 --- a/packages/core/src/actions/account/public/get-account-settings.ts +++ b/packages/core/src/actions/account/public/get-account-settings.ts @@ -1,10 +1,10 @@ import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' import { CommonModuleNames } from '../../../actions/public/types' -import { VersionControlTypes } from '../../../codegen/abstract' +import { RegistryTypes } from '../../../codegen/abstract' import { getAccountQueryClientFromApi } from './get-account-query-client-from-api' export type GetAccountSettingsParameters = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId cosmWasmClient: CosmWasmClient apiUrl: string } diff --git a/packages/core/src/actions/account/public/get-ibc-client-query-client-from-manager.ts b/packages/core/src/actions/account/public/get-ibc-client-query-client-from-manager.ts index 31360665..ab60b8f0 100644 --- a/packages/core/src/actions/account/public/get-ibc-client-query-client-from-manager.ts +++ b/packages/core/src/actions/account/public/get-ibc-client-query-client-from-manager.ts @@ -1,15 +1,12 @@ import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { - IbcClientQueryClient, - VersionControlTypes, -} from '../../../codegen/abstract' +import { IbcClientQueryClient, RegistryTypes } from '../../../codegen/abstract' import { abstractModuleId } from '../../../utils/modules/abstract-module-id' import { getIbcClientQueryClient } from '../../public/get-ibc-client-query-client' import { CommonModuleNames } from '../../public/types' import { getModuleAddress } from './get-module-address' export type GetIbcClientQueryClientFromManagerParameters = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId cosmWasmClient: CosmWasmClient apiUrl: string } diff --git a/packages/core/src/actions/account/public/get-module-address.ts b/packages/core/src/actions/account/public/get-module-address.ts index c6d97f70..edc5c647 100644 --- a/packages/core/src/actions/account/public/get-module-address.ts +++ b/packages/core/src/actions/account/public/get-module-address.ts @@ -1,9 +1,9 @@ import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { VersionControlTypes } from '../../../codegen/abstract' +import { RegistryTypes } from '../../../codegen/abstract' import { getAccountQueryClientFromApi } from './get-account-query-client-from-api' export type GetModuleAddressParameters = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId cosmWasmClient: CosmWasmClient apiUrl: string id: string diff --git a/packages/core/src/actions/account/public/get-module-instantiate2-address-from-api.ts b/packages/core/src/actions/account/public/get-module-instantiate2-address-from-api.ts index 30e4a602..44652887 100644 --- a/packages/core/src/actions/account/public/get-module-instantiate2-address-from-api.ts +++ b/packages/core/src/actions/account/public/get-module-instantiate2-address-from-api.ts @@ -4,15 +4,15 @@ import { getInstantiate2Address, } from '@abstract-money/core' import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { VersionControlTypes } from '../../../codegen/abstract' -import { getVersionControlAddressFromApi } from '../../get-version-control-address-from-api' -import { getAppModuleCodeIdFromVersionControl } from '../../public/get-app-module-code-id-from-version-control' -import { getModuleFactoryAddressFromVersionControl } from '../../public/get-module-factory-address-from-version-control' +import { RegistryTypes } from '../../../codegen/abstract' +import { getRegistryAddressFromApi } from '../../get-registry-address-from-api' +import { getAppModuleCodeIdFromRegistry } from '../../public/get-app-module-code-id-from-registry' +import { getModuleFactoryAddressFromRegistry } from '../../public/get-module-factory-address-from-registry' export type GetModuleInstantiate2AddressFromApi = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId moduleId: ModuleId - version?: VersionControlTypes.ModuleVersion + version?: RegistryTypes.ModuleVersion cosmWasmClient: CosmWasmClient apiUrl: string } @@ -27,21 +27,21 @@ export async function getModuleInstantiate2AddressFromApi({ const chainId = await cosmWasmClient.getChainId() const chainName = chainIdToName(chainId) - const versionControlAddress = await getVersionControlAddressFromApi({ + const registryAddress = await getRegistryAddressFromApi({ apiUrl, chainName, }) - const moduleFactoryAddress = await getModuleFactoryAddressFromVersionControl({ + const moduleFactoryAddress = await getModuleFactoryAddressFromRegistry({ cosmWasmClient, - versionControlAddress, + registryAddress, }) - const moduleCodeId = await getAppModuleCodeIdFromVersionControl({ + const moduleCodeId = await getAppModuleCodeIdFromRegistry({ moduleId, version, cosmWasmClient, - versionControlAddress, + registryAddress, }) const moduleCodeDetails = await cosmWasmClient.getCodeDetails(moduleCodeId) diff --git a/packages/core/src/actions/account/public/get-module-version.ts b/packages/core/src/actions/account/public/get-module-version.ts index 5bbf6264..d4a16024 100644 --- a/packages/core/src/actions/account/public/get-module-version.ts +++ b/packages/core/src/actions/account/public/get-module-version.ts @@ -1,9 +1,9 @@ import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { VersionControlTypes } from '../../../codegen/abstract' +import { RegistryTypes } from '../../../codegen/abstract' import { getAccountQueryClientFromApi } from './get-account-query-client-from-api' export type GetModuleVersionParameters = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId cosmWasmClient: CosmWasmClient apiUrl: string id: string diff --git a/packages/core/src/actions/account/public/get-modules.ts b/packages/core/src/actions/account/public/get-modules.ts index 80e83e12..f4516e8a 100644 --- a/packages/core/src/actions/account/public/get-modules.ts +++ b/packages/core/src/actions/account/public/get-modules.ts @@ -1,12 +1,9 @@ import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { - AccountQueryClient, - VersionControlTypes, -} from '../../../codegen/abstract' +import { AccountQueryClient, RegistryTypes } from '../../../codegen/abstract' import { getAccountQueryClientFromApi } from './get-account-query-client-from-api' export type GetModulesParameters = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId cosmWasmClient: CosmWasmClient apiUrl: string } & Parameters[0] diff --git a/packages/core/src/actions/account/public/get-namespace.ts b/packages/core/src/actions/account/public/get-namespace.ts index cd95b1f0..33f77df1 100644 --- a/packages/core/src/actions/account/public/get-namespace.ts +++ b/packages/core/src/actions/account/public/get-namespace.ts @@ -1,10 +1,10 @@ import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { VersionControlTypes } from '../../../codegen/abstract' +import { RegistryTypes } from '../../../codegen/abstract' import { accountIdToParameter } from '../../../utils/account-id' -import { getVersionControlQueryClientFromApi } from '../../public/get-version-control-query-client-from-api' +import { getRegistryQueryClientFromApi } from '../../public/get-registry-query-client-from-api' export type GetNamespaceParameters = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId cosmWasmClient: CosmWasmClient apiUrl: string } @@ -14,11 +14,11 @@ export async function getNamespace({ cosmWasmClient, apiUrl, }: GetNamespaceParameters): Promise { - const versionControlQueryClient = await getVersionControlQueryClientFromApi({ + const registryQueryClient = await getRegistryQueryClientFromApi({ cosmWasmClient, apiUrl, }) - const namespace = await versionControlQueryClient + const namespace = await registryQueryClient .namespaces({ accounts: [accountIdToParameter(accountId)] }) .then((x) => x.namespaces[0]?.[0]) diff --git a/packages/core/src/actions/account/public/get-owner.ts b/packages/core/src/actions/account/public/get-owner.ts index ce9d42d5..63dee1e0 100644 --- a/packages/core/src/actions/account/public/get-owner.ts +++ b/packages/core/src/actions/account/public/get-owner.ts @@ -1,9 +1,9 @@ import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { VersionControlTypes } from '../../../codegen/abstract' +import { RegistryTypes } from '../../../codegen/abstract' import { getAccountQueryClientFromApi } from './get-account-query-client-from-api' export type GetOwnerParameters = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId cosmWasmClient: CosmWasmClient apiUrl: string } diff --git a/packages/core/src/actions/account/public/get-remote-account-proxies.ts b/packages/core/src/actions/account/public/get-remote-account-proxies.ts index 630bfc4b..531e6b82 100644 --- a/packages/core/src/actions/account/public/get-remote-account-proxies.ts +++ b/packages/core/src/actions/account/public/get-remote-account-proxies.ts @@ -1,13 +1,10 @@ import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { - IbcClientQueryClient, - VersionControlTypes, -} from '../../../codegen/abstract' +import { IbcClientQueryClient, RegistryTypes } from '../../../codegen/abstract' import { accountIdToParameter } from '../../../utils/account-id/account-id-to-parameter' import { getIbcClientQueryClientFromManager } from './get-ibc-client-query-client-from-manager' export type GetRemoteProxiesParameters = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId cosmWasmClient: CosmWasmClient apiUrl: string } & Omit< diff --git a/packages/core/src/actions/account/public/get-sub-account-ids.ts b/packages/core/src/actions/account/public/get-sub-account-ids.ts index 9884374d..5334fb98 100644 --- a/packages/core/src/actions/account/public/get-sub-account-ids.ts +++ b/packages/core/src/actions/account/public/get-sub-account-ids.ts @@ -1,15 +1,12 @@ import { AccountId } from '@abstract-money/core' import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { - AccountQueryClient, - VersionControlTypes, -} from '../../../codegen/abstract' +import { AccountQueryClient, RegistryTypes } from '../../../codegen/abstract' import { sequenceToLocalAccountId } from '../../../utils/account-id/seq-to-local-account-id' import { chainIdToName } from '../../../utils/chain-registry' import { getSubAccountSequences } from './get-sub-account-sequences' export type GetSubAccountIdsParameters = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId cosmWasmClient: CosmWasmClient apiUrl: string } & Parameters[0] diff --git a/packages/core/src/actions/account/public/get-sub-account-sequences.ts b/packages/core/src/actions/account/public/get-sub-account-sequences.ts index 9e845b25..2e48f49d 100644 --- a/packages/core/src/actions/account/public/get-sub-account-sequences.ts +++ b/packages/core/src/actions/account/public/get-sub-account-sequences.ts @@ -1,12 +1,9 @@ import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { - AccountQueryClient, - VersionControlTypes, -} from '../../../codegen/abstract' +import { AccountQueryClient, RegistryTypes } from '../../../codegen/abstract' import { getAccountQueryClientFromApi } from './get-account-query-client-from-api' export type GetSubAccountSequencesParameters = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId cosmWasmClient: CosmWasmClient apiUrl: string } & Parameters[0] diff --git a/packages/core/src/actions/account/public/query-module.ts b/packages/core/src/actions/account/public/query-module.ts index 816109f0..95a70a71 100644 --- a/packages/core/src/actions/account/public/query-module.ts +++ b/packages/core/src/actions/account/public/query-module.ts @@ -1,13 +1,13 @@ import { ContractMsg } from '@abstract-money/core' import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' import { ModuleType, wrapModuleQueryMsg } from 'src/utils/modules' -import { VersionControlTypes } from '../../../codegen/abstract' +import { RegistryTypes } from '../../../codegen/abstract' import { getModuleAddress } from './get-module-address' export type QueryModuleParameters< TModuleMsg extends ContractMsg = ContractMsg, > = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId cosmWasmClient: CosmWasmClient apiUrl: string } & { diff --git a/packages/core/src/actions/account/public/simulate-execute-remote-account.ts b/packages/core/src/actions/account/public/simulate-execute-remote-account.ts index 8f223563..8df466af 100644 --- a/packages/core/src/actions/account/public/simulate-execute-remote-account.ts +++ b/packages/core/src/actions/account/public/simulate-execute-remote-account.ts @@ -1,12 +1,12 @@ import { cosmosWasmExecuteMsg } from '@abstract-money/core' import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { AccountTypes, VersionControlTypes } from '../../../codegen/abstract' +import { AccountTypes, RegistryTypes } from '../../../codegen/abstract' import { CosmosMsgForEmpty } from '../../../codegen/abstract/cosmwasm-codegen/Account.types' import { simulateRemoteMsg } from '../../simulate-remote-msg' import { getRemoteAccountProxies } from './get-remote-account-proxies' export type SimulateExecuteRemoteAccountParameters = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId cosmWasmClient: CosmWasmClient apiUrl: string hostChainName: string diff --git a/packages/core/src/actions/account/public/simulate-execute-remote.ts b/packages/core/src/actions/account/public/simulate-execute-remote.ts index c2f441fb..78730450 100644 --- a/packages/core/src/actions/account/public/simulate-execute-remote.ts +++ b/packages/core/src/actions/account/public/simulate-execute-remote.ts @@ -3,13 +3,13 @@ import { MaybeArray } from 'src/types/utils' import { AccountExecuteMsgBuilder, AccountTypes, - VersionControlTypes, + RegistryTypes, } from '../../../codegen/abstract' import { CosmosMsgForEmpty } from '../../../codegen/abstract/cosmwasm-codegen/Account.types' import { simulateExecuteRemoteAccount } from './simulate-execute-remote-account' export type SimulateExecuteRemoteParameters = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId cosmWasmClient: CosmWasmClient apiUrl: string hostChainName: string diff --git a/packages/core/src/actions/account/wallet/claim-namespace.ts b/packages/core/src/actions/account/wallet/claim-namespace.ts index 4f5e55fe..7fd6bf6d 100644 --- a/packages/core/src/actions/account/wallet/claim-namespace.ts +++ b/packages/core/src/actions/account/wallet/claim-namespace.ts @@ -1,8 +1,8 @@ import { ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { VersionControlClient } from '../../../codegen/abstract' +import { RegistryClient } from '../../../codegen/abstract' import { WithCosmWasmSignOptions } from '../../../types/parameters' import { accountIdToParameter } from '../../../utils/account-id' -import { getVersionControlClientFromApi } from '../../wallet/get-version-control-client-from-api' +import { getRegistryClientFromApi } from '../../wallet/get-registry-client-from-api' export type ClaimNamespaceParameters = WithCosmWasmSignOptions< { @@ -10,7 +10,7 @@ export type ClaimNamespaceParameters = WithCosmWasmSignOptions< apiUrl: string sender: string namespace: string - } & Parameters[0] + } & Parameters[0] > export async function claimNamespace({ @@ -23,12 +23,12 @@ export async function claimNamespace({ funds, memo, }: ClaimNamespaceParameters): Promise { - const versionControlClient = await getVersionControlClientFromApi({ + const registryClient = await getRegistryClientFromApi({ signingCosmWasmClient, apiUrl, sender, }) - return versionControlClient.claimNamespace( + return registryClient.claimNamespace( { accountId: accountIdToParameter(accountId), namespace }, fee, memo, diff --git a/packages/core/src/actions/account/wallet/enable-ibc.ts b/packages/core/src/actions/account/wallet/enable-ibc.ts index 90fc49a9..eca9b8ec 100644 --- a/packages/core/src/actions/account/wallet/enable-ibc.ts +++ b/packages/core/src/actions/account/wallet/enable-ibc.ts @@ -1,13 +1,13 @@ import { ABSTRACT_NAMESPACE } from '@abstract-money/core' import { ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { AccountClient, VersionControlTypes } from '../../../codegen/abstract' +import { AccountClient, RegistryTypes } from '../../../codegen/abstract' import { WithCosmWasmSignOptions } from '../../../types/parameters' import { CommonModuleNames } from '../../public/types' import { getAccountClientFromApi } from './get-account-client-from-api' import { installModules } from './install-modules' export type EnableIbcParameters = WithCosmWasmSignOptions<{ - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId signingCosmWasmClient: SigningCosmWasmClient apiUrl: string sender: string diff --git a/packages/core/src/actions/account/wallet/install-modules.ts b/packages/core/src/actions/account/wallet/install-modules.ts index 5e8e9f53..076e9ac2 100644 --- a/packages/core/src/actions/account/wallet/install-modules.ts +++ b/packages/core/src/actions/account/wallet/install-modules.ts @@ -1,5 +1,5 @@ import { ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { AccountClient, VersionControlTypes } from '../../../codegen/abstract' +import { AccountClient, RegistryTypes } from '../../../codegen/abstract' import { WithCosmWasmSignOptions } from '../../../types/parameters' import { getAccountClientFromApi } from './get-account-client-from-api' import { BaseAccountWalletParameters } from './types' diff --git a/packages/core/src/actions/account/wallet/remove-namespace.ts b/packages/core/src/actions/account/wallet/remove-namespace.ts index 86045239..6a27e731 100644 --- a/packages/core/src/actions/account/wallet/remove-namespace.ts +++ b/packages/core/src/actions/account/wallet/remove-namespace.ts @@ -1,5 +1,5 @@ import { WithCosmWasmSignOptions } from '../../../types/parameters' -import { getVersionControlClientFromApi } from '../../wallet/get-version-control-client-from-api' +import { getRegistryClientFromApi } from '../../wallet/get-registry-client-from-api' import { getNamespace } from '../public/get-namespace' import { BaseAccountWalletParameters } from './types' @@ -15,7 +15,7 @@ export async function revokeNamespace({ memo, funds, }: RevokeNamespaceParameters) { - const versionControlClient = await getVersionControlClientFromApi({ + const registryClient = await getRegistryClientFromApi({ signingCosmWasmClient, apiUrl, sender, @@ -27,7 +27,7 @@ export async function revokeNamespace({ }) if (!namespace) throw new Error('Namespace not found') - return versionControlClient.forgoNamespace( + return registryClient.forgoNamespace( { namespaces: [namespace] }, fee, memo, diff --git a/packages/core/src/actions/account/wallet/types.ts b/packages/core/src/actions/account/wallet/types.ts index 2aca6b21..00e62fcf 100644 --- a/packages/core/src/actions/account/wallet/types.ts +++ b/packages/core/src/actions/account/wallet/types.ts @@ -1,8 +1,8 @@ import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { VersionControlTypes } from '../../../codegen/abstract' +import { RegistryTypes } from '../../../codegen/abstract' export type BaseAccountWalletParameters = { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId signingCosmWasmClient: SigningCosmWasmClient apiUrl: string sender: string diff --git a/packages/core/src/actions/get-version-control-address-from-api.ts b/packages/core/src/actions/get-registry-address-from-api.ts similarity index 64% rename from packages/core/src/actions/get-version-control-address-from-api.ts rename to packages/core/src/actions/get-registry-address-from-api.ts index 7ed95d1b..ea8e7aa6 100644 --- a/packages/core/src/actions/get-version-control-address-from-api.ts +++ b/packages/core/src/actions/get-registry-address-from-api.ts @@ -1,19 +1,19 @@ import { request } from 'graphql-request' import { gql } from '../codegen/gql' -export type GetVersionControlAddressFromApiParameters = { +export type GetRegistryAddressFromApiParameters = { apiUrl: string chainName: string } -export async function getVersionControlAddressFromApi({ +export async function getRegistryAddressFromApi({ apiUrl, chainName, -}: GetVersionControlAddressFromApiParameters) { +}: GetRegistryAddressFromApiParameters) { const deploymentData = await request( apiUrl, gql(/* GraphQL */ ` - query VersionControlDeployment($chain: ID!) { + query RegistryDeployment($chain: ID!) { deployment(chain: $chain) { registry } diff --git a/packages/core/src/actions/index.ts b/packages/core/src/actions/index.ts index c105bf6c..41545eb6 100644 --- a/packages/core/src/actions/index.ts +++ b/packages/core/src/actions/index.ts @@ -4,7 +4,7 @@ export * from './get-ans-host-address-from-api' export * from './get-ans-token-from-api' export * from './get-ans-tokens-from-api' export * from './get-modules-from-api' -export * from './get-version-control-address-from-api' +export * from './get-registry-address-from-api' export * from './get-chain-rpc-from-api' export * from './get-sub-account-ids-by-module-id' @@ -30,30 +30,30 @@ export * from './account/wallet/remove-namespace' export * from './account/wallet/upgrade-modules' export * from './account/wallet/withdraw' -export * from './public/get-abstract-module-address-from-version-control' +export * from './public/get-abstract-module-address-from-registry' export * from './public/get-abstract-module-version' -export * from './public/get-ans-host-address-from-version-control' +export * from './public/get-ans-host-address-from-registry' export * from './public/get-ans-host-query-client-from-api' -export * from './public/get-ans-host-query-client-from-version-control' +export * from './public/get-ans-host-query-client-from-registry' export * from './public/get-ans-host-query-client' export * from './public/get-ans-host-version-from-api' -export * from './public/get-app-module-code-id-from-version-control' +export * from './public/get-app-module-code-id-from-registry' export * from './public/get-cosm-wasm-client' export * from './public/get-account-query-client' -export * from './public/get-module-factory-address-from-version-control' +export * from './public/get-module-factory-address-from-registry' export * from './public/get-module-factory-version' -export * from './public/get-version-control-module-data' -export * from './public/get-version-control-query-client-from-api' -export * from './public/get-version-control-query-client' +export * from './public/get-registry-module-data' +export * from './public/get-registry-query-client-from-api' +export * from './public/get-registry-query-client' export * from './public/types' export * from './wallet/create-account-monarchy' export * from './wallet/create-account' export * from './wallet/get-ans-host-client-from-api' -export * from './wallet/get-ans-host-client-from-version-control' +export * from './wallet/get-ans-host-client-from-registry' export * from './wallet/get-ans-host-client' export * from './wallet/get-account-client' export * from './wallet/get-sender-address' export * from './wallet/get-signing-cosm-wasm-client' -export * from './wallet/get-version-control-client-from-api' -export * from './wallet/get-version-control-client' +export * from './wallet/get-registry-client-from-api' +export * from './wallet/get-registry-client' diff --git a/packages/core/src/actions/public/get-abstract-module-address-from-registry.ts b/packages/core/src/actions/public/get-abstract-module-address-from-registry.ts new file mode 100644 index 00000000..b001603d --- /dev/null +++ b/packages/core/src/actions/public/get-abstract-module-address-from-registry.ts @@ -0,0 +1,47 @@ +import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' + +import { ABSTRACT_NAMESPACE } from '@abstract-money/core' +import { RegistryTypes } from '../../codegen/abstract' +import { registryModuleToAddress } from '../../utils/registry/registry-module-to-address' +import { getRegistryQueryClient } from './get-registry-query-client' + +export type GetAbstractModuleAddressFromRegistry = { + moduleName: string + cosmWasmClient: CosmWasmClient + registryAddress: string + version?: string +} + +export async function getAbstractModuleAddressFromRegistry({ + moduleName, + cosmWasmClient, + registryAddress, + version, +}: GetAbstractModuleAddressFromRegistry) { + const registryQueryClient = getRegistryQueryClient({ + cosmWasmClient, + registryAddress, + }) + + const [moduleAddress] = await registryQueryClient + .modules({ + infos: [ + { + name: moduleName, + namespace: ABSTRACT_NAMESPACE, + version: version ? { version } : 'latest', + } satisfies RegistryTypes.ModuleInfo, + ], + }) + .then(({ modules }) => + modules.map(({ module }) => registryModuleToAddress(module)), + ) + + if (!moduleAddress) { + throw new Error( + `Could not fetch address for module ${moduleName} version ${version} from registry ${registryAddress}`, + ) + } + + return moduleAddress +} diff --git a/packages/core/src/actions/public/get-abstract-module-address-from-version-control.ts b/packages/core/src/actions/public/get-abstract-module-address-from-version-control.ts deleted file mode 100644 index 16346665..00000000 --- a/packages/core/src/actions/public/get-abstract-module-address-from-version-control.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' - -import { ABSTRACT_NAMESPACE } from '@abstract-money/core' -import { VersionControlTypes } from '../../codegen/abstract' -import { versionControlModuleToAddress } from '../../utils/version-control/version-control-module-to-address' -import { getVersionControlQueryClient } from './get-version-control-query-client' - -export type GetAbstractModuleAddressFromVersionControl = { - moduleName: string - cosmWasmClient: CosmWasmClient - versionControlAddress: string - version?: string -} - -export async function getAbstractModuleAddressFromVersionControl({ - moduleName, - cosmWasmClient, - versionControlAddress, - version, -}: GetAbstractModuleAddressFromVersionControl) { - const versionControlQueryClient = getVersionControlQueryClient({ - cosmWasmClient, - versionControlAddress, - }) - - const [moduleAddress] = await versionControlQueryClient - .modules({ - infos: [ - { - name: moduleName, - namespace: ABSTRACT_NAMESPACE, - version: version ? { version } : 'latest', - } satisfies VersionControlTypes.ModuleInfo, - ], - }) - .then(({ modules }) => - modules.map(({ module }) => versionControlModuleToAddress(module)), - ) - - if (!moduleAddress) { - throw new Error( - `Could not fetch address for module ${moduleName} version ${version} from registry ${versionControlAddress}`, - ) - } - - return moduleAddress -} diff --git a/packages/core/src/actions/public/get-abstract-module-version.ts b/packages/core/src/actions/public/get-abstract-module-version.ts index 6fab9ed7..0c38de2a 100644 --- a/packages/core/src/actions/public/get-abstract-module-version.ts +++ b/packages/core/src/actions/public/get-abstract-module-version.ts @@ -1,8 +1,8 @@ import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { VersionControlTypes } from '../../codegen/abstract' -import { versionControlModuleToVersion } from '../../utils/version-control/version-control-module-to-version' -import { getVersionControlQueryClientFromApi } from './get-version-control-query-client-from-api' +import { RegistryTypes } from '../../codegen/abstract' +import { registryModuleToVersion } from '../../utils/registry/registry-module-to-version' +import { getRegistryQueryClientFromApi } from './get-registry-query-client-from-api' export type GetAbstractModuleVersion = { moduleName: string @@ -17,28 +17,28 @@ export async function getAbstractModuleVersion({ version, apiUrl, }: GetAbstractModuleVersion) { - const versionControlQueryClient = await getVersionControlQueryClientFromApi({ + const registryQueryClient = await getRegistryQueryClientFromApi({ cosmWasmClient, apiUrl, }) - const [moduleVersion] = await versionControlQueryClient + const [moduleVersion] = await registryQueryClient .modules({ infos: [ { name: moduleName, namespace: 'abstract', version: version ? { version } : 'latest', - } satisfies VersionControlTypes.ModuleInfo, + } satisfies RegistryTypes.ModuleInfo, ], }) .then(({ modules }) => - modules.map(({ module }) => versionControlModuleToVersion(module)), + modules.map(({ module }) => registryModuleToVersion(module)), ) if (!moduleVersion) { throw new Error( - `Could not fetch address for module ${moduleName} version ${version} from registry ${versionControlQueryClient.contractAddress}`, + `Could not fetch address for module ${moduleName} version ${version} from registry ${registryQueryClient.contractAddress}`, ) } diff --git a/packages/core/src/actions/public/get-account-addresses-from-api.ts b/packages/core/src/actions/public/get-account-addresses-from-api.ts index e2b9bc2b..653e8a91 100644 --- a/packages/core/src/actions/public/get-account-addresses-from-api.ts +++ b/packages/core/src/actions/public/get-account-addresses-from-api.ts @@ -1,10 +1,10 @@ import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { VersionControlTypes } from '../../codegen/abstract' +import { RegistryTypes } from '../../codegen/abstract' import { accountIdToParameter } from '../../utils/account-id' -import { getVersionControlQueryClientFromApi } from './get-version-control-query-client-from-api' +import { getRegistryQueryClientFromApi } from './get-registry-query-client-from-api' export type GetAccountsBaseAddressesFromApiParameters = { - accountIds: VersionControlTypes.AccountId[] + accountIds: RegistryTypes.AccountId[] cosmWasmClient: CosmWasmClient apiUrl: string } @@ -14,13 +14,13 @@ export async function getAccountAddressesFromApi({ cosmWasmClient, apiUrl, }: GetAccountsBaseAddressesFromApiParameters) { - const versionControlQueryClient = await getVersionControlQueryClientFromApi({ + const registryQueryClient = await getRegistryQueryClientFromApi({ cosmWasmClient, apiUrl, }) return await Promise.all( accountIds.map((accountId) => - versionControlQueryClient + registryQueryClient .account({ accountId: accountIdToParameter(accountId), }) diff --git a/packages/core/src/actions/public/get-ans-host-address-from-registry.ts b/packages/core/src/actions/public/get-ans-host-address-from-registry.ts new file mode 100644 index 00000000..219a139e --- /dev/null +++ b/packages/core/src/actions/public/get-ans-host-address-from-registry.ts @@ -0,0 +1,22 @@ +import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' +import { getAbstractModuleAddressFromRegistry } from './get-abstract-module-address-from-registry' +import { CommonModuleNames } from './types' + +export type GetAnsHostAddressFromRegistryParameters = { + cosmWasmClient: CosmWasmClient + registryAddress: string + version?: string +} + +export async function getAnsHostAddressFromRegistry({ + cosmWasmClient, + registryAddress, + version, +}: GetAnsHostAddressFromRegistryParameters) { + return getAbstractModuleAddressFromRegistry({ + moduleName: CommonModuleNames.ANS_HOST, + cosmWasmClient, + registryAddress, + version, + }) +} diff --git a/packages/core/src/actions/public/get-ans-host-address-from-version-control.ts b/packages/core/src/actions/public/get-ans-host-address-from-version-control.ts deleted file mode 100644 index 01b04fc3..00000000 --- a/packages/core/src/actions/public/get-ans-host-address-from-version-control.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { getAbstractModuleAddressFromVersionControl } from './get-abstract-module-address-from-version-control' -import { CommonModuleNames } from './types' - -export type GetAnsHostAddressFromVersionControlParameters = { - cosmWasmClient: CosmWasmClient - versionControlAddress: string - version?: string -} - -export async function getAnsHostAddressFromVersionControl({ - cosmWasmClient, - versionControlAddress, - version, -}: GetAnsHostAddressFromVersionControlParameters) { - return getAbstractModuleAddressFromVersionControl({ - moduleName: CommonModuleNames.ANS_HOST, - cosmWasmClient, - versionControlAddress, - version, - }) -} diff --git a/packages/core/src/actions/public/get-ans-host-query-client-from-registry.ts b/packages/core/src/actions/public/get-ans-host-query-client-from-registry.ts new file mode 100644 index 00000000..4c403255 --- /dev/null +++ b/packages/core/src/actions/public/get-ans-host-query-client-from-registry.ts @@ -0,0 +1,23 @@ +import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' + +import { getAnsHostAddressFromRegistry } from './get-ans-host-address-from-registry' +import { getAnsHostQueryClient } from './get-ans-host-query-client' + +export type GetAnsHostQueryClientFromRegistryParameters = { + cosmWasmClient: CosmWasmClient + registryAddress: string + version?: string +} +export async function getAnsHostQueryClientFromRegistry({ + cosmWasmClient, + registryAddress, + version, +}: GetAnsHostQueryClientFromRegistryParameters) { + const ansHostAddress = await getAnsHostAddressFromRegistry({ + cosmWasmClient, + registryAddress, + version, + }) + + return getAnsHostQueryClient({ cosmWasmClient, ansHostAddress }) +} diff --git a/packages/core/src/actions/public/get-ans-host-query-client-from-version-control.ts b/packages/core/src/actions/public/get-ans-host-query-client-from-version-control.ts deleted file mode 100644 index 16fcbfda..00000000 --- a/packages/core/src/actions/public/get-ans-host-query-client-from-version-control.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' - -import { getAnsHostAddressFromVersionControl } from './get-ans-host-address-from-version-control' -import { getAnsHostQueryClient } from './get-ans-host-query-client' - -export type GetAnsHostQueryClientFromVersionControlParameters = { - cosmWasmClient: CosmWasmClient - versionControlAddress: string - version?: string -} -export async function getAnsHostQueryClientFromVersionControl({ - cosmWasmClient, - versionControlAddress, - version, -}: GetAnsHostQueryClientFromVersionControlParameters) { - const ansHostAddress = await getAnsHostAddressFromVersionControl({ - cosmWasmClient, - versionControlAddress, - version, - }) - - return getAnsHostQueryClient({ cosmWasmClient, ansHostAddress }) -} diff --git a/packages/core/src/actions/public/get-app-module-code-id-from-registry.ts b/packages/core/src/actions/public/get-app-module-code-id-from-registry.ts new file mode 100644 index 00000000..0a42dbe7 --- /dev/null +++ b/packages/core/src/actions/public/get-app-module-code-id-from-registry.ts @@ -0,0 +1,51 @@ +import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' + +import { + ModuleId, + moduleIdToName, + moduleIdToNamespace, +} from '@abstract-money/core' +import { RegistryTypes } from '../../codegen/abstract' +import { registryModuleToCodeId } from '../../utils/registry/registry-module-to-code-id' +import { getRegistryQueryClient } from './get-registry-query-client' + +export type GetAppModuleCodeIdFromRegistry = { + moduleId: `${ModuleId}` + cosmWasmClient: CosmWasmClient + registryAddress: string + version?: RegistryTypes.ModuleVersion +} + +export async function getAppModuleCodeIdFromRegistry({ + moduleId, + cosmWasmClient, + registryAddress, + version, +}: GetAppModuleCodeIdFromRegistry) { + const registryQueryClient = getRegistryQueryClient({ + cosmWasmClient, + registryAddress, + }) + + const [moduleCodeId] = await registryQueryClient + .modules({ + infos: [ + { + name: moduleIdToName(moduleId), + namespace: moduleIdToNamespace(moduleId), + version: version ?? 'latest', + } satisfies RegistryTypes.ModuleInfo, + ], + }) + .then(({ modules }) => + modules.map(({ module }) => registryModuleToCodeId(module)), + ) + + if (!moduleCodeId) { + throw new Error( + `Could not fetch code id for app module ${moduleId} version ${version} from registry ${registryAddress}`, + ) + } + + return moduleCodeId +} diff --git a/packages/core/src/actions/public/get-app-module-code-id-from-version-control.ts b/packages/core/src/actions/public/get-app-module-code-id-from-version-control.ts deleted file mode 100644 index cbce9f5f..00000000 --- a/packages/core/src/actions/public/get-app-module-code-id-from-version-control.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' - -import { - ModuleId, - moduleIdToName, - moduleIdToNamespace, -} from '@abstract-money/core' -import { VersionControlTypes } from '../../codegen/abstract' -import { versionControlModuleToCodeId } from '../../utils/version-control/version-control-module-to-code-id' -import { getVersionControlQueryClient } from './get-version-control-query-client' - -export type GetAppModuleCodeIdFromVersionControl = { - moduleId: `${ModuleId}` - cosmWasmClient: CosmWasmClient - versionControlAddress: string - version?: VersionControlTypes.ModuleVersion -} - -export async function getAppModuleCodeIdFromVersionControl({ - moduleId, - cosmWasmClient, - versionControlAddress, - version, -}: GetAppModuleCodeIdFromVersionControl) { - const versionControlQueryClient = getVersionControlQueryClient({ - cosmWasmClient, - versionControlAddress, - }) - - const [moduleCodeId] = await versionControlQueryClient - .modules({ - infos: [ - { - name: moduleIdToName(moduleId), - namespace: moduleIdToNamespace(moduleId), - version: version ?? 'latest', - } satisfies VersionControlTypes.ModuleInfo, - ], - }) - .then(({ modules }) => - modules.map(({ module }) => versionControlModuleToCodeId(module)), - ) - - if (!moduleCodeId) { - throw new Error( - `Could not fetch code id for app module ${moduleId} version ${version} from registry ${versionControlAddress}`, - ) - } - - return moduleCodeId -} diff --git a/packages/core/src/actions/public/get-ibc-client-address-from-registry.ts b/packages/core/src/actions/public/get-ibc-client-address-from-registry.ts new file mode 100644 index 00000000..15ea5b8e --- /dev/null +++ b/packages/core/src/actions/public/get-ibc-client-address-from-registry.ts @@ -0,0 +1,21 @@ +import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' +import { getAbstractModuleAddressFromRegistry } from './get-abstract-module-address-from-registry' +import { CommonModuleNames } from './types' + +export type GetIbcClientAddressFromRegistryParameters = { + cosmWasmClient: CosmWasmClient + registryAddress: string + version?: string +} +export async function getIbcClientAddressFromRegistry({ + cosmWasmClient, + registryAddress, + version, +}: GetIbcClientAddressFromRegistryParameters) { + return getAbstractModuleAddressFromRegistry({ + moduleName: CommonModuleNames.IBC_CLIENT, + cosmWasmClient, + registryAddress, + version, + }) +} diff --git a/packages/core/src/actions/public/get-ibc-client-address-from-version-control.ts b/packages/core/src/actions/public/get-ibc-client-address-from-version-control.ts deleted file mode 100644 index 379be9a5..00000000 --- a/packages/core/src/actions/public/get-ibc-client-address-from-version-control.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { getAbstractModuleAddressFromVersionControl } from './get-abstract-module-address-from-version-control' -import { CommonModuleNames } from './types' - -export type GetIbcClientAddressFromVersionControlParameters = { - cosmWasmClient: CosmWasmClient - versionControlAddress: string - version?: string -} -export async function getIbcClientAddressFromVersionControl({ - cosmWasmClient, - versionControlAddress, - version, -}: GetIbcClientAddressFromVersionControlParameters) { - return getAbstractModuleAddressFromVersionControl({ - moduleName: CommonModuleNames.IBC_CLIENT, - cosmWasmClient, - versionControlAddress, - version, - }) -} diff --git a/packages/core/src/actions/public/get-ibc-client-query-client-from-registry.ts b/packages/core/src/actions/public/get-ibc-client-query-client-from-registry.ts new file mode 100644 index 00000000..4c0a7dfe --- /dev/null +++ b/packages/core/src/actions/public/get-ibc-client-query-client-from-registry.ts @@ -0,0 +1,22 @@ +import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' +import { getIbcClientAddressFromRegistry } from './get-ibc-client-address-from-registry' +import { getIbcClientQueryClient } from './get-ibc-client-query-client' + +export type GetIbcClientQueryClientFromRegistryParameters = { + cosmWasmClient: CosmWasmClient + registryAddress: string + version?: string +} +export async function getIbcClientQueryClientFromRegistry({ + cosmWasmClient, + registryAddress, + version, +}: GetIbcClientQueryClientFromRegistryParameters) { + const ibcClientAddress = await getIbcClientAddressFromRegistry({ + cosmWasmClient, + registryAddress, + version, + }) + + return getIbcClientQueryClient({ cosmWasmClient, ibcClientAddress }) +} diff --git a/packages/core/src/actions/public/get-ibc-client-query-client-from-version-control.ts b/packages/core/src/actions/public/get-ibc-client-query-client-from-version-control.ts deleted file mode 100644 index b637fd74..00000000 --- a/packages/core/src/actions/public/get-ibc-client-query-client-from-version-control.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { getIbcClientAddressFromVersionControl } from './get-ibc-client-address-from-version-control' -import { getIbcClientQueryClient } from './get-ibc-client-query-client' - -export type GetIbcClientQueryClientFromVersionControlParameters = { - cosmWasmClient: CosmWasmClient - versionControlAddress: string - version?: string -} -export async function getIbcClientQueryClientFromVersionControl({ - cosmWasmClient, - versionControlAddress, - version, -}: GetIbcClientQueryClientFromVersionControlParameters) { - const ibcClientAddress = await getIbcClientAddressFromVersionControl({ - cosmWasmClient, - versionControlAddress, - version, - }) - - return getIbcClientQueryClient({ cosmWasmClient, ibcClientAddress }) -} diff --git a/packages/core/src/actions/public/get-ibc-host-address-from-registry.ts b/packages/core/src/actions/public/get-ibc-host-address-from-registry.ts new file mode 100644 index 00000000..3fc5cfc3 --- /dev/null +++ b/packages/core/src/actions/public/get-ibc-host-address-from-registry.ts @@ -0,0 +1,21 @@ +import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' +import { getAbstractModuleAddressFromRegistry } from './get-abstract-module-address-from-registry' +import { CommonModuleNames } from './types' + +export type GetIbcHostAddressFromRegistryParameters = { + cosmWasmClient: CosmWasmClient + registryAddress: string + version?: string +} +export async function getIbcHostAddressFromRegistry({ + cosmWasmClient, + registryAddress, + version, +}: GetIbcHostAddressFromRegistryParameters) { + return getAbstractModuleAddressFromRegistry({ + moduleName: CommonModuleNames.IBC_HOST, + cosmWasmClient, + registryAddress, + version, + }) +} diff --git a/packages/core/src/actions/public/get-ibc-host-address-from-version-control.ts b/packages/core/src/actions/public/get-ibc-host-address-from-version-control.ts deleted file mode 100644 index 874bc177..00000000 --- a/packages/core/src/actions/public/get-ibc-host-address-from-version-control.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { getAbstractModuleAddressFromVersionControl } from './get-abstract-module-address-from-version-control' -import { CommonModuleNames } from './types' - -export type GetIbcHostAddressFromVersionControlParameters = { - cosmWasmClient: CosmWasmClient - versionControlAddress: string - version?: string -} -export async function getIbcHostAddressFromVersionControl({ - cosmWasmClient, - versionControlAddress, - version, -}: GetIbcHostAddressFromVersionControlParameters) { - return getAbstractModuleAddressFromVersionControl({ - moduleName: CommonModuleNames.IBC_HOST, - cosmWasmClient, - versionControlAddress, - version, - }) -} diff --git a/packages/core/src/actions/public/get-module-factory-address-from-registry.ts b/packages/core/src/actions/public/get-module-factory-address-from-registry.ts new file mode 100644 index 00000000..d918219c --- /dev/null +++ b/packages/core/src/actions/public/get-module-factory-address-from-registry.ts @@ -0,0 +1,22 @@ +import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' + +import { getAbstractModuleAddressFromRegistry } from './get-abstract-module-address-from-registry' +import { CommonModuleNames } from './types' + +export type GetModuleFactoryAddressFromRegistryParameters = { + cosmWasmClient: CosmWasmClient + registryAddress: string + version?: string +} +export async function getModuleFactoryAddressFromRegistry({ + cosmWasmClient, + registryAddress, + version, +}: GetModuleFactoryAddressFromRegistryParameters) { + return getAbstractModuleAddressFromRegistry({ + moduleName: CommonModuleNames.MODULE_FACTORY, + cosmWasmClient, + registryAddress, + version, + }) +} diff --git a/packages/core/src/actions/public/get-module-factory-address-from-version-control.ts b/packages/core/src/actions/public/get-module-factory-address-from-version-control.ts deleted file mode 100644 index 21b9ad69..00000000 --- a/packages/core/src/actions/public/get-module-factory-address-from-version-control.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' - -import { getAbstractModuleAddressFromVersionControl } from './get-abstract-module-address-from-version-control' -import { CommonModuleNames } from './types' - -export type GetModuleFactoryAddressFromVersionControlParameters = { - cosmWasmClient: CosmWasmClient - versionControlAddress: string - version?: string -} -export async function getModuleFactoryAddressFromVersionControl({ - cosmWasmClient, - versionControlAddress, - version, -}: GetModuleFactoryAddressFromVersionControlParameters) { - return getAbstractModuleAddressFromVersionControl({ - moduleName: CommonModuleNames.MODULE_FACTORY, - cosmWasmClient, - versionControlAddress, - version, - }) -} diff --git a/packages/core/src/actions/public/get-version-control-module-data.ts b/packages/core/src/actions/public/get-registry-module-data.ts similarity index 60% rename from packages/core/src/actions/public/get-version-control-module-data.ts rename to packages/core/src/actions/public/get-registry-module-data.ts index bdeda3a3..af20f952 100644 --- a/packages/core/src/actions/public/get-version-control-module-data.ts +++ b/packages/core/src/actions/public/get-registry-module-data.ts @@ -1,34 +1,34 @@ import { rawQuery } from '@abstract-money/cosmwasm-utils' import { type CosmWasmClient } from '@cosmjs/cosmwasm-stargate' import { match } from 'ts-pattern' -import { VersionControlTypes } from '../../codegen/abstract' +import { RegistryTypes } from '../../codegen/abstract' import { ModuleData } from '../../utils/modules/msg-factory' -import { formatModuleIdWithVersion } from '../../utils/version-control/module-id/format-module-id-with-version' -import { versionControlModuleToAddress } from '../../utils/version-control/version-control-module-to-address' -import { versionControlModuleToCodeId } from '../../utils/version-control/version-control-module-to-code-id' -import { versionControlModuleToType } from '../../utils/version-control/version-control-module-to-type' +import { formatModuleIdWithVersion } from '../../utils/registry/module-id/format-module-id-with-version' +import { registryModuleToAddress } from '../../utils/registry/registry-module-to-address' +import { registryModuleToCodeId } from '../../utils/registry/registry-module-to-code-id' +import { registryModuleToType } from '../../utils/registry/registry-module-to-type' -export type GetVersionControlModuleDataParameters< - TVcModule extends VersionControlTypes.Module = VersionControlTypes.Module, +export type GetRegistryModuleDataParameters< + TVcModule extends RegistryTypes.Module = RegistryTypes.Module, > = { cosmWasmClient: CosmWasmClient; module: TVcModule } -export async function getVersionControlModuleData< - const TVcModule extends VersionControlTypes.Module = VersionControlTypes.Module, +export async function getRegistryModuleData< + const TVcModule extends RegistryTypes.Module = RegistryTypes.Module, >({ cosmWasmClient, module, -}: GetVersionControlModuleDataParameters): Promise { +}: GetRegistryModuleDataParameters): Promise { // Retrieve the first instantiation of the module - const moduleType = versionControlModuleToType(module) + const moduleType = registryModuleToType(module) const firstInstantiation = await match(moduleType) .with('adapter', async () => { - return Promise.resolve(versionControlModuleToAddress(module)) + return Promise.resolve(registryModuleToAddress(module)) }) // TODO: not all standalones will have module_data .with('standalone', 'app', async () => { // retrieve the first instantiation const instantiations = await cosmWasmClient.getContracts( - versionControlModuleToCodeId(module), + registryModuleToCodeId(module), ) const firstInstantiation = instantiations[0] if (!firstInstantiation) { diff --git a/packages/core/src/actions/public/get-registry-query-client-from-api.ts b/packages/core/src/actions/public/get-registry-query-client-from-api.ts new file mode 100644 index 00000000..cae7d80c --- /dev/null +++ b/packages/core/src/actions/public/get-registry-query-client-from-api.ts @@ -0,0 +1,27 @@ +import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' + +import { chainIdToName } from '../../utils/chain-registry' +import { getRegistryAddressFromApi } from '../get-registry-address-from-api' +import { getRegistryQueryClient } from './get-registry-query-client' + +export type GetRegistryQueryClientFromApiParameters = { + cosmWasmClient: CosmWasmClient + apiUrl: string +} + +export async function getRegistryQueryClientFromApi({ + cosmWasmClient, + apiUrl, +}: GetRegistryQueryClientFromApiParameters) { + const chainId = await cosmWasmClient.getChainId() + const chainName = chainIdToName(chainId) + const registryAddress = await getRegistryAddressFromApi({ + apiUrl, + chainName, + }) + + return getRegistryQueryClient({ + cosmWasmClient, + registryAddress, + }) +} diff --git a/packages/core/src/actions/public/get-registry-query-client.ts b/packages/core/src/actions/public/get-registry-query-client.ts new file mode 100644 index 00000000..ea1b535d --- /dev/null +++ b/packages/core/src/actions/public/get-registry-query-client.ts @@ -0,0 +1,15 @@ +import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' + +import { RegistryQueryClient } from '../../codegen/abstract' + +export type GetRegistryQueryClientParameters = { + cosmWasmClient: CosmWasmClient + registryAddress: string +} + +export function getRegistryQueryClient({ + cosmWasmClient, + registryAddress, +}: GetRegistryQueryClientParameters) { + return new RegistryQueryClient(cosmWasmClient, registryAddress) +} diff --git a/packages/core/src/actions/public/get-remote-hosts-from-api.ts b/packages/core/src/actions/public/get-remote-hosts-from-api.ts index 8962f979..7c3232b3 100644 --- a/packages/core/src/actions/public/get-remote-hosts-from-api.ts +++ b/packages/core/src/actions/public/get-remote-hosts-from-api.ts @@ -1,6 +1,6 @@ import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { getIbcClientQueryClientFromVersionControl } from './get-ibc-client-query-client-from-version-control' -import { getVersionControlQueryClientFromApi } from './get-version-control-query-client-from-api' +import { getIbcClientQueryClientFromRegistry } from './get-ibc-client-query-client-from-registry' +import { getRegistryQueryClientFromApi } from './get-registry-query-client-from-api' export type GetRemoteHosts = { cosmWasmClient: CosmWasmClient @@ -11,14 +11,14 @@ export async function getRemoteHostsFromApi({ cosmWasmClient, apiUrl, }: GetRemoteHosts) { - const versionControlQueryClient = await getVersionControlQueryClientFromApi({ + const registryQueryClient = await getRegistryQueryClientFromApi({ cosmWasmClient, apiUrl, }) - const ibcQueryClient = await getIbcClientQueryClientFromVersionControl({ + const ibcQueryClient = await getIbcClientQueryClientFromRegistry({ cosmWasmClient, - versionControlAddress: versionControlQueryClient.contractAddress, + registryAddress: registryQueryClient.contractAddress, }) const { hosts } = await ibcQueryClient.listRemoteHosts() diff --git a/packages/core/src/actions/public/get-version-control-query-client-from-api.ts b/packages/core/src/actions/public/get-version-control-query-client-from-api.ts deleted file mode 100644 index 0b68f4e4..00000000 --- a/packages/core/src/actions/public/get-version-control-query-client-from-api.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' - -import { chainIdToName } from '../../utils/chain-registry' -import { getVersionControlAddressFromApi } from '../get-version-control-address-from-api' -import { getVersionControlQueryClient } from './get-version-control-query-client' - -export type GetVersionControlQueryClientFromApiParameters = { - cosmWasmClient: CosmWasmClient - apiUrl: string -} - -export async function getVersionControlQueryClientFromApi({ - cosmWasmClient, - apiUrl, -}: GetVersionControlQueryClientFromApiParameters) { - const chainId = await cosmWasmClient.getChainId() - const chainName = chainIdToName(chainId) - const versionControlAddress = await getVersionControlAddressFromApi({ - apiUrl, - chainName, - }) - - return getVersionControlQueryClient({ - cosmWasmClient, - versionControlAddress, - }) -} diff --git a/packages/core/src/actions/public/get-version-control-query-client.ts b/packages/core/src/actions/public/get-version-control-query-client.ts deleted file mode 100644 index e6779332..00000000 --- a/packages/core/src/actions/public/get-version-control-query-client.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' - -import { VersionControlQueryClient } from '../../codegen/abstract' - -export type GetVersionControlQueryClientParameters = { - cosmWasmClient: CosmWasmClient - versionControlAddress: string -} - -export function getVersionControlQueryClient({ - cosmWasmClient, - versionControlAddress, -}: GetVersionControlQueryClientParameters) { - return new VersionControlQueryClient(cosmWasmClient, versionControlAddress) -} diff --git a/packages/core/src/actions/simulate-remote-msg.ts b/packages/core/src/actions/simulate-remote-msg.ts index 31e4f867..d8960922 100644 --- a/packages/core/src/actions/simulate-remote-msg.ts +++ b/packages/core/src/actions/simulate-remote-msg.ts @@ -3,8 +3,8 @@ import { AccountTypes } from '../codegen/abstract' import { MaybeArray } from '../types/utils' import { simulateWasmCosmosMsgs } from '../utils/cosmos' import { getCometClientFromApi } from './get-comet-client-from-api' -import { getVersionControlAddressFromApi } from './get-version-control-address-from-api' -import { getIbcHostAddressFromVersionControl } from './public/get-ibc-host-address-from-version-control' +import { getRegistryAddressFromApi } from './get-registry-address-from-api' +import { getIbcHostAddressFromRegistry } from './public/get-ibc-host-address-from-registry' export type SimulateRemoteMsgParameters = { apiUrl: string @@ -27,7 +27,7 @@ export async function simulateRemoteMsg({ msgs, }: SimulateRemoteMsgParameters) { // TODO: these queries could be combined - const remoteVcAddress = await getVersionControlAddressFromApi({ + const remoteVcAddress = await getRegistryAddressFromApi({ apiUrl, chainName: hostChainName, }) @@ -40,9 +40,9 @@ export async function simulateRemoteMsg({ const remoteCwClient = await CosmWasmClient.create(remoteComet) // TODO: this could be retrieved from the API? - const ibcHostAddress = await getIbcHostAddressFromVersionControl({ + const ibcHostAddress = await getIbcHostAddressFromRegistry({ cosmWasmClient: remoteCwClient, - versionControlAddress: remoteVcAddress, + registryAddress: remoteVcAddress, }) return simulateWasmCosmosMsgs( diff --git a/packages/core/src/actions/wallet/create-account-monarchy.ts b/packages/core/src/actions/wallet/create-account-monarchy.ts index b0c82527..f1a98d87 100644 --- a/packages/core/src/actions/wallet/create-account-monarchy.ts +++ b/packages/core/src/actions/wallet/create-account-monarchy.ts @@ -1,7 +1,7 @@ import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' import { CamelCasedProperties, Merge } from 'type-fest' import { OverrideProperties } from 'type-fest/source/override-properties' -import { AccountTypes, VersionControlTypes } from '../../codegen/abstract' +import { AccountTypes, RegistryTypes } from '../../codegen/abstract' import { WithCosmWasmSignOptions } from '../../types/parameters' import { WithOptional } from '../../types/utils' import { accountIdToParameter } from '../../utils' @@ -19,7 +19,7 @@ export type CreateAccountMonarchyParameters = WithCosmWasmSignOptions< Omit< OverrideProperties< AccountTypes.InstantiateMsg, - { account_id?: VersionControlTypes.AccountId } + { account_id?: RegistryTypes.AccountId } >, 'owner' >, diff --git a/packages/core/src/actions/wallet/create-account.ts b/packages/core/src/actions/wallet/create-account.ts index 17856cd7..ff0c4729 100644 --- a/packages/core/src/actions/wallet/create-account.ts +++ b/packages/core/src/actions/wallet/create-account.ts @@ -1,14 +1,14 @@ import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' import { CamelCasedProperties, Merge } from 'type-fest' import { OverrideProperties } from 'type-fest/source/override-properties' -import { AccountTypes, VersionControlTypes } from '../../codegen/abstract' +import { AccountTypes, RegistryTypes } from '../../codegen/abstract' import { WithCosmWasmSignOptions } from '../../types/parameters' import { WithOptional } from '../../types/utils' import { ABSTRACT_NAMESPACE, accountIdToParameter } from '../../utils' import { parseCreateAccountExecuteResult } from '../../utils/account-factory/parse-create-account-execute-result' import { chainIdToName } from '../../utils/chain-registry' -import { getVersionControlAddressFromApi } from '../get-version-control-address-from-api' -import { getAppModuleCodeIdFromVersionControl } from '../public/get-app-module-code-id-from-version-control' +import { getRegistryAddressFromApi } from '../get-registry-address-from-api' +import { getAppModuleCodeIdFromRegistry } from '../public/get-app-module-code-id-from-registry' import { CommonModuleNames } from '../public/types' export type CreateAccountParameters = WithCosmWasmSignOptions< @@ -21,7 +21,7 @@ export type CreateAccountParameters = WithCosmWasmSignOptions< WithOptional< OverrideProperties< AccountTypes.InstantiateMsg, - { account_id?: VersionControlTypes.AccountId } + { account_id?: RegistryTypes.AccountId } >, 'install_modules' | 'owner' > @@ -64,14 +64,14 @@ export async function createAccount({ }) } - const versionControlAddress = await getVersionControlAddressFromApi({ + const registryAddress = await getRegistryAddressFromApi({ apiUrl, chainName, }) - const accountCodeId = await getAppModuleCodeIdFromVersionControl({ + const accountCodeId = await getAppModuleCodeIdFromRegistry({ cosmWasmClient: signingCosmWasmClient, - versionControlAddress, + registryAddress, moduleId: 'abstract:account', version: 'latest', }) diff --git a/packages/core/src/actions/wallet/get-ans-host-client-from-registry.ts b/packages/core/src/actions/wallet/get-ans-host-client-from-registry.ts new file mode 100644 index 00000000..a1887bea --- /dev/null +++ b/packages/core/src/actions/wallet/get-ans-host-client-from-registry.ts @@ -0,0 +1,30 @@ +import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' + +import { getAnsHostAddressFromRegistry } from '../public/get-ans-host-address-from-registry' +import { getAnsHostClient } from './get-ans-host-client' + +export type GetAnsHostClientFromRegistryParameters = { + signingCosmWasmClient: SigningCosmWasmClient + sender: string + registryAddress: string + version?: string +} + +export async function getAnsHostClientFromRegistry({ + signingCosmWasmClient, + sender, + registryAddress, + version, +}: GetAnsHostClientFromRegistryParameters) { + const ansHostAddress = await getAnsHostAddressFromRegistry({ + cosmWasmClient: signingCosmWasmClient, + registryAddress, + version, + }) + + return getAnsHostClient({ + signingCosmWasmClient, + sender, + ansHostAddress, + }) +} diff --git a/packages/core/src/actions/wallet/get-ans-host-client-from-version-control.ts b/packages/core/src/actions/wallet/get-ans-host-client-from-version-control.ts deleted file mode 100644 index 8836a99c..00000000 --- a/packages/core/src/actions/wallet/get-ans-host-client-from-version-control.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' - -import { getAnsHostAddressFromVersionControl } from '../public/get-ans-host-address-from-version-control' -import { getAnsHostClient } from './get-ans-host-client' - -export type GetAnsHostClientFromVersionControlParameters = { - signingCosmWasmClient: SigningCosmWasmClient - sender: string - versionControlAddress: string - version?: string -} - -export async function getAnsHostClientFromVersionControl({ - signingCosmWasmClient, - sender, - versionControlAddress, - version, -}: GetAnsHostClientFromVersionControlParameters) { - const ansHostAddress = await getAnsHostAddressFromVersionControl({ - cosmWasmClient: signingCosmWasmClient, - versionControlAddress, - version, - }) - - return getAnsHostClient({ - signingCosmWasmClient, - sender, - ansHostAddress, - }) -} diff --git a/packages/core/src/actions/wallet/get-registry-client-from-api.ts b/packages/core/src/actions/wallet/get-registry-client-from-api.ts new file mode 100644 index 00000000..f56ec51b --- /dev/null +++ b/packages/core/src/actions/wallet/get-registry-client-from-api.ts @@ -0,0 +1,30 @@ +import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' + +import { chainIdToName } from '../../utils/chain-registry' +import { getRegistryAddressFromApi } from '../get-registry-address-from-api' +import { getRegistryClient } from './get-registry-client' + +export type GetRegistryClientFromApiParameters = { + signingCosmWasmClient: SigningCosmWasmClient + apiUrl: string + sender: string +} + +export async function getRegistryClientFromApi({ + signingCosmWasmClient, + apiUrl, + sender, +}: GetRegistryClientFromApiParameters) { + const chainId = await signingCosmWasmClient.getChainId() + const chainName = chainIdToName(chainId) + const registryAddress = await getRegistryAddressFromApi({ + apiUrl, + chainName, + }) + + return getRegistryClient({ + signingCosmWasmClient, + sender, + registryAddress, + }) +} diff --git a/packages/core/src/actions/wallet/get-registry-client.ts b/packages/core/src/actions/wallet/get-registry-client.ts new file mode 100644 index 00000000..1f727076 --- /dev/null +++ b/packages/core/src/actions/wallet/get-registry-client.ts @@ -0,0 +1,17 @@ +import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' + +import { RegistryClient } from '../../codegen/abstract' + +export type GetRegistryClientParameters = { + signingCosmWasmClient: SigningCosmWasmClient + sender: string + registryAddress: string +} + +export async function getRegistryClient({ + signingCosmWasmClient, + sender, + registryAddress, +}: GetRegistryClientParameters) { + return new RegistryClient(signingCosmWasmClient, sender, registryAddress) +} diff --git a/packages/core/src/actions/wallet/get-version-control-client-from-api.ts b/packages/core/src/actions/wallet/get-version-control-client-from-api.ts deleted file mode 100644 index 6ea0a641..00000000 --- a/packages/core/src/actions/wallet/get-version-control-client-from-api.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' - -import { chainIdToName } from '../../utils/chain-registry' -import { getVersionControlAddressFromApi } from '../get-version-control-address-from-api' -import { getVersionControlClient } from './get-version-control-client' - -export type GetVersionControlClientFromApiParameters = { - signingCosmWasmClient: SigningCosmWasmClient - apiUrl: string - sender: string -} - -export async function getVersionControlClientFromApi({ - signingCosmWasmClient, - apiUrl, - sender, -}: GetVersionControlClientFromApiParameters) { - const chainId = await signingCosmWasmClient.getChainId() - const chainName = chainIdToName(chainId) - const versionControlAddress = await getVersionControlAddressFromApi({ - apiUrl, - chainName, - }) - - return getVersionControlClient({ - signingCosmWasmClient, - sender, - versionControlAddress, - }) -} diff --git a/packages/core/src/actions/wallet/get-version-control-client.ts b/packages/core/src/actions/wallet/get-version-control-client.ts deleted file mode 100644 index a28eb2e3..00000000 --- a/packages/core/src/actions/wallet/get-version-control-client.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' - -import { VersionControlClient } from '../../codegen/abstract' - -export type GetVersionControlClientParameters = { - signingCosmWasmClient: SigningCosmWasmClient - sender: string - versionControlAddress: string -} - -export async function getVersionControlClient({ - signingCosmWasmClient, - sender, - versionControlAddress, -}: GetVersionControlClientParameters) { - return new VersionControlClient( - signingCosmWasmClient, - sender, - versionControlAddress, - ) -} diff --git a/packages/core/src/clients/create-account-public-client.ts b/packages/core/src/clients/create-account-public-client.ts index 010b3ab1..6c060fc7 100644 --- a/packages/core/src/clients/create-account-public-client.ts +++ b/packages/core/src/clients/create-account-public-client.ts @@ -1,9 +1,9 @@ -import { VersionControlTypes } from '../codegen/abstract/index' +import { RegistryTypes } from '../codegen/abstract/index' import type { Evaluate } from '../types/utils' import { ABSTRACT_API_URL, accountIdToString, - versionControlAccountIdToString, + registryAccountIdToString, } from '../utils' import { type Client } from './create-client' import { PublicClientConfig, createPublicClient } from './create-public-client' @@ -13,7 +13,7 @@ import { } from './decorators/account-public' export type AccountPublicClientConfig = PublicClientConfig & { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId } /** @@ -24,7 +24,7 @@ export type AccountPublicClient = Evaluate> export function createAccountPublicClient( parameters: AccountPublicClientConfig, ): AccountPublicClient { - const accountIdString = versionControlAccountIdToString(parameters.accountId) + const accountIdString = registryAccountIdToString(parameters.accountId) const { key = `account-public-${accountIdString}`, name = `AccountPublic Client (${accountIdString})`, diff --git a/packages/core/src/clients/create-account-wallet-client.ts b/packages/core/src/clients/create-account-wallet-client.ts index 8ef2569f..4d31565c 100644 --- a/packages/core/src/clients/create-account-wallet-client.ts +++ b/packages/core/src/clients/create-account-wallet-client.ts @@ -1,6 +1,6 @@ -import { VersionControlTypes } from '../codegen/abstract/index' +import { RegistryTypes } from '../codegen/abstract/index' import type { Evaluate } from '../types/utils' -import { ABSTRACT_API_URL, versionControlAccountIdToString } from '../utils' +import { ABSTRACT_API_URL, registryAccountIdToString } from '../utils' import { type Client } from './create-client' import { WalletClientConfig, createWalletClient } from './create-wallet-client' import { @@ -10,7 +10,7 @@ import { import { WalletActions } from './decorators/wallet' export type AccountWalletClientConfig = WalletClientConfig & { - accountId: VersionControlTypes.AccountId + accountId: RegistryTypes.AccountId } /** @@ -23,7 +23,7 @@ export type AccountWalletClient = Evaluate< export function createAccountWalletClient( parameters: AccountWalletClientConfig, ): AccountWalletClient { - const accountIdString = versionControlAccountIdToString(parameters.accountId) + const accountIdString = registryAccountIdToString(parameters.accountId) // TODO: the sender may need to be included in the URL const { key = `account-wallet-${accountIdString}`, diff --git a/packages/core/src/clients/decorators/abstract-base.ts b/packages/core/src/clients/decorators/abstract-base.ts index b115c019..f3b7e092 100644 --- a/packages/core/src/clients/decorators/abstract-base.ts +++ b/packages/core/src/clients/decorators/abstract-base.ts @@ -1,13 +1,13 @@ import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import { getAbstractModuleAddressFromVersionControl } from '../../actions/public/get-abstract-module-address-from-version-control' +import { getAbstractModuleAddressFromRegistry } from '../../actions/public/get-abstract-module-address-from-registry' import { getAccountQueryClient } from '../../actions/public/get-account-query-client' -import { getAnsHostAddressFromVersionControl } from '../../actions/public/get-ans-host-address-from-version-control' +import { getAnsHostAddressFromRegistry } from '../../actions/public/get-ans-host-address-from-registry' import { getAnsHostQueryClient } from '../../actions/public/get-ans-host-query-client' -import { getAnsHostQueryClientFromVersionControl } from '../../actions/public/get-ans-host-query-client-from-version-control' +import { getAnsHostQueryClientFromRegistry } from '../../actions/public/get-ans-host-query-client-from-registry' import { getCosmWasmClient } from '../../actions/public/get-cosm-wasm-client' import { getIbcClientQueryClient } from '../../actions/public/get-ibc-client-query-client' -import { getVersionControlModuleData } from '../../actions/public/get-version-control-module-data' -import { getVersionControlQueryClient } from '../../actions/public/get-version-control-query-client' +import { getRegistryModuleData } from '../../actions/public/get-registry-module-data' +import { getRegistryQueryClient } from '../../actions/public/get-registry-query-client' import { ExtractAndPartializeParameters } from '../../types/parameters' type ExtractAndPartializeDecoratedParametersFromParameters< @@ -24,11 +24,11 @@ export type AbstractBaseActions = { typeof getAccountQueryClient >, ): ReturnType - getVersionControlQueryClient( + getRegistryQueryClient( parameters: ExtractAndPartializeDecoratedParametersFromParameters< - typeof getVersionControlQueryClient + typeof getRegistryQueryClient >, - ): ReturnType + ): ReturnType getAnsHostQueryClient( parameters: ExtractAndPartializeDecoratedParametersFromParameters< typeof getAnsHostQueryClient @@ -39,26 +39,26 @@ export type AbstractBaseActions = { typeof getIbcClientQueryClient >, ): ReturnType - getAbstractModuleAddressFromVersionControl( + getAbstractModuleAddressFromRegistry( parameters: ExtractAndPartializeDecoratedParametersFromParameters< - typeof getAbstractModuleAddressFromVersionControl + typeof getAbstractModuleAddressFromRegistry >, - ): ReturnType - getAnsHostAddressFromVersionControl( + ): ReturnType + getAnsHostAddressFromRegistry( parameters: ExtractAndPartializeDecoratedParametersFromParameters< - typeof getAnsHostAddressFromVersionControl + typeof getAnsHostAddressFromRegistry >, - ): ReturnType - getAnsHostQueryClientFromVersionControl( + ): ReturnType + getAnsHostQueryClientFromRegistry( parameters: ExtractAndPartializeDecoratedParametersFromParameters< - typeof getAnsHostQueryClientFromVersionControl + typeof getAnsHostQueryClientFromRegistry >, - ): ReturnType - getVersionControlModuleData( + ): ReturnType + getRegistryModuleData( parameters: ExtractAndPartializeDecoratedParametersFromParameters< - typeof getVersionControlModuleData + typeof getRegistryModuleData >, - ): ReturnType + ): ReturnType } export function abstractBaseActions( @@ -75,8 +75,8 @@ export function abstractBaseActions( ...parameters, ...extra, }), - getVersionControlQueryClient: ({ extra, ...parameters }) => - getVersionControlQueryClient({ + getRegistryQueryClient: ({ extra, ...parameters }) => + getRegistryQueryClient({ cosmWasmClient, ...parameters, ...extra, @@ -94,26 +94,26 @@ export function abstractBaseActions( ...parameters, ...extra, }), - getAbstractModuleAddressFromVersionControl: ({ extra, ...parameters }) => - getAbstractModuleAddressFromVersionControl({ + getAbstractModuleAddressFromRegistry: ({ extra, ...parameters }) => + getAbstractModuleAddressFromRegistry({ cosmWasmClient, ...parameters, ...extra, }), - getAnsHostAddressFromVersionControl: ({ extra, ...parameters }) => - getAnsHostAddressFromVersionControl({ + getAnsHostAddressFromRegistry: ({ extra, ...parameters }) => + getAnsHostAddressFromRegistry({ cosmWasmClient, ...parameters, ...extra, }), - getAnsHostQueryClientFromVersionControl: ({ extra, ...parameters }) => - getAnsHostQueryClientFromVersionControl({ + getAnsHostQueryClientFromRegistry: ({ extra, ...parameters }) => + getAnsHostQueryClientFromRegistry({ cosmWasmClient, ...parameters, ...extra, }), - getVersionControlModuleData: ({ extra, ...parameters }) => - getVersionControlModuleData({ + getRegistryModuleData: ({ extra, ...parameters }) => + getRegistryModuleData({ cosmWasmClient, ...parameters, ...extra, diff --git a/packages/core/src/clients/decorators/account-public.ts b/packages/core/src/clients/decorators/account-public.ts index 122f89b1..e9c1b865 100644 --- a/packages/core/src/clients/decorators/account-public.ts +++ b/packages/core/src/clients/decorators/account-public.ts @@ -16,7 +16,7 @@ import { getSubAccountIds } from '../../actions/account/public/get-sub-account-i import { getSubAccountSequences } from '../../actions/account/public/get-sub-account-sequences' import { simulateExecuteRemote } from '../../actions/account/public/simulate-execute-remote' import { simulateExecuteRemoteAccount } from '../../actions/account/public/simulate-execute-remote-account' -import { VersionControlTypes } from '../../codegen/abstract/index' +import { RegistryTypes } from '../../codegen/abstract/index' import { ExtractAndPartializeParameters } from '../../types/parameters' type ExtractAndPartializeDecoratedParametersFromParameters< @@ -113,7 +113,7 @@ export type AccountPublicActions = { } export function accountPublicActions( - accountId: VersionControlTypes.AccountId, + accountId: RegistryTypes.AccountId, cosmWasmClient: CosmWasmClient, apiUrl: string, ): AccountPublicActions { diff --git a/packages/core/src/clients/decorators/account-wallet.ts b/packages/core/src/clients/decorators/account-wallet.ts index 69526bca..f84d31a5 100644 --- a/packages/core/src/clients/decorators/account-wallet.ts +++ b/packages/core/src/clients/decorators/account-wallet.ts @@ -20,7 +20,7 @@ import { updateOwnership } from '../../actions/account/wallet/update-ownership' import { updateStatus } from '../../actions/account/wallet/update-status' import { upgradeModules } from '../../actions/account/wallet/upgrade-modules' import { withdraw } from '../../actions/account/wallet/withdraw' -import { VersionControlTypes } from '../../codegen/abstract/index' +import { RegistryTypes } from '../../codegen/abstract/index' import { ExtractAndPartializeParameters } from '../../types/parameters' type ExtractAndPartializeDecoratedParametersFromParameters< @@ -142,7 +142,7 @@ export type AccountWalletActions = { } export function accountWalletActions( - accountId: VersionControlTypes.AccountId, + accountId: RegistryTypes.AccountId, signingCosmWasmClient: SigningCosmWasmClient, sender: string, apiUrl: string, diff --git a/packages/core/src/clients/decorators/api.ts b/packages/core/src/clients/decorators/api.ts index fbf051c9..6e6efb48 100644 --- a/packages/core/src/clients/decorators/api.ts +++ b/packages/core/src/clients/decorators/api.ts @@ -4,8 +4,8 @@ import { getAnsHostAddressFromApi } from '../../actions/get-ans-host-address-fro import { getAnsTokenFromApi } from '../../actions/get-ans-token-from-api' import { getAnsTokensFromApi } from '../../actions/get-ans-tokens-from-api' import { getModulesFromApi } from '../../actions/get-modules-from-api' +import { getRegistryAddressFromApi } from '../../actions/get-registry-address-from-api' import { getSubAccountIdsByModuleIdFromApi } from '../../actions/get-sub-account-ids-by-module-id' -import { getVersionControlAddressFromApi } from '../../actions/get-version-control-address-from-api' import { ExtractAndPartializeParameters } from '../../types/parameters' type ExtractAndPartializeDecoratedParametersFromParameters< @@ -41,11 +41,11 @@ export type ApiActions = { typeof getModulesFromApi >, ): ReturnType - getVersionControlAddressFromApi( + getRegistryAddressFromApi( parameters: ExtractAndPartializeDecoratedParametersFromParameters< - typeof getVersionControlAddressFromApi + typeof getRegistryAddressFromApi >, - ): ReturnType + ): ReturnType getAccountBalancesFromApi( parameters: ExtractAndPartializeDecoratedParametersFromParameters< typeof getAccountBalancesFromApi @@ -96,8 +96,8 @@ export function apiActions(apiUrl: string): ApiActions { ...parameters, ...extra, }), - getVersionControlAddressFromApi: ({ extra, ...parameters }) => - getVersionControlAddressFromApi({ + getRegistryAddressFromApi: ({ extra, ...parameters }) => + getRegistryAddressFromApi({ apiUrl, ...parameters, ...extra, diff --git a/packages/core/src/clients/decorators/public.ts b/packages/core/src/clients/decorators/public.ts index 734305fc..e482c899 100644 --- a/packages/core/src/clients/decorators/public.ts +++ b/packages/core/src/clients/decorators/public.ts @@ -1,20 +1,20 @@ import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate' import { getSimulationResultFromApi } from '../../actions/get-simulation-result-from-api' -import { getAbstractModuleAddressFromVersionControl } from '../../actions/public/get-abstract-module-address-from-version-control' +import { getAbstractModuleAddressFromRegistry } from '../../actions/public/get-abstract-module-address-from-registry' import { getAbstractModuleVersion } from '../../actions/public/get-abstract-module-version' import { getAccountAddressesFromApi } from '../../actions/public/get-account-addresses-from-api' import { getAccountQueryClient } from '../../actions/public/get-account-query-client' -import { getAnsHostAddressFromVersionControl } from '../../actions/public/get-ans-host-address-from-version-control' +import { getAnsHostAddressFromRegistry } from '../../actions/public/get-ans-host-address-from-registry' import { getAnsHostQueryClient } from '../../actions/public/get-ans-host-query-client' import { getAnsHostQueryClientFromApi } from '../../actions/public/get-ans-host-query-client-from-api' -import { getAnsHostQueryClientFromVersionControl } from '../../actions/public/get-ans-host-query-client-from-version-control' +import { getAnsHostQueryClientFromRegistry } from '../../actions/public/get-ans-host-query-client-from-registry' import { getAnsHostVersionFromApi } from '../../actions/public/get-ans-host-version-from-api' import { getCosmWasmClient } from '../../actions/public/get-cosm-wasm-client' import { getIbcClientQueryClient } from '../../actions/public/get-ibc-client-query-client' +import { getRegistryModuleData } from '../../actions/public/get-registry-module-data' +import { getRegistryQueryClient } from '../../actions/public/get-registry-query-client' +import { getRegistryQueryClientFromApi } from '../../actions/public/get-registry-query-client-from-api' import { getRemoteHostsFromApi } from '../../actions/public/get-remote-hosts-from-api' -import { getVersionControlModuleData } from '../../actions/public/get-version-control-module-data' -import { getVersionControlQueryClient } from '../../actions/public/get-version-control-query-client' -import { getVersionControlQueryClientFromApi } from '../../actions/public/get-version-control-query-client-from-api' import { simulateRemoteMsg } from '../../actions/simulate-remote-msg' import { ExtractAndPartializeParameters } from '../../types/parameters' @@ -47,11 +47,11 @@ export type PublicActions = { typeof getAnsHostQueryClientFromApi >, ): ReturnType - getVersionControlQueryClientFromApi( + getRegistryQueryClientFromApi( parameters?: ExtractAndPartializeDecoratedParametersFromParameters< - typeof getVersionControlQueryClientFromApi + typeof getRegistryQueryClientFromApi >, - ): ReturnType + ): ReturnType getRemoteHosts( parameters?: ExtractAndPartializeDecoratedParametersFromParameters< typeof getRemoteHostsFromApi @@ -102,8 +102,8 @@ export function publicActions( ...parameters, ...extra, }), - getVersionControlQueryClientFromApi: ({ extra, ...parameters } = {}) => - getVersionControlQueryClientFromApi({ + getRegistryQueryClientFromApi: ({ extra, ...parameters } = {}) => + getRegistryQueryClientFromApi({ cosmWasmClient, apiUrl, ...parameters, diff --git a/packages/core/src/clients/decorators/wallet.ts b/packages/core/src/clients/decorators/wallet.ts index 1b5e114a..7328fafc 100644 --- a/packages/core/src/clients/decorators/wallet.ts +++ b/packages/core/src/clients/decorators/wallet.ts @@ -1,15 +1,15 @@ import { getAnsHostClientFromApi } from '../../actions/wallet/get-ans-host-client-from-api' -import { getAnsHostClientFromVersionControl } from '../../actions/wallet/get-ans-host-client-from-version-control' -import { getVersionControlClientFromApi } from '../../actions/wallet/get-version-control-client-from-api' +import { getAnsHostClientFromRegistry } from '../../actions/wallet/get-ans-host-client-from-registry' +import { getRegistryClientFromApi } from '../../actions/wallet/get-registry-client-from-api' import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' import { createAccount } from '../../actions/wallet/create-account' import { createAccountMonarchy } from '../../actions/wallet/create-account-monarchy' import { getAccountClient } from '../../actions/wallet/get-account-client' import { getAnsHostClient } from '../../actions/wallet/get-ans-host-client' +import { getRegistryClient } from '../../actions/wallet/get-registry-client' import { getSenderAddress } from '../../actions/wallet/get-sender-address' import { getSigningCosmWasmClient } from '../../actions/wallet/get-signing-cosm-wasm-client' -import { getVersionControlClient } from '../../actions/wallet/get-version-control-client' import { ExtractAndPartializeParameters } from '../../types/parameters' type ExtractAndPartializeDecoratedParametersFromParameters< @@ -40,21 +40,21 @@ export type WalletActions = { typeof getAnsHostClientFromApi >, ): ReturnType - getAnsHostClientFromVersionControl( + getAnsHostClientFromRegistry( parameters: ExtractAndPartializeDecoratedParametersFromParameters< - typeof getAnsHostClientFromVersionControl + typeof getAnsHostClientFromRegistry >, - ): ReturnType - getVersionControlClient( + ): ReturnType + getRegistryClient( parameters: ExtractAndPartializeDecoratedParametersFromParameters< - typeof getVersionControlClient + typeof getRegistryClient >, - ): ReturnType - getVersionControlClientFromApi( + ): ReturnType + getRegistryClientFromApi( parameters?: ExtractAndPartializeDecoratedParametersFromParameters< - typeof getVersionControlClientFromApi + typeof getRegistryClientFromApi >, - ): ReturnType + ): ReturnType getAccountClient( parameters: ExtractAndPartializeDecoratedParametersFromParameters< typeof getAccountClient @@ -102,24 +102,24 @@ export function walletActions( ...parameters, ...extra, }), - getAnsHostClientFromVersionControl: ({ extra, ...parameters }) => - getAnsHostClientFromVersionControl({ + getAnsHostClientFromRegistry: ({ extra, ...parameters }) => + getAnsHostClientFromRegistry({ signingCosmWasmClient, sender, ...parameters, ...extra, }), - getVersionControlClientFromApi: ({ extra, ...parameters } = {}) => - getVersionControlClientFromApi({ + getRegistryClientFromApi: ({ extra, ...parameters } = {}) => + getRegistryClientFromApi({ signingCosmWasmClient, sender, apiUrl, ...parameters, ...extra, }), - getVersionControlClient: ({ extra, ...parameters }) => - getVersionControlClient({ + getRegistryClient: ({ extra, ...parameters }) => + getRegistryClient({ signingCosmWasmClient, sender, ...parameters, diff --git a/packages/core/src/utils/account-id/account-id-to-parameter.ts b/packages/core/src/utils/account-id/account-id-to-parameter.ts index 8d4c9670..a41f0965 100644 --- a/packages/core/src/utils/account-id/account-id-to-parameter.ts +++ b/packages/core/src/utils/account-id/account-id-to-parameter.ts @@ -1,5 +1,5 @@ -import { VersionControlTypes } from '../../codegen/abstract' +import { RegistryTypes } from '../../codegen/abstract' -export function accountIdToParameter(id: VersionControlTypes.AccountId) { +export function accountIdToParameter(id: RegistryTypes.AccountId) { return { seq: id.seq, trace: id.trace } } diff --git a/packages/core/src/utils/account-id/account-id.ts b/packages/core/src/utils/account-id/account-id.ts index e769e4c8..865b1e83 100644 --- a/packages/core/src/utils/account-id/account-id.ts +++ b/packages/core/src/utils/account-id/account-id.ts @@ -1,8 +1,8 @@ -import { VersionControlTypes } from '../../codegen/abstract' +import { RegistryTypes } from '../../codegen/abstract' export type AccountId = { chainName: TChainName -} & VersionControlTypes.AccountId +} & RegistryTypes.AccountId export const ACCOUNT_ID_CHAIN_DELIMITER = '>' export const ACCOUNT_ID_SEQUENCE_DELIMITER = '-' diff --git a/packages/core/src/utils/account-id/index.ts b/packages/core/src/utils/account-id/index.ts index d4995cc2..6d9f3c0b 100644 --- a/packages/core/src/utils/account-id/index.ts +++ b/packages/core/src/utils/account-id/index.ts @@ -5,4 +5,4 @@ export * from './account-id-to-string' export * from './account-id' export * from './seq-to-local-account-id' export * from './string-to-account-id' -export * from './version-control-account-id-to-string' +export * from './registry-account-id-to-string' diff --git a/packages/core/src/utils/account-id/version-control-account-id-to-string.ts b/packages/core/src/utils/account-id/registry-account-id-to-string.ts similarity index 73% rename from packages/core/src/utils/account-id/version-control-account-id-to-string.ts rename to packages/core/src/utils/account-id/registry-account-id-to-string.ts index ade036f3..977d26e7 100644 --- a/packages/core/src/utils/account-id/version-control-account-id-to-string.ts +++ b/packages/core/src/utils/account-id/registry-account-id-to-string.ts @@ -1,4 +1,4 @@ -import { VersionControlTypes } from '../../codegen/abstract' +import { RegistryTypes } from '../../codegen/abstract' import { ACCOUNT_ID_CHAIN_DELIMITER } from './account-id' /** @@ -7,9 +7,7 @@ import { ACCOUNT_ID_CHAIN_DELIMITER } from './account-id' * { seq: 45, trace: ['juno'] } => 'juno-45' * @param id */ -export function versionControlAccountIdToString( - id: VersionControlTypes.AccountId, -) { +export function registryAccountIdToString(id: RegistryTypes.AccountId) { if (id.trace === 'local') { return `local-${id.seq}` } diff --git a/packages/core/src/utils/index.ts b/packages/core/src/utils/index.ts index 6527d100..0b4307f3 100644 --- a/packages/core/src/utils/index.ts +++ b/packages/core/src/utils/index.ts @@ -5,7 +5,7 @@ export * from './account-id' export * from './assets' export * from './chain-registry' export * from './tokens' -export * from './version-control' +export * from './registry' export * from './constants' export * from './encoding' export * from './errors' diff --git a/packages/core/src/utils/module-factory/get-instantiate2-address.ts b/packages/core/src/utils/module-factory/get-instantiate2-address.ts index e6c7b24f..71bbdb22 100644 --- a/packages/core/src/utils/module-factory/get-instantiate2-address.ts +++ b/packages/core/src/utils/module-factory/get-instantiate2-address.ts @@ -1,13 +1,13 @@ import { instantiate2Address } from '@cosmjs/cosmwasm-stargate' import { fromHex } from '@cosmjs/encoding' import { bech32 } from 'bech32' -import { AccountId, versionControlAccountIdToString } from '../account-id' +import { AccountId, registryAccountIdToString } from '../account-id' import { toSha256 } from '../encoding' const SALT_POSTFIX = 'abstract' async function getAccountIdSalt(accountId: AccountId) { - const sha256 = await toSha256(versionControlAccountIdToString(accountId)) + const sha256 = await toSha256(registryAccountIdToString(accountId)) const encoder = new TextEncoder() return new Uint8Array([...sha256, ...encoder.encode(SALT_POSTFIX)]) diff --git a/packages/core/src/utils/modules/module-type.ts b/packages/core/src/utils/modules/module-type.ts index 1191e036..ce72b427 100644 --- a/packages/core/src/utils/modules/module-type.ts +++ b/packages/core/src/utils/modules/module-type.ts @@ -1,4 +1,4 @@ -import { ModuleReference } from '../../codegen/abstract/cosmwasm-codegen/VersionControl.types' +import { ModuleReference } from '../../codegen/abstract/cosmwasm-codegen/Registry.types' import { VariantKeys } from '../cosmwasm/contract-msg-builder' export type ModuleType = VariantKeys diff --git a/packages/core/src/utils/registry/index.ts b/packages/core/src/utils/registry/index.ts new file mode 100644 index 00000000..97f2331e --- /dev/null +++ b/packages/core/src/utils/registry/index.ts @@ -0,0 +1,5 @@ +export * from './module-id' +export * from './registry-module-to-address' +export * from './registry-module-to-code-id' +export * from './registry-module-to-type' +export * from './registry-module-to-version' diff --git a/packages/core/src/utils/version-control/module-id/format-module-id-with-version.ts b/packages/core/src/utils/registry/module-id/format-module-id-with-version.ts similarity index 50% rename from packages/core/src/utils/version-control/module-id/format-module-id-with-version.ts rename to packages/core/src/utils/registry/module-id/format-module-id-with-version.ts index 486fb057..380e0dc1 100644 --- a/packages/core/src/utils/version-control/module-id/format-module-id-with-version.ts +++ b/packages/core/src/utils/registry/module-id/format-module-id-with-version.ts @@ -1,10 +1,10 @@ import * as s from 'string-ts' -import { VersionControlTypes } from '../../../codegen/abstract' +import { RegistryTypes } from '../../../codegen/abstract' import { moduleVersionToString } from './module-version-to-string' export function formatModuleIdWithVersion( - namespace: VersionControlTypes.ModuleInfo['namespace'], - name: VersionControlTypes.ModuleInfo['name'], - version: VersionControlTypes.ModuleInfo['version'], + namespace: RegistryTypes.ModuleInfo['namespace'], + name: RegistryTypes.ModuleInfo['name'], + version: RegistryTypes.ModuleInfo['version'], ) { return s.join([namespace, name, moduleVersionToString(version)] as const, ':') } diff --git a/packages/core/src/utils/version-control/module-id/index.ts b/packages/core/src/utils/registry/module-id/index.ts similarity index 100% rename from packages/core/src/utils/version-control/module-id/index.ts rename to packages/core/src/utils/registry/module-id/index.ts diff --git a/packages/core/src/utils/version-control/module-id/module-id-to-name.ts b/packages/core/src/utils/registry/module-id/module-id-to-name.ts similarity index 100% rename from packages/core/src/utils/version-control/module-id/module-id-to-name.ts rename to packages/core/src/utils/registry/module-id/module-id-to-name.ts diff --git a/packages/core/src/utils/version-control/module-id/module-id-to-namespace.ts b/packages/core/src/utils/registry/module-id/module-id-to-namespace.ts similarity index 100% rename from packages/core/src/utils/version-control/module-id/module-id-to-namespace.ts rename to packages/core/src/utils/registry/module-id/module-id-to-namespace.ts diff --git a/packages/core/src/utils/version-control/module-id/module-version-to-string.ts b/packages/core/src/utils/registry/module-id/module-version-to-string.ts similarity index 58% rename from packages/core/src/utils/version-control/module-id/module-version-to-string.ts rename to packages/core/src/utils/registry/module-id/module-version-to-string.ts index 20304fc2..531c726d 100644 --- a/packages/core/src/utils/version-control/module-id/module-version-to-string.ts +++ b/packages/core/src/utils/registry/module-id/module-version-to-string.ts @@ -1,6 +1,6 @@ -import { VersionControlTypes } from '../../../codegen/abstract' +import { RegistryTypes } from '../../../codegen/abstract' export function moduleVersionToString< - TVersion extends VersionControlTypes.ModuleInfo['version'] = VersionControlTypes.ModuleInfo['version'], + TVersion extends RegistryTypes.ModuleInfo['version'] = RegistryTypes.ModuleInfo['version'], >(version: TVersion) { if (typeof version !== 'string') { return version.version diff --git a/packages/core/src/utils/version-control/module-id/types.ts b/packages/core/src/utils/registry/module-id/types.ts similarity index 100% rename from packages/core/src/utils/version-control/module-id/types.ts rename to packages/core/src/utils/registry/module-id/types.ts diff --git a/packages/core/src/utils/version-control/version-control-module-to-address.ts b/packages/core/src/utils/registry/registry-module-to-address.ts similarity index 62% rename from packages/core/src/utils/version-control/version-control-module-to-address.ts rename to packages/core/src/utils/registry/registry-module-to-address.ts index 4f80ff60..dfe520c3 100644 --- a/packages/core/src/utils/version-control/version-control-module-to-address.ts +++ b/packages/core/src/utils/registry/registry-module-to-address.ts @@ -1,8 +1,8 @@ import { P, match } from 'ts-pattern' -import { VersionControlTypes } from '../../codegen/abstract' +import { RegistryTypes } from '../../codegen/abstract' -export function versionControlModuleToAddress< - const TVcModule extends VersionControlTypes.Module = VersionControlTypes.Module, +export function registryModuleToAddress< + const TVcModule extends RegistryTypes.Module = RegistryTypes.Module, >(module: TVcModule) { return match(module.reference) .with({ native: P.select() }, (native) => native) diff --git a/packages/core/src/utils/version-control/version-control-module-to-code-id.ts b/packages/core/src/utils/registry/registry-module-to-code-id.ts similarity index 66% rename from packages/core/src/utils/version-control/version-control-module-to-code-id.ts rename to packages/core/src/utils/registry/registry-module-to-code-id.ts index 4962bca5..7c9bc315 100644 --- a/packages/core/src/utils/version-control/version-control-module-to-code-id.ts +++ b/packages/core/src/utils/registry/registry-module-to-code-id.ts @@ -1,8 +1,8 @@ import { P, match } from 'ts-pattern' -import { VersionControlTypes } from '../../codegen/abstract' +import { RegistryTypes } from '../../codegen/abstract' -export function versionControlModuleToCodeId< - const TVcModule extends VersionControlTypes.Module = VersionControlTypes.Module, +export function registryModuleToCodeId< + const TVcModule extends RegistryTypes.Module = RegistryTypes.Module, >(module: TVcModule) { return match(module.reference) .with({ account: P.select() }, (account) => account) diff --git a/packages/core/src/utils/version-control/version-control-module-to-type.ts b/packages/core/src/utils/registry/registry-module-to-type.ts similarity index 73% rename from packages/core/src/utils/version-control/version-control-module-to-type.ts rename to packages/core/src/utils/registry/registry-module-to-type.ts index 52a3528d..8070145f 100644 --- a/packages/core/src/utils/version-control/version-control-module-to-type.ts +++ b/packages/core/src/utils/registry/registry-module-to-type.ts @@ -1,8 +1,8 @@ import { P, match } from 'ts-pattern' -import { VersionControlTypes } from '../../codegen/abstract' +import { RegistryTypes } from '../../codegen/abstract' -export function versionControlModuleToType< - const TVcModule extends VersionControlTypes.Module = VersionControlTypes.Module, +export function registryModuleToType< + const TVcModule extends RegistryTypes.Module = RegistryTypes.Module, >(module: TVcModule) { return match(module.reference) .with({ account: P.select() }, () => 'account' as const) diff --git a/packages/core/src/utils/registry/registry-module-to-version.ts b/packages/core/src/utils/registry/registry-module-to-version.ts new file mode 100644 index 00000000..bb44238f --- /dev/null +++ b/packages/core/src/utils/registry/registry-module-to-version.ts @@ -0,0 +1,7 @@ +import { RegistryTypes } from '../../codegen/abstract' + +export function registryModuleToVersion< + const TVcModule extends RegistryTypes.Module = RegistryTypes.Module, +>(module: TVcModule) { + return module.info.version +} diff --git a/packages/core/src/utils/version-control/index.ts b/packages/core/src/utils/version-control/index.ts deleted file mode 100644 index 34f53250..00000000 --- a/packages/core/src/utils/version-control/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './module-id' -export * from './version-control-module-to-address' -export * from './version-control-module-to-code-id' -export * from './version-control-module-to-type' -export * from './version-control-module-to-version' diff --git a/packages/core/src/utils/version-control/version-control-module-to-version.ts b/packages/core/src/utils/version-control/version-control-module-to-version.ts deleted file mode 100644 index 8b2759cb..00000000 --- a/packages/core/src/utils/version-control/version-control-module-to-version.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { VersionControlTypes } from '../../codegen/abstract' - -export function versionControlModuleToVersion< - const TVcModule extends VersionControlTypes.Module = VersionControlTypes.Module, ->(module: TVcModule) { - return module.info.version -} diff --git a/packages/react/src/utils/use-abstract-module-client.ts b/packages/react/src/utils/use-abstract-module-client.ts index 2097f398..7aa6408f 100644 --- a/packages/react/src/utils/use-abstract-module-client.ts +++ b/packages/react/src/utils/use-abstract-module-client.ts @@ -6,7 +6,7 @@ import { UseQueryParameters, useQuery } from '../types/queries' interface AbstractModuleClientConstructor { new (args: { - accountClient: AccountWalletClient + accountWalletClient: AccountWalletClient moduleId: string }): any } @@ -14,16 +14,16 @@ interface AbstractModuleClientConstructor { async function getAbstractModuleClient< TModule extends AbstractModuleClientConstructor, >({ - accountClient, + accountWalletClient, moduleId, Module, }: { - accountClient: AccountWalletClient + accountWalletClient: AccountWalletClient moduleId: string Module: TModule }) { return new Module({ - accountClient: accountClient, + accountWalletClient: accountWalletClient, moduleId, }) as InstanceType } @@ -56,7 +56,7 @@ export function useAbstractModuleClient< }: UseAbstractModuleClientParameters) { const { useAccountWalletClient } = useConfig() - const accountClient = useAccountWalletClient({ + const accountWalletClient = useAccountWalletClient({ accountId, chainName, }) @@ -67,16 +67,17 @@ export function useAbstractModuleClient< ) const queryFn = React.useCallback(() => { - if (!accountClient) throw new Error('accountClient is not defined') + if (!accountWalletClient) + throw new Error('accountWalletClient is not defined') return getAbstractModuleClient({ - accountClient: accountClient, + accountWalletClient: accountWalletClient, moduleId, Module, }) - }, [accountClient, moduleId, Module]) + }, [accountWalletClient, moduleId, Module]) - const enabled = Boolean(accountClient && (query.enabled ?? true)) + const enabled = Boolean(accountWalletClient && (query.enabled ?? true)) const { data,