Skip to content

Commit

Permalink
Rename version control to registry
Browse files Browse the repository at this point in the history
  • Loading branch information
adairrr committed Oct 8, 2024
1 parent 22f6de7 commit 29085eb
Show file tree
Hide file tree
Showing 87 changed files with 605 additions and 625 deletions.
2 changes: 1 addition & 1 deletion packages/core/abstract.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const contractsConfig = [
version: '0.24.0-test.1',
},
{
name: 'version-control',
name: 'registry',
version: '0.24.0-rc.1',
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 2 additions & 5 deletions packages/core/src/actions/account/public/get-modules.ts
Original file line number Diff line number Diff line change
@@ -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<typeof AccountQueryClient.prototype.moduleInfos>[0]
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/actions/account/public/get-namespace.ts
Original file line number Diff line number Diff line change
@@ -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
}
Expand All @@ -14,11 +14,11 @@ export async function getNamespace({
cosmWasmClient,
apiUrl,
}: GetNamespaceParameters): Promise<string | null> {
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])

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/actions/account/public/get-owner.ts
Original file line number Diff line number Diff line change
@@ -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
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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<
Expand Down
Original file line number Diff line number Diff line change
@@ -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<typeof AccountQueryClient.prototype.subAccountIds>[0]
Expand Down
Original file line number Diff line number Diff line change
@@ -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<typeof AccountQueryClient.prototype.subAccountIds>[0]
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/actions/account/public/query-module.ts
Original file line number Diff line number Diff line change
@@ -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
} & {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/actions/account/wallet/claim-namespace.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
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<
{
signingCosmWasmClient: SigningCosmWasmClient
apiUrl: string
sender: string
namespace: string
} & Parameters<typeof VersionControlClient.prototype.claimNamespace>[0]
} & Parameters<typeof RegistryClient.prototype.claimNamespace>[0]
>

export async function claimNamespace({
Expand All @@ -23,12 +23,12 @@ export async function claimNamespace({
funds,
memo,
}: ClaimNamespaceParameters): Promise<ExecuteResult> {
const versionControlClient = await getVersionControlClientFromApi({
const registryClient = await getRegistryClientFromApi({
signingCosmWasmClient,
apiUrl,
sender,
})
return versionControlClient.claimNamespace(
return registryClient.claimNamespace(
{ accountId: accountIdToParameter(accountId), namespace },
fee,
memo,
Expand Down
Loading

0 comments on commit 29085eb

Please sign in to comment.