@0xknwn/starknet-module-sessionkey / Exports
@0xknwn/starknet-module-sessionkey
Table of contents
Classes
Type Aliases
Variables
Functions
Type Aliases
Policies
Ƭ Policies: Policy
[]
Defined in
sdks/module-sessionkey/src/policies.ts:8
Policy
Ƭ Policy: Object
Type declaration
Name | Type |
---|---|
contractAddress | string |
selector | string |
Defined in
sdks/module-sessionkey/src/policies.ts:3
Variables
SessionKeyValidatorABI
• Const
SessionKeyValidatorABI: 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
: "smartr::modules::sessionkeyvalidator::sessionkeyvalidator::IDisableSessionKey"
= "smartr::modules::sessionkeyvalidator::sessionkeyvalidator::IDisableSessionKey"; name
: "DisableSessionKeyImpl"
= "DisableSessionKeyImpl"; 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
: "sessionkey"
= "sessionkey"; type
: "core::felt252"
= "core::felt252" }] ; name
: "disable_session_key"
= "disable_session_key"; outputs
: readonly [] = []; state_mutability
: "external"
= "external"; type
: "function"
= "function" }, { inputs
: readonly [{ name
: "sessionkey"
= "sessionkey"; type
: "core::felt252"
= "core::felt252" }] ; name
: "is_disabled_session_key"
= "is_disabled_session_key"; outputs
: readonly [{ type
: "core::bool"
= "core::bool" }] ; state_mutability
: "view"
= "view"; type
: "function"
= "function" }] ; name
: "smartr::modules::sessionkeyvalidator::sessionkeyvalidator::IDisableSessionKey"
= "smartr::modules::sessionkeyvalidator::sessionkeyvalidator::IDisableSessionKey"; type
: "interface"
= "interface" }, { 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::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" }, { 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::sessionkeyvalidator::sessionkeyvalidator::SessionKeyValidator::Event"
= "smartr::modules::sessionkeyvalidator::sessionkeyvalidator::SessionKeyValidator::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/module-sessionkey/src/abi/SessionKeyValidator.ts:1
__module_validate__
• Const
__module_validate__: "0x119c88dea7ff05dbe71c36247fc6682116f6dafa24089373d49aca7b2657017"
Defined in
sdks/module-sessionkey/src/sessionkey.ts:11
Functions
classHash
▸ classHash(className?
): string
Computes the hash of the requested class that is part of the 0xknwn/starknet-modular-account project.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
className | "SessionKeyValidator" | "SessionKeyValidator" | 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/module-sessionkey/src/class.ts:14
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
Name | Type | Default value | Description |
---|---|---|---|
account | Account | undefined | The starknet.js account used to declare the class. |
className | "SessionKeyValidator" | "SessionKeyValidator" | 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.