Class: WalletAccount
Hierarchyβ
β³
WalletAccount
Implementsβ
Constructorsβ
constructorβ
β’ new WalletAccount(providerOrOptions
, walletProvider
, cairoVersion?
): WalletAccount
Parametersβ
Name | Type |
---|---|
providerOrOptions | ProviderOptions | ProviderInterface |
walletProvider | StarknetWalletProvider |
cairoVersion? | CairoVersion |
Returnsβ
Overridesβ
Defined inβ
Propertiesβ
addressβ
β’ address: string
= ''
Implementation ofβ
Overridesβ
Defined inβ
walletProviderβ
β’ walletProvider: StarknetWalletProvider
Defined inβ
signerβ
β’ signer: SignerInterface
Implementation ofβ
Inherited fromβ
Defined inβ
cairoVersionβ
β’ cairoVersion: CairoVersion
Implementation ofβ
Inherited fromβ
Defined inβ
transactionVersionβ
β’ Readonly
transactionVersion: "0x2"
| "0x3"
Inherited fromβ
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
>
Inherited fromβ
Defined inβ
responseParserβ
β’ responseParser: RPCResponseParser
Inherited fromβ
Defined inβ
channelβ
β’ channel: RpcChannel
| RpcChannel
Implementation ofβ
Inherited fromβ
Defined inβ
getStateUpdateβ
β’ getStateUpdate: () => Promise
<{ block_hash
: never
; 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: { ...; }[]; replaced_classes: { ...; }[]; nonces: { ...; }[]; } }>(blockIdentifier
: "pending"
) => Promise
<{ block_hash
: never
; 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: { ...; }[]; replaced_classes: { ...; }[]; nonces: { ...; }[]; } }>(blockIdentifier
: "latest"
) => Promise
<{ block_hash
: string
; old_root
: string
; new_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: { ...; }[]; replaced_classes: { ...; }[]; nonces: { ...; }[]; } }>(blockIdentifier?
: BlockIdentifier
) => Promise
<StateUpdateResponse
>
Type declarationβ
βΈ (): Promise
<{ block_hash
: never
; 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: { ...; }[]; replaced_classes: { ...; }[]; nonces: { ...; }[]; } }>
Returnsβ
Promise
<{ block_hash
: never
; 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: { ...; }[]; replaced_classes: { ...; }[]; nonces: { ...; }[]; } }>
βΈ (blockIdentifier
): Promise
<{ block_hash
: never
; 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: { ...; }[]; replaced_classes: { ...; }[]; nonces: { ...; }[]; } }>
Parametersβ
Name | Type |
---|---|
blockIdentifier | "pending" |
Returnsβ
Promise
<{ block_hash
: never
; 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: { ...; }[]; replaced_classes: { ...; }[]; nonces: { ...; }[]; } }>
βΈ (blockIdentifier
): Promise
<{ block_hash
: string
; old_root
: string
; new_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: { ...; }[]; replaced_classes: { ...; }[]; nonces: { ...; }[]; } }>
Parametersβ
Name | Type |
---|---|
blockIdentifier | "latest" |
Returnsβ
Promise
<{ block_hash
: string
; old_root
: string
; new_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: { ...; }[]; replaced_classes: { ...; }[]; nonces: { ...; }[]; } }>
βΈ (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:61
getAddressFromStarkNameβ
βΈ getAddressFromStarkName(provider
, name
, StarknetIdContract?
): Promise
<string
>
Parametersβ
Name | Type |
---|---|
provider | ProviderInterface |
name | string |
StarknetIdContract? | string |
Returnsβ
Promise
<string
>
Inherited fromβ
Account.getAddressFromStarkName
Defined inβ
src/provider/extensions/starknetId.ts:95
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:121
onAccountChangeβ
βΈ onAccountChange(callback
): void
WALLET EVENTS
Parametersβ
Name | Type |
---|---|
callback | AccountChangeEventHandler |
Returnsβ
void
Defined inβ
onNetworkChangedβ
βΈ onNetworkChanged(callback
): void
Parametersβ
Name | Type |
---|---|
callback | NetworkChangeEventHandler |
Returnsβ
void
Defined inβ
requestAccountsβ
βΈ requestAccounts(silentMode?
): Promise
<string
[]>
WALLET SPECIFIC METHODS
Parametersβ
Name | Type | Default value |
---|---|---|
silentMode | boolean | false |
Returnsβ
Promise
<string
[]>
Defined inβ
getPermissionsβ
βΈ getPermissions(): Promise
<"accounts"
[]>
Returnsβ
Promise
<"accounts"
[]>
Defined inβ
switchStarknetChainβ
βΈ switchStarknetChain(chainId
): Promise
<boolean
>
Parametersβ
Name | Type |
---|---|
chainId | StarknetChainId |
Returnsβ
Promise
<boolean
>
Defined inβ
watchAssetβ
βΈ watchAsset(asset
): Promise
<boolean
>
Parametersβ
Name | Type |
---|---|
asset | WatchAssetParameters |
Returnsβ
Promise
<boolean
>
Defined inβ
addStarknetChainβ
βΈ addStarknetChain(chain
): Promise
<boolean
>
Parametersβ
Name | Type |
---|---|
chain | AddStarknetChainParameters |
Returnsβ
Promise
<boolean
>
Defined inβ
executeβ
βΈ execute(calls
): Promise
<AddInvokeTransactionResult
>
ACCOUNT METHODS
Parametersβ
Name | Type |
---|---|
calls | AllowArray <Call > |
Returnsβ
Promise
<AddInvokeTransactionResult
>
Implementation ofβ
Overridesβ
Defined inβ
declareβ
βΈ declare(payload
): Promise
<AddDeclareTransactionResult
>
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. |
Returnsβ
Promise
<AddDeclareTransactionResult
>
a confirmation of sending a transaction on the starknet contract
Implementation ofβ
Overridesβ
Defined inβ
deployβ
βΈ deploy(payload
): 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 |
Returnsβ
Promise
<MultiDeployContractResponse
>
- contract_address[]
- transaction_hash
Implementation ofβ
Overridesβ
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β
Overridesβ
Defined inβ
getPreferredVersionβ
βΈ getPreferredVersion(type12
, type3
): ETransactionVersion
Parametersβ
Name | Type |
---|---|
type12 | ETransactionVersion |
type3 | ETransactionVersion |
Returnsβ
Inherited fromβ
Defined inβ
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β
Inherited fromβ
Defined inβ
getNonceSafeβ
βΈ getNonceSafe(nonce?
): Promise
<bigint
>
Parametersβ
Name | Type |
---|---|
nonce? | BigNumberish |
Returnsβ
Promise
<bigint
>
Inherited fromβ
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
>
Inherited fromβ
Defined inβ
estimateFeeβ
βΈ estimateFee(calls
, estimateFeeDetails?
): Promise
<EstimateFee
>
Parametersβ
Name | Type |
---|---|
calls | AllowArray <Call > |
estimateFeeDetails | UniversalDetails |
Returnsβ
Promise
<EstimateFee
>
Inherited fromβ
Defined inβ
estimateInvokeFeeβ
βΈ estimateInvokeFee(calls
, details?
): Promise
<EstimateFee
>
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
<EstimateFee
>
response from estimate_fee
Implementation ofβ
AccountInterface.estimateInvokeFee
Inherited fromβ
Defined inβ
estimateDeclareFeeβ
βΈ estimateDeclareFee(payload
, details?
): Promise
<EstimateFee
>
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
<EstimateFee
>
response from estimate_fee
Implementation ofβ
AccountInterface.estimateDeclareFee
Inherited fromβ
Defined inβ
estimateAccountDeployFeeβ
βΈ estimateAccountDeployFee(Β«destructuredΒ»
, details?
): Promise
<EstimateFee
>
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
<EstimateFee
>
response from estimate_fee
Implementation ofβ
AccountInterface.estimateAccountDeployFee
Inherited fromβ
Account.estimateAccountDeployFee
Defined inβ
estimateDeployFeeβ
βΈ estimateDeployFee(payload
, details?
): Promise
<EstimateFee
>
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 |
---|---|---|
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
<EstimateFee
>
Implementation ofβ
AccountInterface.estimateDeployFee
Inherited fromβ
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
Inherited fromβ
Defined inβ
simulateTransactionβ
βΈ 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
Implementation ofβ
AccountInterface.simulateTransaction
Inherited fromβ
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
}>
Inherited fromβ
Defined inβ
deployContractβ
βΈ 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 | UniversalDetails | InvocationsDetails |
Returnsβ
Promise
<DeployContractUDCResponse
>
- contract_address
- transaction_hash
- address
- deployer
- unique
- classHash
- calldata_len
- calldata
- salt
Implementation ofβ
AccountInterface.deployContract
Inherited fromβ
Defined inβ
declareAndDeployβ
βΈ 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 | 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
Inherited fromβ
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
Inherited fromβ
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β
Inherited fromβ
Defined inβ
verifyMessageHashβ
βΈ verifyMessageHash(hash
, signature
, signatureVerificationFunctionName?
, signatureVerificationResponse?
): Promise
<boolean
>
Parametersβ
Name | Type |
---|---|
hash | BigNumberish |
signature | Signature |
signatureVerificationFunctionName? | string |
signatureVerificationResponse? | Object |
signatureVerificationResponse.okResponse | string [] |
signatureVerificationResponse.nokResponse | string [] |
signatureVerificationResponse.error | string [] |
Returnsβ
Promise
<boolean
>
Deprecated
To replace by myRpcProvider.verifyMessageInStarknet()
Inherited fromβ
Defined inβ
verifyMessageβ
βΈ verifyMessage(typedData
, signature
, signatureVerificationFunctionName?
, signatureVerificationResponse?
): Promise
<boolean
>
Parametersβ
Name | Type |
---|---|
typedData | TypedData |
signature | Signature |
signatureVerificationFunctionName? | string |
signatureVerificationResponse? | Object |
signatureVerificationResponse.okResponse | string [] |
signatureVerificationResponse.nokResponse | string [] |
signatureVerificationResponse.error | string [] |
Returnsβ
Promise
<boolean
>
Deprecated
To replace by myRpcProvider.verifyMessageInStarknet()
Inherited fromβ
Defined inβ
getSnip9Versionβ
βΈ getSnip9Version(): Promise
<OutsideExecutionVersion
>
Verify if an account is compatible with SNIP-9 outside execution, and with which version of this standard.
Returnsβ
Promise
<OutsideExecutionVersion
>
Not compatible, V1, V2.
Example
const result = myAccount.getSnip9Version();
// result = "V1"
Inherited fromβ
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
Inherited fromβ
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"
Inherited fromβ
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? | OutsideExecutionVersion | 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'
// }
Inherited fromβ
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...`}
Inherited fromβ
Defined inβ
getUniversalSuggestedFeeβ
βΈ getUniversalSuggestedFee(version
, Β«destructuredΒ»
, details
): Promise
<UniversalSuggestedFee
>
Parametersβ
Name | Type |
---|---|
version | ETransactionVersion |
Β«destructuredΒ» | EstimateFeeAction |
details | UniversalDetails |
Returnsβ
Promise
<UniversalSuggestedFee
>
Inherited fromβ
Account.getUniversalSuggestedFee
Defined inβ
getSuggestedFeeβ
βΈ getSuggestedFee(Β«destructuredΒ»
, details
): Promise
<EstimateFee
>
Gets Suggested Max Fee based on the transaction type
Parametersβ
Name | Type |
---|---|
Β«destructuredΒ» | EstimateFeeAction |
details | UniversalDetails |
Returnsβ
Promise
<EstimateFee
>
EstimateFee (...response, resourceBounds, suggestedMaxFee)
Implementation ofβ
AccountInterface.getSuggestedFee
Inherited fromβ
Defined inβ
buildInvocationβ
βΈ buildInvocation(call
, details
): Promise
<Invocation
>
Parametersβ
Name | Type |
---|---|
call | Call [] |
details | InvocationsSignerDetails |
Returnsβ
Promise
<Invocation
>
Inherited fromβ
Defined inβ
buildDeclarePayloadβ
βΈ buildDeclarePayload(payload
, details
): Promise
<DeclareContractTransaction
>
Parametersβ
Name | Type |
---|---|
payload | DeclareContractPayload |
details | InvocationsSignerDetails |
Returnsβ
Promise
<DeclareContractTransaction
>
Inherited fromβ
Defined inβ
buildAccountDeployPayloadβ
βΈ buildAccountDeployPayload(Β«destructuredΒ»
, details
): Promise
<DeployAccountContractTransaction
>
Parametersβ
Name | Type |
---|---|
Β«destructuredΒ» | DeployAccountContractPayload |
details | InvocationsSignerDetails |
Returnsβ
Promise
<DeployAccountContractTransaction
>
Inherited fromβ
Account.buildAccountDeployPayload
Defined inβ
buildUDCContractPayloadβ
βΈ buildUDCContractPayload(payload
): Call
[]
Parametersβ
Name | Type |
---|---|
payload | UniversalDeployerContractPayload | UniversalDeployerContractPayload [] |
Returnsβ
Call
[]
Inherited fromβ
Account.buildUDCContractPayload
Defined inβ
accountInvocationsFactoryβ
βΈ accountInvocationsFactory(invocations
, details
): Promise
<AccountInvocations
>
Parametersβ
Name | Type |
---|---|
invocations | Invocations |
details | AccountInvocationsFactoryDetails |
Returnsβ
Promise
<AccountInvocations
>
Inherited fromβ
Account.accountInvocationsFactory
Defined inβ
getStarkNameβ
βΈ getStarkName(address?
, StarknetIdContract?
): Promise
<string
>
Parametersβ
Name | Type |
---|---|
address | BigNumberish |
StarknetIdContract? | string |
Returnsβ
Promise
<string
>
Inherited fromβ
Defined inβ
fetchβ
βΈ fetch(method
, params?
, id?
): Promise
<Response
>
Parametersβ
Name | Type | Default value |
---|---|---|
method | string | undefined |
params? | object | undefined |
id | string | number | 0 |
Returnsβ
Promise
<Response
>
Inherited fromβ
Defined inβ
getChainIdβ
βΈ getChainId(): Promise
<StarknetChainId
>
Gets the Starknet chain Id
Returnsβ
Promise
<StarknetChainId
>
the chain Id
Implementation ofβ
Inherited fromβ
Defined inβ
getSpecVersionβ
βΈ getSpecVersion(): Promise
<string
>
Returnsβ
Promise
<string
>
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
<PendingBlock
>
Gets the block information
Returnsβ
Promise
<PendingBlock
>
the block object
Implementation ofβ
Inherited fromβ
Defined inβ
βΈ getBlock(blockIdentifier
): Promise
<PendingBlock
>
Parametersβ
Name | Type |
---|---|
blockIdentifier | "pending" |
Returnsβ
Promise
<PendingBlock
>
Implementation ofβ
Inherited fromβ
Defined inβ
βΈ getBlock(blockIdentifier
): Promise
<Block
>
Parametersβ
Name | Type |
---|---|
blockIdentifier | "latest" |
Returnsβ
Promise
<Block
>
Implementation ofβ
Inherited fromβ
Defined inβ
βΈ getBlock(blockIdentifier?
): Promise
<GetBlockResponse
>
Parametersβ
Name | Type |
---|---|
blockIdentifier? | BlockIdentifier |
Returnsβ
Promise
<GetBlockResponse
>
Implementation ofβ
AccountInterface.getBlock
Inherited fromβ
Defined inβ
getBlockLatestAcceptedβ
βΈ getBlockLatestAccepted(): Promise
<BlockHashAndNumber
>
Get the most recent accepted block hash and number
Returnsβ
Promise
<BlockHashAndNumber
>
Inherited fromβ
Account.getBlockLatestAccepted
Defined inβ
getBlockNumberβ
βΈ getBlockNumber(): Promise
<number
>
Get the most recent accepted block number redundant use getBlockLatestAccepted();
Returnsβ
Promise
<number
>
Number of the latest block
Inherited fromβ
Defined inβ
getBlockWithTxHashesβ
βΈ getBlockWithTxHashes(blockIdentifier?
): Promise
<BlockWithTxHashes
>
Parametersβ
Name | Type |
---|---|
blockIdentifier? | BlockIdentifier |
Returnsβ
Promise
<BlockWithTxHashes
>
Inherited fromβ
Defined inβ
getBlockWithTxsβ
βΈ getBlockWithTxs(blockIdentifier?
): Promise
<BlockWithTxs
>
Parametersβ
Name | Type |
---|---|
blockIdentifier? | BlockIdentifier |
Returnsβ
Promise
<BlockWithTxs
>
Inherited fromβ
Defined inβ
waitForBlockβ
βΈ waitForBlock(blockIdentifier?
, retryInterval?
): Promise
<void
>
Pause the execution of the script until a specified block is created.
Parametersβ
Name | Type | Default value | Description |
---|---|---|---|
blockIdentifier | BlockIdentifier | 'pending' | bloc number (BigNumberish) or 'pending' or 'latest'. Use of 'latest" or of a block already created will generate no pause. |
retryInterval? | number | 5000 | number of milliseconds between 2 requests to the node |
Returnsβ
Promise
<void
>
Example
await myProvider.waitForBlock();
// wait the creation of the pending block
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
<BlockWithTxReceipts
>
Parametersβ
Name | Type |
---|---|
blockIdentifier? | BlockIdentifier |
Returnsβ
Promise
<BlockWithTxReceipts
>
Inherited fromβ
Defined inβ
getBlockStateUpdateβ
βΈ getBlockStateUpdate(): Promise
<{ block_hash
: never
; 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: { ...; }[]; replaced_classes: { ...; }[]; nonces: { ...; }[]; } }>
Returnsβ
Promise
<{ block_hash
: never
; 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: { ...; }[]; replaced_classes: { ...; }[]; nonces: { ...; }[]; } }>
Inherited fromβ
Defined inβ
βΈ getBlockStateUpdate(blockIdentifier
): Promise
<{ block_hash
: never
; 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: { ...; }[]; replaced_classes: { ...; }[]; nonces: { ...; }[]; } }>
Parametersβ
Name | Type |
---|---|
blockIdentifier | "pending" |
Returnsβ
Promise
<{ block_hash
: never
; 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: { ...; }[]; replaced_classes: { ...; }[]; nonces: { ...; }[]; } }>
Inherited fromβ
Defined inβ
βΈ getBlockStateUpdate(blockIdentifier
): Promise
<{ block_hash
: string
; old_root
: string
; new_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: { ...; }[]; replaced_classes: { ...; }[]; nonces: { ...; }[]; } }>
Parametersβ
Name | Type |
---|---|
blockIdentifier | "latest" |
Returnsβ
Promise
<{ block_hash
: string
; old_root
: string
; new_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: { ...; }[]; replaced_classes: { ...; }[]; nonces: { ...; }[]; } }>
Inherited fromβ
Defined inβ
βΈ getBlockStateUpdate(blockIdentifier?
): Promise
<StateUpdateResponse
>
Parametersβ
Name | Type |
---|---|
blockIdentifier? | BlockIdentifier |
Returnsβ
Promise
<StateUpdateResponse
>
Inherited fromβ
Defined inβ
getBlockTransactionsTracesβ
βΈ getBlockTransactionsTraces(blockIdentifier?
): Promise
<BlockTransactionsTraces
>
Parametersβ
Name | Type |
---|---|
blockIdentifier? | BlockIdentifier |
Returnsβ
Promise
<BlockTransactionsTraces
>
Inherited fromβ
Account.getBlockTransactionsTraces
Defined inβ
getBlockTransactionCountβ
βΈ getBlockTransactionCount(blockIdentifier?
): Promise
<number
>
Parametersβ
Name | Type |
---|---|
blockIdentifier? | BlockIdentifier |
Returnsβ
Promise
<number
>
Inherited fromβ
Account.getBlockTransactionCount
Defined inβ
getPendingTransactionsβ
βΈ getPendingTransactions(): Promise
<TransactionWithHash
[]>
Return transactions from pending block
Returnsβ
Promise
<TransactionWithHash
[]>
Deprecated
Instead use getBlock(BlockTag.PENDING); (will be removed in next minor version) Utility method, same result can be achieved using getBlockWithTxHashes(BlockTag.pending);
Inherited fromβ
Account.getPendingTransactions
Defined inβ
getTransactionβ
βΈ getTransaction(txHash
): Promise
<TransactionWithHash
>
Gets the transaction information from a tx id.
Parametersβ
Name | Type |
---|---|
txHash | BigNumberish |
Returnsβ
Promise
<TransactionWithHash
>
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
<TransactionWithHash
>
Parametersβ
Name | Type |
---|---|
txHash | BigNumberish |
Returnsβ
Promise
<TransactionWithHash
>
Inherited fromβ
Defined inβ
getTransactionByBlockIdAndIndexβ
βΈ getTransactionByBlockIdAndIndex(blockIdentifier
, index
): Promise
<TransactionWithHash
>
Parametersβ
Name | Type |
---|---|
blockIdentifier | BlockIdentifier |
index | number |
Returnsβ
Promise
<TransactionWithHash
>
Inherited fromβ
Account.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β
Defined inβ
getTransactionTraceβ
βΈ getTransactionTrace(txHash
): Promise
<TRANSACTION_TRACE
>
Parametersβ
Name | Type |
---|---|
txHash | BigNumberish |
Returnsβ
Promise
<TRANSACTION_TRACE
>
Inherited fromβ
Defined inβ
getTransactionStatusβ
βΈ getTransactionStatus(transactionHash
): Promise
<TransactionStatus
>
Get the status of a transaction
Parametersβ
Name | Type |
---|---|
transactionHash | BigNumberish |
Returnsβ
Promise
<TransactionStatus
>
Inherited fromβ
Defined inβ
getSimulateTransactionβ
βΈ getSimulateTransaction(invocations
, options?
): Promise
<SimulateTransactionResponse
>
Parametersβ
Name | Type | Description |
---|---|---|
invocations | AccountInvocations | AccountInvocations |
options? | getSimulateTransactionOptions | blockIdentifier and flags to skip validation and fee charge - blockIdentifier - skipValidate (default false) - skipFeeCharge (default true) |
Returnsβ
Promise
<SimulateTransactionResponse
>
Implementation ofβ
AccountInterface.getSimulateTransaction
Inherited fromβ
Account.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"
>>
Parametersβ
Name | Type |
---|---|
classHash | BigNumberish |
blockIdentifier? | BlockIdentifier |
Returnsβ
Promise
<LegacyContractClass
| Omit
<CompiledSierra
, "sierra_program_debug_info"
>>
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β
getEstimateFeeβ
βΈ getEstimateFee(invocation
, invocationDetails
, blockIdentifier?
, skipValidate?
): Promise
<EstimateFeeResponse
>
Parametersβ
Name | Type |
---|---|
invocation | Invocation |
invocationDetails | InvocationsDetailsWithNonce |
blockIdentifier? | BlockIdentifier |
skipValidate? | boolean |
Returnsβ
Promise
<EstimateFeeResponse
>
Deprecated
use gettypeEstimateFee (will be refactored based on type after sequencer deprecation)
Implementation ofβ
AccountInterface.getEstimateFee
Inherited fromβ
Defined inβ
getInvokeEstimateFeeβ
βΈ getInvokeEstimateFee(invocation
, invocationDetails
, 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 |
invocationDetails | 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
Implementation ofβ
AccountInterface.getInvokeEstimateFee
Inherited fromβ
Defined inβ
getDeclareEstimateFeeβ
βΈ getDeclareEstimateFee(invocation
, details
, blockIdentifier?
, skipValidate?
): Promise
<EstimateFeeResponse
>
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
<EstimateFeeResponse
>
the estimated fee
Implementation ofβ
AccountInterface.getDeclareEstimateFee
Inherited fromβ
Defined inβ
getDeployAccountEstimateFeeβ
βΈ getDeployAccountEstimateFee(invocation
, details
, blockIdentifier?
, skipValidate?
): Promise
<EstimateFeeResponse
>
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
<EstimateFeeResponse
>
the estimated fee
Implementation ofβ
AccountInterface.getDeployAccountEstimateFee
Inherited fromβ
Account.getDeployAccountEstimateFee
Defined inβ
getEstimateFeeBulkβ
βΈ 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 |
Returnsβ
Promise
<EstimateFeeResponseBulk
>
the estimated fee
Implementation ofβ
AccountInterface.getEstimateFeeBulk
Inherited fromβ
Defined inβ
invokeFunctionβ
βΈ invokeFunction(functionInvocation
, details
): Promise
<InvokedTransaction
>
Invokes a function on starknet
Parametersβ
Name | Type | Description |
---|---|---|
functionInvocation | 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
<InvokedTransaction
>
response from addTransaction
Deprecated
This method won't be supported as soon as fees are mandatory. Should not be used outside of Account class
Implementation ofβ
AccountInterface.invokeFunction
Inherited fromβ
Defined inβ
declareContractβ
βΈ declareContract(transaction
, details
): Promise
<DeclaredTransaction
>
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
<DeclaredTransaction
>
a confirmation of sending a transaction on the starknet contract
Implementation ofβ
AccountInterface.declareContract
Inherited fromβ
Defined inβ
deployAccountContractβ
βΈ deployAccountContract(transaction
, details
): Promise
<DeployedAccountTransaction
>
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
<DeployedAccountTransaction
>
a confirmation of sending a transaction on the starknet contract
Implementation ofβ
AccountInterface.deployAccountContract
Inherited fromβ
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
>
NEW: Estimate the fee for a message from L1
Parametersβ
Name | Type | Description |
---|---|---|
message | MSG_FROM_L1 | Message From L1 |
blockIdentifier? | BlockIdentifier | - |
Returnsβ
Promise
<FEE_ESTIMATE
>
Inherited fromβ
Defined inβ
getSyncingStatsβ
βΈ getSyncingStats(): Promise
<Syncing
>
Returns an object about the sync status, or false if the node is not synching
Returnsβ
Promise
<Syncing
>
Object with the stats data
Inherited fromβ
Defined inβ
getEventsβ
βΈ getEvents(eventFilter
): Promise
<EVENTS_CHUNK
>
Returns all events matching the given filter
Parametersβ
Name | Type |
---|---|
eventFilter | EventFilter |
Returnsβ
Promise
<EVENTS_CHUNK
>
events and the pagination of the events
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 = myRpcProvider.verifyMessageInStarknet(myTypedMessage, sign, accountAddress);
const result2 = myRpcProvider.verifyMessageInStarknet(messageHash, sign, accountAddress);
// result1 = result2 = true
Inherited fromβ
Account.verifyMessageInStarknet
Defined inβ
isClassDeclaredβ
βΈ isClassDeclared(contractClassIdentifier
, blockIdentifier?
): Promise
<boolean
>
Test if class is already declared from ContractClassIdentifier Helper method using getClass
Parametersβ
Name | Type |
---|---|
contractClassIdentifier | ContractClassIdentifier |
blockIdentifier? | BlockIdentifier |
Returnsβ
Promise
<boolean
>
Inherited fromβ
Defined inβ
prepareInvocationsβ
βΈ prepareInvocations(invocations
): Promise
<Invocations
>
Build bulk invocations with auto-detect declared class
- Test if class is declared if not declare it preventing already declared class error and not declared class errors
- Order declarations first
Parametersβ
Name | Type |
---|---|
invocations | Invocations |
Returnsβ
Promise
<Invocations
>
Inherited fromβ
Defined inβ
getAddressFromStarkNameβ
βΈ getAddressFromStarkName(name
, StarknetIdContract?
): Promise
<string
>
Parametersβ
Name | Type |
---|---|
name | string |
StarknetIdContract? | string |
Returnsβ
Promise
<string
>
Inherited fromβ
Account.getAddressFromStarkName
Defined inβ
src/provider/extensions/starknetId.ts:30
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
>