Class StandardAccount

  • All Implemented Interfaces:
    com.swmansion.starknet.account.Account

    
    public final class StandardAccount
     implements Account
                        

    Standard account used in Starknet.

    • Constructor Detail

      • StandardAccount

        StandardAccount(Felt address, Felt privateKey, Provider provider, StarknetChainId chainId, CairoVersion cairoVersion)
        Parameters:
        address - the address of the account contract
        privateKey - a private key used to create a signer
        provider - a provider used to interact with Starknet
        chainId - the chain id of the Starknet network
        cairoVersion - the version of Cairo language in which account contract is written
      • StandardAccount

        StandardAccount(Felt address, Felt privateKey, Provider provider, StarknetChainId chainId)
        Parameters:
        address - the address of the account contract
        privateKey - a private key used to create a signer
        provider - a provider used to interact with Starknet
        chainId - the chain id of the Starknet network
      • StandardAccount

        StandardAccount(Felt address, Signer signer, Provider provider, StarknetChainId chainId, CairoVersion cairoVersion)
        Parameters:
        address - the address of the account contract
        signer - a signer instance used to sign transactions
        provider - a provider used to interact with Starknet
        chainId - the chain id of the Starknet network
        cairoVersion - the version of Cairo language in which account contract is written
      • StandardAccount

        StandardAccount(Felt address, Signer signer, Provider provider, StarknetChainId chainId)
        Parameters:
        address - the address of the account contract
        signer - a signer instance used to sign transactions
        provider - a provider used to interact with Starknet
        chainId - the chain id of the Starknet network
    • Method Detail

      • signV3

         InvokeTransactionV3 signV3(List<Call> calls, InvokeParamsV3 params, Boolean forFeeEstimate)
        Parameters:
        calls - a list of calls to be signed
        params - additional execution parameters for the transaction
        forFeeEstimate - when set to true, it changes the version to 2^128+version so the signed transaction can only be used for fee estimation
      • signDeployAccountV3

         DeployAccountTransactionV3 signDeployAccountV3(Felt classHash, List<Felt> calldata, Felt salt, DeployAccountParamsV3 params, Boolean forFeeEstimate)
        Parameters:
        classHash - hash of the contract that will be deployed
        calldata - constructor calldata for the contract deployment
        salt - salt used to calculate address of the new contract
        params - additional params for the transaction
        forFeeEstimate - when set to true, it changes the version to 2^128+version so the signed transaction can only be used for fee estimation
      • signDeclareV3

         DeclareTransactionV3 signDeclareV3(Cairo1ContractDefinition sierraContractDefinition, CasmContractDefinition casmContractDefinition, DeclareParamsV3 params, Boolean forFeeEstimate)
        Parameters:
        sierraContractDefinition - a cairo 1/2 sierra compiled definition of the contract to be declared
        casmContractDefinition - a casm representation of cairo 1/2 compiled contract to be declared
        params - additional parameters for the transaction
        forFeeEstimate - when set to true, it changes the version to 2^128+version so the signed transaction can only be used for fee estimation
      • executeV3

         Request<InvokeFunctionResponse> executeV3(List<Call> calls, Double estimateAmountMultiplier, Double estimateUnitPriceMultiplier)

        Execute a list of calls using version 3 invoke transaction with automatically estimated fee that will be multiplied by the specified multipliers when resource bounds are calculated.

        Parameters:
        calls - a list of calls to be executed.
        estimateAmountMultiplier - how big multiplier should be used for the estimated amount.
        estimateUnitPriceMultiplier - how big multiplier should be used for the estimated unit price.
      • executeV3

         Request<InvokeFunctionResponse> executeV3(Call call, Double estimateAmountMultiplier, Double estimateUnitPriceMultiplier)

        Execute single call using version 3 invoke transaction with automatically estimated fee that will be multiplied by the specified multipliers when resource bounds are calculated.

        Parameters:
        call - a call to be executed.
        estimateAmountMultiplier - how big multiplier should be used for the estimated amount.
        estimateUnitPriceMultiplier - how big multiplier should be used for the estimated unit price.
      • getNonce

         Request<Felt> getNonce(Felt blockHash)
        Parameters:
        blockHash - block hash used for returning this value.
      • estimateFeeV3

         Request<EstimateFeeResponseList> estimateFeeV3(Call call, Boolean skipValidate)

        Estimate fee for a call as a version 3 invoke transaction.

        Estimate fee for a signed call on Starknet.

        Parameters:
        call - a call used to estimate a fee.
        skipValidate - when set to true, the validation part of the transaction is skipped.
      • estimateFeeV3

         Request<EstimateFeeResponseList> estimateFeeV3(Call call, BlockTag blockTag)

        Estimate fee for a call as a version 3 invoke transaction.

        Estimate fee for a signed call on Starknet for specified block tag.

        Parameters:
        call - a call used to estimate a fee.
        blockTag - a tag of the block in respect to what the query will be made.
      • estimateFeeV3

         Request<EstimateFeeResponseList> estimateFeeV3(Call call, BlockTag blockTag, Boolean skipValidate)

        Estimate fee for a call as a version 3 invoke transaction.

        Estimate fee for a signed call on Starknet for specified block tag.

        Parameters:
        call - a call used to estimate a fee.
        blockTag - a tag of the block in respect to what the query will be made.
        skipValidate - when set to true, the validation part of the transaction is skipped.
      • estimateFeeV3

         Request<EstimateFeeResponseList> estimateFeeV3(List<Call> calls)

        Estimate fee for a list of calls as a version 3 invoke transaction.

        Estimate fee for a signed list of calls on Starknet.

        Parameters:
        calls - a list of calls used to estimate a fee.
      • estimateFeeV3

         Request<EstimateFeeResponseList> estimateFeeV3(List<Call> calls, BlockTag blockTag)

        Estimate fee for a list of calls.

        Estimate fee for a signed list of calls on Starknet.

        Parameters:
        calls - a list of calls used to estimate a fee.
        blockTag - a tag of the block in respect to what the query will be made.
      • estimateFeeV3

         Request<EstimateFeeResponseList> estimateFeeV3(List<Call> calls, BlockTag blockTag, Boolean skipValidate)

        Estimate fee for a list of calls.

        Estimate fee for a signed list of calls on Starknet.

        Parameters:
        calls - a list of calls used to estimate a fee.
        blockTag - a tag of the block in respect to what the query will be made.
        skipValidate - when set to true, the validation part of the transaction is skipped.
      • signOutsideExecutionCallV2

         Call signOutsideExecutionCallV2(Felt caller, Felt executeAfter, Felt executeBefore, List<Call> calls, Felt nonce)
        Parameters:
        caller - authorized executor of the transaction(s): Hex address or Felt.
        executeAfter - unix second timestamp of the beginning of the timeframe
        calls - the usual calls to be executed by the account
        nonce - this is different from the account’s usual nonce, it is used to prevent signature reuse across executions and doesn’t need to be incremental as long as it’s unique.
      • signOutsideExecutionCallV2

         Call signOutsideExecutionCallV2(Felt caller, Felt executeAfter, Felt executeBefore, Call call, Felt nonce)
        Parameters:
        caller - authorized executor of the transaction(s): Hex address or Felt.
        executeAfter - unix second timestamp of the beginning of the timeframe
        call - the usual call to be executed by the account
        nonce - this is different from the account’s usual nonce, it is used to prevent signature reuse across executions and doesn’t need to be incremental as long as it’s unique.
      • signOutsideExecutionCallV2

         Call signOutsideExecutionCallV2(Felt caller, Felt executeAfter, Felt executeBefore, List<Call> calls)
        Parameters:
        caller - authorized executor of the transaction(s): Hex address or Felt.
        executeAfter - unix second timestamp of the beginning of the timeframe
        calls - the usual calls to be executed by the account
      • signOutsideExecutionCallV2

         Call signOutsideExecutionCallV2(Felt caller, Felt executeAfter, Felt executeBefore, Call call)
        Parameters:
        caller - authorized executor of the transaction(s): Hex address or Felt.
        executeAfter - unix second timestamp of the beginning of the timeframe
        call - the usual call to be executed by the account
      • create

         final static StandardAccount create(Felt address, Signer signer, Provider provider, StarknetChainId chainId)

        Factory method to create a StandardAccount instance with automatic Cairo version determination.

        Parameters:
        address - the address of the account contract
        signer - a signer instance used to sign transactions
        provider - a provider used to interact with Starknet
        chainId - the chain id of the Starknet network
      • create

         final static StandardAccount create(Felt address, Felt privateKey, Provider provider, StarknetChainId chainId)

        Factory method to create a StandardAccount instance with a private key and automatic Cairo version determination.

        Parameters:
        address - the address of the account contract
        privateKey - a private key used to create a signer
        provider - a provider used to interact with Starknet
        chainId - the chain id of the Starknet network