@0xknwn/starknet-modular-account / Exports

@0xknwn/starknet-modular-account

Table of contents

Classes

Interfaces

Type Aliases

Variables

Functions

Type Aliases

Authorization

Ƭ Authorization: Object

Type declaration

NameType
accountAddressstring
authKeystring
chainIdstring
expiresstring
grantorClass?string
hash?string
rootstring
selectorstring
signaturestring[]
validatorClassstring

Defined in

sdks/account/src/smartr_account.ts:27

Variables

POLICY_TYPE_HASH

Const POLICY_TYPE_HASH: string

Defined in

sdks/account/src/message.ts:5


SESSION_TYPE_HASH

Const SESSION_TYPE_HASH: string

Defined in

sdks/account/src/message.ts:4


STARKNET_DOMAIN_TYPE_HASH

Const STARKNET_DOMAIN_TYPE_HASH: string

Defined in

sdks/account/src/message.ts:3


SmartrAccountABI

Const SmartrAccountABI: readonly [{ interface_name: "smartr::component::version::IVersion" = "smartr::component::version::IVersion"; name: "VersionImpl" = "VersionImpl"; type: "impl" = "impl" }, { items: readonly [{ inputs: readonly [] = []; name: "get_version" = "get_version"; outputs: readonly [{ type: "core::felt252" = "core::felt252" }] ; state_mutability: "view" = "view"; type: "function" = "function" }, { inputs: readonly [] = []; name: "get_name" = "get_name"; outputs: readonly [{ type: "core::felt252" = "core::felt252" }] ; state_mutability: "view" = "view"; type: "function" = "function" }] ; name: "smartr::component::version::IVersion" = "smartr::component::version::IVersion"; type: "interface" = "interface" }, { interface_name: "openzeppelin::upgrades::interface::IUpgradeable" = "openzeppelin::upgrades::interface::IUpgradeable"; name: "UpgradeableImpl" = "UpgradeableImpl"; type: "impl" = "impl" }, { items: readonly [{ inputs: readonly [{ name: "new_class_hash" = "new_class_hash"; type: "core::starknet::class_hash::ClassHash" = "core::starknet::class_hash::ClassHash" }] ; name: "upgrade" = "upgrade"; outputs: readonly [] = []; state_mutability: "external" = "external"; type: "function" = "function" }] ; name: "openzeppelin::upgrades::interface::IUpgradeable" = "openzeppelin::upgrades::interface::IUpgradeable"; type: "interface" = "interface" }, { interface_name: "smartr::component::account::ISRC6" = "smartr::component::account::ISRC6"; name: "SRC6Impl" = "SRC6Impl"; type: "impl" = "impl" }, { members: readonly [{ name: "snapshot" = "snapshot"; type: "@core::array::Array::<core::felt252>" = "@core::array::Array::<core::felt252>" }] ; name: "core::array::Span::<core::felt252>" = "core::array::Span::<core::felt252>"; type: "struct" = "struct" }, { members: readonly [{ name: "to" = "to"; type: "core::starknet::contract_address::ContractAddress" = "core::starknet::contract_address::ContractAddress" }, { name: "selector" = "selector"; type: "core::felt252" = "core::felt252" }, { name: "calldata" = "calldata"; type: "core::array::Span::<core::felt252>" = "core::array::Span::<core::felt252>" }] ; name: "core::starknet::account::Call" = "core::starknet::account::Call"; type: "struct" = "struct" }, { items: readonly [{ inputs: readonly [{ name: "calls" = "calls"; type: "core::array::Array::<core::starknet::account::Call>" = "core::array::Array::<core::starknet::account::Call>" }] ; name: "__execute__" = "__execute__"; outputs: readonly [{ type: "core::array::Array::<core::array::Span::<core::felt252>>" = "core::array::Array::<core::array::Span::<core::felt252>>" }] ; state_mutability: "view" = "view"; type: "function" = "function" }, { inputs: readonly [{ name: "calls" = "calls"; type: "core::array::Array::<core::starknet::account::Call>" = "core::array::Array::<core::starknet::account::Call>" }] ; name: "__validate__" = "__validate__"; outputs: readonly [{ type: "core::felt252" = "core::felt252" }] ; state_mutability: "view" = "view"; type: "function" = "function" }, { inputs: readonly [{ name: "hash" = "hash"; type: "core::array::Array::<core::felt252>" = "core::array::Array::<core::felt252>" }, { name: "signature" = "signature"; type: "core::array::Array::<core::felt252>" = "core::array::Array::<core::felt252>" }] ; name: "is_valid_signature" = "is_valid_signature"; outputs: readonly [{ type: "core::felt252" = "core::felt252" }] ; state_mutability: "view" = "view"; type: "function" = "function" }] ; name: "smartr::component::account::ISRC6" = "smartr::component::account::ISRC6"; type: "interface" = "interface" }, { interface_name: "smartr::component::account::IDeclarer" = "smartr::component::account::IDeclarer"; name: "DeclarerImpl" = "DeclarerImpl"; type: "impl" = "impl" }, { items: readonly [{ inputs: readonly [{ name: "class_hash" = "class_hash"; type: "core::felt252" = "core::felt252" }] ; name: "__validate_declare__" = "__validate_declare__"; outputs: readonly [{ type: "core::felt252" = "core::felt252" }] ; state_mutability: "view" = "view"; type: "function" = "function" }] ; name: "smartr::component::account::IDeclarer" = "smartr::component::account::IDeclarer"; type: "interface" = "interface" }, { interface_name: "smartr::component::account::IDeployable" = "smartr::component::account::IDeployable"; name: "DeployableImpl" = "DeployableImpl"; type: "impl" = "impl" }, { items: readonly [{ inputs: readonly [{ name: "class_hash" = "class_hash"; type: "core::felt252" = "core::felt252" }, { name: "contract_address_salt" = "contract_address_salt"; type: "core::felt252" = "core::felt252" }, { name: "core_validator" = "core_validator"; type: "core::felt252" = "core::felt252" }, { name: "public_key" = "public_key"; type: "core::array::Array::<core::felt252>" = "core::array::Array::<core::felt252>" }] ; name: "__validate_deploy__" = "__validate_deploy__"; outputs: readonly [{ type: "core::felt252" = "core::felt252" }] ; state_mutability: "view" = "view"; type: "function" = "function" }] ; name: "smartr::component::account::IDeployable" = "smartr::component::account::IDeployable"; type: "interface" = "interface" }, { interface_name: "smartr::component::account::IModule" = "smartr::component::account::IModule"; name: "ModuleImpl" = "ModuleImpl"; type: "impl" = "impl" }, { name: "core::bool" = "core::bool"; type: "enum" = "enum"; variants: readonly [{ name: "False" = "False"; type: "()" = "()" }, { name: "True" = "True"; type: "()" = "()" }] }, { items: readonly [{ inputs: readonly [{ name: "calldata" = "calldata"; type: "core::array::Array::<core::felt252>" = "core::array::Array::<core::felt252>" }] ; name: "__module_validate__" = "__module_validate__"; outputs: readonly [] = []; state_mutability: "view" = "view"; type: "function" = "function" }, { inputs: readonly [{ name: "class_hash" = "class_hash"; type: "core::starknet::class_hash::ClassHash" = "core::starknet::class_hash::ClassHash" }] ; name: "add_module" = "add_module"; outputs: readonly [] = []; state_mutability: "external" = "external"; type: "function" = "function" }, { inputs: readonly [{ name: "class_hash" = "class_hash"; type: "core::starknet::class_hash::ClassHash" = "core::starknet::class_hash::ClassHash" }] ; name: "remove_module" = "remove_module"; outputs: readonly [] = []; state_mutability: "external" = "external"; type: "function" = "function" }, { inputs: readonly [{ name: "class_hash" = "class_hash"; type: "core::starknet::class_hash::ClassHash" = "core::starknet::class_hash::ClassHash" }, { name: "forward_validate_module" = "forward_validate_module"; type: "core::bool" = "core::bool" }] ; name: "update_core_module" = "update_core_module"; outputs: readonly [] = []; state_mutability: "external" = "external"; type: "function" = "function" }, { inputs: readonly [] = []; name: "get_core_module" = "get_core_module"; outputs: readonly [{ type: "core::starknet::class_hash::ClassHash" = "core::starknet::class_hash::ClassHash" }] ; state_mutability: "view" = "view"; type: "function" = "function" }, { inputs: readonly [] = []; name: "is_validate_module_forwarded" = "is_validate_module_forwarded"; outputs: readonly [{ type: "core::bool" = "core::bool" }] ; state_mutability: "view" = "view"; type: "function" = "function" }, { inputs: readonly [{ name: "class_hash" = "class_hash"; type: "core::starknet::class_hash::ClassHash" = "core::starknet::class_hash::ClassHash" }] ; name: "is_module" = "is_module"; outputs: readonly [{ type: "core::bool" = "core::bool" }] ; state_mutability: "view" = "view"; type: "function" = "function" }, { inputs: readonly [{ name: "class_hash" = "class_hash"; type: "core::starknet::class_hash::ClassHash" = "core::starknet::class_hash::ClassHash" }, { name: "call" = "call"; type: "core::starknet::account::Call" = "core::starknet::account::Call" }] ; name: "call_on_module" = "call_on_module"; outputs: readonly [{ type: "core::array::Array::<core::felt252>" = "core::array::Array::<core::felt252>" }] ; state_mutability: "view" = "view"; type: "function" = "function" }, { inputs: readonly [{ name: "class_hash" = "class_hash"; type: "core::starknet::class_hash::ClassHash" = "core::starknet::class_hash::ClassHash" }, { name: "call" = "call"; type: "core::starknet::account::Call" = "core::starknet::account::Call" }] ; name: "execute_on_module" = "execute_on_module"; outputs: readonly [{ type: "core::array::Array::<core::felt252>" = "core::array::Array::<core::felt252>" }] ; state_mutability: "external" = "external"; type: "function" = "function" }] ; name: "smartr::component::account::IModule" = "smartr::component::account::IModule"; type: "interface" = "interface" }, { interface_name: "openzeppelin::introspection::interface::ISRC5" = "openzeppelin::introspection::interface::ISRC5"; name: "SRC5Impl" = "SRC5Impl"; type: "impl" = "impl" }, { items: readonly [{ inputs: readonly [{ name: "interface_id" = "interface_id"; type: "core::felt252" = "core::felt252" }] ; name: "supports_interface" = "supports_interface"; outputs: readonly [{ type: "core::bool" = "core::bool" }] ; state_mutability: "view" = "view"; type: "function" = "function" }] ; name: "openzeppelin::introspection::interface::ISRC5" = "openzeppelin::introspection::interface::ISRC5"; type: "interface" = "interface" }, { inputs: readonly [{ name: "core_validator" = "core_validator"; type: "core::felt252" = "core::felt252" }, { name: "args" = "args"; type: "core::array::Array::<core::felt252>" = "core::array::Array::<core::felt252>" }] ; name: "constructor" = "constructor"; type: "constructor" = "constructor" }, { kind: "struct" = "struct"; members: readonly [{ kind: "key" = "key"; name: "new_owner_guid" = "new_owner_guid"; type: "core::array::Array::<core::felt252>" = "core::array::Array::<core::felt252>" }] ; name: "smartr::component::account::AccountComponent::OwnerAdded" = "smartr::component::account::AccountComponent::OwnerAdded"; type: "event" = "event" }, { kind: "struct" = "struct"; members: readonly [{ kind: "key" = "key"; name: "removed_owner_guid" = "removed_owner_guid"; type: "core::array::Array::<core::felt252>" = "core::array::Array::<core::felt252>" }] ; name: "smartr::component::account::AccountComponent::OwnerRemoved" = "smartr::component::account::AccountComponent::OwnerRemoved"; type: "event" = "event" }, { kind: "enum" = "enum"; name: "smartr::component::account::AccountComponent::Event" = "smartr::component::account::AccountComponent::Event"; type: "event" = "event"; variants: readonly [{ kind: "nested" = "nested"; name: "OwnerAdded" = "OwnerAdded"; type: "smartr::component::account::AccountComponent::OwnerAdded" = "smartr::component::account::AccountComponent::OwnerAdded" }, { kind: "nested" = "nested"; name: "OwnerRemoved" = "OwnerRemoved"; type: "smartr::component::account::AccountComponent::OwnerRemoved" = "smartr::component::account::AccountComponent::OwnerRemoved" }] }, { kind: "enum" = "enum"; name: "openzeppelin::introspection::src5::SRC5Component::Event" = "openzeppelin::introspection::src5::SRC5Component::Event"; type: "event" = "event"; variants: readonly [] = [] }, { kind: "struct" = "struct"; members: readonly [{ kind: "data" = "data"; name: "class_hash" = "class_hash"; type: "core::starknet::class_hash::ClassHash" = "core::starknet::class_hash::ClassHash" }] ; name: "openzeppelin::upgrades::upgradeable::UpgradeableComponent::Upgraded" = "openzeppelin::upgrades::upgradeable::UpgradeableComponent::Upgraded"; type: "event" = "event" }, { kind: "enum" = "enum"; name: "openzeppelin::upgrades::upgradeable::UpgradeableComponent::Event" = "openzeppelin::upgrades::upgradeable::UpgradeableComponent::Event"; type: "event" = "event"; variants: readonly [{ kind: "nested" = "nested"; name: "Upgraded" = "Upgraded"; type: "openzeppelin::upgrades::upgradeable::UpgradeableComponent::Upgraded" = "openzeppelin::upgrades::upgradeable::UpgradeableComponent::Upgraded" }] }, { kind: "enum" = "enum"; name: "smartr::account::smartraccount::SmartrAccount::Event" = "smartr::account::smartraccount::SmartrAccount::Event"; type: "event" = "event"; variants: readonly [{ kind: "flat" = "flat"; name: "AccountEvent" = "AccountEvent"; type: "smartr::component::account::AccountComponent::Event" = "smartr::component::account::AccountComponent::Event" }, { kind: "flat" = "flat"; name: "SRC5Event" = "SRC5Event"; type: "openzeppelin::introspection::src5::SRC5Component::Event" = "openzeppelin::introspection::src5::SRC5Component::Event" }, { kind: "flat" = "flat"; name: "UpgradeableEvent" = "UpgradeableEvent"; type: "openzeppelin::upgrades::upgradeable::UpgradeableComponent::Event" = "openzeppelin::upgrades::upgradeable::UpgradeableComponent::Event" }] }]

Defined in

sdks/account/src/abi/SmartrAccount.ts:1


StarkValidatorABI

Const StarkValidatorABI: readonly [{ interface_name: "smartr::component::validator::IValidator" = "smartr::component::validator::IValidator"; name: "ValidatorImpl" = "ValidatorImpl"; type: "impl" = "impl" }, { members: readonly [{ name: "snapshot" = "snapshot"; type: "@core::array::Array::<core::felt252>" = "@core::array::Array::<core::felt252>" }] ; name: "core::array::Span::<core::felt252>" = "core::array::Span::<core::felt252>"; type: "struct" = "struct" }, { members: readonly [{ name: "to" = "to"; type: "core::starknet::contract_address::ContractAddress" = "core::starknet::contract_address::ContractAddress" }, { name: "selector" = "selector"; type: "core::felt252" = "core::felt252" }, { name: "calldata" = "calldata"; type: "core::array::Span::<core::felt252>" = "core::array::Span::<core::felt252>" }] ; name: "core::starknet::account::Call" = "core::starknet::account::Call"; type: "struct" = "struct" }, { items: readonly [{ inputs: readonly [{ name: "grantor_class" = "grantor_class"; type: "core::starknet::class_hash::ClassHash" = "core::starknet::class_hash::ClassHash" }, { name: "calls" = "calls"; type: "core::array::Array::<core::starknet::account::Call>" = "core::array::Array::<core::starknet::account::Call>" }] ; name: "validate" = "validate"; outputs: readonly [{ type: "core::felt252" = "core::felt252" }] ; state_mutability: "view" = "view"; type: "function" = "function" }] ; name: "smartr::component::validator::IValidator" = "smartr::component::validator::IValidator"; type: "interface" = "interface" }, { interface_name: "smartr::component::version::IVersion" = "smartr::component::version::IVersion"; name: "VersionImpl" = "VersionImpl"; type: "impl" = "impl" }, { items: readonly [{ inputs: readonly [] = []; name: "get_version" = "get_version"; outputs: readonly [{ type: "core::felt252" = "core::felt252" }] ; state_mutability: "view" = "view"; type: "function" = "function" }, { inputs: readonly [] = []; name: "get_name" = "get_name"; outputs: readonly [{ type: "core::felt252" = "core::felt252" }] ; state_mutability: "view" = "view"; type: "function" = "function" }] ; name: "smartr::component::version::IVersion" = "smartr::component::version::IVersion"; type: "interface" = "interface" }, { interface_name: "smartr::component::validator::ICoreValidator" = "smartr::component::validator::ICoreValidator"; name: "CoreValidator" = "CoreValidator"; type: "impl" = "impl" }, { items: readonly [{ inputs: readonly [{ name: "hash" = "hash"; type: "core::array::Array::<core::felt252>" = "core::array::Array::<core::felt252>" }, { name: "signature" = "signature"; type: "core::array::Array::<core::felt252>" = "core::array::Array::<core::felt252>" }] ; name: "is_valid_signature" = "is_valid_signature"; outputs: readonly [{ type: "core::felt252" = "core::felt252" }] ; state_mutability: "view" = "view"; type: "function" = "function" }, { inputs: readonly [{ name: "args" = "args"; type: "core::array::Array::<core::felt252>" = "core::array::Array::<core::felt252>" }] ; name: "initialize" = "initialize"; outputs: readonly [] = []; state_mutability: "external" = "external"; type: "function" = "function" }] ; name: "smartr::component::validator::ICoreValidator" = "smartr::component::validator::ICoreValidator"; type: "interface" = "interface" }, { interface_name: "smartr::component::validator::IConfigure" = "smartr::component::validator::IConfigure"; name: "ConfigureImpl" = "ConfigureImpl"; type: "impl" = "impl" }, { items: readonly [{ inputs: readonly [{ name: "call" = "call"; type: "core::starknet::account::Call" = "core::starknet::account::Call" }] ; name: "call" = "call"; outputs: readonly [{ type: "core::array::Array::<core::felt252>" = "core::array::Array::<core::felt252>" }] ; state_mutability: "view" = "view"; type: "function" = "function" }, { inputs: readonly [{ name: "call" = "call"; type: "core::starknet::account::Call" = "core::starknet::account::Call" }] ; name: "execute" = "execute"; outputs: readonly [{ type: "core::array::Array::<core::felt252>" = "core::array::Array::<core::felt252>" }] ; state_mutability: "external" = "external"; type: "function" = "function" }] ; name: "smartr::component::validator::IConfigure" = "smartr::component::validator::IConfigure"; type: "interface" = "interface" }, { interface_name: "smartr::modules::starkvalidator::starkvalidator::IPublicKey" = "smartr::modules::starkvalidator::starkvalidator::IPublicKey"; name: "PublicKey" = "PublicKey"; type: "impl" = "impl" }, { items: readonly [{ inputs: readonly [{ name: "new_public_key" = "new_public_key"; type: "core::felt252" = "core::felt252" }] ; name: "set_public_key" = "set_public_key"; outputs: readonly [] = []; state_mutability: "external" = "external"; type: "function" = "function" }, { inputs: readonly [] = []; name: "get_public_key" = "get_public_key"; outputs: readonly [{ type: "core::felt252" = "core::felt252" }] ; state_mutability: "view" = "view"; type: "function" = "function" }] ; name: "smartr::modules::starkvalidator::starkvalidator::IPublicKey" = "smartr::modules::starkvalidator::starkvalidator::IPublicKey"; type: "interface" = "interface" }, { inputs: readonly [] = []; name: "constructor" = "constructor"; type: "constructor" = "constructor" }, { kind: "enum" = "enum"; name: "smartr::component::validator::ValidatorComponent::Event" = "smartr::component::validator::ValidatorComponent::Event"; type: "event" = "event"; variants: readonly [] = [] }, { kind: "enum" = "enum"; name: "openzeppelin::introspection::src5::SRC5Component::Event" = "openzeppelin::introspection::src5::SRC5Component::Event"; type: "event" = "event"; variants: readonly [] = [] }, { kind: "struct" = "struct"; members: readonly [{ kind: "key" = "key"; name: "new_owner_guid" = "new_owner_guid"; type: "core::array::Array::<core::felt252>" = "core::array::Array::<core::felt252>" }] ; name: "smartr::component::account::AccountComponent::OwnerAdded" = "smartr::component::account::AccountComponent::OwnerAdded"; type: "event" = "event" }, { kind: "struct" = "struct"; members: readonly [{ kind: "key" = "key"; name: "removed_owner_guid" = "removed_owner_guid"; type: "core::array::Array::<core::felt252>" = "core::array::Array::<core::felt252>" }] ; name: "smartr::component::account::AccountComponent::OwnerRemoved" = "smartr::component::account::AccountComponent::OwnerRemoved"; type: "event" = "event" }, { kind: "enum" = "enum"; name: "smartr::component::account::AccountComponent::Event" = "smartr::component::account::AccountComponent::Event"; type: "event" = "event"; variants: readonly [{ kind: "nested" = "nested"; name: "OwnerAdded" = "OwnerAdded"; type: "smartr::component::account::AccountComponent::OwnerAdded" = "smartr::component::account::AccountComponent::OwnerAdded" }, { kind: "nested" = "nested"; name: "OwnerRemoved" = "OwnerRemoved"; type: "smartr::component::account::AccountComponent::OwnerRemoved" = "smartr::component::account::AccountComponent::OwnerRemoved" }] }, { kind: "enum" = "enum"; name: "smartr::modules::starkvalidator::starkvalidator::StarkValidator::Event" = "smartr::modules::starkvalidator::starkvalidator::StarkValidator::Event"; type: "event" = "event"; variants: readonly [{ kind: "flat" = "flat"; name: "ValidatorEvent" = "ValidatorEvent"; type: "smartr::component::validator::ValidatorComponent::Event" = "smartr::component::validator::ValidatorComponent::Event" }, { kind: "flat" = "flat"; name: "SRC5Event" = "SRC5Event"; type: "openzeppelin::introspection::src5::SRC5Component::Event" = "openzeppelin::introspection::src5::SRC5Component::Event" }, { kind: "flat" = "flat"; name: "AccountEvent" = "AccountEvent"; type: "smartr::component::account::AccountComponent::Event" = "smartr::component::account::AccountComponent::Event" }] }]

