Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ibc executions #74

Merged
merged 24 commits into from
May 1, 2024
Merged

feat: add ibc executions #74

merged 24 commits into from
May 1, 2024

Conversation

adairrr
Copy link
Contributor

@adairrr adairrr commented Mar 5, 2024

This change adds the following to the wallet client:

  • executeOnModule
  • createRemoteAccount
  • executeOnRemote
  • executeOnRemoteModule
  • sendFundsToRemote
  • requestFundsFromRemote

Based on usage in https://gist.github.com/adairrr/ace71687418275bb9880ba054e8fb9e2

THis also adds an example, which is currently NOT functional.

Copy link

changeset-bot bot commented Mar 5, 2024

🦋 Changeset detected

Latest commit: 328ba92

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
wagemos-cosmoskit-nextjs Patch
wagemos-graz-nextjs Patch
@abstract-money/cli Patch
@abstract-money/core Patch
@abstract-money/react Patch
@abstract-money/provider-graz Patch
@abstract-money/provider-cosmoskit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@adairrr adairrr requested a review from dalechyn March 5, 2024 22:24
WithArgsAndCosmWasmSignOptions<
BaseWalletParameters & {
hostChainName: string
assets: MaybeArray<Asset>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this should only be native assets since it only accepts native assets?

@@ -0,0 +1,16 @@
import { jsonToBinary } from '@abstract-money/core'
import { ModuleType } from '../../codegen/gql/graphql'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This module type might be the wrong one? Which one is preferred to use?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's always preferred to use types from the contracts codegen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IN the legacy SDK we used VariantKeys<ModuleReference> which we could use from the contracts codegen... thoughts?

Copy link
Contributor

github-actions bot commented Mar 5, 2024

Size Change: +3.05 kB (+3%)

Total Size: 113 kB

Filename Size Change
packages/cli/dist/plugins/index.js 1.56 kB +28 B (+2%)
packages/core/dist/actions 947 B -376 B (-28%) 🎉
packages/core/dist/actions/index.js 27.6 kB +17.8 kB (+181%) 🆘
packages/core/dist/chunk-7XPRIYC5.js 2.31 kB +839 B (+57%) 🆘
packages/core/dist/chunk-QY6KZ7QQ.js 0 B -131 B (removed) 🏆
packages/core/dist/clients 1.37 kB +125 B (+10%) ⚠️
packages/core/dist/clients/index.d.ts 2.49 kB -564 B (-18%) 👏
packages/core/dist/clients/index.js 8.4 kB +847 B (+11%) ⚠️
packages/core/dist/create-public-client-fGHWriNe.d.ts 0 B -1.07 kB (removed) 🏆
packages/core/dist/get-version-control-client-9d8hQI77.d.ts 0 B -772 B (removed) 🏆
packages/core/dist/index.d.ts 13.3 kB +14 B (0%)
packages/core/dist/index.js 427 B -17.3 kB (-98%) 🏆
packages/core/dist/legacy 2.56 kB +233 B (+10%) ⚠️
packages/core/dist/messages-yrJO8PfG.d.ts 0 B -3.61 kB (removed) 🏆
packages/core/dist/types-lUss04JZ.d.ts 0 B -715 B (removed) 🏆
packages/provider-cosmoskit/dist 2.7 kB +256 B (+10%) ⚠️
packages/provider-cosmoskit/dist/index.js 639 B +53 B (+9%) 🔍
packages/provider-graz/dist 318 B +20 B (+7%) 🔍
packages/provider-graz/dist/index.d.ts 4 kB +443 B (+12%) ⚠️
packages/provider-graz/dist/index.js 2.31 kB +49 B (+2%)
packages/react/dist 2.31 kB +20 B (+1%)
packages/core/dist/chunk-JGLUUNH5.js 130 B +130 B (new file) 🆕
packages/core/dist/create-public-client-yMkfjwtQ.d.ts 556 B +556 B (new file) 🆕
packages/core/dist/get-version-control-client-fqJA_Ltd.d.ts 1.08 kB +1.08 kB (new file) 🆕
packages/core/dist/get-version-control-query-client--LeVZzF2.d.ts 770 B +770 B (new file) 🆕
packages/core/dist/messages-UiKQKD8b.d.ts 3.62 kB +3.62 kB (new file) 🆕
packages/core/dist/types-NErMM4Nj.d.ts 715 B +715 B (new file) 🆕
ℹ️ View Unchanged
Filename Size Change
packages/bundle-require/dist 1.11 kB 0 B
packages/bundle-require/dist/index.d.ts 2 kB 0 B
packages/bundle-require/dist/index.js 4.68 kB 0 B
packages/cli/dist 150 B 0 B
packages/cli/dist/_tsup-dts-rollup.d.ts 379 B 0 B
packages/cli/dist/chunk-6C3VEZWH.js 153 B 0 B
packages/cli/dist/chunk-AOQH5JQO.js 1.4 kB 0 B
packages/cli/dist/chunk-B7QC3SVE.js 31 B 0 B
packages/cli/dist/chunk-ELQZQKSN.js 1.41 kB 0 B
packages/cli/dist/cli.d.ts 2.48 kB 0 B
packages/cli/dist/cli.js 113 B 0 B
packages/cli/dist/commands-RWJT77ZY.js 104 B 0 B
packages/cli/dist/config.d.ts 1.22 kB 0 B
packages/cli/dist/config.js 77 B 0 B
packages/cli/dist/cosmjs.d.ts 131 B 0 B
packages/cli/dist/cosmjs.js 150 B 0 B
packages/cli/dist/index.d.ts 0 B 0 B 🆕
packages/cli/dist/index.js 95 B 0 B
packages/cli/dist/plugins 4.97 kB 0 B
packages/cli/dist/plugins/index.d.ts 0 B 0 B 🆕
packages/core/dist 546 B 0 B
packages/core/dist/actions/index.d.ts 7.88 kB 0 B
packages/core/dist/chains-AF0KNDOG.d.ts 0 B 0 B 🆕
packages/core/dist/get-version-control-query-client-p66aRR4i.d.ts 0 B 0 B 🆕
packages/core/dist/legacy/index.d.ts 354 B 0 B
packages/core/dist/legacy/index.js 0 B 0 B 🆕
packages/core/dist/utils 829 B 0 B
packages/core/dist/utils/index.d.ts 591 B 0 B
packages/core/dist/utils/index.js 310 B 0 B
packages/cosmwasm-utils/dist 0 B 0 B 🆕
packages/cosmwasm-utils/dist/_tsup-dts-rollup.d.ts 189 B 0 B
packages/cosmwasm-utils/dist/chunk-3ETX6U3V.js 156 B 0 B
packages/cosmwasm-utils/dist/chunk-KTEV5PS3.js 170 B 0 B
packages/cosmwasm-utils/dist/client 182 B 0 B
packages/cosmwasm-utils/dist/client/index.d.ts 0 B 0 B 🆕
packages/cosmwasm-utils/dist/client/index.js 81 B 0 B
packages/cosmwasm-utils/dist/index.d.ts 77 B 0 B
packages/cosmwasm-utils/dist/index.js 109 B 0 B
packages/cosmwasm-utils/dist/query 478 B 0 B
packages/cosmwasm-utils/dist/query/index.d.ts 245 B 0 B
packages/cosmwasm-utils/dist/query/index.js 264 B 0 B
packages/provider-cosmoskit/dist/index.d.ts 0 B 0 B 🆕
packages/react/dist/chunk-IVDJTNYM.js 0 B 0 B 🆕
packages/react/dist/hooks 0 B 0 B 🆕
packages/react/dist/hooks/index.d.ts 0 B 0 B 🆕
packages/react/dist/hooks/index.js 0 B 0 B 🆕
packages/react/dist/index-tg905p31.d.ts 0 B 0 B 🆕
packages/react/dist/index.d.ts 0 B 0 B 🆕
packages/react/dist/index.js 0 B 0 B 🆕
packages/core/dist/chains-ECc0OxYe.d.ts 0 B 0 B 🆕
packages/core/dist/graphql-NLBVD9-A.d.ts 0 B 0 B 🆕
packages/react/dist/chunk-SKIZO7AP.js 0 B 0 B 🆕
packages/react/dist/index-NkriFZTk.d.ts 0 B 0 B 🆕

compressed-size-action

@adairrr
Copy link
Contributor Author

adairrr commented Mar 5, 2024

Also - might be interesting to explore something where where the account can auto-detect whether it's remote or not - and perform the executions over IBC... though this would also prevent us in the future from adding duplex communication because the logic would be invalid.

Extract<IbcClientTypes.ExecuteMsg, { register: unknown }>['register'],
'host_chain'
> & {
hostChainName: string
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to call this remoteChainName

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to stick with the names that we have in the contract to avoid confusion.

we can provide this one as an alias maybe.

Copy link
Collaborator

@dalechyn dalechyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

.gitignore Outdated Show resolved Hide resolved
const abstractConfig = createConfig({ provider: cosmosKitProvider })
const abstractConfig = createConfig({
provider: cosmosKitProvider,
apiUrl: 'https://api.abstract.money/graphql',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i actually think it makes sense exporting mainnetApiUrl and testnetApiUrl from the SDK itself. most likely those are the ones devs will use in future. something to consider.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

examples/wagemos-cosmoskit-nextjs/src/app/remote/page.tsx Outdated Show resolved Hide resolved
Extract<IbcClientTypes.ExecuteMsg, { register: unknown }>['register'],
'host_chain'
> & {
hostChainName: string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to stick with the names that we have in the contract to avoid confusion.

we can provide this one as an alias maybe.

@@ -0,0 +1,16 @@
import { jsonToBinary } from '@abstract-money/core'
import { ModuleType } from '../../codegen/gql/graphql'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's always preferred to use types from the contracts codegen.

adairrr and others added 3 commits March 6, 2024 09:01
Co-authored-by: Vladyslav Dalechyn <vlad.dalechin@gmail.com>
adairrr and others added 4 commits March 11, 2024 14:53
…t.tsx

Co-authored-by: Vladyslav Dalechyn <vlad.dalechin@gmail.com>
Co-authored-by: Vladyslav Dalechyn <vlad.dalechin@gmail.com>
Co-authored-by: Vladyslav Dalechyn <vlad.dalechin@gmail.com>
@adairrr adairrr requested a review from dalechyn March 20, 2024 01:12
adairrr and others added 2 commits March 19, 2024 18:17
Co-authored-by: Vladyslav Dalechyn <vlad.dalechin@gmail.com>

type QueryOptions = Omit<
UseQueryOptions<QueryFnData, QueryError, QueryData, QueryKey>,
'queryFn'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we don't omit the queryKey from the options in our queries doesn't this mean it could be "accidentially" (or purposefully) overridden? Is this something we'd like to enable?

Esp sinc the syntax has been changed to glob all the options together instead of having the query key, query function as first args to useQuery

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left to be purposefully overriden, don't see it as a blocker rn.

Comment on lines +40 to +46
rpc: chain.apis?.rpc?.length
? [
chain.apis.rpc.find((rpc) =>
rpc.address.includes('polkachu'),
) ?? chain.apis.rpc[0],
]
: [],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that looks odd, why do we have to do that?

examples/wagemos-cosmoskit-nextjs/src/app/remote/page.tsx Outdated Show resolved Hide resolved
@@ -0,0 +1,48 @@
import { PublicClient } from '@abstract-money/core'
import { UseQueryOptions, useQuery } from '@tanstack/react-query'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use UseQueryParameters instead

i.e.
import { UseQueryParameters, useQuery } from '../types/queries'

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not critical though


type QueryOptions = Omit<
UseQueryOptions<QueryFnData, QueryError, QueryData, QueryKey>,
'queryFn'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left to be purposefully overriden, don't see it as a blocker rn.

@dalechyn dalechyn changed the title Add IBC Executions feat: add ibc executions May 1, 2024
@dalechyn dalechyn merged commit 10f9ba2 into mainline May 1, 2024
4 checks passed
@github-actions github-actions bot mentioned this pull request May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants