Class: AccountInterface
Hierarchy​
↳
AccountInterface
Implemented by​
Constructors​
constructor​
• new AccountInterface()
Inherited from​
Properties​
address​
• Abstract
address: string
Defined in​
signer​
• Abstract
signer: SignerInterface
Defined in​
cairoVersion​
• Abstract
cairoVersion: CairoVersion
Defined in​
Methods​
estimateInvokeFee​
â–¸ Abstract
estimateInvokeFee(calls
, estimateFeeDetails?
): Promise
<EstimateFeeResponse
>
Estimate Fee for executing an INVOKE transaction on starknet
Parameters​
Name | Type | Description |
---|---|---|
calls | AllowArray <Call > | the invocation object containing: - contractAddress - the address of the contract - entrypoint - the entrypoint of the contract - calldata - (defaults to []) the calldata |
estimateFeeDetails? | EstimateFeeDetails | - |
Returns​
Promise
<EstimateFeeResponse
>
response from estimate_fee
Defined in​
estimateDeclareFee​
â–¸ Abstract
estimateDeclareFee(contractPayload
, estimateFeeDetails?
): Promise
<EstimateFeeResponse
>
Estimate Fee for executing a DECLARE transaction on starknet
Parameters​
Name | Type | Description |
---|---|---|
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. |
estimateFeeDetails? | EstimateFeeDetails | - |
Returns​
Promise
<EstimateFeeResponse
>
response from estimate_fee
Defined in​
estimateAccountDeployFee​
â–¸ Abstract
estimateAccountDeployFee(contractPayload
, estimateFeeDetails?
): Promise
<EstimateFeeResponse
>
Estimate Fee for executing a DEPLOY_ACCOUNT transaction on starknet
Parameters​
Name | Type | Description |
---|---|---|
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. |
estimateFeeDetails? | EstimateFeeDetails | optional blockIdentifier - constant nonce = 0 |
Returns​
Promise
<EstimateFeeResponse
>
response from estimate_fee
Defined in​
estimateDeployFee​
â–¸ Abstract
estimateDeployFee(deployContractPayload
, transactionsDetail?
): 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​
Name | Type | Description |
---|---|---|
deployContractPayload | UniversalDeployerContractPayload | UniversalDeployerContractPayload [] | containing - classHash: computed class hash of compiled contract - salt: address salt - unique: bool if true ensure unique salt - calldata: constructor calldata |
transactionsDetail? | InvocationsDetails | Invocation Details containing: - optional nonce - optional version - optional maxFee |
Returns​
Promise
<EstimateFeeResponse
>
Defined in​
estimateFeeBulk​
â–¸ Abstract
estimateFeeBulk(invocations
, details?
): Promise
<EstimateFeeResponseBulk
>
Estimate Fee for executing a list of transactions on starknet Contract must be deployed for fee estimation to be possible
Parameters​
Name | Type |
---|---|
invocations | Invocations |
details? | EstimateFeeDetails |
Returns​
Promise
<EstimateFeeResponseBulk
>
response from estimate_fee
Defined in​
execute​
â–¸ Abstract
execute(transactions
, abis?
, transactionsDetail?
): Promise
<InvokeFunctionResponse
>
Invoke execute function in account contract
Parameters​
Name | Type | Description |
---|---|---|
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 |
abis? | Abi [] | - |
transactionsDetail? | InvocationsDetails | - |
Returns​
Promise
<InvokeFunctionResponse
>
response from addTransaction
Defined in​
declare​
â–¸ Abstract
declare(contractPayload
, transactionsDetail?
): Promise
<DeclareContractResponse
>
Declares a given compiled contract (json) to starknet
Parameters​
Name | Type | Description |
---|---|---|
contractPayload | DeclareContractPayload | transaction payload to be deployed containing: - contract: compiled contract code - (optional) classHash: computed class hash of compiled contract. Pre-compute it for faster execution. - (required for Cairo1 without compiledClassHash) casm: CompiledContract | string; - (optional for Cairo1 with casm) compiledClassHash: compiled class hash from casm. Pre-compute it for faster execution. |
transactionsDetail? | InvocationsDetails | Invocation Details containing: - optional nonce - optional version - optional maxFee |
Returns​
Promise
<DeclareContractResponse
>
a confirmation of sending a transaction on the starknet contract
Defined in​
deploy​
â–¸ Abstract
deploy(payload
, details?
): Promise
<MultiDeployContractResponse
>
Deploys a declared contract to starknet - using Universal Deployer Contract (UDC) support multicall
Parameters​
Name | Type | Description |
---|---|---|
payload | UniversalDeployerContractPayload | UniversalDeployerContractPayload [] | classHash: computed class hash of compiled contract - [constructorCalldata] contract constructor calldata - [salt=pseudorandom] deploy address salt - [unique=true] ensure unique salt |
details? | InvocationsDetails | [nonce=getNonce] - [version=transactionVersion] - [maxFee=getSuggestedMaxFee] |
Returns​
Promise
<MultiDeployContractResponse
>
- contract_address[]
- transaction_hash
Defined in​
deployContract​
â–¸ Abstract
deployContract(payload
, details?
): Promise
<DeployContractUDCResponse
>
Simplify deploy simulating old DeployContract with same response + UDC specific response Internal wait for L2 transaction, support multicall
Parameters​
Name | Type | Description |
---|---|---|
payload | UniversalDeployerContractPayload | UniversalDeployerContractPayload [] | classHash: computed class hash of compiled contract - [constructorCalldata] contract constructor calldata - [salt=pseudorandom] deploy address salt - [unique=true] ensure unique salt |
details? | InvocationsDetails | [nonce=getNonce] - [version=transactionVersion] - [maxFee=getSuggestedMaxFee] |
Returns​
Promise
<DeployContractUDCResponse
>
- contract_address
- transaction_hash
- address
- deployer
- unique
- classHash
- calldata_len
- calldata
- salt
Defined in​
declareAndDeploy​
â–¸ Abstract
declareAndDeploy(payload
, details?
): Promise
<DeclareDeployUDCResponse
>
Declares and Deploy a given compiled contract (json) to starknet using UDC Internal wait for L2 transaction, do not support multicall Method will pass even if contract is already declared (internal using DeclareIfNot)
Parameters​
Name | Type | Description |
---|---|---|
payload | DeclareAndDeployContractPayload | contract: compiled contract code - [casm=cairo1]: CairoAssembly | undefined; - [compiledClassHash]: string | undefined; - [classHash]: computed class hash of compiled contract - [constructorCalldata] contract constructor calldata - [salt=pseudorandom] deploy address salt - [unique=true] ensure unique salt |
details? | InvocationsDetails | [nonce=getNonce] - [version=transactionVersion] - [maxFee=getSuggestedMaxFee] |
Returns​
Promise
<DeclareDeployUDCResponse
>
- declare
- transaction_hash
- deploy
- contract_address
- transaction_hash
- address
- deployer
- unique
- classHash
- calldata_len
- calldata
- salt
Defined in​
deployAccount​
â–¸ Abstract
deployAccount(contractPayload
, transactionsDetail?
): Promise
<DeployContractResponse
>
Deploy the account on Starknet
Parameters​
Name | Type | Description |
---|---|---|
contractPayload | DeployAccountContractPayload | transaction payload to be deployed containing: - classHash: computed class hash of compiled contract - optional constructor calldata - optional address salt - optional contractAddress |
transactionsDetail? | InvocationsDetails | Invocation Details containing: - constant nonce = 0 - optional version - optional maxFee |
Returns​
Promise
<DeployContractResponse
>
a confirmation of sending a transaction on the starknet contract
Defined in​
signMessage​
â–¸ Abstract
signMessage(typedData
): Promise
<Signature
>
Sign an JSON object for off-chain usage with the starknet private key and return the signature This adds a message prefix so it can't be interchanged with transactions
Throws
if the JSON object is not a valid JSON
Parameters​
Name | Type |
---|---|
typedData | TypedData |
Returns​
Promise
<Signature
>
the signature of the JSON object
Defined in​
hashMessage​
â–¸ Abstract
hashMessage(typedData
): Promise
<string
>
Hash a JSON object with Pedersen hash and return the hash This adds a message prefix so it can't be interchanged with transactions
Throws
if the JSON object is not a valid JSON
Parameters​
Name | Type |
---|---|
typedData | TypedData |
Returns​
Promise
<string
>
the hash of the JSON object
Defined in​
verifyMessage​
â–¸ Abstract
verifyMessage(typedData
, signature
): Promise
<boolean
>
Verify a signature of a JSON object
Throws
if the JSON object is not a valid JSON or the signature is not a valid signature
Parameters​
Name | Type | Description |
---|---|---|
typedData | TypedData | JSON object to be verified |
signature | Signature | signature of the JSON object |
Returns​
Promise
<boolean
>
true if the signature is valid, false otherwise
Defined in​
verifyMessageHash​
â–¸ Abstract
verifyMessageHash(hash
, signature
): Promise
<boolean
>
Verify a signature of a given hash
Warning
This method is not recommended, use verifyMessage instead
Throws
if the signature is not a valid signature
Parameters​
Name | Type | Description |
---|---|---|
hash | BigNumberish | hash to be verified |
signature | Signature | signature of the hash |
Returns​
Promise
<boolean
>
true if the signature is valid, false otherwise
Defined in​
getNonce​
â–¸ Abstract
getNonce(blockIdentifier?
): Promise
<string
>
Gets the nonce of the account with respect to a specific block
Parameters​
Name | Type | Description |
---|---|---|
blockIdentifier? | BlockIdentifier | optional blockIdentifier. Defaults to 'pending' |
Returns​
Promise
<string
>
nonce of the account
Defined in​
getSuggestedMaxFee​
â–¸ Abstract
getSuggestedMaxFee(estimateFeeAction
, details
): Promise
<bigint
>
Gets Suggested Max Fee based on the transaction type
Parameters​
Name | Type |
---|---|
estimateFeeAction | EstimateFeeAction |
details | EstimateFeeDetails |
Returns​
Promise
<bigint
>
suggestedMaxFee
Defined in​
simulateTransaction​
â–¸ Abstract
simulateTransaction(invocations
, details?
): Promise
<SimulateTransactionResponse
>
Simulates an array of transaction and returns an array of transaction trace and estimated fee.
Parameters​
Name | Type | Description |
---|---|---|
invocations | Invocations | Invocations containing: - type - transaction type: DECLARE, (multi)DEPLOY, DEPLOY_ACCOUNT, (multi)INVOKE_FUNCTION |
details? | SimulateTransactionDetails | SimulateTransactionDetails |
Returns​
Promise
<SimulateTransactionResponse
>
response from simulate_transaction
Defined in​
getChainId​
â–¸ Abstract
getChainId(): Promise
<StarknetChainId
>
Gets the Starknet chain Id
Returns​
Promise
<StarknetChainId
>
the chain Id
Inherited from​
Defined in​
callContract​
â–¸ Abstract
callContract(call
, blockIdentifier?
): Promise
<CallContractResponse
>
Calls a function on the Starknet contract.
Parameters​
Name | Type | Description |
---|---|---|
call | Call | transaction to be called |
blockIdentifier? | BlockIdentifier | block identifier |
Returns​
Promise
<CallContractResponse
>
the result of the function on the smart contract.
Inherited from​
ProviderInterface.callContract
Defined in​
getBlock​
â–¸ Abstract
getBlock(blockIdentifier
): Promise
<GetBlockResponse
>
Gets the block information
Parameters​
Name | Type | Description |
---|---|---|
blockIdentifier | BlockIdentifier | block identifier |
Returns​
Promise
<GetBlockResponse
>
the block object
Inherited from​
Defined in​
getCode​
â–¸ Abstract
getCode(contractAddress
, blockIdentifier?
): Promise
<GetCodeResponse
>
Deprecated
The method should not be used
Parameters​
Name | Type |
---|---|
contractAddress | string |
blockIdentifier? | BlockIdentifier |
Returns​
Promise
<GetCodeResponse
>
Inherited from​
Defined in​
getClassAt​
â–¸ Abstract
getClassAt(contractAddress
, blockIdentifier?
): Promise
<ContractClassResponse
>
Gets the contract class of the deployed contract.
Parameters​
Name | Type | Description |
---|---|---|
contractAddress | string | contract address |
blockIdentifier? | BlockIdentifier | block identifier |
Returns​
Promise
<ContractClassResponse
>
Contract class of compiled contract
Inherited from​
Defined in​
getClassHashAt​
â–¸ Abstract
getClassHashAt(contractAddress
, blockIdentifier?
): Promise
<string
>
Returns the contract class hash in the given block for the contract deployed at the given address
Parameters​
Name | Type | Description |
---|---|---|
contractAddress | string | contract address |
blockIdentifier? | BlockIdentifier | block identifier |
Returns​
Promise
<string
>
Class hash
Inherited from​
ProviderInterface.getClassHashAt
Defined in​
getClassByHash​
â–¸ Abstract
getClassByHash(classHash
): Promise
<ContractClassResponse
>
Returns the contract class deployed under the given class hash.
Parameters​
Name | Type | Description |
---|---|---|
classHash | string | class hash |
Returns​
Promise
<ContractClassResponse
>
Contract class of compiled contract
Inherited from​
ProviderInterface.getClassByHash
Defined in​
getNonceForAddress​
â–¸ Abstract
getNonceForAddress(contractAddress
, blockIdentifier?
): Promise
<string
>
Returns the nonce associated with the given address in the given block
Parameters​
Name | Type | Description |
---|---|---|
contractAddress | string | contract address |
blockIdentifier? | BlockIdentifier | - |
Returns​
Promise
<string
>
the hex nonce
Inherited from​
ProviderInterface.getNonceForAddress
Defined in​
getStorageAt​
â–¸ Abstract
getStorageAt(contractAddress
, key
, blockIdentifier?
): Promise
<string
>
Get the value of the storage (contract's variable) at the given address and key
Parameters​
Name | Type | Description |
---|---|---|
contractAddress | string | |
key | BigNumberish | from getStorageVarAddress('<STORAGE_VARIABLE_NAME>') (WIP) |
blockIdentifier? | BlockIdentifier | block identifier |
Returns​
Promise
<string
>
the value of the storage variable
Inherited from​
ProviderInterface.getStorageAt
Defined in​
getTransaction​
â–¸ Abstract
getTransaction(transactionHash
): Promise
<GetTransactionResponse
>
Gets the transaction information from a tx id.
Parameters​
Name | Type |
---|---|
transactionHash | BigNumberish |
Returns​
Promise
<GetTransactionResponse
>
the transaction object { transaction_id, status, transaction, block_number?, block_number?, transaction_index?, transaction_failure_reason? }
Inherited from​
ProviderInterface.getTransaction
Defined in​
getTransactionReceipt​
â–¸ Abstract
getTransactionReceipt(transactionHash
): Promise
<GetTransactionReceiptResponse
>
Gets the transaction receipt from a tx hash.
Parameters​
Name | Type |
---|---|
transactionHash | BigNumberish |
Returns​
Promise
<GetTransactionReceiptResponse
>
the transaction receipt object
Inherited from​
ProviderInterface.getTransactionReceipt
Defined in​
deployAccountContract​
â–¸ Abstract
deployAccountContract(payload
, details
): Promise
<DeployContractResponse
>
Deploys a given compiled Account contract (json) to starknet
Parameters​
Name | Type | Description |
---|---|---|
payload | DeployAccountContractPayload | payload to be deployed containing: - compiled contract code - constructor calldata - address salt |
details | InvocationsDetailsWithNonce | - |
Returns​
Promise
<DeployContractResponse
>
a confirmation of sending a transaction on the starknet contract
Inherited from​
ProviderInterface.deployAccountContract
Defined in​
invokeFunction​
â–¸ Abstract
invokeFunction(invocation
, details
): Promise
<InvokeFunctionResponse
>
Invokes a function on starknet
Deprecated
This method won't be supported as soon as fees are mandatory. Should not be used outside of Account class
Parameters​
Name | Type | Description |
---|---|---|
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
>
response from addTransaction
Inherited from​
ProviderInterface.invokeFunction
Defined in​
declareContract​
â–¸ Abstract
declareContract(transaction
, details
): Promise
<DeclareContractResponse
>
Declares a given compiled contract (json) to starknet
Parameters​
Name | Type | Description |
---|---|---|
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
>
a confirmation of sending a transaction on the starknet contract
Inherited from​
ProviderInterface.declareContract
Defined in​
getEstimateFee​
â–¸ Abstract
getEstimateFee(invocation
, details
, blockIdentifier
, skipValidate?
): Promise
<EstimateFeeResponse
>
Estimates the fee for a given INVOKE transaction
Deprecated
Please use getInvokeEstimateFee or getDeclareEstimateFee instead. Should not be used outside of Account class
Parameters​
Name | Type | Description |
---|---|---|
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 | (optional) block identifier |
skipValidate? | boolean | (optional) skip cairo validate method |
Returns​
Promise
<EstimateFeeResponse
>
the estimated fee
Inherited from​
ProviderInterface.getEstimateFee
Defined in​
getInvokeEstimateFee​
â–¸ Abstract
getInvokeEstimateFee(invocation
, details
, blockIdentifier?
, skipValidate?
): Promise
<EstimateFeeResponse
>
Estimates the fee for a given INVOKE transaction
Parameters​
Name | Type | Description |
---|---|---|
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 | (optional) block identifier |
skipValidate? | boolean | (optional) skip cairo validate method |
Returns​
Promise
<EstimateFeeResponse
>
the estimated fee
Inherited from​
ProviderInterface.getInvokeEstimateFee
Defined in​
getDeclareEstimateFee​
â–¸ Abstract
getDeclareEstimateFee(transaction
, details
, blockIdentifier?
, skipValidate?
): Promise
<EstimateFeeResponse
>
Estimates the fee for a given DECLARE transaction
Parameters​
Name | Type | Description |
---|---|---|
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 |
blockIdentifier? | BlockIdentifier | (optional) block identifier |
skipValidate? | boolean | (optional) skip cairo validate method |
Returns​
Promise
<EstimateFeeResponse
>
the estimated fee
Inherited from​
ProviderInterface.getDeclareEstimateFee
Defined in​
getDeployAccountEstimateFee​
â–¸ Abstract
getDeployAccountEstimateFee(transaction
, details
, blockIdentifier?
, skipValidate?
): Promise
<EstimateFeeResponse
>
Estimates the fee for a given DEPLOY_ACCOUNT transaction
Parameters​
Name | Type | Description |
---|---|---|
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 |
blockIdentifier? | BlockIdentifier | (optional) block identifier |
skipValidate? | boolean | (optional) skip cairo validate method |
Returns​
Promise
<EstimateFeeResponse
>
the estimated fee
Inherited from​
ProviderInterface.getDeployAccountEstimateFee
Defined in​
getEstimateFeeBulk​
â–¸ Abstract
getEstimateFeeBulk(invocations
, options?
): Promise
<EstimateFeeResponseBulk
>
Estimates the fee for a list of INVOKE transaction
Parameters​
Name | Type | Description |
---|---|---|
invocations | AccountInvocations | AccountInvocations - Complete invocations array with account details |
options? | getEstimateFeeBulkOptions | getEstimateFeeBulkOptions - (optional) blockIdentifier - BlockIdentifier - (optional) skipValidate - boolean (default false) |
Returns​
Promise
<EstimateFeeResponseBulk
>
the estimated fee
Inherited from​
ProviderInterface.getEstimateFeeBulk
Defined in​
waitForTransaction​
â–¸ Abstract
waitForTransaction(txHash
, options?
): Promise
<GetTransactionReceiptResponse
>
Wait for the transaction to be accepted
Parameters​
Name | Type | Description |
---|---|---|
txHash | BigNumberish | transaction hash |
options? | waitForTransactionOptions | waitForTransactionOptions - (optional) retryInterval: number | undefined; - (optional) successStates: TransactionStatus[] | undefined; |
Returns​
Promise
<GetTransactionReceiptResponse
>
GetTransactionReceiptResponse
Inherited from​
ProviderInterface.waitForTransaction
Defined in​
getSimulateTransaction​
â–¸ Abstract
getSimulateTransaction(invocations
, options?
): Promise
<SimulateTransactionResponse
>
Simulates the transaction and returns the transaction trace and estimated fee.
Parameters​
Name | Type | Description |
---|---|---|
invocations | AccountInvocations | AccountInvocations - Complete invocations array with account details |
options? | getSimulateTransactionOptions | getSimulateTransactionOptions - (optional) blockIdentifier - block identifier - (optional) skipValidate - skip cairo validate method - (optional) skipExecute - skip cairo execute method |
Returns​
Promise
<SimulateTransactionResponse
>
an array of transaction trace and estimated fee
Inherited from​
ProviderInterface.getSimulateTransaction
Defined in​
getStateUpdate​
â–¸ Abstract
getStateUpdate(blockIdentifier?
): Promise
<StateUpdateResponse
>
Gets the state changes in a specific block (result of executing the requested block)
Parameters​
Name | Type | Description |
---|---|---|
blockIdentifier? | BlockIdentifier | block identifier |
Returns​
Promise
<StateUpdateResponse
>
StateUpdateResponse
Inherited from​
ProviderInterface.getStateUpdate
Defined in​
getContractVersion​
â–¸ Abstract
getContractVersion(contractAddress
, classHash?
, options?
): Promise
<ContractVersion
>
Gets the contract version from the provided address
Parameters​
Name | Type | Description |
---|---|---|
contractAddress | string | string |
classHash? | undefined | undefined |
options? | getContractVersionOptions | getContractVersionOptions - (optional) compiler - (default true) extract compiler version using type tactic from abi - (optional) blockIdentifier - block identifier |
Returns​
Promise
<ContractVersion
>
Inherited from​
ProviderInterface.getContractVersion
Defined in​
â–¸ Abstract
getContractVersion(contractAddress
, classHash
, options?
): Promise
<ContractVersion
>
Gets the contract version from the provided address
Parameters​
Name | Type | Description |
---|---|---|
contractAddress | undefined | undefined |
classHash | string | |
options? | getContractVersionOptions | getContractVersionOptions - (optional) compiler - (default true) extract compiler version using type tactic from abi - (optional) blockIdentifier - block identifier |
Returns​
Promise
<ContractVersion
>
Inherited from​
ProviderInterface.getContractVersion