Defined in

sdks/account/src/abi/StarkValidator.ts:1

Functions

accountAddress

accountAddress(accountName, salt, constructorCallData): string

Calculates the account address for a given account name, public key, and constructor call data.

Parameters

NameTypeDescription
accountName"SmartrAccount"-
saltstring-
constructorCallDatastring[]The constructor call data for the account.

Returns

string

The calculated account address.

Remarks

This function requires the cairo account to be compiled with the scarb build command at the root of the project.

Defined in

sdks/account/src/contract.ts:14


classHash

classHash(className?): string

Computes the hash of the requested class that is part of the 0xknwn/starknet-modular-account project.

Parameters

NameTypeDefault valueDescription
className"StarkValidator" | "SmartrAccount" | "SimpleValidator""SmartrAccount"The name of the contract class.

Returns

string

The hash of the contract class.

Remarks

This function requires the cairo contract to be compiled with the scarb build command at the root of the project.

Defined in

sdks/account/src/class.ts:18


declareClass

declareClass(account, className?): Promise<{ classHash: string = HelperClassHash } | { actual_fee: { amount: string ; unit: "WEI" | "FRI" } ; block_hash: string ; block_number: number ; classHash: string = declare.class_hash; events: { data: string[] ; from_address: string ; keys: string[] }[] ; execution_resources: { bitwise_builtin_applications: undefined | number ; data_availability: undefined | { l1_data_gas: number ; l1_gas: number } ; ec_op_builtin_applications: undefined | number ; ecdsa_builtin_applications: undefined | number ; keccak_builtin_applications: undefined | number ; memory_holes: undefined | number ; pedersen_builtin_applications: undefined | number ; poseidon_builtin_applications: undefined | number ; range_check_builtin_applications: undefined | number ; segment_arena_builtin: undefined | number ; steps: number } ; execution_status: "SUCCEEDED" | "REVERTED" ; finality_status: "ACCEPTED_ON_L2" | "ACCEPTED_ON_L1" ; messages_sent: { from_address: string ; payload: string[] ; to_address: string }[] ; revert_reason: undefined | string ; statusReceipt: keyof TransactionStatusReceiptSets ; transaction_hash: string ; type: "INVOKE" ; value: TransactionReceiptValue } | { actual_fee: { amount: string ; unit: "WEI" | "FRI" } ; classHash: string = declare.class_hash; events: { data: string[] ; from_address: string ; keys: string[] }[] ; execution_resources: { bitwise_builtin_applications: undefined | number ; data_availability: undefined | { l1_data_gas: number ; l1_gas: number } ; ec_op_builtin_applications: undefined | number ; ecdsa_builtin_applications: undefined | number ; keccak_builtin_applications: undefined | number ; memory_holes: undefined | number ; pedersen_builtin_applications: undefined | number ; poseidon_builtin_applications: undefined | number ; range_check_builtin_applications: undefined | number ; segment_arena_builtin: undefined | number ; steps: number } ; execution_status: "SUCCEEDED" | "REVERTED" ; finality_status: "ACCEPTED_ON_L2" | "ACCEPTED_ON_L1" ; messages_sent: { from_address: string ; payload: string[] ; to_address: string }[] ; revert_reason: undefined | string ; statusReceipt: keyof TransactionStatusReceiptSets ; transaction_hash: string ; type: "INVOKE" ; value: TransactionReceiptValue } | { actual_fee: { amount: string ; unit: "WEI" | "FRI" } ; block_hash: string ; block_number: number ; classHash: string = declare.class_hash; events: { data: string[] ; from_address: string ; keys: string[] }[] ; execution_resources: { bitwise_builtin_applications: undefined | number ; data_availability: undefined | { l1_data_gas: number ; l1_gas: number } ; ec_op_builtin_applications: undefined | number ; ecdsa_builtin_applications: undefined | number ; keccak_builtin_applications: undefined | number ; memory_holes: undefined | number ; pedersen_builtin_applications: undefined | number ; poseidon_builtin_applications: undefined | number ; range_check_builtin_applications: undefined | number ; segment_arena_builtin: undefined | number ; steps: number } ; execution_status: "SUCCEEDED" | "REVERTED" ; finality_status: "ACCEPTED_ON_L2" | "ACCEPTED_ON_L1" ; messages_sent: { from_address: string ; payload: string[] ; to_address: string }[] ; revert_reason: undefined | string ; statusReceipt: keyof TransactionStatusReceiptSets ; transaction_hash: string ; type: "DECLARE" ; value: TransactionReceiptValue } | { actual_fee: { amount: string ; unit: "WEI" | "FRI" } ; classHash: string = declare.class_hash; events: { data: string[] ; from_address: string ; keys: string[] }[] ; execution_resources: { bitwise_builtin_applications: undefined | number ; data_availability: undefined | { l1_data_gas: number ; l1_gas: number } ; ec_op_builtin_applications: undefined | number ; ecdsa_builtin_applications: undefined | number ; keccak_builtin_applications: undefined | number ; memory_holes: undefined | number ; pedersen_builtin_applications: undefined | number ; poseidon_builtin_applications: undefined | number ; range_check_builtin_applications: undefined | number ; segment_arena_builtin: undefined | number ; steps: number } ; execution_status: "SUCCEEDED" | "REVERTED" ; finality_status: "ACCEPTED_ON_L2" | "ACCEPTED_ON_L1" ; messages_sent: { from_address: string ; payload: string[] ; to_address: string }[] ; revert_reason: undefined | string ; statusReceipt: keyof TransactionStatusReceiptSets ; transaction_hash: string ; type: "DECLARE" ; value: TransactionReceiptValue } | { actual_fee: string ; block_hash?: string ; block_number?: BlockNumber ; classHash: string = declare.class_hash; events: any[] ; execution_status: any ; finality_status: any ; messages_sent: MessageToL1[] ; revert_reason?: string ; status?: TransactionStatus ; statusReceipt: keyof TransactionStatusReceiptSets ; transaction_hash: string ; transaction_index?: number ; type?: any ; value: TransactionReceiptValue } | { classHash: string = declare.class_hash; status: "REJECTED" ; statusReceipt: keyof TransactionStatusReceiptSets ; transaction_failure_reason: { code: string ; error_message: string } ; value: TransactionReceiptValue }>

