Class AccountInterfaceAbstract

Hierarchy

  • ProviderInterface
    • AccountInterface

Constructors

Properties

chainId: StarknetChainId
address: string
signer: SignerInterface

Methods

  • Gets the Starknet chain Id

    Returns

    the chain Id

    Returns Promise<StarknetChainId>

  • Calls a function on the StarkNet contract.

    Returns

    the result of the function on the smart contract.

    Parameters

    • call: Call

      transaction to be called

    • Optional blockIdentifier: BlockIdentifier

      block identifier

    Returns Promise<CallContractResponse>

  • Gets the block information

    Returns

    the block object

    Parameters

    • blockIdentifier: BlockIdentifier

      block identifier

    Returns Promise<GetBlockResponse>

  • Deprecated

    The method should not be used

    Parameters

    • contractAddress: string
    • Optional blockIdentifier: BlockIdentifier

    Returns Promise<GetCodeResponse>

  • Gets the contract class of the deployed contract.

    Returns

    Contract class of compiled contract

    Parameters

    • contractAddress: string

      contract address

    • Optional blockIdentifier: BlockIdentifier

      block identifier

    Returns Promise<ContractClass>

  • Returns the class hash deployed under the given address.

    Returns

    Class hash

    Parameters

    • contractAddress: string

      contract address

    • Optional blockIdentifier: BlockIdentifier

      block identifier

    Returns Promise<string>

  • Returns the contract class deployed under the given class hash.

    Returns

    Contract class of compiled contract

    Parameters

    • classHash: string

      class hash

    Returns Promise<ContractClass>

  • Gets the nonce of a contract with respect to a specific block

    Returns

    the hex nonce

    Parameters

    • contractAddress: string

      contract address

    • Optional blockIdentifier: BlockIdentifier

    Returns Promise<BigNumberish>

  • Gets the contract's storage variable at a specific key.

    Returns

    the value of the storage variable

    Parameters

    • contractAddress: string
    • key: BigNumberish

      from getStorageVarAddress('') (WIP)

    • Optional blockIdentifier: BlockIdentifier

      block identifier

    Returns Promise<BigNumberish>

  • Gets the transaction information from a tx id.

    Returns

    the transaction object { transaction_id, status, transaction, block_number?, block_number?, transaction_index?, transaction_failure_reason? }

    Parameters

    • transactionHash: BigNumberish

    Returns Promise<GetTransactionResponse>

  • Gets the transaction receipt from a tx hash.

    Returns

    the transaction receipt object

    Parameters

    • transactionHash: BigNumberish

    Returns Promise<GetTransactionReceiptResponse>

  • Deploys a given compiled Account contract (json) to starknet

    Returns

    a confirmation of sending a transaction on the starknet contract

    Parameters

    • payload: DeployAccountContractPayload

      payload to be deployed containing:

      • compiled contract code
      • constructor calldata
      • address salt
    • details: InvocationsDetailsWithNonce

    Returns Promise<DeployContractResponse>

  • Invokes a function on starknet

    Deprecated

    This method wont be supported as soon as fees are mandatory. Should not be used outside of Account class

    Returns

    response from addTransaction

    Parameters

    • invocation: Invocation

      the invocation object containing:

      • contractAddress - the address of the contract
      • entrypoint - the entrypoint of the contract
      • calldata - (defaults to []) the calldata
      • signature - (defaults to []) the signature
    • details: InvocationsDetailsWithNonce

      optional details containing:

      • nonce - optional nonce
      • version - optional version
      • maxFee - optional maxFee

    Returns Promise<InvokeFunctionResponse>

  • Declares a given compiled contract (json) to starknet

    Returns

    a confirmation of sending a transaction on the starknet contract

    Parameters

    • transaction: DeclareContractTransaction

      transaction payload to be deployed containing:

      • compiled contract code
      • sender address
      • signature
    • details: InvocationsDetailsWithNonce

      Invocation Details containing:

      • nonce
      • optional version
      • optional maxFee

    Returns Promise<DeclareContractResponse>

  • Estimates the fee for a given INVOKE transaction

    Deprecated

    Please use getInvokeEstimateFee or getDeclareEstimateFee instead. Should not be used outside of Account class

    Returns

    the estimated fee

    Parameters

    • invocation: Invocation

      the invocation object containing:

      • contractAddress - the address of the contract
      • entrypoint - the entrypoint of the contract
      • calldata - (defaults to []) the calldata
      • signature - (defaults to []) the signature
    • details: InvocationsDetailsWithNonce

      optional details containing:

      • nonce - optional nonce
      • version - optional version
    • blockIdentifier: BlockIdentifier

      block identifier

    Returns Promise<EstimateFeeResponse>

  • Estimates the fee for a given INVOKE transaction

    Returns

    the estimated fee

    Parameters

    • invocation: Invocation

      the invocation object containing:

      • contractAddress - the address of the contract
      • entrypoint - the entrypoint of the contract
      • calldata - (defaults to []) the calldata
      • signature - (defaults to []) the signature
    • details: InvocationsDetailsWithNonce

      optional details containing:

      • nonce - optional nonce
      • version - optional version
    • Optional blockIdentifier: BlockIdentifier

      block identifier

    Returns Promise<EstimateFeeResponse>

  • Estimates the fee for a given DECLARE transaction

    Returns

    the estimated fee

    Parameters

    • transaction: DeclareContractTransaction

      transaction payload to be declared containing:

      • compiled contract code
      • sender address
      • signature - (defaults to []) the signature
    • details: InvocationsDetailsWithNonce

      optional details containing:

      • nonce
      • version - optional version
      • optional maxFee
    • Optional blockIdentifier: BlockIdentifier

      block identifier

    Returns Promise<EstimateFeeResponse>

  • Estimates the fee for a given DEPLOY_ACCOUNT transaction

    Returns

    the estimated fee

    Parameters

    • transaction: DeployAccountContractTransaction

      transaction payload to be deployed containing:

      • classHash
      • constructorCalldata
      • addressSalt
      • signature - (defaults to []) the signature
    • details: InvocationsDetailsWithNonce

      optional details containing:

      • nonce
      • version - optional version
      • optional maxFee
    • Optional blockIdentifier: BlockIdentifier

      block identifier

    Returns Promise<EstimateFeeResponse>

  • Wait for the transaction to be accepted

    Returns

    GetTransactionReceiptResponse

    Parameters

    • txHash: BigNumberish

      transaction hash

    • Optional retryInterval: number

      retry interval

    • Optional successStates: Status[]

    Returns Promise<GetTransactionReceiptResponse>

  • Deprecated

    Use estimateInvokeFee or estimateDeclareFee instead Estimate Fee for executing an INVOKE transaction on starknet

    Returns

    response from estimate_fee

    Parameters

    • calls: AllowArray<Call>

      the invocation object containing:

      • contractAddress - the address of the contract
      • entrypoint - the entrypoint of the contract
      • calldata - (defaults to []) the calldata
    • Optional estimateFeeDetails: EstimateFeeDetails

    Returns Promise<EstimateFeeResponse>

  • Estimate Fee for executing an INVOKE transaction on starknet

    Returns

    response from estimate_fee

    Parameters

    • calls: AllowArray<Call>

      the invocation object containing:

      • contractAddress - the address of the contract
      • entrypoint - the entrypoint of the contract
      • calldata - (defaults to []) the calldata
    • Optional estimateFeeDetails: EstimateFeeDetails

    Returns Promise<EstimateFeeResponse>

  • Estimate Fee for executing a DECLARE transaction on starknet

    Returns

    response from estimate_fee

    Parameters

    • contractPayload: DeclareContractPayload

      the payload object containing:

      • contract - the compiled contract to be declared
      • classHash - the class hash of the compiled contract. This can be obtained by using starknet-cli.
    • Optional estimateFeeDetails: EstimateFeeDetails

    Returns Promise<EstimateFeeResponse>

  • Estimate Fee for executing a DEPLOY_ACCOUNT transaction on starknet

    Returns

    response from estimate_fee

    Parameters

    • contractPayload: DeployAccountContractPayload

      contract - the compiled contract to be deployed

      • classHash - the class hash of the compiled contract. This can be obtained by using starknet-cli.
    • Optional estimateFeeDetails: EstimateFeeDetails

      optional blockIdentifier

      • constant nonce = 0

    Returns Promise<EstimateFeeResponse>

  • Estimate Fee for executing a UDC DEPLOY transaction on starknet This is different from the normal DEPLOY transaction as it goes through the Universal Deployer Contract (UDC)

    Parameters

    • deployContractPayload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[]

      containing

      • classHash: computed class hash of compiled contract
      • salt: address salt
      • unique: bool if true ensure unique salt
      • calldata: constructor calldata
    • Optional transactionsDetail: InvocationsDetails

      Invocation Details containing:

      • optional nonce
      • optional version
      • optional maxFee

    Returns Promise<EstimateFeeResponse>

  • Invoke execute function in account contract

    Returns

    response from addTransaction

    Parameters

    • transactions: AllowArray<Call>

      the invocation object or an array of them, containing:

      • contractAddress - the address of the contract
      • entrypoint - the entrypoint of the contract
      • calldata - (defaults to []) the calldata
      • signature - (defaults to []) the signature
    • Optional abis: Abi[]
    • Optional transactionsDetail: InvocationsDetails

    Returns Promise<InvokeFunctionResponse>

  • Declares a given compiled contract (json) to starknet

    Returns

    a confirmation of sending a transaction on the starknet contract

    Parameters

    • contractPayload: DeclareContractPayload

      transaction payload to be deployed containing:

      • contract: compiled contract code
      • classHash: computed class hash of compiled contract
    • Optional transactionsDetail: InvocationsDetails

      Invocation Details containing:

      • optional nonce
      • optional version
      • optional maxFee

    Returns Promise<DeclareContractResponse>

  • Deploys a declared contract to starknet - using Universal Deployer Contract (UDC) support multicall

    Returns

    • contract_address[]
    • transaction_hash

    Parameters

    • payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[]

      classHash: computed class hash of compiled contract

      • [constructorCalldata] contract constructor calldata
      • [salt=pseudorandom] deploy address salt
      • [unique=true] ensure unique salt
    • Optional details: InvocationsDetails

      [nonce=getNonce]

      • [version=transactionVersion]
      • [maxFee=getSuggestedMaxFee]

    Returns Promise<MultiDeployContractResponse>

  • Simplify deploy simulating old DeployContract with same response + UDC specific response Internal wait for L2 transaction, support multicall

    Returns

    • contract_address
    • transaction_hash
    • address
    • deployer
    • unique
    • classHash
    • calldata_len
    • calldata
    • salt

    Parameters

    • payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[]

      classHash: computed class hash of compiled contract

      • [constructorCalldata] contract constructor calldata
      • [salt=pseudorandom] deploy address salt
      • [unique=true] ensure unique salt
    • Optional details: InvocationsDetails

      [nonce=getNonce]

      • [version=transactionVersion]
      • [maxFee=getSuggestedMaxFee]

    Returns Promise<DeployContractUDCResponse>

  • Declares and Deploy a given compiled contract (json) to starknet using UDC Internal wait for L2 transaction, do not support multicall

    Returns

    • declare
      • transaction_hash
    • deploy
      • contract_address
      • transaction_hash
      • address
      • deployer
      • unique
      • classHash
      • calldata_len
      • calldata
      • salt

    Parameters

    • payload: DeclareDeployContractPayload
    • Optional details: InvocationsDetails

      [nonce=getNonce]

      • [version=transactionVersion]
      • [maxFee=getSuggestedMaxFee]

    Returns Promise<DeclareDeployUDCResponse>

  • Deploy the account on Starknet

    Returns

    a confirmation of sending a transaction on the starknet contract

    Parameters

    • contractPayload: DeployAccountContractPayload

      transaction payload to be deployed containing:

      • classHash: computed class hash of compiled contract
      • optional constructor calldata
      • optional address salt
      • optional contractAddress
    • Optional transactionsDetail: InvocationsDetails

      Invocation Details containing:

      • constant nonce = 0
      • optional version
      • optional maxFee

    Returns Promise<DeployContractResponse>

  • Sign an JSON object for off-chain usage with the starknet private key and return the signature This adds a message prefix so it cant be interchanged with transactions

    Returns

    the signature of the JSON object

    Throws

    if the JSON object is not a valid JSON

    Parameters

    • typedData: TypedData

    Returns Promise<Signature>

  • Hash a JSON object with pederson hash and return the hash This adds a message prefix so it cant be interchanged with transactions

    Returns

    the hash of the JSON object

    Throws

    if the JSON object is not a valid JSON

    Parameters

    • typedData: TypedData

    Returns Promise<string>

  • Verify a signature of a JSON object

    Returns

    true if the signature is valid, false otherwise

    Throws

    if the JSON object is not a valid JSON or the signature is not a valid signature

    Parameters

    • typedData: TypedData

      JSON object to be verified

    • signature: Signature

      signature of the JSON object

    Returns Promise<boolean>

  • Verify a signature of a given hash

    Warning

    This method is not recommended, use verifyMessage instead

    Returns

    true if the signature is valid, false otherwise

    Throws

    if the signature is not a valid signature

    Parameters

    • hash: BigNumberish

      hash to be verified

    • signature: Signature

      signature of the hash

    Returns Promise<boolean>

  • Gets the nonce of the account with respect to a specific block

    Returns

    nonce of the account

    Parameters

    • Optional blockIdentifier: BlockIdentifier

      optional blockIdentifier. Defaults to 'pending'

    Returns Promise<BigNumberish>

  • Gets Suggested Max Fee based on the transaction type

    Returns

    suggestedMaxFee

    Parameters

    • estimateFeeAction: EstimateFeeAction
    • details: EstimateFeeDetails

    Returns Promise<BigNumberish>

Generated using TypeDoc