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

[APP-243] feat: revive monorepo #2

Merged
merged 23 commits into from
Dec 8, 2023
Merged

[APP-243] feat: revive monorepo #2

merged 23 commits into from
Dec 8, 2023

Conversation

dalechyn
Copy link
Collaborator

@dalechyn dalechyn commented Nov 17, 2023

This is work in progress.
The proposed monorepo change would allow us ship both CJS, ESM and DTS files split in different proxy packages for better tree-shacking purposes.

As well as it "fixes" (and ignores) some of the issues within the core package, and yet needs more type-safety fixes on react package.

Implements APP-243 (https://linear.app/abstract-sdk/issue/APP-243/refactor-the-current-sdk)

This is work in progress.
The proposed monorepo change would allow us ship both CJS, ESM and DTS
files split in different proxy packages for better tree-shacking
purposes.

As well as it "fixes" (and ignores) some of the issues within the `core`
package, and yet needs more type-safety fixes on `react` package.
@dalechyn dalechyn self-assigned this Nov 17, 2023
@dalechyn dalechyn requested a review from adairrr November 17, 2023 20:06
Copy link

cloudflare-workers-and-pages bot commented Nov 17, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: befaad4
Status:🚫  Build failed.

View logs

Copy link
Contributor

github-actions bot commented Nov 20, 2023

Size Change: 0 B

Total Size: 109 kB

ℹ️ View Unchanged
Filename Size Change
packages/core/dist 38.3 kB 0 B
packages/core/dist/_tsup-dts-rollup.d.ts 0 B 0 B 🆕
packages/core/dist/account 244 B 0 B
packages/core/dist/account/index.d.ts 188 B 0 B
packages/core/dist/account/index.js 0 B 0 B 🆕
packages/core/dist/api 99 B 0 B
packages/core/dist/api/index.d.ts 106 B 0 B
packages/core/dist/api/index.js 0 B 0 B 🆕
packages/core/dist/apps 188 B 0 B
packages/core/dist/apps/index.d.ts 235 B 0 B
packages/core/dist/apps/index.js 0 B 0 B 🆕
packages/core/dist/chain-registry 115 B 0 B
packages/core/dist/chain-registry/index.d.ts 158 B 0 B
packages/core/dist/chain-registry/index.js 10.5 kB 0 B
packages/core/dist/chunk-4OZ2727H.js 3.63 kB 0 B
packages/core/dist/chunk-6FKGNBUO.js 264 B 0 B
packages/core/dist/chunk-7SZZLVCF.js 5.21 kB 0 B
packages/core/dist/chunk-AT4QRNMO.js 220 B 0 B
packages/core/dist/chunk-EP7S2KF3.js 727 B 0 B
packages/core/dist/chunk-JGZGBE42.js 1.81 kB 0 B
packages/core/dist/chunk-NAOOQA5A.js 2.69 kB 0 B
packages/core/dist/chunk-X3VVPRIW.js 1.77 kB 0 B
packages/core/dist/chunk-XL7PCQZW.js 0 B 0 B 🆕
packages/core/dist/clients 540 B 0 B
packages/core/dist/clients/index.d.ts 377 B 0 B
packages/core/dist/clients/index.js 0 B 0 B 🆕
packages/core/dist/cw-plus 378 B 0 B
packages/core/dist/cw-plus/index.d.ts 252 B 0 B
packages/core/dist/cw-plus/index.js 1.08 kB 0 B
packages/core/dist/index.d.ts 1.02 kB 0 B
packages/core/dist/index.js 0 B 0 B 🆕
packages/core/dist/modules 457 B 0 B
packages/core/dist/modules/index.d.ts 239 B 0 B
packages/core/dist/modules/index.js 0 B 0 B 🆕
packages/core/dist/native 315 B 0 B
packages/core/dist/native/index.d.ts 233 B 0 B
packages/core/dist/native/index.js 0 B 0 B 🆕
packages/core/dist/tools 145 B 0 B
packages/core/dist/tools/index.d.ts 107 B 0 B
packages/core/dist/tools/index.js 829 B 0 B
packages/cosmwasm/dist 312 B 0 B
packages/cosmwasm/dist/_tsup-dts-rollup.d.ts 466 B 0 B
packages/cosmwasm/dist/chunk-52DRSWLU.js 0 B 0 B 🆕
packages/cosmwasm/dist/chunk-OELFXS2C.js 189 B 0 B
packages/cosmwasm/dist/client 156 B 0 B
packages/cosmwasm/dist/client/index.d.ts 168 B 0 B
packages/cosmwasm/dist/client/index.js 182 B 0 B
packages/cosmwasm/dist/index.d.ts 0 B 0 B 🆕
packages/cosmwasm/dist/index.js 81 B 0 B
packages/cosmwasm/dist/utils 77 B 0 B
packages/cosmwasm/dist/utils/index.d.ts 683 B 0 B
packages/cosmwasm/dist/utils/index.js 827 B 0 B
packages/react/dist 2.22 kB 0 B
packages/react/dist/chunk-3SPFBBH7.js 489 B 0 B
packages/react/dist/chunk-7B4T2UPQ.js 129 B 0 B
packages/react/dist/chunk-B744AQ3S.js 0 B 0 B 🆕
packages/react/dist/index.d.ts 0 B 0 B 🆕
packages/react/dist/index.js 2.8 kB 0 B
packages/react/dist/internal 288 B 0 B
packages/react/dist/internal/account 0 B 0 B 🆕
packages/react/dist/internal/account/index.d.ts 0 B 0 B 🆕
packages/react/dist/internal/account/index.js 1.72 kB 0 B
packages/react/dist/internal/apps 1.31 kB 0 B
packages/react/dist/internal/apps/challenge 0 B 0 B 🆕
packages/react/dist/internal/apps/challenge/index.d.ts 0 B 0 B 🆕
packages/react/dist/internal/apps/challenge/index.js 0 B 0 B 🆕
packages/react/dist/internal/cw-plus 1.55 kB 0 B
packages/react/dist/internal/cw-plus/cw-20 1.04 kB 0 B
packages/react/dist/internal/cw-plus/cw-20-ics 2.04 kB 0 B
packages/react/dist/internal/cw-plus/cw-20-ics/index.d.ts 1.67 kB 0 B
packages/react/dist/internal/cw-plus/cw-20-ics/index.js 0 B 0 B 🆕
packages/react/dist/internal/cw-plus/cw-20/index.d.ts 1.81 kB 0 B
packages/react/dist/internal/cw-plus/cw-20/index.js 1.21 kB 0 B
packages/react/dist/internal/cw-plus/cw-3-flex-multisig 0 B 0 B 🆕
packages/react/dist/internal/cw-plus/cw-3-flex-multisig/index.d.ts 1.41 kB 0 B
packages/react/dist/internal/cw-plus/cw-3-flex-multisig/index.js 995 B 0 B
packages/react/dist/internal/cw-plus/cw-4-group 350 B 0 B
packages/react/dist/internal/cw-plus/cw-4-group/index.d.ts 285 B 0 B
packages/react/dist/internal/cw-plus/cw-4-group/index.js 0 B 0 B 🆕
packages/react/dist/internal/index.d.ts 0 B 0 B 🆕
packages/react/dist/internal/index.js 2.38 kB 0 B
packages/react/dist/internal/native 1.51 kB 0 B
packages/react/dist/internal/native/ans 0 B 0 B 🆕
packages/react/dist/internal/native/ans/index.d.ts 1.26 kB 0 B
packages/react/dist/internal/native/ans/index.js 759 B 0 B
packages/react/dist/internal/native/factory 0 B 0 B 🆕
packages/react/dist/internal/native/factory/index.d.ts 2.12 kB 0 B
packages/react/dist/internal/native/factory/index.js 1.61 kB 0 B
packages/react/dist/internal/native/registry 606 B 0 B
packages/react/dist/internal/native/registry/index.d.ts 0 B 0 B 🆕
packages/react/dist/internal/native/registry/index.js 601 B 0 B
packages/react/dist/use-execute-contract-1FUeOLzd.d.ts 963 B 0 B
packages/react/dist/utils 0 B 0 B 🆕
packages/react/dist/utils/index.d.ts 0 B 0 B 🆕
packages/react/dist/utils/index.js 0 B 0 B 🆕

compressed-size-action

@dalechyn
Copy link
Collaborator Author

Size job fails but should be operating normally after the merge.

Post-action bug in there.

@dalechyn dalechyn marked this pull request as ready for review November 20, 2023 19:58
@dalechyn dalechyn marked this pull request as draft November 30, 2023 17:31
Comment on lines 76 to 87
const {
data: wagemosQueryClient,
isLoading: isWagemosQueryClientLoading,
isError: isWagemosQueryClientError,
error: wagemosQueryClientError,
} = useModuleQueryClient(
{
moduleId: WAGEMOS_MODULE_ID,
Module: WagemosAppQueryClient,
},
{ enabled: options?.enabled },
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we should also pull this into an autogenerated hook useWagemosQueryClient

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

could you describe a bit more what do you mean?

examples/wagemos-app-nextjs/src/generated/wagemos/index.ts Outdated Show resolved Hide resolved
packages/core/src/__generated__/gql/index.ts Show resolved Hide resolved
packages/core/src/api/apiRequest.ts Outdated Show resolved Hide resolved
packages/core/src/clients/AnsClient.ts Show resolved Hide resolved
packages/core/codegen.yml Outdated Show resolved Hide resolved
packages/react/src/contexts/account-id.ts Show resolved Hide resolved
},
})

