Skip to content

Commit

Permalink
🪲 fix index container to utilize uint16 instead of uint8 (#363)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Goulding <[email protected]>
  • Loading branch information
ryandgoulding authored Feb 7, 2024
1 parent 0c3af33 commit 398f7cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
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

0 comments on commit 398f7cd

Please sign in to comment.