Skip to content

Commit fd91ee8

Browse files
[SDK] Handle fixed size arrays in solidity inputs (#6870)
1 parent e9069c9 commit fd91ee8

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

.changeset/grumpy-carpets-sniff.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Handle fixed size arrays in solidity inputs

apps/dashboard/src/contract-ui/components/solidity-inputs/helpers.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ export const validateAddress = (value: string) => {
159159

160160
// all
161161
export const validateSolidityInput = (value: string, solidityType: string) => {
162-
if (solidityType.startsWith("int") || solidityType.startsWith("uint")) {
162+
if (
163+
(solidityType.startsWith("int") || solidityType.startsWith("uint")) &&
164+
!solidityType.endsWith("]")
165+
) {
163166
return validateInt(value, solidityType);
164167
}
165168
// TODO: bytes array not working right now

apps/dashboard/src/contract-ui/components/solidity-inputs/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const SolidityInput = forwardRef<
6060
);
6161
}
6262

63-
if (solidityType?.endsWith("[]")) {
63+
if (solidityType?.endsWith("]")) {
6464
return (
6565
<SolidityRawInput
6666
formContext={form}

packages/thirdweb/src/utils/contract/parse-abi-params.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function parseAbiParams(
5151
}
5252
return constructorParamTypes.map((type, index) => {
5353
const value = constructorParamValues[index];
54-
if (type === "tuple" || type.endsWith("[]")) {
54+
if (type === "tuple" || type.endsWith("]")) {
5555
if (typeof value === "string") {
5656
return JSON.parse(value);
5757
}

0 commit comments

Comments
 (0)