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: estimate transaction cost #399

Merged
merged 7 commits into from
Sep 19, 2023
Merged

Conversation

vojtechsimetka
Copy link
Contributor

resolves #314

@vercel
Copy link

vercel bot commented Sep 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
waku-objects-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 19, 2023 2:03pm

}
}
let fee: bigint | undefined = undefined
let feeError: undefined | Error = undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

feeError is not set anywhere. Maybe on line 51 it could be set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch! Forgot to commit this one, thanks!

import { defaultBlockchainNetwork } from '$lib/adapters/transaction'
import type { Balance } from './schemas'
import type { Splitter, SplitterFactory } from './contracts/types'

const splitterFactoryAddress = defaultBlockchainNetwork.objects.splitterFactory
Copy link
Contributor

Choose a reason for hiding this comment

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

I just realized that the splitterFactory address is hardcoded in the BlockchainNetwork type. I don't think that's a good place to store it, it seems it would be better if the object code would define it, especially if the object is an external type then there is no way that it can expect the host application to know about it and expose it in the SDK.

This does not belong in this PR, but I just wanted to document this issue somewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kinda agree. At the same time, it also depends on which blockchain the app is connected to. I'll create an issue about this but I believe there is some discussion needed.

Copy link
Contributor

@agazso agazso left a comment

Choose a reason for hiding this comment

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

The code looks good, but please check out my comments.

I tested with Payggy where there is a field called Transaction fee (max) which looks reasonable. Then after the transaction is done the same is displayed but at that time the exact amount can be known and it would be better to display that instead of the estimated maximum which has no relevance anymore.

@vojtechsimetka vojtechsimetka merged commit 8968e99 into main Sep 19, 2023
2 checks passed
@vojtechsimetka vojtechsimetka deleted the feat/estimate-transaction-cost branch September 19, 2023 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Estimate transaction fee
2 participants