From 092a808ff6d481916465f179f589268139715aec Mon Sep 17 00:00:00 2001 From: adairrr <32375605+adairrr@users.noreply.github.com> Date: Sat, 22 Jun 2024 15:34:18 +0200 Subject: [PATCH] Update helper type name, useUpdateInfo --- .../wagemos-cosmoskit-nextjs/CHANGELOG.md | 9 ++++ .../wagemos-cosmoskit-nextjs/package.json | 2 +- examples/wagemos-graz-nextjs/CHANGELOG.md | 9 ++++ examples/wagemos-graz-nextjs/package.json | 2 +- packages/core/CHANGELOG.md | 6 +++ packages/core/package.json | 2 +- .../account/wallet/create-remote-account.ts | 4 +- .../account/wallet/create-sub-account.ts | 4 +- .../src/actions/account/wallet/deposit.ts | 4 +- .../account/wallet/execute-ibc-action.ts | 4 +- .../account/wallet/execute-on-module.ts | 4 +- .../wallet/execute-on-remote-manager.ts | 4 +- .../wallet/execute-on-remote-module.ts | 4 +- .../actions/account/wallet/execute-remote.ts | 4 +- .../src/actions/account/wallet/execute.ts | 4 +- .../wallet/get-manager-client-from-api.ts | 4 +- .../wallet/get-proxy-client-from-api.ts | 4 +- .../actions/account/wallet/install-modules.ts | 4 +- .../actions/account/wallet/propose-owner.ts | 4 +- .../account/wallet/remove-namespace.ts | 4 +- .../account/wallet/request-remote-funds.ts | 4 +- .../account/wallet/send-funds-to-remote.ts | 4 +- .../core/src/actions/account/wallet/types.ts | 2 +- .../account/wallet/uninstall-module.ts | 4 +- .../src/actions/account/wallet/update-info.ts | 4 +- .../account/wallet/update-ownership.ts | 4 +- .../actions/account/wallet/update-status.ts | 4 +- .../actions/account/wallet/upgrade-modules.ts | 10 +++-- .../src/actions/account/wallet/withdraw.ts | 4 +- packages/provider-cosmoskit/CHANGELOG.md | 7 ++++ packages/provider-cosmoskit/package.json | 2 +- packages/provider-graz/CHANGELOG.md | 8 ++++ packages/provider-graz/package.json | 2 +- packages/react/CHANGELOG.md | 9 ++++ packages/react/package.json | 2 +- .../react/src/hooks/account/wallet/index.ts | 1 + .../hooks/account/wallet/use-update-info.ts | 41 +++++++++++++++++++ 37 files changed, 146 insertions(+), 52 deletions(-) create mode 100644 packages/react/src/hooks/account/wallet/use-update-info.ts diff --git a/examples/wagemos-cosmoskit-nextjs/CHANGELOG.md b/examples/wagemos-cosmoskit-nextjs/CHANGELOG.md index 0bd1542c..b3a75448 100644 --- a/examples/wagemos-cosmoskit-nextjs/CHANGELOG.md +++ b/examples/wagemos-cosmoskit-nextjs/CHANGELOG.md @@ -1,5 +1,14 @@ # wagemos-cosmoskit-nextjs +## 0.3.19 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/core@1.3.3 + - @abstract-money/react@1.3.6 + - @abstract-money/provider-cosmoskit@5.0.6 + ## 0.3.18 ### Patch Changes diff --git a/examples/wagemos-cosmoskit-nextjs/package.json b/examples/wagemos-cosmoskit-nextjs/package.json index 941a76dd..80fffb5f 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.18", + "version": "0.3.19", "private": true, "scripts": { "dev": "next dev", diff --git a/examples/wagemos-graz-nextjs/CHANGELOG.md b/examples/wagemos-graz-nextjs/CHANGELOG.md index 704673d0..f0a5c02e 100644 --- a/examples/wagemos-graz-nextjs/CHANGELOG.md +++ b/examples/wagemos-graz-nextjs/CHANGELOG.md @@ -1,5 +1,14 @@ # wagemos-graz-nextjs +## 0.3.19 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/core@1.3.3 + - @abstract-money/react@1.3.6 + - @abstract-money/provider-graz@5.0.6 + ## 0.3.18 ### Patch Changes diff --git a/examples/wagemos-graz-nextjs/package.json b/examples/wagemos-graz-nextjs/package.json index f9983f4f..533f75ac 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.18", + "version": "0.3.19", "private": true, "scripts": { "dev": "NODE_OPTIONS='--inspect' next dev", diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 44ec69cb..1205a127 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,11 @@ ## 0.1.0 +## 1.3.3 + +### Patch Changes + +- Update inner base type and include useUpdateInfo + ## 1.3.2 ### Patch Changes diff --git a/packages/core/package.json b/packages/core/package.json index 3b120e89..17d51ca1 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@abstract-money/core", - "version": "1.3.2", + "version": "1.3.3", "description": "Typings for Abstract smart contracts", "homepage": "https://github.com/AbstractSDK/abstract.js#readme", "author": "adairrr ", diff --git a/packages/core/src/actions/account/wallet/create-remote-account.ts b/packages/core/src/actions/account/wallet/create-remote-account.ts index 9b4ed6ae..8e89e64d 100644 --- a/packages/core/src/actions/account/wallet/create-remote-account.ts +++ b/packages/core/src/actions/account/wallet/create-remote-account.ts @@ -1,11 +1,11 @@ import { IbcClientTypes } from '../../../codegen/abstract' import { WithCosmWasmSignOptions } from '../../../types/parameters' import { executeIbcAction } from './execute-ibc-action' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' export type CreateRemoteAccountParameters = Omit< WithCosmWasmSignOptions< - BaseWalletParameters & + BaseAccountWalletParameters & Omit< Extract['register'], 'host_chain' | 'install_modules' diff --git a/packages/core/src/actions/account/wallet/create-sub-account.ts b/packages/core/src/actions/account/wallet/create-sub-account.ts index 31556117..a07ac21f 100644 --- a/packages/core/src/actions/account/wallet/create-sub-account.ts +++ b/packages/core/src/actions/account/wallet/create-sub-account.ts @@ -1,10 +1,10 @@ import { ManagerClient } from '../../../codegen/abstract' import { WithCosmWasmSignOptions } from '../../../types/parameters' import { getManagerClientFromApi } from './get-manager-client-from-api' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' export type CreateSubAccountParameters = WithCosmWasmSignOptions< - BaseWalletParameters & + BaseAccountWalletParameters & Omit< Parameters[0], 'accountId' diff --git a/packages/core/src/actions/account/wallet/deposit.ts b/packages/core/src/actions/account/wallet/deposit.ts index 455d8c0a..b359c407 100644 --- a/packages/core/src/actions/account/wallet/deposit.ts +++ b/packages/core/src/actions/account/wallet/deposit.ts @@ -1,11 +1,11 @@ import { WithCosmWasmSignOptions } from '../../../types/parameters' import { Asset, encodeAssetsTransfersMsgs } from '../../../utils/assets' import { getAccountBaseAddressesFromApi } from '../public/get-account-base-addresses-from-api' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' export type DepositParameters = Omit< WithCosmWasmSignOptions< - BaseWalletParameters & { + BaseAccountWalletParameters & { assets: Asset[] } >, diff --git a/packages/core/src/actions/account/wallet/execute-ibc-action.ts b/packages/core/src/actions/account/wallet/execute-ibc-action.ts index cdb2c45f..52b2150f 100644 --- a/packages/core/src/actions/account/wallet/execute-ibc-action.ts +++ b/packages/core/src/actions/account/wallet/execute-ibc-action.ts @@ -8,11 +8,11 @@ import { CommonModuleNames } from '../../public/types' import { getModuleAddress } from '../public/get-module-address' import { getModuleVersion } from '../public/get-module-version' import { executeOnModule } from './execute-on-module' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' export type ExecuteIbcActionParameters = Omit< WithCosmWasmSignOptions< - BaseWalletParameters & { + BaseAccountWalletParameters & { msg: IbcClientTypes.ExecuteMsg } >, diff --git a/packages/core/src/actions/account/wallet/execute-on-module.ts b/packages/core/src/actions/account/wallet/execute-on-module.ts index 3164b574..0beb2a2c 100644 --- a/packages/core/src/actions/account/wallet/execute-on-module.ts +++ b/packages/core/src/actions/account/wallet/execute-on-module.ts @@ -3,13 +3,13 @@ import { ModuleType } from '../../../codegen/gql/graphql' import { WithCosmWasmSignOptions } from '../../../types/parameters' import { encodeModuleMsg } from '../../../utils/modules/encode-module-msg' import { getAccountBaseAddressesFromApi } from '../public/get-account-base-addresses-from-api' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' type Base64EncodedJson = string export type ExecuteOnModuleParameters = Omit< WithCosmWasmSignOptions< - BaseWalletParameters & { + BaseAccountWalletParameters & { moduleId: string moduleType?: ModuleType moduleMsg: Record | Base64EncodedJson diff --git a/packages/core/src/actions/account/wallet/execute-on-remote-manager.ts b/packages/core/src/actions/account/wallet/execute-on-remote-manager.ts index 3983a8fd..c52b1468 100644 --- a/packages/core/src/actions/account/wallet/execute-on-remote-manager.ts +++ b/packages/core/src/actions/account/wallet/execute-on-remote-manager.ts @@ -2,11 +2,11 @@ import { IbcClientTypes, ManagerTypes } from '../../../codegen/abstract' import { WithCosmWasmSignOptions } from '../../../types/parameters' import { MaybeArray } from '../../../types/utils' import { executeIbcAction } from './execute-ibc-action' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' export type ExecuteOnRemoteParameters = Omit< WithCosmWasmSignOptions< - BaseWalletParameters & { + BaseAccountWalletParameters & { hostChainName: string managerMsg: MaybeArray } diff --git a/packages/core/src/actions/account/wallet/execute-on-remote-module.ts b/packages/core/src/actions/account/wallet/execute-on-remote-module.ts index d54053de..d724b109 100644 --- a/packages/core/src/actions/account/wallet/execute-on-remote-module.ts +++ b/packages/core/src/actions/account/wallet/execute-on-remote-module.ts @@ -6,13 +6,13 @@ import { executeOnModuleMsg, } from '../../../utils/modules/encode-module-msg' import { executeOnRemoteManager } from './execute-on-remote-manager' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' type Base64EncodedJson = string export type ExecuteOnRemoteModuleParameters = Omit< WithCosmWasmSignOptions< - BaseWalletParameters & { + BaseAccountWalletParameters & { hostChainName: string moduleId: string moduleType?: ModuleType diff --git a/packages/core/src/actions/account/wallet/execute-remote.ts b/packages/core/src/actions/account/wallet/execute-remote.ts index 6071a3b8..06c4e3ad 100644 --- a/packages/core/src/actions/account/wallet/execute-remote.ts +++ b/packages/core/src/actions/account/wallet/execute-remote.ts @@ -11,11 +11,11 @@ import { encodeModuleMsg } from '../../../utils/modules/encode-module-msg' import { CommonModuleNames } from '../../public/types' import { executeOnRemoteManager } from './execute-on-remote-manager' import { executeOnRemoteModule } from './execute-on-remote-module' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' export type ExecuteOnRemoteParameters = Omit< WithCosmWasmSignOptions< - BaseWalletParameters & { + BaseAccountWalletParameters & { hostChainName: string msgs: MaybeArray } diff --git a/packages/core/src/actions/account/wallet/execute.ts b/packages/core/src/actions/account/wallet/execute.ts index d5d031de..6299477e 100644 --- a/packages/core/src/actions/account/wallet/execute.ts +++ b/packages/core/src/actions/account/wallet/execute.ts @@ -2,14 +2,14 @@ import { ProxyExecuteMsgBuilder, ProxyTypes } from '../../../codegen/abstract' import { ModuleType } from '../../../codegen/gql/graphql' import { MaybeArray } from '../../../types/utils' import { executeOnModule } from './execute-on-module' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' import { WithCosmWasmSignOptions } from '../../../types/parameters' import { abstractModuleId } from '../../../utils/modules/abstract-module-id' import { CommonModuleNames } from '../../public/types' export type ExecuteParameters = Omit< WithCosmWasmSignOptions< - BaseWalletParameters & { + BaseAccountWalletParameters & { msgs: MaybeArray } >, diff --git a/packages/core/src/actions/account/wallet/get-manager-client-from-api.ts b/packages/core/src/actions/account/wallet/get-manager-client-from-api.ts index d2db18dd..954bc5c4 100644 --- a/packages/core/src/actions/account/wallet/get-manager-client-from-api.ts +++ b/packages/core/src/actions/account/wallet/get-manager-client-from-api.ts @@ -1,8 +1,8 @@ import { getManagerClient } from '../../wallet/get-manager-client' import { getAccountBaseAddressesFromApi } from '../public/get-account-base-addresses-from-api' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' -export type GetManagerClientFromApiParameters = BaseWalletParameters +export type GetManagerClientFromApiParameters = BaseAccountWalletParameters export async function getManagerClientFromApi({ accountId, diff --git a/packages/core/src/actions/account/wallet/get-proxy-client-from-api.ts b/packages/core/src/actions/account/wallet/get-proxy-client-from-api.ts index d963249f..beaf6226 100644 --- a/packages/core/src/actions/account/wallet/get-proxy-client-from-api.ts +++ b/packages/core/src/actions/account/wallet/get-proxy-client-from-api.ts @@ -1,8 +1,8 @@ import { getProxyClient } from '../../wallet/get-proxy-client' import { getAccountBaseAddressesFromApi } from '../public/get-account-base-addresses-from-api' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' -export type GetProxyClientFromApiParameters = BaseWalletParameters +export type GetProxyClientFromApiParameters = BaseAccountWalletParameters export async function getProxyClientFromApi({ accountId, diff --git a/packages/core/src/actions/account/wallet/install-modules.ts b/packages/core/src/actions/account/wallet/install-modules.ts index 7c799530..562f30d5 100644 --- a/packages/core/src/actions/account/wallet/install-modules.ts +++ b/packages/core/src/actions/account/wallet/install-modules.ts @@ -2,10 +2,10 @@ import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' import { ManagerClient, VersionControlTypes } from '../../../codegen/abstract' import { WithCosmWasmSignOptions } from '../../../types/parameters' import { getManagerClientFromApi } from './get-manager-client-from-api' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' export type InstallModulesParameters = WithCosmWasmSignOptions< - BaseWalletParameters & + BaseAccountWalletParameters & Parameters[0] > diff --git a/packages/core/src/actions/account/wallet/propose-owner.ts b/packages/core/src/actions/account/wallet/propose-owner.ts index f66c7c11..5a914f44 100644 --- a/packages/core/src/actions/account/wallet/propose-owner.ts +++ b/packages/core/src/actions/account/wallet/propose-owner.ts @@ -2,10 +2,10 @@ 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 { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' export type ProposeOwnerParameters = WithCosmWasmSignOptions< - BaseWalletParameters & + BaseAccountWalletParameters & Parameters[0] > diff --git a/packages/core/src/actions/account/wallet/remove-namespace.ts b/packages/core/src/actions/account/wallet/remove-namespace.ts index 0a525448..54123a7f 100644 --- a/packages/core/src/actions/account/wallet/remove-namespace.ts +++ b/packages/core/src/actions/account/wallet/remove-namespace.ts @@ -1,10 +1,10 @@ import { WithCosmWasmSignOptions } from '../../../types/parameters' import { getVersionControlClientFromApi } from '../../wallet/get-version-control-client-from-api' import { getNamespace } from '../public/get-namespace' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' export type RevokeNamespaceParameters = - WithCosmWasmSignOptions + WithCosmWasmSignOptions export async function revokeNamespace({ accountId, diff --git a/packages/core/src/actions/account/wallet/request-remote-funds.ts b/packages/core/src/actions/account/wallet/request-remote-funds.ts index cc7ca99c..243780a9 100644 --- a/packages/core/src/actions/account/wallet/request-remote-funds.ts +++ b/packages/core/src/actions/account/wallet/request-remote-funds.ts @@ -1,11 +1,11 @@ import { IbcClientTypes } from '../../../codegen/abstract' import { WithCosmWasmSignOptions } from '../../../types/parameters' import { executeIbcAction } from './execute-ibc-action' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' export type RequestFundsFromRemoteParameters = Omit< WithCosmWasmSignOptions< - BaseWalletParameters & { + BaseAccountWalletParameters & { hostChainName: string } >, diff --git a/packages/core/src/actions/account/wallet/send-funds-to-remote.ts b/packages/core/src/actions/account/wallet/send-funds-to-remote.ts index c203bd9b..47415393 100644 --- a/packages/core/src/actions/account/wallet/send-funds-to-remote.ts +++ b/packages/core/src/actions/account/wallet/send-funds-to-remote.ts @@ -3,11 +3,11 @@ import { WithCosmWasmSignOptions } from '../../../types/parameters' import { MaybeArray } from '../../../types/utils' import { Asset, assetToNativeAsset } from '../../../utils/assets' import { executeIbcAction } from './execute-ibc-action' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' export type SendFundsToRemoteParameters = Omit< WithCosmWasmSignOptions< - BaseWalletParameters & { + BaseAccountWalletParameters & { hostChainName: string assets: MaybeArray } diff --git a/packages/core/src/actions/account/wallet/types.ts b/packages/core/src/actions/account/wallet/types.ts index 6dba3429..2aca6b21 100644 --- a/packages/core/src/actions/account/wallet/types.ts +++ b/packages/core/src/actions/account/wallet/types.ts @@ -1,7 +1,7 @@ import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' import { VersionControlTypes } from '../../../codegen/abstract' -export type BaseWalletParameters = { +export type BaseAccountWalletParameters = { accountId: VersionControlTypes.AccountId signingCosmWasmClient: SigningCosmWasmClient apiUrl: string diff --git a/packages/core/src/actions/account/wallet/uninstall-module.ts b/packages/core/src/actions/account/wallet/uninstall-module.ts index f5e75605..ea780dea 100644 --- a/packages/core/src/actions/account/wallet/uninstall-module.ts +++ b/packages/core/src/actions/account/wallet/uninstall-module.ts @@ -2,10 +2,10 @@ import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' import { ManagerClient, VersionControlTypes } from '../../../codegen/abstract' import { WithCosmWasmSignOptions } from '../../../types/parameters' import { getManagerClientFromApi } from './get-manager-client-from-api' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' export type UninstallModulesParameters = WithCosmWasmSignOptions< - BaseWalletParameters & + BaseAccountWalletParameters & Parameters[0] > diff --git a/packages/core/src/actions/account/wallet/update-info.ts b/packages/core/src/actions/account/wallet/update-info.ts index 1d14f110..921d73d5 100644 --- a/packages/core/src/actions/account/wallet/update-info.ts +++ b/packages/core/src/actions/account/wallet/update-info.ts @@ -1,10 +1,10 @@ import { ManagerClient } from '../../../codegen/abstract' import { WithCosmWasmSignOptions } from '../../../types/parameters' import { getManagerClientFromApi } from './get-manager-client-from-api' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' export type UpdateInfoParameters = WithCosmWasmSignOptions< - BaseWalletParameters & + BaseAccountWalletParameters & Parameters[0] > diff --git a/packages/core/src/actions/account/wallet/update-ownership.ts b/packages/core/src/actions/account/wallet/update-ownership.ts index cd8d8f4f..834e99b6 100644 --- a/packages/core/src/actions/account/wallet/update-ownership.ts +++ b/packages/core/src/actions/account/wallet/update-ownership.ts @@ -2,10 +2,10 @@ 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 { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' export type UpdateOwnershipParameters = WithCosmWasmSignOptions< - BaseWalletParameters & { + BaseAccountWalletParameters & { update: Action } > diff --git a/packages/core/src/actions/account/wallet/update-status.ts b/packages/core/src/actions/account/wallet/update-status.ts index 3b28938d..a910cf38 100644 --- a/packages/core/src/actions/account/wallet/update-status.ts +++ b/packages/core/src/actions/account/wallet/update-status.ts @@ -1,10 +1,10 @@ import { ManagerClient } from '../../../codegen/abstract' import { WithCosmWasmSignOptions } from '../../../types/parameters' import { getManagerClientFromApi } from './get-manager-client-from-api' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' export type UpdateStatusParameters = WithCosmWasmSignOptions< - BaseWalletParameters & + BaseAccountWalletParameters & Parameters[0] > diff --git a/packages/core/src/actions/account/wallet/upgrade-modules.ts b/packages/core/src/actions/account/wallet/upgrade-modules.ts index 75c1a672..141ab3d2 100644 --- a/packages/core/src/actions/account/wallet/upgrade-modules.ts +++ b/packages/core/src/actions/account/wallet/upgrade-modules.ts @@ -2,14 +2,18 @@ import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' import { ManagerClient, VersionControlTypes } from '../../../codegen/abstract' import { WithCosmWasmSignOptions } from '../../../types/parameters' import { getManagerClientFromApi } from './get-manager-client-from-api' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' export type UpgradeModulesParameters = WithCosmWasmSignOptions< - BaseWalletParameters & Parameters[0] + BaseAccountWalletParameters & + Omit[0], 'accountId'> & { + subAccountId?: number + } > export async function upgradeModules({ accountId, + subAccountId, signingCosmWasmClient, apiUrl, sender, @@ -19,7 +23,7 @@ export async function upgradeModules({ ...rest }: UpgradeModulesParameters) { const managerClient = await getManagerClientFromApi({ - accountId, + accountId: subAccountId ? { ...accountId, seq: subAccountId } : accountId, signingCosmWasmClient, sender, apiUrl, diff --git a/packages/core/src/actions/account/wallet/withdraw.ts b/packages/core/src/actions/account/wallet/withdraw.ts index 2fb9227a..56fa6e81 100644 --- a/packages/core/src/actions/account/wallet/withdraw.ts +++ b/packages/core/src/actions/account/wallet/withdraw.ts @@ -2,10 +2,10 @@ import { WithCosmWasmSignOptions } from '../../../types/parameters' import { Asset, encodeAssetsProxyTransferMsgs } from '../../../utils/assets' import { getAccountBaseAddressesFromApi } from '../public/get-account-base-addresses-from-api' import { execute } from './execute' -import { BaseWalletParameters } from './types' +import { BaseAccountWalletParameters } from './types' export type WithdrawParameters = WithCosmWasmSignOptions< - BaseWalletParameters & { + BaseAccountWalletParameters & { assets: Asset[] recipient: string } diff --git a/packages/provider-cosmoskit/CHANGELOG.md b/packages/provider-cosmoskit/CHANGELOG.md index e9751018..cbc66711 100644 --- a/packages/provider-cosmoskit/CHANGELOG.md +++ b/packages/provider-cosmoskit/CHANGELOG.md @@ -1,5 +1,12 @@ # @abstract-money/provider-cosmoskit +## 5.0.6 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/react@1.3.6 + ## 5.0.5 ### Patch Changes diff --git a/packages/provider-cosmoskit/package.json b/packages/provider-cosmoskit/package.json index f96dcd31..e6920ef1 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.5", + "version": "5.0.6", "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 c660e7dd..effdbddd 100644 --- a/packages/provider-graz/CHANGELOG.md +++ b/packages/provider-graz/CHANGELOG.md @@ -1,5 +1,13 @@ # @abstract-money/provider-graz +## 5.0.6 + +### Patch Changes + +- Updated dependencies []: + - @abstract-money/core@1.3.3 + - @abstract-money/react@1.3.6 + ## 5.0.5 ### Patch Changes diff --git a/packages/provider-graz/package.json b/packages/provider-graz/package.json index 52428854..195dd086 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.5", + "version": "5.0.6", "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 3db8723c..a63222e5 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -1,5 +1,14 @@ # @abstract-money/react +## 1.3.6 + +### Patch Changes + +- Update inner base type and include useUpdateInfo + +- Updated dependencies []: + - @abstract-money/core@1.3.3 + ## 1.3.5 ### Patch Changes diff --git a/packages/react/package.json b/packages/react/package.json index 8bbd964a..c2084db9 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@abstract-money/react", - "version": "1.3.5", + "version": "1.3.6", "description": "React Hooks for Abstract SDK", "homepage": "https://github.com/AbstractSDK/abstract.js#readme", "author": "dalechyn ", diff --git a/packages/react/src/hooks/account/wallet/index.ts b/packages/react/src/hooks/account/wallet/index.ts index a18a5aa4..c20d500e 100644 --- a/packages/react/src/hooks/account/wallet/index.ts +++ b/packages/react/src/hooks/account/wallet/index.ts @@ -7,6 +7,7 @@ export * from './use-execute-on-remote-module' export * from './use-execute-remote' export * from './use-send-funds-to-remote' export * from './use-update-status' +export * from './use-update-info' export * from './use-update-settings' export * from './use-enable-ibc' export * from './use-upgrade-modules' diff --git a/packages/react/src/hooks/account/wallet/use-update-info.ts b/packages/react/src/hooks/account/wallet/use-update-info.ts new file mode 100644 index 00000000..905df356 --- /dev/null +++ b/packages/react/src/hooks/account/wallet/use-update-info.ts @@ -0,0 +1,41 @@ +import { AccountWalletClient } from '@abstract-money/core/clients' +import { AccountId } from '@abstract-money/core/utils' +import { useMutation } from '@tanstack/react-query' +import { useConfig } from '../../../contexts' +import { ExtractArgsFromParameters } from '../../../types/args' +import { UseMutationParameters } from '../../../types/queries' + +type UpdateInfoMutation = ExtractArgsFromParameters< + Parameters[0] +> + +export type UseUpdateInfoParameters = { + accountId: AccountId | undefined + chainName: string | undefined + mutation?: UseMutationParameters< + Awaited>, + unknown, + UpdateInfoMutation + > +} + +export function useUpdateInfo({ + accountId, + chainName, + mutation, +}: UseUpdateInfoParameters) { + const config = useConfig() + const accountClient = config.useAccountWalletClient({ + chainName, + accountId, + }) + + return useMutation( + ['updateInfo', chainName, accountId], + ({ args, ...cosmWasmSignOptions }) => { + if (!accountClient) throw new Error('accountClient is not defined') + return accountClient.updateInfo({ ...cosmWasmSignOptions, ...args }) + }, + mutation, + ) +}