Skip to content

Commit

Permalink
feat(calldata): implement decode functions for calldata to JSC types
Browse files Browse the repository at this point in the history
  • Loading branch information
AryanGodara committed Mar 26, 2024
1 parent 3c6223f commit e4a97ee
Show file tree
Hide file tree
Showing 2 changed files with 326 additions and 64 deletions.
6 changes: 4 additions & 2 deletions src/utils/cairoDataTypes/uint256.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ export class CairoUint256 {
*/
static fromCalldata(calldata: [string, string]): CairoUint256 {
if (calldata.length !== 2) {
throw new Error("Calldata must contain exactly two elements for low and high parts of uint256.");
throw new Error(
'Calldata must contain exactly two elements for low and high parts of uint256.'
);
}

// Validate each part to ensure they are within the acceptable range.
const [low, high] = calldata;
const validatedLow = CairoUint256.validateProps(low, UINT_256_LOW_MIN.toString());
Expand Down
Loading

0 comments on commit e4a97ee

Please sign in to comment.