Skip to content

Commit

Permalink
Merge branch 'v0.8.0' into thiagodeev/new-rpcdata
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagodeev committed Dec 20, 2024
2 parents 3aaf436 + 9cb940b commit 58f05ad
Show file tree
Hide file tree
Showing 18 changed files with 864 additions and 237 deletions.
45 changes: 45 additions & 0 deletions mocks/mock_rpc_provider.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion rpc/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,5 +655,4 @@ func validatePendingBlockHeader(t *testing.T, pBlock *PendingBlockHeader) {
require.NotZero(t, pBlock.L1GasPrice)
require.NotZero(t, pBlock.StarknetVersion)
require.NotZero(t, pBlock.L1DataGasPrice)
require.NotNil(t, pBlock.L1DAMode)
}
28 changes: 28 additions & 0 deletions rpc/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ func (provider *Provider) Nonce(ctx context.Context, blockID BlockID, contractAd
// Estimates the resources required by a given sequence of transactions when applied on a given state.
// If one of the transactions reverts or fails due to any reason (e.g. validation failure or an internal error),
// a TRANSACTION_EXECUTION_ERROR is returned. For v0-2 transactions the estimate is given in wei, and for v3 transactions it is given in fri.
//
// Parameters:
// - ctx: The context of the function call
// - requests: A sequence of transactions to estimate, running each transaction on the state resulting from applying all the previous ones
// - simulationFlags: Describes what parts of the transaction should be executed
// - blockID: The hash of the requested block, or number (height) of the requested block, or a block tag, for the block referencing the state or call the transaction on
// Returns:
// - []FeeEstimation: A sequence of fee estimation where the i'th estimate corresponds to the i'th transaction
// - error: An error if any occurred during the execution
func (provider *Provider) EstimateFee(ctx context.Context, requests []BroadcastTxn, simulationFlags []SimulationFlag, blockID BlockID) ([]FeeEstimation, error) {
var raw []FeeEstimation
if err := do(ctx, provider.c, "starknet_estimateFee", &raw, requests, simulationFlags, blockID); err != nil {
Expand All @@ -160,3 +169,22 @@ func (provider *Provider) EstimateMessageFee(ctx context.Context, msg MsgFromL1,
}
return &raw, nil
}

// Get merkle paths in one of the state tries: global state, classes, individual contract.
// A single request can query for any mix of the three types of storage proofs (classes, contracts, and storage)
//
// Parameters:
// - ctx: The context of the function call
// - storageProofInput: an input containing at least one of the fields filled
// Returns:
// - *StorageProofResult: The requested storage proofs. Note that if a requested leaf has the default value,
// the path to it may end in an edge node whose path is not a prefix of the requested leaf, thus effectively proving non-membership
// - error: an error if any occurred during the execution
func (provider *Provider) GetStorageProof(ctx context.Context, storageProofInput StorageProofInput) (*StorageProofResult, error) {
var raw StorageProofResult
if err := do(ctx, provider.c, "starknet_getStorageProof", &raw, storageProofInput); err != nil {

return nil, tryUnwrapToRPCErr(err, ErrBlockNotFound, ErrStorageProofNotSupported)
}
return &raw, nil
}
Loading

0 comments on commit 58f05ad

Please sign in to comment.