-
-
Notifications
You must be signed in to change notification settings - Fork 912
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: default priority fee per-chain #1006
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 14e6140 The changes in this PR will be included in the next version bump. 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 |
Size Change: +185 B (0%) Total Size: 316 kB
ℹ️ View Unchanged
|
Codecov Report
@@ Coverage Diff @@
## main #1006 +/- ##
==========================================
- Coverage 99.81% 97.43% -2.38%
==========================================
Files 264 260 -4
Lines 25802 25622 -180
Branches 2080 1830 -250
==========================================
- Hits 25754 24966 -788
- Misses 45 653 +608
Partials 3 3
|
src/index.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deprecated
💆♂️
src/utils/chain.ts
Outdated
config?: ChainConfig<formatters>, | ||
): Assign<chain, ChainConfig<formatters>> { | ||
const { | ||
fees = chain.fees, | ||
formatters = chain.formatters, | ||
serializers = chain.serializers, | ||
} = config || {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick
config?: ChainConfig<formatters>, | |
): Assign<chain, ChainConfig<formatters>> { | |
const { | |
fees = chain.fees, | |
formatters = chain.formatters, | |
serializers = chain.serializers, | |
} = config || {} | |
config: ChainConfig<formatters> = {}, | |
): Assign<chain, ChainConfig<formatters>> { | |
const { | |
fees = chain.fees, | |
formatters = chain.formatters, | |
serializers = chain.serializers, | |
} = config |
src/types/chain.ts
Outdated
getDefaultPriorityFee(args: { | ||
block: Prettify<FormattedBlock<{ formatters: formatters }>> | ||
request: PrepareRequestParameters< | ||
Omit<Chain, 'formatters'> & { formatters: formatters } | ||
> | ||
}): Promise<bigint> | bigint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not worth adding another type here, but think it's worthwhile if this could also just be a bigint
in addition to async/sync function that returns bigint
? In that world, maybe it makes sense to rename the key from getDefaultPriorityFee
to defaultPriorityFee
.
import type { ChainFees } from '../../types/chain.js'
export const feesOptimism = {
defaultPriorityFee: 1_000_000n, // 0.001 gwei
} as const satisfies ChainFees
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense!
block, | ||
request: request as PrepareRequestParameters, | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:chefkiss:
* feat: optimism transaction receipt formatter * refactor: restructure * feat: chain fees config * chore: changeset * chore: update test * chore: impl * refactor: cleanup formatters & serializers types * chore: fix * refactor * chore: snapshots * Update sweet-lemons-explain.md * Update sweet-lemons-explain.md * refactor * refactor * refactor
Added
fees
tochain
config that includes agetDefaultPriorityFee
for setting a default priority fee for a chain.Also cleaned up the chain serializers & formatters types. Probably makes more sense to have them in
types/chain.ts
rather than separate files since they aren't related to anything else apart from the chain. Will also help if we scale to more than justfees
,serializers
&formatters
on the chain config (and also when we chose to move the chains into a separate package).PR-Codex overview
Focus of this PR:
This PR focuses on adding a
fees
field to thechain
configuration, which includes adefaultPriorityFee
for setting a default priority fee (maxFeePerGas
) for a chain.Detailed summary:
fees
field tochain
configfees
field includes adefaultPriorityFee
for setting a default priority fee (maxFeePerGas
) for a chainfees
field in thechain
configuration