From a688cbacd3d7bcca2d91ce6560e699c6768c81d0 Mon Sep 17 00:00:00 2001 From: Franco Barpp Gomes Date: Fri, 24 Jan 2025 02:19:12 +0900 Subject: [PATCH] Ensure starknet_call calldata is not null (#658) * fix: Fix function call calldata possibly nil * refactor: Remove empty calldata package var --- rpc/call.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rpc/call.go b/rpc/call.go index 4d29cf1d..651edd94 100644 --- a/rpc/call.go +++ b/rpc/call.go @@ -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)