Class: Account
Hierarchy
↳
Account
Implements
Constructors
constructor
• new Account(options
): Account
Parameters
Name | Type |
---|---|
options | AccountOptions |
Returns
Overrides
Defined in
Properties
signer
• signer: SignerInterface
Implementation of
Defined in
address
• address: string
Implementation of
Defined in
cairoVersion
• cairoVersion: CairoVersion
Implementation of
Defined in
transactionVersion
• Readonly
transactionVersion: "0x3"
Defined in
paymaster
• paymaster: PaymasterInterface
Defined in
deployer
• deployer: Deployer
Defined in
defaultTipType
• defaultTipType: TipType
Defined in
deploySelf
• deploySelf: (__namedParameters
: DeployAccountContractPayload
, details
: UniversalDetails
) => Promise
<DeployContractResponse
>
Type declaration
▸ («destructured»
, details?
): Promise
<DeployContractResponse
>
Parameters
Name | Type |
---|---|
«destructured» | DeployAccountContractPayload |
details | UniversalDetails |
Returns
Promise
<DeployContractResponse
>
Defined in
responseParser
• responseParser: RPCResponseParser
Implementation of
AccountInterface.responseParser
Inherited from
Defined in
channel
• channel: RpcChannel
| RpcChannel
Implementation of
Inherited from
Defined in
getStateUpdate
• getStateUpdate: () => Promise
<{ block_hash
: string
; new_root
: string
; old_root
: string
; state_diff
: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>(blockIdentifier
: "pre_confirmed"
) => Promise
<PRE_CONFIRMED_STATE_UPDATE
>(blockIdentifier
: "latest"
) => Promise
<{ block_hash
: string
; new_root
: string
; old_root
: string
; state_diff
: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>(blockIdentifier?
: BlockIdentifier
) => Promise
<StateUpdateResponse
>
Type declaration
▸ (): Promise
<{ block_hash
: string
; new_root
: string
; old_root
: string
; state_diff
: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>
Returns
Promise
<{ block_hash
: string
; new_root
: string
; old_root
: string
; state_diff
: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>
▸ (blockIdentifier
): Promise
<PRE_CONFIRMED_STATE_UPDATE
>
Parameters
Name | Type |
---|---|
blockIdentifier | "pre_confirmed" |
Returns
Promise
<PRE_CONFIRMED_STATE_UPDATE
>
▸ (blockIdentifier
): Promise
<{ block_hash
: string
; new_root
: string
; old_root
: string
; state_diff
: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>
Parameters
Name | Type |
---|---|
blockIdentifier | "latest" |
Returns
Promise
<{ block_hash
: string
; new_root
: string
; old_root
: string
; state_diff
: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>
▸ (blockIdentifier?
): Promise
<StateUpdateResponse
>
Parameters
Name | Type |
---|---|
blockIdentifier? | BlockIdentifier |
Returns
Promise
<StateUpdateResponse
>
Implementation of
AccountInterface.getStateUpdate
Inherited from
Defined in
Methods
getStarkName
▸ getStarkName(provider
, address
, StarknetIdContract?
): Promise
<string
>
Parameters
Name | Type |
---|---|
provider | ProviderInterface |
address | BigNumberish |
StarknetIdContract? | string |
Returns
Promise
<string
>
Inherited from
Defined in
src/provider/extensions/starknetId.ts:62
getAddressFromStarkName
▸ getAddressFromStarkName(provider
, name
, StarknetIdContract?
): Promise
<string
>
Parameters
Name | Type |
---|---|
provider | ProviderInterface |
name | string |
StarknetIdContract? | string |
Returns
Promise
<string
>
Inherited from
Provider.getAddressFromStarkName
Defined in
src/provider/extensions/starknetId.ts:96
getStarkProfile
▸ getStarkProfile(provider
, address
, StarknetIdContract?
, StarknetIdIdentityContract?
, StarknetIdVerifierContract?
, StarknetIdPfpContract?
, StarknetIdPopContract?
, StarknetIdMulticallContract?
): Promise
<StarkProfile
>
Parameters
Name | Type |
---|---|
provider | ProviderInterface |
address | BigNumberish |
StarknetIdContract? | string |
StarknetIdIdentityContract? | string |
StarknetIdVerifierContract? | string |
StarknetIdPfpContract? | string |
StarknetIdPopContract? | string |
StarknetIdMulticallContract? | string |
Returns
Promise
<StarkProfile
>
Inherited from
Defined in
src/provider/extensions/starknetId.ts:128
getNonce
▸ 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
Implementation of
Defined in
getNonceSafe
▸ getNonceSafe(nonce?
): Promise
<bigint
>
Parameters
Name | Type |
---|---|
nonce? | BigNumberish |
Returns
Promise
<bigint
>
Defined in
getCairoVersion
▸ getCairoVersion(classHash?
): Promise
<CairoVersion
>
Retrieves the Cairo version from the network and sets cairoVersion
if not already set in the constructor.
Parameters
Name | Type | Description |
---|---|---|
classHash? | string | if provided detects Cairo version from classHash, otherwise from the account address |
Returns
Promise
<CairoVersion
>
Defined in
estimateInvokeFee
▸ estimateInvokeFee(calls
, details?
): Promise
<EstimateFeeResponseOverhead
>
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 |
details | UniversalDetails | blockIdentifier? - nonce? = 0 - skipValidate? - default true - tip? - prioritize order of transactions in the mempool. - accountDeploymentData? - deploy an account contract (substitution for deploy account transaction) - paymasterData? - entity other than the transaction sender to pay the transaction fees(EIP-4337) - nonceDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - feeDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - version? - specify ETransactionVersion - V3 Transactions fee is in fri, oldV transactions fee is in wei |
Returns
Promise
<EstimateFeeResponseOverhead
>
response from estimate_fee
Implementation of
AccountInterface.estimateInvokeFee
Defined in
estimateDeclareFee
▸ estimateDeclareFee(payload
, details?
): Promise
<EstimateFeeResponseOverhead
>
Estimate Fee for executing a DECLARE transaction on starknet
Parameters
Name | Type | Description |
---|---|---|
payload | DeclareContractPayload | the payload object containing: - contract - the compiled contract to be declared - casm? - compiled cairo assembly. Cairo1(casm or compiledClassHash are required) - classHash? - the class hash of the compiled contract. Precalculate for faster execution. - compiledClassHash?: class hash of the cairo assembly. Cairo1(casm or compiledClassHash are required) |
details | UniversalDetails | blockIdentifier? - nonce? = 0 - skipValidate? - default true - tip? - prioritize order of transactions in the mempool. - accountDeploymentData? - deploy an account contract (substitution for deploy account transaction) - paymasterData? - entity other than the transaction sender to pay the transaction fees(EIP-4337) - nonceDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - feeDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - version? - specify ETransactionVersion - V3 Transactions fee is in fri, oldV transactions fee is in wei |
Returns
Promise
<EstimateFeeResponseOverhead
>
response from estimate_fee
Implementation of
AccountInterface.estimateDeclareFee
Defined in
estimateAccountDeployFee
▸ estimateAccountDeployFee(«destructured»
, details?
): Promise
<EstimateFeeResponseOverhead
>
Estimate Fee for executing a DEPLOY_ACCOUNT transaction on starknet
Parameters
Name | Type | Description |
---|---|---|
«destructured» | DeployAccountContractPayload | classHash - the class hash of the compiled contract. - constructorCalldata? - constructor data; - contractAddress? - future account contract address. Precalculate for faster execution. - addressSalt? - salt used for calculation of the contractAddress. Required if contractAddress is provided. |
details | UniversalDetails | blockIdentifier? - nonce? = 0 - skipValidate? - default true - tip? - prioritize order of transactions in the mempool. - paymasterData? - entity other than the transaction sender to pay the transaction fees(EIP-4337) - nonceDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - feeDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - version? - specify ETransactionVersion - V3 Transactions fee is in fri, oldV transactions fee is in wei |
Returns
Promise
<EstimateFeeResponseOverhead
>
response from estimate_fee
Implementation of
AccountInterface.estimateAccountDeployFee
Defined in
estimateDeployFee
▸ estimateDeployFee(payload
, details?
): Promise
<EstimateFeeResponseOverhead
>
Estimate Fee for executing a Deployer DEPLOY transaction on starknet This is different from the normal DEPLOY transaction as it goes through a Deployer Contract
Parameters
Name | Type | Description |
---|---|---|
payload | UniversalDeployerContractPayload | UniversalDeployerContractPayload [] | array or singular - classHash: computed class hash of compiled contract - salt: address salt - unique: bool if true ensure unique salt - constructorCalldata: constructor calldata |
details | UniversalDetails | blockIdentifier? - nonce? - skipValidate? - default true - tip? - prioritize order of transactions in the mempool. - accountDeploymentData? - deploy an account contract (substitution for deploy account transaction) - paymasterData? - entity other than the transaction sender to pay the transaction fees(EIP-4337) - nonceDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - feeDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - version? - specify ETransactionVersion - V3 Transactions fee is in fri, oldV transactions fee is in wei |
Returns
Promise
<EstimateFeeResponseOverhead
>
Implementation of
AccountInterface.estimateDeployFee
Defined in
estimateFeeBulk
▸ estimateFeeBulk(invocations
, details?
): Promise
<EstimateFeeBulk
>
Estimate Fee for executing a list of transactions on starknet Contract must be deployed for fee estimation to be possible
Parameters
Name | Type | Description |
---|---|---|
invocations | Invocations | array of transaction object containing : - type - the type of transaction : 'DECLARE' | (multi)'DEPLOY' | (multi)'INVOKE_FUNCTION' | 'DEPLOY_ACCOUNT' - payload - the payload of the transaction |
details | UniversalDetails | blockIdentifier? - nonce? - skipValidate? - default true - tip? - prioritize order of transactions in the mempool. - accountDeploymentData? - deploy an account contract (substitution for deploy account transaction) - paymasterData? - entity other than the transaction sender to pay the transaction fees(EIP-4337) - nonceDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - feeDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - version? - specify ETransactionVersion - V3 Transactions fee is in fri, oldV transactions fee is in wei |
Returns
Promise
<EstimateFeeBulk
>
response from estimate_fee
Implementation of
AccountInterface.estimateFeeBulk
Defined in
simulateTransaction
▸ simulateTransaction(invocations
, details?
): Promise
<SimulateTransactionOverheadResponse
>
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
<SimulateTransactionOverheadResponse
>
response from simulate_transaction
Implementation of
AccountInterface.simulateTransaction
Defined in
execute
▸ execute(transactions
, transactionsDetail?
): Promise
<{ transaction_hash
: string
}>
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 |
transactionsDetail | UniversalDetails | Additional optional parameters for the transaction |
Returns
Promise
<{ transaction_hash
: string
}>
response from addTransaction
Implementation of
Defined in
declareIfNot
▸ declareIfNot(payload
, transactionsDetail?
): Promise
<{ class_hash
: string
; transaction_hash
: string
}>
First check if contract is already declared, if not declare it If contract already declared returned transaction_hash is ''. Method will pass even if contract is already declared
Parameters
Name | Type | Description |
---|---|---|
payload | DeclareContractPayload | - |
transactionsDetail | UniversalDetails | (optional) |
Returns
Promise
<{ class_hash
: string
; transaction_hash
: string
}>
Defined in
declare
▸ declare(payload
, details?
): Promise
<{ class_hash
: string
; transaction_hash
: string
}>
Declares a given compiled contract (json) to starknet
Parameters
Name | Type | Description |
---|---|---|
payload | 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. |
details | UniversalDetails | InvocationsDetails |
Returns
Promise
<{ class_hash
: string
; transaction_hash
: string
}>
a confirmation of sending a transaction on the starknet contract
Implementation of
Defined in
deploy
▸ deploy(payload
, details?
): Promise
<MultiDeployContractResponse
>
Deploys a declared contract to starknet - using a Deployer Contract 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 | UniversalDetails | InvocationsDetails |
Returns
Promise
<MultiDeployContractResponse
>
- contract_address[]
- transaction_hash
Implementation of
Defined in
deployContract
▸ deployContract(payload
, details?
): Promise
<DeployContractUDCResponse
>
Simplify deploy simulating old DeployContract with same response + Deployer 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 | UniversalDetails | InvocationsDetails |
Returns
Promise
<DeployContractUDCResponse
>
- contract_address
- transaction_hash
- address
- deployer
- unique
- classHash
- calldata_len
- calldata
- salt
Implementation of
AccountInterface.deployContract
Defined in
declareAndDeploy
▸ declareAndDeploy(payload
, details?
): Promise
<DeclareDeployUDCResponse
>
Declares and Deploy a given compiled contract (json) to starknet using a Deployer. 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 | UniversalDetails | InvocationsDetails |
Returns
Promise
<DeclareDeployUDCResponse
>
- declare
- transaction_hash
- deploy
- contract_address
- transaction_hash
- address
- deployer
- unique
- classHash
- calldata_len
- calldata
- salt
Implementation of
AccountInterface.declareAndDeploy
Defined in
deployAccount
▸ deployAccount(«destructured»
, details?
): Promise
<DeployContractResponse
>
Deploy the account on Starknet
Parameters
Name | Type | Description |
---|---|---|
«destructured» | DeployAccountContractPayload | transaction payload to be deployed containing: - classHash: computed class hash of compiled contract - optional constructor calldata - optional address salt - optional contractAddress |
details | UniversalDetails | InvocationsDetails |
Returns
Promise
<DeployContractResponse
>
a confirmation of sending a transaction on the starknet contract
Implementation of
AccountInterface.deployAccount
Defined in
signMessage
▸ signMessage(typedData
): Promise
<Signature
>
Signs a TypedData object for off-chain usage with the Starknet private key and returns the signature This adds a message prefix so it can't be interchanged with transactions
Parameters
Name | Type | Description |
---|---|---|
typedData | TypedData | TypedData object to be signed |
Returns
Promise
<Signature
>
the signature of the TypedData object
Throws
if typedData is not a valid TypedData
Implementation of
Defined in
hashMessage
▸ hashMessage(typedData
): Promise
<string
>
Hash a TypedData object with Pedersen hash and return the hash This adds a message prefix so it can't be interchanged with transactions
Parameters
Name | Type | Description |
---|---|---|
typedData | TypedData | TypedData object to be hashed |
Returns
Promise
<string
>
the hash of the TypedData object
Throws
if typedData is not a valid TypedData
Implementation of
Defined in
getSnip9Version
▸ getSnip9Version(): Promise
<"0"
| "1"
| "2"
>
Verify if an account is compatible with SNIP-9 outside execution, and with which version of this standard.
Returns
Promise
<"0"
| "1"
| "2"
>
Not compatible, V1, V2.
Example
const result = myAccount.getSnip9Version();
// result = "V1"
Defined in
isValidSnip9Nonce
▸ isValidSnip9Nonce(nonce
): Promise
<boolean
>
Verify if a SNIP-9 nonce has not yet been used by the account.
Parameters
Name | Type | Description |
---|---|---|
nonce | BigNumberish | SNIP-9 nonce to test. |
Returns
Promise
<boolean
>
true if SNIP-9 nonce not yet used.
Example
const result = myAccount.isValidSnip9Nonce(1234);
// result = true
Defined in
getSnip9Nonce
▸ getSnip9Nonce(): Promise
<string
>
Outside transaction needs a specific SNIP-9 nonce, that we get in this function. A SNIP-9 nonce can be any number not yet used ; no ordering is needed.
Returns
Promise
<string
>
an Hex string of a SNIP-9 nonce.
Example
const result = myAccount.getSnip9Nonce();
// result = "0x28a612590dbc36927933c8ee0f357eee639c8b22b3d3aa86949eed3ada4ac55"
Defined in
getOutsideTransaction
▸ getOutsideTransaction(options
, calls
, version?
, nonce?
): Promise
<OutsideTransaction
>
Creates an object containing transaction(s) that can be executed by an other account with Account.executeFromOutside()
, called Outside Transaction.
Parameters
Name | Type | Description |
---|---|---|
options | OutsideExecutionOptions | Parameters of the transaction(s). |
calls | AllowArray <Call > | Transaction(s) to execute. |
version? | "0" | "1" | "2" | SNIP-9 version of the Account that creates the outside transaction. |
nonce? | BigNumberish | Outside Nonce. |
Returns
Promise
<OutsideTransaction
>
and object that can be used in Account.executeFromOutside()
Example
const now_seconds = Math.floor(Date.now() / 1000);
const callOptions: OutsideExecutionOptions = {
caller: executorAccount.address, execute_after: now_seconds - 3600, execute_before: now_seconds + 3600 };
const call1: Call = { contractAddress: ethAddress, entrypoint: 'transfer', calldata: {
recipient: recipientAccount.address, amount: cairo.uint256(100) } };
const outsideTransaction1: OutsideTransaction = await signerAccount.getOutsideTransaction(callOptions, call3);
// result = {
// outsideExecution: {
// caller: '0x64b48806902a367c8598f4f95c305e8c1a1acba5f082d294a43793113115691',
// nonce: '0x28a612590dbc36927933c8ee0f357eee639c8b22b3d3aa86949eed3ada4ac55',
// execute_after: 1723650229, execute_before: 1723704229, calls: [[Object]] },
// signature: Signature {
// r: 67518627037915514985321278857825384106482999609634873287406612756843916814n,
// s: 737198738569840639192844101690009498983611654458636624293579534560862067709n, recovery: 0 },
// signerAddress: '0x655f8fd7c4013c07cf12a92184aa6c314d181443913e21f7e209a18f0c78492',
// version: '2'
// }
Defined in
executeFromOutside
▸ executeFromOutside(outsideTransaction
, opts?
): Promise
<{ transaction_hash
: string
}>
An account B executes a transaction that has been signed by an account A. Fees are paid by B.
Parameters
Name | Type | Description |
---|---|---|
outsideTransaction | AllowArray <OutsideTransaction > | the signed transaction generated by Account.getOutsideTransaction() . |
opts? | UniversalDetails | same options than Account.execute() . |
Returns
Promise
<{ transaction_hash
: string
}>
same response than Account.execute()
.
Example
const outsideTransaction1: OutsideTransaction = await signerAccount.getOutsideTransaction(callOptions, call1);
const outsideTransaction2: OutsideTransaction = await signerAccount.getOutsideTransaction(callOptions4, call4);
const result = await myAccount.executeFromOutside([
outsideTransaction1,
outsideTransaction2,
]);
// result = { transaction_hash: '0x11233...`}
Defined in
resolveDetailsWithTip
▸ resolveDetailsWithTip(details
): Promise
<UniversalDetails
& { tip
: BigNumberish
}>
Helper method to resolve details with tip estimation
Parameters
Name | Type |
---|---|
details | UniversalDetails |
Returns
Promise
<UniversalDetails
& { tip
: BigNumberish
}>
Defined in
resolveTransactionVersion
▸ resolveTransactionVersion(providedVersion?
): ETransactionVersion3
Helper method to resolve transaction version
Parameters
Name | Type |
---|---|
providedVersion? | BigNumberish |
Returns
Defined in
buildInvocation
▸ buildInvocation(call
, details
): Promise
<Invocation
>
Parameters
Name | Type |
---|---|
call | Call [] |
details | InvocationsSignerDetails |
Returns
Promise
<Invocation
>
Defined in
buildDeclarePayload
▸ buildDeclarePayload(payload
, details
): Promise
<DeclareContractTransaction
>
Parameters
Name | Type |
---|---|
payload | DeclareContractPayload |
details | InvocationsSignerDetails |
Returns
Promise
<DeclareContractTransaction
>
Defined in
buildAccountDeployPayload
▸ buildAccountDeployPayload(«destructured»
, details
): Promise
<DeployAccountContractTransaction
>
Parameters
Name | Type |
---|---|
«destructured» | DeployAccountContractPayload |
details | InvocationsSignerDetails |
Returns
Promise
<DeployAccountContractTransaction
>
Defined in
accountInvocationsFactory
▸ accountInvocationsFactory(invocations
, details
): Promise
<[{ type
: "INVOKE"
; contractAddress
: string
; calldata?
: Calldata
| RawArgs
; signature?
: Signature
; nonce
: BigNumberish
; version?
: BigNumberish
; resourceBounds?
: ResourceBoundsBN
; tip?
: BigNumberish
; paymasterData?
: BigNumberish
[] ; accountDeploymentData?
: BigNumberish
[] ; nonceDataAvailabilityMode?
: EDataAvailabilityMode
; feeDataAvailabilityMode?
: EDataAvailabilityMode
}]>
Build account invocations with proper typing based on transaction type
Parameters
Name | Type |
---|---|
invocations | [{ type : "INVOKE" ; payload : AllowArray <Call > }] |
details | AccountInvocationsFactoryDetails |
Returns
Promise
<[{ type
: "INVOKE"
; contractAddress
: string
; calldata?
: Calldata
| RawArgs
; signature?
: Signature
; nonce
: BigNumberish
; version?
: BigNumberish
; resourceBounds?
: ResourceBoundsBN
; tip?
: BigNumberish
; paymasterData?
: BigNumberish
[] ; accountDeploymentData?
: BigNumberish
[] ; nonceDataAvailabilityMode?
: EDataAvailabilityMode
; feeDataAvailabilityMode?
: EDataAvailabilityMode
}]>
Defined in
▸ accountInvocationsFactory(invocations
, details
): Promise
<[{ type
: "DECLARE"
; contract
: ContractClass
; senderAddress
: string
; signature?
: Signature
; compiledClassHash?
: string
; nonce
: BigNumberish
; version?
: BigNumberish
; resourceBounds?
: ResourceBoundsBN
; tip?
: BigNumberish
; paymasterData?
: BigNumberish
[] ; accountDeploymentData?
: BigNumberish
[] ; nonceDataAvailabilityMode?
: EDataAvailabilityMode
; feeDataAvailabilityMode?
: EDataAvailabilityMode
}]>
Parameters
Name | Type |
---|---|
invocations | [{ type : "DECLARE" ; payload : DeclareContractPayload }] |
details | AccountInvocationsFactoryDetails |
Returns
Promise
<[{ type
: "DECLARE"
; contract
: ContractClass
; senderAddress
: string
; signature?
: Signature
; compiledClassHash?
: string
; nonce
: BigNumberish
; version?
: BigNumberish
; resourceBounds?
: ResourceBoundsBN
; tip?
: BigNumberish
; paymasterData?
: BigNumberish
[] ; accountDeploymentData?
: BigNumberish
[] ; nonceDataAvailabilityMode?
: EDataAvailabilityMode
; feeDataAvailabilityMode?
: EDataAvailabilityMode
}]>
Defined in
▸ accountInvocationsFactory(invocations
, details
): Promise
<[{ type
: "DEPLOY_ACCOUNT"
; classHash
: string
; constructorCalldata?
: RawArgs
; addressSalt?
: BigNumberish
; signature?
: Signature
; nonce
: BigNumberish
; version?
: BigNumberish
; resourceBounds?
: ResourceBoundsBN
; tip?
: BigNumberish
; paymasterData?
: BigNumberish
[] ; accountDeploymentData?
: BigNumberish
[] ; nonceDataAvailabilityMode?
: EDataAvailabilityMode
; feeDataAvailabilityMode?
: EDataAvailabilityMode
}]>
Parameters
Name | Type |
---|---|
invocations | [{ type : "DEPLOY_ACCOUNT" ; payload : DeployAccountContractPayload }] |
details | AccountInvocationsFactoryDetails |
Returns
Promise
<[{ type
: "DEPLOY_ACCOUNT"
; classHash
: string
; constructorCalldata?
: RawArgs
; addressSalt?
: BigNumberish
; signature?
: Signature
; nonce
: BigNumberish
; version?
: BigNumberish
; resourceBounds?
: ResourceBoundsBN
; tip?
: BigNumberish
; paymasterData?
: BigNumberish
[] ; accountDeploymentData?
: BigNumberish
[] ; nonceDataAvailabilityMode?
: EDataAvailabilityMode
; feeDataAvailabilityMode?
: EDataAvailabilityMode
}]>
Defined in
▸ accountInvocationsFactory(invocations
, details
): Promise
<AccountInvocations
>
Parameters
Name | Type |
---|---|
invocations | Invocations |
details | AccountInvocationsFactoryDetails |
Returns
Promise
<AccountInvocations
>
Defined in
buildPaymasterTransaction
▸ buildPaymasterTransaction(calls
, paymasterDetails
): Promise
<PreparedTransaction
>
Build a paymaster transaction
Parameters
Name | Type | Description |
---|---|---|
calls | Call [] | the invocation object containing: - contractAddress - the address of the contract - entrypoint - the entrypoint of the contract - calldata - (defaults to []) the calldata |
paymasterDetails | PaymasterDetails | the paymaster details containing: - feeMode - the fee mode - deploymentData - the deployment data (optional) - timeBounds - the time bounds (optional) |
Returns
Promise
<PreparedTransaction
>
the prepared transaction
Implementation of
AccountInterface.buildPaymasterTransaction
Defined in
estimatePaymasterTransactionFee
▸ estimatePaymasterTransactionFee(calls
, paymasterDetails
): Promise
<PaymasterFeeEstimate
>
Estimate Fee for executing a paymaster transaction on starknet
Parameters
Name | Type | Description |
---|---|---|
calls | Call [] | the invocation object containing: - contractAddress - the address of the contract - entrypoint - the entrypoint of the contract - calldata - (defaults to []) the calldata |
paymasterDetails | PaymasterDetails | the paymaster details containing: - feeMode - the fee mode - deploymentData - the deployment data (optional) - timeBounds - the time bounds (optional) |
Returns
Promise
<PaymasterFeeEstimate
>
response extracting fee from buildPaymasterTransaction
Implementation of
AccountInterface.estimatePaymasterTransactionFee
Defined in
preparePaymasterTransaction
▸ preparePaymasterTransaction(preparedTransaction
): Promise
<ExecutableUserTransaction
>
Parameters
Name | Type |
---|---|
preparedTransaction | PreparedTransaction |
Returns
Promise
<ExecutableUserTransaction
>
Defined in
executePaymasterTransaction
▸ executePaymasterTransaction(calls
, paymasterDetails
, maxFeeInGasToken?
): Promise
<{ transaction_hash
: string
}>
Execute a paymaster transaction
Assert that the gas token value is equal to the provided gas fees Assert that the calls are strictly equal to the returned calls. Assert that the gas token (in gas token) price is not too high, if provided. Assert that typedData to signed is strictly equal to the provided typedData.
Parameters
Name | Type | Description |
---|---|---|
calls | Call [] | the invocation object containing: - contractAddress - the address of the contract - entrypoint - the entrypoint of the contract - calldata - (defaults to []) the calldata |
paymasterDetails | PaymasterDetails | the paymaster details containing: - feeMode - the fee mode (sponsored or default) - deploymentData - the deployment data (optional) - timeBounds - the time bounds when the transaction is valid (optional) - executeAfter and executeBefore expected to be in seconds (BLOCK_TIMESTAMP) |
maxFeeInGasToken? | BigNumberish | the max fee acceptable to pay in gas token (optional) |
Returns
Promise
<{ transaction_hash
: string
}>
the tarnsaction hash if successful, otherwise an error is thrown
Implementation of
AccountInterface.executePaymasterTransaction
Defined in
getStarkName
▸ getStarkName(address?
, StarknetIdContract?
): Promise
<string
>
Get the Starknet ID for an address
Parameters
Name | Type | Description |
---|---|---|
address | BigNumberish | The address to get the Starknet ID for |
StarknetIdContract? | string | The Starknet ID contract address (optional) |
Returns
Promise
<string
>
The Starknet ID for the address
Overrides
Defined in
fetch
▸ fetch(method
, params?
, id?
): Promise
<Response
>
Direct RPC method call
Parameters
Name | Type | Default value | Description |
---|---|---|---|
method | string | undefined | RPC method name |
params? | object | undefined | method parameters |
id | string | number | 0 | request ID |
Returns
Promise
<Response
>
RPC response
Implementation of
Inherited from
Defined in
getChainId
▸ getChainId(): Promise
<"0x534e5f4d41494e"
| "0x534e5f5345504f4c4941"
>
Gets the Starknet chain Id
Returns
Promise
<"0x534e5f4d41494e"
| "0x534e5f5345504f4c4941"
>
the chain Id
Implementation of
Inherited from
Defined in
readSpecVersion
▸ readSpecVersion(): undefined
| "0.8.1"
| "0.9.0"
Read channel spec version
Returns
undefined
| "0.8.1"
| "0.9.0"
Spec version string or undefined if not set
Implementation of
AccountInterface.readSpecVersion
Inherited from
Defined in
getSpecVersion
▸ getSpecVersion(): Promise
<string
>
Get channel spec version
Returns
Promise
<string
>
Promise resolving to spec version
Implementation of
AccountInterface.getSpecVersion
Inherited from
Defined in
setUpSpecVersion
▸ setUpSpecVersion(): Promise
<"0.8.1"
| "0.9.0"
>
Setup channel spec version and return it
Returns
Promise
<"0.8.1"
| "0.9.0"
>
Promise resolving to spec version
Implementation of
AccountInterface.setUpSpecVersion
Inherited from
Defined in
getNonceForAddress
▸ getNonceForAddress(contractAddress
, blockIdentifier?
): Promise
<string
>
Returns the nonce associated with the given address in the given block
Parameters
Name | Type | Description |
---|---|---|
contractAddress | BigNumberish | contract address |
blockIdentifier? | BlockIdentifier | - |
Returns
Promise
<string
>
the hex nonce
Implementation of
AccountInterface.getNonceForAddress
Inherited from
Defined in
getBlock
▸ getBlock(): Promise
<{ transactions
: string
[] ; parent_hash
: string
; timestamp
: number
; sequencer_address
: string
; l1_gas_price
: RESOURCE_PRICE
; l2_gas_price
: RESOURCE_PRICE
; l1_data_gas_price
: RESOURCE_PRICE
; l1_da_mode
: L1_DA_MODE
; starknet_version
: string
}>
Gets the block information
Returns
Promise
<{ transactions
: string
[] ; parent_hash
: string
; timestamp
: number
; sequencer_address
: string
; l1_gas_price
: RESOURCE_PRICE
; l2_gas_price
: RESOURCE_PRICE
; l1_data_gas_price
: RESOURCE_PRICE
; l1_da_mode
: L1_DA_MODE
; starknet_version
: string
}>
the block object
Implementation of
Inherited from
Defined in
▸ getBlock(blockIdentifier
): Promise
<{ transactions
: string
[] ; parent_hash
: string
; timestamp
: number
; sequencer_address
: string
; l1_gas_price
: RESOURCE_PRICE
; l2_gas_price
: RESOURCE_PRICE
; l1_data_gas_price
: RESOURCE_PRICE
; l1_da_mode
: L1_DA_MODE
; starknet_version
: string
}>
Parameters
Name | Type |
---|---|
blockIdentifier | "pre_confirmed" |
Returns
Promise
<{ transactions
: string
[] ; parent_hash
: string
; timestamp
: number
; sequencer_address
: string
; l1_gas_price
: RESOURCE_PRICE
; l2_gas_price
: RESOURCE_PRICE
; l1_data_gas_price
: RESOURCE_PRICE
; l1_da_mode
: L1_DA_MODE
; starknet_version
: string
}>
Implementation of
Inherited from
Defined in
▸ getBlock(blockIdentifier
): Promise
<{ status
: EBlockStatus
; block_hash
: string
; parent_hash
: string
; block_number
: number
; new_root
: string
; timestamp
: number
; sequencer_address
: string
; l1_gas_price
: RESOURCE_PRICE
; l2_gas_price
: RESOURCE_PRICE
; l1_data_gas_price
: RESOURCE_PRICE
; l1_da_mode
: L1_DA_MODE
; starknet_version
: string
; transactions
: string
[] }>
Parameters
Name | Type |
---|---|
blockIdentifier | "latest" |
Returns
Promise
<{ status
: EBlockStatus
; block_hash
: string
; parent_hash
: string
; block_number
: number
; new_root
: string
; timestamp
: number
; sequencer_address
: string
; l1_gas_price
: RESOURCE_PRICE
; l2_gas_price
: RESOURCE_PRICE
; l1_data_gas_price
: RESOURCE_PRICE
; l1_da_mode
: L1_DA_MODE
; starknet_version
: string
; transactions
: string
[] }>
Implementation of
Inherited from
Defined in
▸ getBlock(blockIdentifier
): Promise
<GetBlockResponse
>
Parameters
Name | Type |
---|---|
blockIdentifier | BlockIdentifier |
Returns
Promise
<GetBlockResponse
>
Implementation of
Inherited from
Defined in
getBlockLatestAccepted
▸ getBlockLatestAccepted(): Promise
<BlockHashAndNumber
>
Get the most recent accepted block hash and number
Returns
Promise
<BlockHashAndNumber
>
Object containing block hash and number
Implementation of
AccountInterface.getBlockLatestAccepted
Inherited from
Provider.getBlockLatestAccepted
Defined in
getBlockNumber
▸ getBlockNumber(): Promise
<number
>
Get the most recent accepted block number
Returns
Promise
<number
>
Number of the latest block
Implementation of
AccountInterface.getBlockNumber
Inherited from
Defined in
getBlockWithTxHashes
▸ getBlockWithTxHashes(blockIdentifier?
): Promise
<OnlyFirst
<BLOCK_WITH_TX_HASHES
, { status
: BLOCK_STATUS
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TX_HASHES
& PENDING_BLOCK_HEADER
> | OnlyFirst
<PENDING_BLOCK_WITH_TX_HASHES
, { status
: BLOCK_STATUS
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TX_HASHES
& PENDING_BLOCK_HEADER
> | OnlyFirst
<BLOCK_WITH_TX_HASHES
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TX_HASHES
& PRE_CONFIRMED_BLOCK_HEADER
> | OnlyFirst
<PRE_CONFIRMED_BLOCK_WITH_TX_HASHES
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TX_HASHES
& PRE_CONFIRMED_BLOCK_HEADER
>>
Get block information with transaction hashes
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<OnlyFirst
<BLOCK_WITH_TX_HASHES
, { status
: BLOCK_STATUS
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TX_HASHES
& PENDING_BLOCK_HEADER
> | OnlyFirst
<PENDING_BLOCK_WITH_TX_HASHES
, { status
: BLOCK_STATUS
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TX_HASHES
& PENDING_BLOCK_HEADER
> | OnlyFirst
<BLOCK_WITH_TX_HASHES
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TX_HASHES
& PRE_CONFIRMED_BLOCK_HEADER
> | OnlyFirst
<PRE_CONFIRMED_BLOCK_WITH_TX_HASHES
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TX_HASHES
& PRE_CONFIRMED_BLOCK_HEADER
>>
Block with transaction hashes
Implementation of
AccountInterface.getBlockWithTxHashes
Inherited from
Defined in
getBlockWithTxs
▸ getBlockWithTxs(blockIdentifier?
): Promise
<OnlyFirst
<BLOCK_WITH_TXS
, { status
: BLOCK_STATUS
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TXS
& PENDING_BLOCK_HEADER
> | OnlyFirst
<PENDING_BLOCK_WITH_TXS
, { status
: BLOCK_STATUS
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TXS
& PENDING_BLOCK_HEADER
> | OnlyFirst
<BLOCK_WITH_TXS
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TXS
& PRE_CONFIRMED_BLOCK_HEADER
> | OnlyFirst
<PRE_CONFIRMED_BLOCK_WITH_TXS
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TXS
& PRE_CONFIRMED_BLOCK_HEADER
>>
Get block information with full transactions
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<OnlyFirst
<BLOCK_WITH_TXS
, { status
: BLOCK_STATUS
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TXS
& PENDING_BLOCK_HEADER
> | OnlyFirst
<PENDING_BLOCK_WITH_TXS
, { status
: BLOCK_STATUS
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TXS
& PENDING_BLOCK_HEADER
> | OnlyFirst
<BLOCK_WITH_TXS
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TXS
& PRE_CONFIRMED_BLOCK_HEADER
> | OnlyFirst
<PRE_CONFIRMED_BLOCK_WITH_TXS
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TXS
& PRE_CONFIRMED_BLOCK_HEADER
>>
Block with full transactions
Implementation of
AccountInterface.getBlockWithTxs
Inherited from
Defined in
waitForBlock
▸ waitForBlock(blockIdentifier?
, retryInterval?
): Promise
<void
>
Pause execution until a specified block is created
Parameters
Name | Type | Default value | Description |
---|---|---|---|
blockIdentifier | BlockIdentifier | BlockTag.LATEST | block number or tag |
retryInterval | number | 5000 | milliseconds between requests (default: 5000) |
Returns
Promise
<void
>
Example
await provider.waitForBlock(12345);
await provider.waitForBlock('latest');
Implementation of
Inherited from
Defined in
getL1GasPrice
▸ getL1GasPrice(blockIdentifier?
): Promise
<string
>
Gets the price of l1 gas in the block
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<string
>
gas price of the block
Implementation of
AccountInterface.getL1GasPrice
Inherited from
Defined in
getL1MessageHash
▸ getL1MessageHash(l2TxHash
): Promise
<string
>
Get L1 message hash from L2 transaction hash
Parameters
Name | Type | Description |
---|---|---|
l2TxHash | BigNumberish | L2 transaction hash |
Returns
Promise
<string
>
Hex string of L1 message hash
Example
In Sepolia Testnet :
const result = provider.getL1MessageHash('0x28dfc05eb4f261b37ddad451ff22f1d08d4e3c24dc646af0ec69fa20e096819');
// result = '0x55b3f8b6e607fffd9b4d843dfe8f9b5c05822cd94fcad8797deb01d77805532a'
Implementation of
AccountInterface.getL1MessageHash
Inherited from
Defined in
getBlockWithReceipts
▸ getBlockWithReceipts(blockIdentifier?
): Promise
<OnlyFirst
<BLOCK_WITH_RECEIPTS
, { status
: BLOCK_STATUS
} & BLOCK_HEADER
& BLOCK_BODY_WITH_RECEIPTS
& PENDING_BLOCK_HEADER
> | OnlyFirst
<PENDING_BLOCK_WITH_RECEIPTS
, { status
: BLOCK_STATUS
} & BLOCK_HEADER
& BLOCK_BODY_WITH_RECEIPTS
& PENDING_BLOCK_HEADER
> | OnlyFirst
<BLOCK_WITH_RECEIPTS
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_RECEIPTS
& PRE_CONFIRMED_BLOCK_HEADER
> | OnlyFirst
<PRE_CONFIRMED_BLOCK_WITH_RECEIPTS
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_RECEIPTS
& PRE_CONFIRMED_BLOCK_HEADER
>>
Get block information with transaction receipts
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<OnlyFirst
<BLOCK_WITH_RECEIPTS
, { status
: BLOCK_STATUS
} & BLOCK_HEADER
& BLOCK_BODY_WITH_RECEIPTS
& PENDING_BLOCK_HEADER
> | OnlyFirst
<PENDING_BLOCK_WITH_RECEIPTS
, { status
: BLOCK_STATUS
} & BLOCK_HEADER
& BLOCK_BODY_WITH_RECEIPTS
& PENDING_BLOCK_HEADER
> | OnlyFirst
<BLOCK_WITH_RECEIPTS
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_RECEIPTS
& PRE_CONFIRMED_BLOCK_HEADER
> | OnlyFirst
<PRE_CONFIRMED_BLOCK_WITH_RECEIPTS
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_RECEIPTS
& PRE_CONFIRMED_BLOCK_HEADER
>>
Block with transaction receipts
Implementation of
AccountInterface.getBlockWithReceipts
Inherited from
Defined in
getBlockStateUpdate
▸ getBlockStateUpdate(): Promise
<{ block_hash
: string
; new_root
: string
; old_root
: string
; state_diff
: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>
Gets the state changes in a specific block (result of executing the requested block) Alternative method name for getStateUpdate with specific overloads
Returns
Promise
<{ block_hash
: string
; new_root
: string
; old_root
: string
; state_diff
: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>
StateUpdateResponse
Implementation of
AccountInterface.getBlockStateUpdate
Inherited from
Defined in
▸ getBlockStateUpdate(blockIdentifier
): Promise
<PRE_CONFIRMED_STATE_UPDATE
>
Parameters
Name | Type |
---|---|
blockIdentifier | "pre_confirmed" |
Returns
Promise
<PRE_CONFIRMED_STATE_UPDATE
>
Implementation of
AccountInterface.getBlockStateUpdate
Inherited from
Defined in
▸ getBlockStateUpdate(blockIdentifier
): Promise
<{ block_hash
: string
; new_root
: string
; old_root
: string
; state_diff
: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>
Parameters
Name | Type |
---|---|
blockIdentifier | "latest" |
Returns
Promise
<{ block_hash
: string
; new_root
: string
; old_root
: string
; state_diff
: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>
Implementation of
AccountInterface.getBlockStateUpdate
Inherited from
Defined in
▸ getBlockStateUpdate(blockIdentifier?
): Promise
<StateUpdateResponse
>
Parameters
Name | Type |
---|---|
blockIdentifier? | BlockIdentifier |
Returns
Promise
<StateUpdateResponse
>
Implementation of
AccountInterface.getBlockStateUpdate
Inherited from
Defined in
getBlockTransactionsTraces
▸ getBlockTransactionsTraces(blockIdentifier?
): Promise
<BlockTransactionsTraces
| BlockTransactionsTraces
>
Get transaction traces for all transactions in a block
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<BlockTransactionsTraces
| BlockTransactionsTraces
>
Array of transaction traces
Implementation of
AccountInterface.getBlockTransactionsTraces
Inherited from
Provider.getBlockTransactionsTraces
Defined in
getBlockTransactionCount
▸ getBlockTransactionCount(blockIdentifier?
): Promise
<number
>
Get the number of transactions in a block
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<number
>
Transaction count
Implementation of
AccountInterface.getBlockTransactionCount
Inherited from
Provider.getBlockTransactionCount
Defined in
getTransaction
▸ getTransaction(txHash
): Promise
<TXN_WITH_HASH
>
Gets the transaction information from a tx id.
Parameters
Name | Type |
---|---|
txHash | BigNumberish |
Returns
Promise
<TXN_WITH_HASH
>
the transaction object { transaction_id, status, transaction, block_number?, block_number?, transaction_index?, transaction_failure_reason? }
Implementation of
AccountInterface.getTransaction
Inherited from
Defined in
getTransactionByHash
▸ getTransactionByHash(txHash
): Promise
<TXN_WITH_HASH
>
Gets the transaction information from a tx hash (alias for getTransaction)
Parameters
Name | Type | Description |
---|---|---|
txHash | BigNumberish | transaction hash |
Returns
Promise
<TXN_WITH_HASH
>
Transaction information
Implementation of
AccountInterface.getTransactionByHash
Inherited from
Defined in
getTransactionByBlockIdAndIndex
▸ getTransactionByBlockIdAndIndex(blockIdentifier
, index
): Promise
<TXN_WITH_HASH
>
Gets transaction by block identifier and index
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier | BlockIdentifier | block identifier |
index | number | transaction index in the block |
Returns
Promise
<TXN_WITH_HASH
>
Transaction information
Implementation of
AccountInterface.getTransactionByBlockIdAndIndex
Inherited from
Provider.getTransactionByBlockIdAndIndex
Defined in
getTransactionReceipt
▸ getTransactionReceipt(txHash
): Promise
<GetTransactionReceiptResponse
>
Gets the transaction receipt from a tx hash.
Parameters
Name | Type |
---|---|
txHash | BigNumberish |
Returns
Promise
<GetTransactionReceiptResponse
>
the transaction receipt object
Implementation of
AccountInterface.getTransactionReceipt
Inherited from
Provider.getTransactionReceipt
Defined in
getTransactionTrace
▸ getTransactionTrace(txHash
): Promise
<TRANSACTION_TRACE
| TRANSACTION_TRACE
>
Gets the transaction trace
Parameters
Name | Type | Description |
---|---|---|
txHash | BigNumberish | transaction hash |
Returns
Promise
<TRANSACTION_TRACE
| TRANSACTION_TRACE
>
Transaction trace
Implementation of
AccountInterface.getTransactionTrace
Inherited from
Defined in
getTransactionStatus
▸ getTransactionStatus(transactionHash
): Promise
<TXN_STATUS_RESULT
| TXN_STATUS_RESULT
>
Get the status of a transaction
Parameters
Name | Type | Description |
---|---|---|
transactionHash | BigNumberish | transaction hash |
Returns
Promise
<TXN_STATUS_RESULT
| TXN_STATUS_RESULT
>
Transaction status
Implementation of
AccountInterface.getTransactionStatus
Inherited from
Defined in
getSimulateTransaction
▸ getSimulateTransaction(invocations
, options?
): Promise
<SimulateTransactionOverheadResponse
>
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
<SimulateTransactionOverheadResponse
>
an array of transaction trace and estimated fee
Implementation of
AccountInterface.getSimulateTransaction
Inherited from
Provider.getSimulateTransaction
Defined in
waitForTransaction
▸ 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
Implementation of
AccountInterface.waitForTransaction
Inherited from
Defined in
getStorageAt
▸ 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 | BigNumberish | |
key | BigNumberish | from getStorageVarAddress('<STORAGE_VARIABLE_NAME>') (WIP) |
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<string
>
the value of the storage variable
Implementation of
Inherited from
Defined in
getClassHashAt
▸ 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 | BigNumberish | contract address |
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<string
>
Class hash
Implementation of
AccountInterface.getClassHashAt
Inherited from
Defined in
getClassByHash
▸ getClassByHash(classHash
): Promise
<LegacyContractClass
| Omit
<CompiledSierra
, "sierra_program_debug_info"
>>
Returns the contract class deployed under the given class hash.
Parameters
Name | Type | Description |
---|---|---|
classHash | BigNumberish | class hash |
Returns
Promise
<LegacyContractClass
| Omit
<CompiledSierra
, "sierra_program_debug_info"
>>
Contract class of compiled contract
Implementation of
AccountInterface.getClassByHash
Inherited from
Defined in
getClass
▸ getClass(classHash
, blockIdentifier?
): Promise
<LegacyContractClass
| Omit
<CompiledSierra
, "sierra_program_debug_info"
>>
Get contract class by hash with optional block identifier
Parameters
Name | Type | Description |
---|---|---|
classHash | BigNumberish | class hash |
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<LegacyContractClass
| Omit
<CompiledSierra
, "sierra_program_debug_info"
>>
Contract class
Implementation of
Inherited from
Defined in
getClassAt
▸ getClassAt(contractAddress
, blockIdentifier?
): Promise
<LegacyContractClass
| Omit
<CompiledSierra
, "sierra_program_debug_info"
>>
Gets the contract class of the deployed contract.
Parameters
Name | Type | Description |
---|---|---|
contractAddress | BigNumberish | contract address |
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<LegacyContractClass
| Omit
<CompiledSierra
, "sierra_program_debug_info"
>>
Contract class of compiled contract
Implementation of
Inherited from
Defined in
getContractVersion
▸ getContractVersion(contractAddress
, classHash?
, options?
): Promise
<ContractVersion
>
Gets the contract version from the provided address
Parameters
Name | Type | Description |
---|---|---|
contractAddress | BigNumberish | 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
>
Implementation of
AccountInterface.getContractVersion
Inherited from
Defined in
▸ getContractVersion(contractAddress
, classHash
, options?
): Promise
<ContractVersion
>
Gets the contract version from the provided address
Parameters
Name | Type | Description |
---|---|---|
contractAddress | undefined | undefined |
classHash | BigNumberish | |
options? | getContractVersionOptions | getContractVersionOptions - (optional) compiler - (default true) extract compiler version using type tactic from abi - (optional) blockIdentifier - block identifier |
Returns
Promise
<ContractVersion
>
Implementation of
AccountInterface.getContractVersion
Inherited from
Defined in
getInvokeEstimateFee
▸ getInvokeEstimateFee(invocation
, details
, blockIdentifier?
, skipValidate?
): Promise
<EstimateFeeResponseOverhead
>
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 - (optional) the entrypoint of the contract - calldata - (optional, defaults to []) the calldata - signature - (optional, 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
<EstimateFeeResponseOverhead
>
the estimated fee
Deprecated
Consider using getEstimateFeeBulk for multiple transactions
Example
const feeEstimate = await provider.getInvokeEstimateFee(invocation, details);
// Equivalent to:
const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: ETransactionType.INVOKE, ...invocation, ...details }], options);
Alias
getEstimateFeeBulk - This method is an alias that calls getEstimateFeeBulk with a single transaction
Implementation of
AccountInterface.getInvokeEstimateFee
Inherited from
Defined in
getDeclareEstimateFee
▸ getDeclareEstimateFee(invocation
, details
, blockIdentifier?
, skipValidate?
): Promise
<EstimateFeeResponseOverhead
>
Estimates the fee for a given DECLARE transaction
Parameters
Name | Type | Description |
---|---|---|
invocation | 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
<EstimateFeeResponseOverhead
>
the estimated fee
Deprecated
Consider using getEstimateFeeBulk for multiple transactions
Example
const feeEstimate = await provider.getDeclareEstimateFee(transaction, details);
// Equivalent to:
const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: ETransactionType.DECLARE, ...transaction, ...details }], options);
Alias
getEstimateFeeBulk - This method is an alias that calls getEstimateFeeBulk with a single transaction
Implementation of
AccountInterface.getDeclareEstimateFee
Inherited from
Provider.getDeclareEstimateFee
Defined in
getDeployAccountEstimateFee
▸ getDeployAccountEstimateFee(invocation
, details
, blockIdentifier?
, skipValidate?
): Promise
<EstimateFeeResponseOverhead
>
Estimates the fee for a given DEPLOY_ACCOUNT transaction
Parameters
Name | Type | Description |
---|---|---|
invocation | 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
<EstimateFeeResponseOverhead
>
the estimated fee
Deprecated
Consider using getEstimateFeeBulk for multiple transactions
Example
const feeEstimate = await provider.getDeployAccountEstimateFee(transaction, details);
// Equivalent to:
const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: ETransactionType.DEPLOY_ACCOUNT, ...transaction, ...details }], options);
Alias
getEstimateFeeBulk - This method is an alias that calls getEstimateFeeBulk with a single transaction
Implementation of
AccountInterface.getDeployAccountEstimateFee
Inherited from
Provider.getDeployAccountEstimateFee
Defined in
getEstimateFeeBulk
▸ getEstimateFeeBulk(invocations
, options
): Promise
<EstimateFeeResponseBulkOverhead
>
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 |
Returns
Promise
<EstimateFeeResponseBulkOverhead
>
the estimated fee
Implementation of
AccountInterface.getEstimateFeeBulk
Inherited from
Defined in
invokeFunction
▸ invokeFunction(functionInvocation
, details
): Promise
<{ transaction_hash
: string
}>
Invokes a function on starknet
Parameters
Name | Type | Description |
---|---|---|
functionInvocation | Invocation | the invocation object containing: - contractAddress - the address of the contract - entrypoint - (optional) the entrypoint of the contract - calldata - (optional, defaults to []) the calldata - signature - (optional, defaults to []) the signature |
details | InvocationsDetailsWithNonce | optional details containing: - nonce - optional nonce - version - optional version - maxFee - optional maxFee |
Returns
Promise
<{ transaction_hash
: string
}>
response from addTransaction
Implementation of
AccountInterface.invokeFunction
Inherited from
Defined in
declareContract
▸ declareContract(transaction
, details
): Promise
<{ class_hash
: string
; transaction_hash
: string
}>
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
<{ class_hash
: string
; transaction_hash
: string
}>
a confirmation of sending a transaction on the starknet contract
Implementation of
AccountInterface.declareContract
Inherited from
Defined in
deployAccountContract
▸ deployAccountContract(transaction
, details
): Promise
<{ contract_address
: string
; transaction_hash
: string
}>
Deploys a given compiled Account contract (json) to starknet
Parameters
Name | Type | Description |
---|---|---|
transaction | DeployAccountContractTransaction | payload to be deployed containing: - compiled contract code - constructor calldata - address salt |
details | InvocationsDetailsWithNonce | - |
Returns
Promise
<{ contract_address
: string
; transaction_hash
: string
}>
a confirmation of sending a transaction on the starknet contract
Implementation of
AccountInterface.deployAccountContract
Inherited from
Provider.deployAccountContract
Defined in
callContract
▸ callContract(call
, blockIdentifier?
): Promise
<string
[]>
Calls a function on the Starknet contract.
Parameters
Name | Type | Description |
---|---|---|
call | Call | transaction to be called |
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<string
[]>
the result of the function on the smart contract.
Implementation of
Inherited from
Defined in
estimateMessageFee
▸ estimateMessageFee(message
, blockIdentifier?
): Promise
<FEE_ESTIMATE
| MESSAGE_FEE_ESTIMATE
>
Estimate the fee for a message from L1
Parameters
Name | Type | Description |
---|---|---|
message | MSG_FROM_L1 | L1 message |
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<FEE_ESTIMATE
| MESSAGE_FEE_ESTIMATE
>
Fee estimate
Implementation of
AccountInterface.estimateMessageFee
Inherited from
Defined in
getSyncingStats
▸ getSyncingStats(): Promise
<Syncing
>
Get node synchronization status
Returns
Promise
<Syncing
>
Sync status or false if not syncing
Implementation of
AccountInterface.getSyncingStats
Inherited from
Defined in
getEvents
▸ getEvents(eventFilter
): Promise
<EVENTS_CHUNK
| EVENTS_CHUNK
>
Get events matching the given filter
Parameters
Name | Type | Description |
---|---|---|
eventFilter | EventFilter | EventFilter | event filter |
Returns
Promise
<EVENTS_CHUNK
| EVENTS_CHUNK
>
Events and pagination info
Implementation of
Inherited from
Defined in
verifyMessageInStarknet
▸ verifyMessageInStarknet(message
, signature
, accountAddress
, signatureVerificationFunctionName?
, signatureVerificationResponse?
): Promise
<boolean
>
Verify in Starknet a signature of a TypedData object or of a given hash.
Parameters
Name | Type | Description |
---|---|---|
message | TypedData | BigNumberish | TypedData object to be verified, or message hash to be verified. |
signature | Signature | signature of the message. |
accountAddress | BigNumberish | address of the account that has signed the message. |
signatureVerificationFunctionName? | string | if account contract with non standard account verification function name. |
signatureVerificationResponse? | Object | if account contract with non standard response of verification function. |
signatureVerificationResponse.okResponse | string [] | - |
signatureVerificationResponse.nokResponse | string [] | - |
signatureVerificationResponse.error | string [] | - |
Returns
Promise
<boolean
>
const myTypedMessage: TypedMessage = .... ;
const messageHash = typedData.getMessageHash(myTypedMessage,accountAddress);
const sign: WeierstrassSignatureType = ec.starkCurve.sign(messageHash, privateKey);
const accountAddress = "0x43b7240d227aa2fb8434350b3321c40ac1b88c7067982549e7609870621b535";
const result1 = await myRpcProvider.verifyMessageInStarknet(myTypedMessage, sign, accountAddress);
const result2 = await myRpcProvider.verifyMessageInStarknet(messageHash, sign, accountAddress);
// result1 = result2 = true
Implementation of
AccountInterface.verifyMessageInStarknet
Inherited from
Provider.verifyMessageInStarknet
Defined in
isClassDeclared
▸ isClassDeclared(contractClassIdentifier
, blockIdentifier?
): Promise
<boolean
>
Test if class is already declared
Parameters
Name | Type | Description |
---|---|---|
contractClassIdentifier | ContractClassIdentifier | contract class identifier |
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<boolean
>
true if class is declared
Implementation of
AccountInterface.isClassDeclared
Inherited from
Defined in
prepareInvocations
▸ prepareInvocations(invocations
): Promise
<Invocations
>
Build bulk invocations with auto-detect declared class
Parameters
Name | Type | Description |
---|---|---|
invocations | Invocations | array of invocations |
Returns
Promise
<Invocations
>
Prepared invocations
Implementation of
AccountInterface.prepareInvocations
Inherited from
Defined in
getL1MessagesStatus
▸ getL1MessagesStatus(transactionHash
): Promise
<L1L2MessagesStatus
| L1L2MessagesStatus
>
Get L1 messages status for a transaction
Parameters
Name | Type | Description |
---|---|---|
transactionHash | BigNumberish | L1 transaction hash |
Returns
Promise
<L1L2MessagesStatus
| L1L2MessagesStatus
>
L1 message status
Implementation of
AccountInterface.getL1MessagesStatus
Inherited from
Defined in
getStorageProof
▸ getStorageProof(classHashes
, contractAddresses
, contractsStorageKeys
, blockIdentifier?
): Promise
<StorageProof
>
Get Merkle paths in state tries
Parameters
Name | Type | Description |
---|---|---|
classHashes | BigNumberish [] | class hashes |
contractAddresses | BigNumberish [] | contract addresses |
contractsStorageKeys | CONTRACT_STORAGE_KEYS [] | storage keys |
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<StorageProof
>
Storage proof
Implementation of
AccountInterface.getStorageProof
Inherited from
Defined in
getCompiledCasm
▸ getCompiledCasm(classHash
): Promise
<CASM_COMPILED_CONTRACT_CLASS
>
Get compiled CASM contract class
Parameters
Name | Type | Description |
---|---|---|
classHash | BigNumberish | class hash |
Returns
Promise
<CASM_COMPILED_CONTRACT_CLASS
>
Compiled CASM contract class
Implementation of
AccountInterface.getCompiledCasm
Inherited from
Defined in
getEstimateTip
▸ getEstimateTip(blockIdentifier?
, options?
): Promise
<TipEstimate
>
Get transaction tip estimation based on network analysis
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier? | BlockIdentifier | block identifier to analyze from |
options | TipAnalysisOptions | tip analysis options |
Returns
Promise
<TipEstimate
>
Tip estimation with statistics
Example
const tipEstimate = await provider.getEstimateTip('latest', {
maxBlocks: 10,
minTxsNecessary: 5
});
console.log('Recommended tip:', tipEstimate.recommendedTip);
Implementation of
AccountInterface.getEstimateTip
Inherited from
Defined in
getAddressFromStarkName
▸ getAddressFromStarkName(name
, StarknetIdContract?
): Promise
<string
>
Parameters
Name | Type |
---|---|
name | string |
StarknetIdContract? | string |
Returns
Promise
<string
>
Inherited from
Provider.getAddressFromStarkName
Defined in
src/provider/extensions/starknetId.ts:31
getStarkProfile
▸ getStarkProfile(address
, StarknetIdContract?
, StarknetIdIdentityContract?
, StarknetIdVerifierContract?
, StarknetIdPfpContract?
, StarknetIdPopContract?
, StarknetIdMulticallContract?
): Promise
<StarkProfile
>
Parameters
Name | Type |
---|---|
address | BigNumberish |
StarknetIdContract? | string |
StarknetIdIdentityContract? | string |
StarknetIdVerifierContract? | string |
StarknetIdPfpContract? | string |
StarknetIdPopContract? | string |
StarknetIdMulticallContract? | string |
Returns
Promise
<StarkProfile
>