Skip to content

Commit

Permalink
Merge branch 'main' into error_data_field
Browse files Browse the repository at this point in the history
  • Loading branch information
cicr99 committed Oct 30, 2023
2 parents 47c41f8 + 5e5e433 commit 28e5e00
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 485 deletions.
19 changes: 9 additions & 10 deletions account/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,12 +570,12 @@ func (account *Account) ClassHashAt(ctx context.Context, blockID rpc.BlockID, co
//
// Parameters:
// - ctx: The context.Context object for the function.
// - requests: An array of rpc.EstimateFeeInput objects representing the requests to estimate the fee for.
// - requests: An array of rpc.BroadcastTxn objects representing the requests to estimate the fee for.
// - blockID: The rpc.BlockID object representing the block ID for which to estimate the fee.
// Returns:
// - []rpc.FeeEstimate: An array of rpc.FeeEstimate objects representing the estimated fees.
// - error: An error object if any error occurred during the estimation process.
func (account *Account) EstimateFee(ctx context.Context, requests []rpc.EstimateFeeInput, blockID rpc.BlockID) ([]rpc.FeeEstimate, error) {
func (account *Account) EstimateFee(ctx context.Context, requests []rpc.BroadcastTxn, blockID rpc.BlockID) ([]rpc.FeeEstimate, error) {
return account.provider.EstimateFee(ctx, requests, blockID)
}

Expand Down Expand Up @@ -604,17 +604,16 @@ func (account *Account) Events(ctx context.Context, input rpc.EventsInput) (*rpc
return account.provider.Events(ctx, input)
}

// Nonce returns the nonce for the specified account and contract address.
// Nonce retrieves the nonce for a given block ID and contract address.
//
// Parameters:
// - ctx: The context.Context object for the function
// - blockID: the rpc.BlockID object for the function
// - contractAddress: the felt.Felt (address of the contract) whose nonce we're seeking
//
// - ctx: is the context.Context for the function call
// - blockID: is the ID of the block
// - contractAddress: is the address of the contract
// Returns:
// - *string: a string pointer
// - error: an error
func (account *Account) Nonce(ctx context.Context, blockID rpc.BlockID, contractAddress *felt.Felt) (*string, error) {
// - *felt.Felt: the contract's nonce at the requested state
// - error: an error if any
func (account *Account) Nonce(ctx context.Context, blockID rpc.BlockID, contractAddress *felt.Felt) (*felt.Felt, error) {
return account.provider.Nonce(ctx, blockID, contractAddress)
}

Expand Down
2 changes: 1 addition & 1 deletion account/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ func TestAddDeclareTxn(t *testing.T) {
require.NoError(t, err)

tx := rpc.DeclareTxnV2{
Nonce: utils.TestHexToFelt(t, *nonce),
Nonce: nonce,
MaxFee: utils.TestHexToFelt(t, "0x50c8f3053db"),
Type: rpc.TransactionType_Declare,
Version: rpc.TransactionV2,
Expand Down
5 changes: 2 additions & 3 deletions examples/simpleInvoke/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ func main() {
panic(err.Error())
}

//Getting the nonce from the account, and then converting it into felt
nonce_string, _ := accnt.Nonce(context.Background(), rpc.BlockID{Tag: "latest"}, accnt.AccountAddress)
nonce, err := utils.HexToFelt(*nonce_string)
//Getting the nonce from the account
nonce, err := accnt.Nonce(context.Background(), rpc.BlockID{Tag: "latest"}, accnt.AccountAddress)
if err != nil {
panic(err.Error())
}
Expand Down
17 changes: 3 additions & 14 deletions mocks/mock_account.go

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

Loading

0 comments on commit 28e5e00

Please sign in to comment.