diff --git a/examples/wagemos-cosmoskit-nextjs/CHANGELOG.md b/examples/wagemos-cosmoskit-nextjs/CHANGELOG.md index ff43d9f8..ed7e2145 100644 --- a/examples/wagemos-cosmoskit-nextjs/CHANGELOG.md +++ b/examples/wagemos-cosmoskit-nextjs/CHANGELOG.md @@ -1,5 +1,14 @@ # wagemos-cosmoskit-nextjs +## 0.3.25 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/core@1.4.0 + - @abstract-money/react@1.4.0 + - @abstract-money/provider-cosmoskit@6.0.0 + ## 0.3.24 ### Patch Changes diff --git a/examples/wagemos-cosmoskit-nextjs/package.json b/examples/wagemos-cosmoskit-nextjs/package.json index cb2a6cbc..8e8fbbfe 100644 --- a/examples/wagemos-cosmoskit-nextjs/package.json +++ b/examples/wagemos-cosmoskit-nextjs/package.json @@ -1,6 +1,6 @@ { "name": "wagemos-cosmoskit-nextjs", - "version": "0.3.24", + "version": "0.3.25", "private": true, "scripts": { "dev": "next dev", @@ -13,7 +13,7 @@ "@abstract-money/core": "workspace:*", "@abstract-money/provider-cosmoskit": "workspace:*", "@abstract-money/react": "workspace:*", - "@chain-registry/types": "^0.13.1", + "@chain-registry/types": "^0.45.50", "@cosmjs/stargate": "^0.32.3", "@cosmos-kit/keplr": "^2.4.15", "@cosmos-kit/react": "^2.6.0", @@ -25,7 +25,7 @@ "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", "@tanstack/react-query": "^4", - "chain-registry": "^1.18.1", + "chain-registry": "^1.63.60", "class-variance-authority": "^0.7.0", "clsx": "^2.0.0", "cosmjs-types": "^0.9.0", diff --git a/examples/wagemos-graz-nextjs/CHANGELOG.md b/examples/wagemos-graz-nextjs/CHANGELOG.md index dd5765ef..c319f94d 100644 --- a/examples/wagemos-graz-nextjs/CHANGELOG.md +++ b/examples/wagemos-graz-nextjs/CHANGELOG.md @@ -1,5 +1,14 @@ # wagemos-graz-nextjs +## 0.3.25 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/core@1.4.0 + - @abstract-money/react@1.4.0 + - @abstract-money/provider-graz@6.0.0 + ## 0.3.24 ### Patch Changes diff --git a/examples/wagemos-graz-nextjs/package.json b/examples/wagemos-graz-nextjs/package.json index 8d3ea3e3..4397df81 100644 --- a/examples/wagemos-graz-nextjs/package.json +++ b/examples/wagemos-graz-nextjs/package.json @@ -1,6 +1,6 @@ { "name": "wagemos-graz-nextjs", - "version": "0.3.24", + "version": "0.3.25", "private": true, "scripts": { "dev": "NODE_OPTIONS='--inspect' next dev", diff --git a/packages/cli/package.json b/packages/cli/package.json index 8deaed16..64333fcb 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -36,7 +36,7 @@ "type": "module", "dependencies": { "@abstract-money/bundle-require": "workspace:*", - "@abstract-money/ts-codegen": "^0.35.8", + "@abstract-money/ts-codegen": "0.36.0-beta-1", "@cosmjs/cosmwasm-stargate": "^0.32.3", "@cosmjs/stargate": "^0.32.3", "abort-controller": "^3.0.0", diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 49ab079f..94c888cb 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,25 @@ ## 0.1.0 +## 1.4.0 + +### Minor Changes + +- Update Abstract to 0.23 + + This change updates: + + - Abstract to 0.23 + - Chain registry to 0.60.60 + + Breaking changes: + + - `Manager.proposeOwnership` has been removed + + Semi-breaking changes: + + - Chain registry updating means that consumers will also need to update their chain registry + types + - Raw manager ownership query results have changed types. + ## 1.3.4 ### Patch Changes diff --git a/packages/core/abstract.config.ts b/packages/core/abstract.config.ts index 03a6a2ff..b1841fd5 100644 --- a/packages/core/abstract.config.ts +++ b/packages/core/abstract.config.ts @@ -4,31 +4,31 @@ import { registry, vanilla } from '@abstract-money/cli/plugins' const contractsConfig = [ { name: 'manager', - version: '0.23.0-beta.0', + version: '0.23.0', }, { name: 'proxy', - version: '0.23.0-beta.0', + version: '0.23.0', }, { name: 'module-factory', - version: '0.23.0-beta.0', + version: '0.23.0', }, { name: 'version-control', - version: '0.23.0-beta.0', + version: '0.23.0', }, { name: 'ans-host', - version: '0.23.0-beta.0', + version: '0.23.0', }, { name: 'account-factory', - version: '0.23.0-beta.0', + version: '0.23.0', }, { name: 'ibc-client', - version: '0.23.0-beta.0', + version: '0.23.0', }, ] diff --git a/packages/core/package.json b/packages/core/package.json index c1a00f80..6d92c720 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@abstract-money/core", - "version": "1.3.4", + "version": "1.4.0", "description": "Typings for Abstract smart contracts", "homepage": "https://github.com/AbstractSDK/abstract.js#readme", "author": "adairrr ", @@ -27,7 +27,7 @@ }, "dependencies": { "@abstract-money/cosmwasm-utils": "workspace:*", - "@chain-registry/types": "^0.13.1", + "@chain-registry/types": "^0.45.50", "@cosmjs/cosmwasm-stargate": "^0.32.3", "@cosmjs/encoding": "^0.32.3", "@cosmjs/proto-signing": "^0.32.3", @@ -35,7 +35,7 @@ "@cosmjs/tendermint-rpc": "^0.32.3", "@rimbu/bimap": "^1.1.1", "bech32": "^2.0.0", - "chain-registry": "^1.18.1", + "chain-registry": "^1.63.60", "cosmjs-types": "^0.9.0", "graphql-request": "^6.1.0", "lodash": "^4.17.21", diff --git a/packages/core/src/actions/account/wallet/propose-owner.ts b/packages/core/src/actions/account/wallet/propose-owner.ts deleted file mode 100644 index 5a914f44..00000000 --- a/packages/core/src/actions/account/wallet/propose-owner.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { ManagerClient } from '../../../codegen/abstract' -import { Action } from '../../../codegen/abstract/cosmwasm-codegen/Manager.types' -import { WithCosmWasmSignOptions } from '../../../types/parameters' -import { getManagerClientFromApi } from './get-manager-client-from-api' -import { BaseAccountWalletParameters } from './types' - -export type ProposeOwnerParameters = WithCosmWasmSignOptions< - BaseAccountWalletParameters & - Parameters[0] -> - -export async function proposeOwner({ - accountId, - signingCosmWasmClient, - apiUrl, - sender, - fee, - memo, - funds, - ...rest -}: ProposeOwnerParameters) { - const managerClient = await getManagerClientFromApi({ - accountId, - signingCosmWasmClient, - sender, - apiUrl, - }) - return managerClient.proposeOwner({ ...rest }, fee, memo, funds) -} diff --git a/packages/core/src/actions/account/wallet/update-ownership.ts b/packages/core/src/actions/account/wallet/update-ownership.ts index 834e99b6..2dce635d 100644 --- a/packages/core/src/actions/account/wallet/update-ownership.ts +++ b/packages/core/src/actions/account/wallet/update-ownership.ts @@ -1,12 +1,11 @@ -import { ManagerClient } from '../../../codegen/abstract' -import { Action } from '../../../codegen/abstract/cosmwasm-codegen/Manager.types' +import { GovAction } from '../../../codegen/abstract/cosmwasm-codegen/Manager.types' import { WithCosmWasmSignOptions } from '../../../types/parameters' import { getManagerClientFromApi } from './get-manager-client-from-api' import { BaseAccountWalletParameters } from './types' export type UpdateOwnershipParameters = WithCosmWasmSignOptions< BaseAccountWalletParameters & { - update: Action + update: GovAction } > diff --git a/packages/core/src/clients/decorators/account-wallet.ts b/packages/core/src/clients/decorators/account-wallet.ts index 510e0cc5..199a9b97 100644 --- a/packages/core/src/clients/decorators/account-wallet.ts +++ b/packages/core/src/clients/decorators/account-wallet.ts @@ -12,7 +12,6 @@ import { executeRemote } from '../../actions/account/wallet/execute-remote' import { getManagerClientFromApi } from '../../actions/account/wallet/get-manager-client-from-api' import { getProxyClientFromApi } from '../../actions/account/wallet/get-proxy-client-from-api' import { installModules } from '../../actions/account/wallet/install-modules' -import { proposeOwner } from '../../actions/account/wallet/propose-owner' import { revokeNamespace } from '../../actions/account/wallet/remove-namespace' import { requestFundsFromRemote } from '../../actions/account/wallet/request-remote-funds' import { sendFundsToRemote } from '../../actions/account/wallet/send-funds-to-remote' @@ -138,11 +137,6 @@ export type AccountWalletActions = { typeof updateOwnership >, ): ReturnType - proposeOwner( - parameters: ExtractAndPartializeDecoratedParametersFromParameters< - typeof proposeOwner - >, - ): ReturnType enableIbc( parameters: ExtractAndPartializeDecoratedParametersFromParameters< typeof enableIbc @@ -319,15 +313,6 @@ export function accountWalletActions( ...parameters, ...extra, }), - proposeOwner: ({ extra, ...parameters }) => - proposeOwner({ - accountId, - signingCosmWasmClient, - apiUrl, - sender, - ...parameters, - ...extra, - }), enableIbc: ({ extra, ...parameters }) => enableIbc({ accountId, diff --git a/packages/core/src/legacy/clients/AbstractAccountClient.ts b/packages/core/src/legacy/clients/AbstractAccountClient.ts index 43091f92..b05009c1 100644 --- a/packages/core/src/legacy/clients/AbstractAccountClient.ts +++ b/packages/core/src/legacy/clients/AbstractAccountClient.ts @@ -6,7 +6,7 @@ import { import { type JsonObject } from '@cosmjs/cosmwasm-stargate/build/modules' import { type Coin } from '@cosmjs/stargate' import { type StdFee } from '@cosmjs/stargate' -import { match } from 'ts-pattern' +import { P, match } from 'ts-pattern' import { ManagerClient, ManagerExecuteMsgBuilder, @@ -22,6 +22,7 @@ import { } from '../../codegen/abstract' type ManagerModuleInfo = ManagerTypes.ManagerModuleInfo +type GovernanceDetails = ManagerTypes.GovernanceDetailsForString type CosmosMsgForEmpty = ProxyTypes.CosmosMsgForEmpty import { ABSTRACT_CONSTANTS } from '../constants' import { @@ -34,9 +35,11 @@ import { AdapterQueryMsgBuilder, } from '../generics/adapter/Adapter.msg-factory' type ModuleReference = VersionControlTypes.ModuleReference +import semver from 'semver/preload' import { jsonToBinary } from '../../utils/encoding' import { ContractMsg, EncodedMsg } from '../messages' import { type AbstractClient, type AbstractQueryClient } from './AbstractClient' +import { rawQuery } from './helpers' import { AbstractAccountId } from './objects/AbstractAccountId' import { AnsAssetList } from './objects/AnsAssetList' import { AssetInfo } from './objects/AssetInfo' @@ -215,6 +218,18 @@ export class AbstractAccountQueryClient implements IAbstractAccountQueryClient { return namespace ?? null } + public async managerVersion(): Promise { + const { version } = await rawQuery<{ + contract: string + version: string + }>({ + readOnlyClient: this.managerQueryClient.client, + address: this.managerQueryClient.contractAddress, + key: 'contract_info', + }) + return version + } + /** * Return the owner of the Account. * @@ -223,16 +238,36 @@ export class AbstractAccountQueryClient implements IAbstractAccountQueryClient { */ public async getOwner(invalidateCache?: boolean): Promise { if (invalidateCache || this._owner === undefined) { - this._owner = await this.managerQueryClient + const version = await this.managerVersion() + + const owner = (await this.managerQueryClient .ownership() - .then((res) => res.owner ?? null) - .catch((error) => { - console.error('Failed to fetch the owner:', error) - throw error - }) + .then(({ owner }) => owner)) as unknown + + // > 0.23.0 returns the full governance type + if (semver.gte(version, '0.23.0')) { + const governance = owner as unknown as GovernanceDetails + + this._owner = match(governance) + .with({ Monarchy: { monarch: P.select() } }, (monarch) => monarch) + .with({ SubAccount: { proxy: P.select() } }, (proxy) => proxy) + .with({ Renounced: {} }, () => null) + .with({ NFT: { collection_addr: P.select() } }, (col) => col) + .with({ External: { governance_address: P.select() } }, (ext) => ext) + .otherwise((e) => { + console.warn( + `Unknown governance type for ${ + this.managerAddress + }: ${JSON.stringify(e)}`, + ) + return JSON.stringify(e) + }) + } else { + this._owner = owner as string + } } - return this._owner + return this._owner ?? null } /** diff --git a/packages/provider-cosmoskit/CHANGELOG.md b/packages/provider-cosmoskit/CHANGELOG.md index 40185fa6..4310c7ad 100644 --- a/packages/provider-cosmoskit/CHANGELOG.md +++ b/packages/provider-cosmoskit/CHANGELOG.md @@ -1,5 +1,12 @@ # @abstract-money/provider-cosmoskit +## 6.0.0 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/react@1.4.0 + ## 5.0.11 ### Patch Changes diff --git a/packages/provider-cosmoskit/package.json b/packages/provider-cosmoskit/package.json index c08e4d2d..2c7b5641 100644 --- a/packages/provider-cosmoskit/package.json +++ b/packages/provider-cosmoskit/package.json @@ -1,6 +1,6 @@ { "name": "@abstract-money/provider-cosmoskit", - "version": "5.0.11", + "version": "6.0.0", "description": "Provider for CosmosKit", "homepage": "https://github.com/AbstractSDK/abstract.js#readme", "author": "dalechyn ", diff --git a/packages/provider-graz/CHANGELOG.md b/packages/provider-graz/CHANGELOG.md index 3b7f38ec..32ce74eb 100644 --- a/packages/provider-graz/CHANGELOG.md +++ b/packages/provider-graz/CHANGELOG.md @@ -1,5 +1,13 @@ # @abstract-money/provider-graz +## 6.0.0 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/core@1.4.0 + - @abstract-money/react@1.4.0 + ## 5.0.11 ### Patch Changes diff --git a/packages/provider-graz/package.json b/packages/provider-graz/package.json index 815c5baf..f3b548f4 100644 --- a/packages/provider-graz/package.json +++ b/packages/provider-graz/package.json @@ -1,6 +1,6 @@ { "name": "@abstract-money/provider-graz", - "version": "5.0.11", + "version": "6.0.0", "description": "Provider for Graz", "homepage": "https://github.com/AbstractSDK/abstract.js#readme", "author": "dalechyn ", diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index bda34886..074d8aa6 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -1,5 +1,30 @@ # @abstract-money/react +## 1.4.0 + +### Minor Changes + +- Update Abstarct to 0.23 + + This change updates: + + - Abstract to 0.23 + - Chain registry to 0.60.60 + + Breaking changes: + + - `Manager.proposeOwnership` has been removed + + Semi-breaking changes: + + - Chain registry updating means that consumers will also need to update their chain registry + types + - Raw manager ownership query results have changed types. + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/core@1.4.0 + ## 1.3.11 ### Patch Changes diff --git a/packages/react/package.json b/packages/react/package.json index c142b59a..67c71d3c 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@abstract-money/react", - "version": "1.3.11", + "version": "1.4.0", "description": "React Hooks for Abstract SDK", "homepage": "https://github.com/AbstractSDK/abstract.js#readme", "author": "dalechyn ", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index aa0e3f1a..14d96bc2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -105,8 +105,8 @@ importers: specifier: workspace:* version: link:../../packages/react '@chain-registry/types': - specifier: ^0.13.1 - version: 0.13.1 + specifier: ^0.45.50 + version: 0.45.50 '@cosmjs/stargate': specifier: ^0.32.3 version: 0.32.3 @@ -141,8 +141,8 @@ importers: specifier: ^5.40.0 version: 5.40.0(@tanstack/react-query@4.36.1)(react@18.2.0) chain-registry: - specifier: ^1.18.1 - version: 1.20.0 + specifier: ^1.63.60 + version: 1.63.60 class-variance-authority: specifier: ^0.7.0 version: 0.7.0 @@ -357,8 +357,8 @@ importers: specifier: workspace:* version: link:../bundle-require '@abstract-money/ts-codegen': - specifier: ^0.35.8 - version: 0.35.8 + specifier: 0.36.0-beta-1 + version: 0.36.0-beta-1 '@cosmjs/cosmwasm-stargate': specifier: ^0.32.3 version: 0.32.3 @@ -448,8 +448,8 @@ importers: specifier: workspace:* version: link:../cosmwasm-utils '@chain-registry/types': - specifier: ^0.13.1 - version: 0.13.1 + specifier: ^0.45.50 + version: 0.45.50 '@cosmjs/cosmwasm-stargate': specifier: ^0.32.3 version: 0.32.3 @@ -472,8 +472,8 @@ importers: specifier: ^2.0.0 version: 2.0.0 chain-registry: - specifier: ^1.18.1 - version: 1.25.0 + specifier: ^1.63.60 + version: 1.63.60 cosmjs-types: specifier: ^0.9.0 version: 0.9.0 @@ -683,8 +683,8 @@ importers: packages: - /@abstract-money/ts-codegen@0.35.8: - resolution: {integrity: sha512-nKDjKS6RgiV4CFeP04OkgtHtnZJaqZcfMIo58Uknnyh8wimTT+TArGfIRC2m78lwDnKD3g0WF3yH6we12bQ8aQ==} + /@abstract-money/ts-codegen@0.36.0-beta-1: + resolution: {integrity: sha512-+OD9+vda4ukCouLAVNZoujaiYIB0rTbJ73qQiUNtx1hQ5K0CdGycTWQ/Mo6i6quivbm0auOLEwN7t/aBLpq8FA==} hasBin: true dependencies: '@babel/core': 7.18.10 @@ -713,13 +713,13 @@ packages: parse-package-name: 1.0.0 rimraf: 3.0.2 shelljs: 0.8.5 - wasm-ast-types: /@abstract-money/wasm-ast-types@0.26.7 + wasm-ast-types: /@abstract-money/wasm-ast-types@0.27.0-beta-1 transitivePeerDependencies: - supports-color dev: false - /@abstract-money/wasm-ast-types@0.26.7: - resolution: {integrity: sha512-hUs2s+EZyEeOhWRDOW9Y27dnXf+Cy/QxfkU1pR8f6a8pn9+qYYzUg+EXOTqEMi0jhngqcyFVFHQ76O84UYB8/A==} + /@abstract-money/wasm-ast-types@0.27.0-beta-1: + resolution: {integrity: sha512-zi2uEYpfBzIr+tyHzv6XyM83ttZVDWqUIJf54IoaH2ky5I/+L89442l94ih73OZVUcFhSqKbpoOevkqCGw50bA==} dependencies: '@babel/runtime': 7.23.4 '@babel/types': 7.18.10 @@ -2518,12 +2518,6 @@ packages: semver: 7.5.4 dev: false - /@chain-registry/types@0.13.1: - resolution: {integrity: sha512-NF4x7pqkQJ/zSQLoT28sYlBdzWUyCTFvWgVE9hJ2jkirX+It9VUHP5j1wtTq+vxQ74SZk2V8vRBo2uuoEYBB1A==} - dependencies: - '@babel/runtime': 7.23.4 - dev: false - /@chain-registry/types@0.17.0: resolution: {integrity: sha512-lavACU4oDxioUy8lZOFZN0Vrr2qR+Dg2yEh/mkrPfOldcioavREXJou0elDyyXwq4pGLC5YQ+IISCtQ4Du0bdw==} dependencies: @@ -2535,6 +2529,10 @@ packages: '@babel/runtime': 7.23.4 dev: false + /@chain-registry/types@0.45.50: + resolution: {integrity: sha512-lnGZnwuyeVV4lhMs8sFToQWJ8v0pNOu+I2y+elm+dHjMLhYZpJrACDjmK89HG20jGf30sWWLprlTO9EpfmDi5w==} + dev: false + /@changesets/apply-release-plan@6.1.4: resolution: {integrity: sha512-FMpKF1fRlJyCZVYHr3CbinpZZ+6MwvOtWUuO8uo+svcATEoc1zRDcj23pAurJ2TZ/uVz1wFHH6K3NlACy0PLew==} dependencies: @@ -9722,18 +9720,10 @@ packages: pathval: 1.1.1 type-detect: 4.0.8 - /chain-registry@1.20.0: - resolution: {integrity: sha512-kBeQVdopECXasauhaA+HiJNSB0UpzNmxtv5AvIpJBAZc3nuM2wzPxaHAiPz1OG5ifYwMraOkvPNxwOnXd1nZzw==} + /chain-registry@1.63.60: + resolution: {integrity: sha512-BrBsThP4Hpqyp/mLTiG1Np1bTCHrvpf0qw1c3usGnsSt2bUJWGlAVrkS6JbzwX3axZt5QmdwUqJqXNz22v8cnw==} dependencies: - '@babel/runtime': 7.23.4 - '@chain-registry/types': 0.17.0 - dev: false - - /chain-registry@1.25.0: - resolution: {integrity: sha512-u+i64OW5hBRGc1HZtZRr7Givgnj0uvcRV1XnJjPMBcSkEP0zTuMWg032HX7wpuu8C47I6aosQ00CGFDLfKtzSQ==} - dependencies: - '@babel/runtime': 7.23.4 - '@chain-registry/types': 0.17.1 + '@chain-registry/types': 0.45.50 dev: false /chalk-template@0.4.0: