Skip to main content
Version: 5.14.1

Namespace: hash

Namespaces​

Variables​

transactionVersion​

• Const transactionVersion: 1n

Defined in​

src/utils/hash.ts:30


transactionVersion_2​

• Const transactionVersion_2: 2n

Defined in​

src/utils/hash.ts:31


feeTransactionVersion​

• Const feeTransactionVersion: bigint

Defined in​

src/utils/hash.ts:33


feeTransactionVersion_2​

• Const feeTransactionVersion_2: bigint

Defined in​

src/utils/hash.ts:34

Functions​

getVersionsByType​

â–¸ getVersionsByType(versionType?): Object

Return versions based on version type, default transaction versions

Parameters​

NameTypeDescription
versionType?"fee" | "transaction"'fee' | 'transaction'

Returns​

Object

versions { v1: bigint; v2: bigint; }

NameType
v1bigint
v2bigint

Defined in​

src/utils/hash.ts:41


computeHashOnElements​

â–¸ computeHashOnElements(data): string

Parameters​

NameType
dataBigNumberish[]

Returns​

string

Defined in​

src/utils/hash.ts:47


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:56


calculateDeployTransactionHash​

â–¸ calculateDeployTransactionHash(contractAddress, constructorCalldata, version, chainId): string

Parameters​

NameType
contractAddressBigNumberish
constructorCalldataRawCalldata
versionBigNumberish
chainIdStarknetChainId

Returns​

string

Defined in​

src/utils/hash.ts:80


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:97


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:118


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:142


calculateContractAddressFromHash​

â–¸ calculateContractAddressFromHash(salt, classHash, constructorCalldata, deployerAddress): string

Parameters​

NameType
saltBigNumberish
classHashBigNumberish
constructorCalldataRawArgs
deployerAddressBigNumberish

Returns​

string

Defined in​

src/utils/hash.ts:162


formatSpaces​

â–¸ formatSpaces(json): string

Parameters​

NameType
jsonstring

Returns​

string

Defined in​

src/utils/hash.ts:195


default​

â–¸ default(compiledContract): string

Parameters​

NameType
compiledContractLegacyCompiledContract

Returns​

string

Defined in​

src/utils/hash.ts:213


computeLegacyContractClassHash​

â–¸ computeLegacyContractClassHash(contract): string

Parameters​

NameType
contractstring | LegacyCompiledContract

Returns​

string

Defined in​

src/utils/hash.ts:222


computeCompiledClassHash​

â–¸ computeCompiledClassHash(casm): string

Parameters​

NameType
casmCairoAssembly

Returns​

string

Defined in​

src/utils/hash.ts:275


computeSierraContractClassHash​

â–¸ computeSierraContractClassHash(sierra): string

Parameters​

NameType
sierraCompiledSierra

Returns​

string

Defined in​

src/utils/hash.ts:316


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:354


keccakBn​

â–¸ keccakBn(value): string

Keccak hash BigNumberish value

Parameters​

NameTypeDescription
valueBigNumberishBigNumberish

Returns​

string

string - hexadecimal string

Defined in​

src/utils/selector.ts:13


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:35


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:48


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:58