Class: WalletAccount
Hierarchyβ
-
β³
WalletAccount
Implementsβ
Constructorsβ
constructorβ
β’ new WalletAccount(providerOrOptions, walletProvider, cairoVersion?): WalletAccount
Parametersβ
| Name | Type |
|---|---|
providerOrOptions | ProviderOptions | ProviderInterface |
walletProvider | StarknetWalletProvider |
cairoVersion? | CairoVersion |
Returnsβ
Deprecated
Use static method WalletAccount.connect or WalletAccount.connectSilent instead. Constructor WalletAccount.(format:2).
Overridesβ
Defined inβ
β’ new WalletAccount(providerOrOptions, walletProvider, cairoVersion?, address?): WalletAccount
Parametersβ
| Name | Type |
|---|---|
providerOrOptions | ProviderOptions | ProviderInterface |
walletProvider | StarknetWalletProvider |
cairoVersion? | CairoVersion |
address? | string |
Returnsβ
Overridesβ
Account.constructor
Defined inβ
Propertiesβ
walletProviderβ
β’ walletProvider: StarknetWalletProvider
Defined inβ
signerβ
β’ signer: SignerInterface
Implementation ofβ
Inherited fromβ
Defined inβ
addressβ
β’ address: string
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β
connectβ
βΈ connect(provider, walletProvider, cairoVersion?, silentMode?): Promise<WalletAccount>
Parametersβ
| Name | Type | Default value |
|---|---|---|
provider | ProviderInterface | undefined |
walletProvider | StarknetWalletProvider | undefined |
cairoVersion? | CairoVersion | undefined |
silentMode | boolean | false |
Returnsβ
Promise<WalletAccount>
Defined inβ
connectSilentβ
βΈ connectSilent(provider, walletProvider, cairoVersion?): Promise<WalletAccount>
Parametersβ
| Name | Type |
|---|---|
provider | ProviderInterface |
walletProvider | StarknetWalletProvider |
cairoVersion? | CairoVersion |
Returnsβ
Promise<WalletAccount>
Defined inβ
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β
Account.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
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