export type AbstractProviderProps = AbstractConfigProps
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably allow the consumer to provide query client options as well - this is what graz does https://github.com/graz-sh/graz/blob/2dd73ddae3313e76be5f79215a30c0916c9c1fcd/packages/graz/src/provider/index.tsx#L2

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

or a client should instead init the query client on his side and inject it into the provider, we could build a fancy createConfig as wagmi did.

packages/react/src/utils/use-module-mutation-client.ts Outdated Show resolved Hide resolved
Also commented out the dev build for the  package, since nextjs
example tries to transpile it and requries dependencies to be installed.
Unfortunately I am meeting building issues again.
@dalechyn dalechyn changed the title feat: revive monorepo [APP-243] feat: revive monorepo Dec 5, 2023
Turned out to be a bad remapping to the package path.
Still having return type annotations issues.
It turned out that `tsup`s `dts` flag has been generating
incorrect typings, so I tried using `experimentalDts` and it
worked.

`react` package won't use this option though, since it doesn't
work there.
DTS building is a wild world.
@dalechyn
Copy link
Collaborator Author

dalechyn commented Dec 7, 2023

@adairrr lint, build, types jobs pass.
PR is ready for the review.

@dalechyn dalechyn marked this pull request as ready for review December 7, 2023 10:20
.vscode/extensions.json Outdated Show resolved Hide resolved
.vscode/settings.json Outdated Show resolved Hide resolved
@dalechyn dalechyn requested a review from carina-akaia December 7, 2023 17:29
Copy link
Contributor

