Skip to content

Commit

Permalink
fix: Fix function call calldata possibly nil
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyodar authored Jan 22, 2025
1 parent 46011b2 commit 4209715
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rpc/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"github.com/NethermindEth/juno/core/felt"
)

var emptyCalldata = []*felt.Felt{}

// Call calls the Starknet Provider's function with the given (Starknet) request and block ID.
//
// Parameters:
Expand All @@ -16,6 +18,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 = emptyCalldata
}

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 4209715

Please sign in to comment.