If not already declared, declare the requested class from the 0xknwn/starknet-modular-account project to the Starknet network used by the provided account.

Parameters

NameTypeDefault valueDescription
accountAccountundefinedThe starknet.js account used to declare the class.
className"StarkValidator" | "SmartrAccount" | "SimpleValidator""SmartrAccount"The name of the class to declare. Defaults to "SmartrAccount".

Returns

Promise<{ classHash: string = HelperClassHash } | { actual_fee: { amount: string ; unit: "WEI" | "FRI" } ; block_hash: string ; block_number: number ; classHash: string = declare.class_hash; events: { data: string[] ; from_address: string ; keys: string[] }[] ; execution_resources: { bitwise_builtin_applications: undefined | number ; data_availability: undefined | { l1_data_gas: number ; l1_gas: number } ; ec_op_builtin_applications: undefined | number ; ecdsa_builtin_applications: undefined | number ; keccak_builtin_applications: undefined | number ; memory_holes: undefined | number ; pedersen_builtin_applications: undefined | number ; poseidon_builtin_applications: undefined | number ; range_check_builtin_applications: undefined | number ; segment_arena_builtin: undefined | number ; steps: number } ; execution_status: "SUCCEEDED" | "REVERTED" ; finality_status: "ACCEPTED_ON_L2" | "ACCEPTED_ON_L1" ; messages_sent: { from_address: string ; payload: string[] ; to_address: string }[] ; revert_reason: undefined | string ; statusReceipt: keyof TransactionStatusReceiptSets ; transaction_hash: string ; type: "INVOKE" ; value: TransactionReceiptValue } | { actual_fee: { amount: string ; unit: "WEI" | "FRI" } ; classHash: string = declare.class_hash; events: { data: string[] ; from_address: string ; keys: string[] }[] ; execution_resources: { bitwise_builtin_applications: undefined | number ; data_availability: undefined | { l1_data_gas: number ; l1_gas: number } ; ec_op_builtin_applications: undefined | number ; ecdsa_builtin_applications: undefined | number ; keccak_builtin_applications: undefined | number ; memory_holes: undefined | number ; pedersen_builtin_applications: undefined | number ; poseidon_builtin_applications: undefined | number ; range_check_builtin_applications: undefined | number ; segment_arena_builtin: undefined | number ; steps: number } ; execution_status: "SUCCEEDED" | "REVERTED" ; finality_status: "ACCEPTED_ON_L2" | "ACCEPTED_ON_L1" ; messages_sent: { from_address: string ; payload: string[] ; to_address: string }[] ; revert_reason: undefined | string ; statusReceipt: keyof TransactionStatusReceiptSets ; transaction_hash: string ; type: "INVOKE" ; value: TransactionReceiptValue } | { actual_fee: { amount: string ; unit: "WEI" | "FRI" } ; block_hash: string ; block_number: number ; classHash: string = declare.class_hash; events: { data: string[] ; from_address: string ; keys: string[] }[] ; execution_resources: { bitwise_builtin_applications: undefined | number ; data_availability: undefined | { l1_data_gas: number ; l1_gas: number } ; ec_op_builtin_applications: undefined | number ; ecdsa_builtin_applications: undefined | number ; keccak_builtin_applications: undefined | number ; memory_holes: undefined | number ; pedersen_builtin_applications: undefined | number ; poseidon_builtin_applications: undefined | number ; range_check_builtin_applications: undefined | number ; segment_arena_builtin: undefined | number ; steps: number } ; execution_status: "SUCCEEDED" | "REVERTED" ; finality_status: "ACCEPTED_ON_L2" | "ACCEPTED_ON_L1" ; messages_sent: { from_address: string ; payload: string[] ; to_address: string }[] ; revert_reason: undefined | string ; statusReceipt: keyof TransactionStatusReceiptSets ; transaction_hash: string ; type: "DECLARE" ; value: TransactionReceiptValue } | { actual_fee: { amount: string ; unit: "WEI" | "FRI" } ; classHash: string = declare.class_hash; events: { data: string[] ; from_address: string ; keys: string[] }[] ; execution_resources: { bitwise_builtin_applications: undefined | number ; data_availability: undefined | { l1_data_gas: number ; l1_gas: number } ; ec_op_builtin_applications: undefined | number ; ecdsa_builtin_applications: undefined | number ; keccak_builtin_applications: undefined | number ; memory_holes: undefined | number ; pedersen_builtin_applications: undefined | number ; poseidon_builtin_applications: undefined | number ; range_check_builtin_applications: undefined | number ; segment_arena_builtin: undefined | number ; steps: number } ; execution_status: "SUCCEEDED" | "REVERTED" ; finality_status: "ACCEPTED_ON_L2" | "ACCEPTED_ON_L1" ; messages_sent: { from_address: string ; payload: string[] ; to_address: string }[] ; revert_reason: undefined | string ; statusReceipt: keyof TransactionStatusReceiptSets ; transaction_hash: string ; type: "DECLARE" ; value: TransactionReceiptValue } | { actual_fee: string ; block_hash?: string ; block_number?: BlockNumber ; classHash: string = declare.class_hash; events: any[] ; execution_status: any ; finality_status: any ; messages_sent: MessageToL1[] ; revert_reason?: string ; status?: TransactionStatus ; statusReceipt: keyof TransactionStatusReceiptSets ; transaction_hash: string ; transaction_index?: number ; type?: any ; value: TransactionReceiptValue } | { classHash: string = declare.class_hash; status: "REJECTED" ; statusReceipt: keyof TransactionStatusReceiptSets ; transaction_failure_reason: { code: string ; error_message: string } ; value: TransactionReceiptValue }>

