Skip to content

Commit

Permalink
Ensure starknet_call calldata is not null (#658)
Browse files Browse the repository at this point in the history
* fix: Fix function call calldata possibly nil

* refactor: Remove empty calldata package var
  • Loading branch information
Hyodar authored Jan 23, 2025
1 parent 46011b2 commit a688cba
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rpc/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import (
// - []*felt.Felt: the result of the function call
// - error: an error if any occurred during the execution
func (provider *Provider) Call(ctx context.Context, request FunctionCall, blockID BlockID) ([]*felt.Felt, error) {
if request.Calldata == nil {
request.Calldata = []*felt.Felt{}
}

var result []*felt.Felt
if err := do(ctx, provider.c, "starknet_call", &result, request, blockID); err != nil {
return nil, tryUnwrapToRPCErr(err, ErrContractNotFound, ErrContractError, ErrBlockNotFound)
Expand Down

0 comments on commit a688cba

Please sign in to comment.