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

🪲 fix index container to utilize uint16 instead of uint8 #363

Merged
merged 2 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/spicy-rockets-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"build-lz-options": patch
---

Fix index container (uint16 instead of uint8)
17 changes: 10 additions & 7 deletions packages/build-lz-options/src/utilities/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { handlePromptState, promptToContinue } from '@layerzerolabs/io-devtools'

// Max value of a Uint128 using a BigInt container.
const MAX_UINT_128 = BigInt(2) ** BigInt(128) - BigInt(1)
// Max value of a Uint8 using a number container.
const MAX_UINT_8 = 0xffff
// Max value of a Uint16 using a number container.
const MAX_UINT_16 = 0xffffffff
// Default initial text number.
const DEFAULT_INITIAL_TEXT_NUMBER = BigInt('200000')

Expand Down Expand Up @@ -67,11 +67,14 @@ export const promptForOptionType = () =>
},
])

const promptForGasLimit: PromptObject<'gasLimit'> = promptForBigInt('gasLimit', 'What gas limit do you want to set?')
const promptForGasLimit: PromptObject<'gasLimit'> = promptForBigInt(
'gasLimit',
'What gas limit (uint128) do you want to set?'
)

const promptForNativeDropAmount: PromptObject<'nativeDropAmount'> = promptForBigInt(
'nativeDropAmount',
'What native gas drop do you want to set?'
'What native gas drop amount (uint128) do you want to set?'
)

/**
Expand All @@ -81,17 +84,17 @@ const promptForIndex: PromptObject<'index'> = {
onState: handlePromptState,
type: 'number',
name: 'index',
message: 'What is the index?',
message: 'What is the index (uint16)?',
initial: 0,
min: 0,
max: MAX_UINT_8,
max: MAX_UINT_16,
}

const promptForNativeDropAddress: PromptObject<'nativeDropAddress'> = {
onState: handlePromptState,
type: 'text',
name: 'nativeDropAddress',
message: 'What native gas drop do you want to set?',
message: 'What native gas drop address (bytes32) do you want to set?',
initial: makeBytes32(),
}

Expand Down
Loading