Skip to main content
Version: Next

Function: toTransactionVersion()

toTransactionVersion(defaultVersion, providedVersion?): ETransactionVersion3

Defined in: src/utils/stark/index.ts:428

Convert input versions to ETransactionVersion or throw an error. Returns providedVersion if specified, otherwise returns defaultVersion.

Parameters

defaultVersion

BigNumberish

The default transaction version to use if providedVersion is not specified

providedVersion?

BigNumberish

Optional transaction version that takes precedence if provided

Returns

ETransactionVersion3

The transaction version - either providedVersion if specified or defaultVersion

Throws

If either version is not a valid ETransactionVersion

Example

const result = stark.toTransactionVersion("0x100000000000000000000000000000003", stark.toFeeVersion(2));
// result = "0x100000000000000000000000000000002"