Skip to content

Commit

Permalink
feat: allow BigNumberish in RawCallData
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvkelawala committed Jan 23, 2023
1 parent 58556ba commit 9b897c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/types/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type RawArgs =
| {
[inputName: string]: string | string[] | { type: 'struct'; [k: string]: BigNumberish };
}
| string[];
| BigNumberish[];

export interface ContractClass {
program: CompressedProgram;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/stark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function compileCalldata(args: RawArgs): Calldata {
if (Array.isArray(value))
return [toBigInt(value.length).toString(), ...value.map((x) => toBigInt(x).toString())];
if (typeof value === 'object' && 'type' in value)
return Object.entries(value)
return Object.entries<BigNumberish>(value)
.filter(([k]) => k !== 'type')
.map(([, v]) => toBigInt(v).toString());
return toBigInt(value).toString();
Expand Down

0 comments on commit 9b897c7

Please sign in to comment.