@adairrr adairrr left a comment

Choose a reason for hiding this comment

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

Let's get this merged and we can fix the remaining chain comments afterwards!

Comment on lines +62 to +86
const onSubmit: SubmitHandler<z.infer<typeof placeBetSchema>> = useCallback(
async ({ amount, accountSeq }) => {
const accountIdToBetOn = round.teams.find(
(account) => account.seq === +accountSeq,
)
if (!accountIdToBetOn) throw new Error('Account not found')

await placeBetAsync?.({
msg: {
roundId: round.id,
bet: {
account_id: accountIdToBetOn,
asset: { name: round.total_bet.name, amount: amount.toString() },
},
},
})

setIsOpen(false)
toast({
title: 'Bet placed',
description: `You bet ${amount} ${round.total_bet.name} on account ${accountIdToBetOn.seq}`,
})
},
[placeBetAsync],
)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit small design question :

Is this generally the best way to deal with mutations in react-query? From what I've seen we want to avoid using the async mutation and add additinoal mutations in the components with the onSuccess and onError handlers

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

While react-query allows both, I assume it is safe to use both variants unless the post-mutation logic is triggered more than once.

@dalechyn dalechyn merged commit b9e9c62 into mainline Dec 8, 2023
3 of 5 checks passed
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.

3 participants