An object containing the declared class hash and the transaction receipt if the class was not already declared.

Throws

An error if the class deployment fails.

Remarks

This function requires the cairo contract to be compiled with the scarb build command at the root of the project. It also requires the account to have enough funds to declare the class to the Starknet network.

Defined in

sdks/account/src/class.ts:58


deployAccount

deployAccount(deployerAccount, accountName, salt, constructorCalldata): Promise<string>

Deploys an account on the StarkNet network.

Parameters

NameTypeDescription
deployerAccountAccountThe account used to deploy the new account.
accountName"SmartrAccount"The name of the account to be deployed.
saltstring-
constructorCalldataany[]The constructor calldata required for deploying the account.

Returns

Promise<string>

The address of the deployed account.

Throws

Error if the deployment fails.

Defined in

sdks/account/src/contract.ts:38


hash_auth_message

hash_auth_message(account_address, validator_class, grantor_class, auth_key, expires, root, chain_id): string

Parameters

NameType
account_addressstring
validator_classstring
grantor_classstring
auth_keystring
expiresstring
rootstring
chain_idstring

Returns

string

Defined in

sdks/account/src/message.ts:7


signatureToHexArray

signatureToHexArray(signature): ArraySignatureType

Generates a signature represented as an array of hexadecimal.

Parameters

NameTypeDescription
signatureSignatureThe signature to handle.

Returns

ArraySignatureType

The signature as an array.

Defined in

sdks/account/src/smartr_account.ts:49