Skip to main content
Version: Next

Namespace: hash

Namespaces

Variables

transactionVersion

Const transactionVersion: 1n

Defined in

src/utils/hash.ts:29


transactionVersion_2

Const transactionVersion_2: 2n

Defined in

src/utils/hash.ts:30


feeTransactionVersion

Const feeTransactionVersion: bigint

Defined in

src/utils/hash.ts:31

Functions

computeHashOnElements

computeHashOnElements(data): string

Parameters

NameType
dataBigNumberish[]

Returns

string

Defined in

src/utils/hash.ts:33


calculateTransactionHashCommon

calculateTransactionHashCommon(txHashPrefix, version, contractAddress, entryPointSelector, calldata, maxFee, chainId, additionalData?): string

Parameters

NameTypeDefault value
txHashPrefixTransactionHashPrefixundefined
versionBigNumberishundefined
contractAddressBigNumberishundefined
entryPointSelectorBigNumberishundefined
calldataRawCalldataundefined
maxFeeBigNumberishundefined
chainIdStarknetChainIdundefined
additionalDataBigNumberish[][]

Returns

string

Defined in

src/utils/hash.ts:42


calculateDeployTransactionHash

calculateDeployTransactionHash(contractAddress, constructorCalldata, version, chainId): string

Parameters

NameType
contractAddressBigNumberish
constructorCalldataRawCalldata
versionBigNumberish
chainIdStarknetChainId

Returns

string

Defined in

src/utils/hash.ts:66


calculateDeclareTransactionHash

calculateDeclareTransactionHash(classHash, senderAddress, version, maxFee, chainId, nonce, compiledClassHash?): string

Parameters

NameType
classHashstring
senderAddressBigNumberish
versionBigNumberish
maxFeeBigNumberish
chainIdStarknetChainId
nonceBigNumberish
compiledClassHash?string

Returns

string

Defined in

src/utils/hash.ts:83


calculateDeployAccountTransactionHash

calculateDeployAccountTransactionHash(contractAddress, classHash, constructorCalldata, salt, version, maxFee, chainId, nonce): string

Parameters

NameType
contractAddressBigNumberish
classHashBigNumberish
constructorCalldataRawCalldata
saltBigNumberish
versionBigNumberish
maxFeeBigNumberish
chainIdStarknetChainId
nonceBigNumberish

Returns

string

Defined in

src/utils/hash.ts:104


calculateTransactionHash

calculateTransactionHash(contractAddress, version, calldata, maxFee, chainId, nonce): string

Parameters

NameType
contractAddressBigNumberish
versionBigNumberish
calldataRawCalldata
maxFeeBigNumberish
chainIdStarknetChainId
nonceBigNumberish

Returns

string

Defined in

src/utils/hash.ts:128


calculateContractAddressFromHash

calculateContractAddressFromHash(salt, classHash, constructorCalldata, deployerAddress): string

Parameters

NameType
saltBigNumberish
classHashBigNumberish
constructorCalldataRawArgs
deployerAddressBigNumberish

Returns

string

Defined in

src/utils/hash.ts:148


formatSpaces

formatSpaces(json): string

Parameters

NameType
jsonstring

Returns

string

Defined in

src/utils/hash.ts:180


default

default(compiledContract): string

Parameters

NameType
compiledContractLegacyCompiledContract

Returns

string

Defined in

src/utils/hash.ts:198


computeLegacyContractClassHash

computeLegacyContractClassHash(contract): string

Parameters

NameType
contractstring | LegacyCompiledContract

Returns

string

Defined in

src/utils/hash.ts:207


computeCompiledClassHash

computeCompiledClassHash(casm): string

Parameters

NameType
casmCairoAssembly

Returns

string

Defined in

src/utils/hash.ts:260


computeSierraContractClassHash

computeSierraContractClassHash(sierra): string

Parameters

NameType
sierraSierraContractClass

Returns

string

Defined in

src/utils/hash.ts:301


computeContractClassHash

computeContractClassHash(contract): string

Compute ClassHash (sierra or legacy) based on provided contract

Parameters

NameTypeDescription
contractstring | CompiledContractCompiledContract | CompiledSierra | string

Returns

string

HexString ClassHash

Defined in

src/utils/hash.ts:339


keccakBn

keccakBn(value): string

Keccak hash BigNumberish value

Parameters

NameTypeDescription
valueBigNumberishBigNumberish

Returns

string

string - hexadecimal string

Defined in

src/utils/selector.ts:12


starknetKeccak

starknetKeccak(value): bigint

Function to get the starknet keccak hash from a string

Reference

Parameters

NameTypeDescription
valuestringstring you want to get the starknetKeccak hash from

Returns

bigint

starknet keccak hash as BigNumber

Defined in

src/utils/selector.ts:34


getSelectorFromName

getSelectorFromName(funcName): string

Function to get the hex selector from a given function name

Reference

Parameters

NameTypeDescription
funcNamestringselectors abi function name

Returns

string

hex selector of given abi function name

Defined in

src/utils/selector.ts:47


getSelector

getSelector(value): string

Function to get hex selector from function name, decimal string or hex string

Parameters

NameTypeDescription
valuestringhex string | decimal string | string

Returns

string

Hex selector

Defined in

src/utils/selector.ts:57