Skip to main content
Version: Next

Starknet.js API - v6.8.0

Namespaces

Enumerations

Classes

References

RpcProvider

Renames and re-exports Provider


RpcChannel

Re-exports RpcChannel


RPC

Re-exports RPC


EstimateFee

Re-exports EstimateFee


EstimateFeeBulk

Re-exports EstimateFeeBulk


AccountInvocationsFactoryDetails

Re-exports AccountInvocationsFactoryDetails


UniversalDetails

Re-exports UniversalDetails


EstimateFeeDetails

Re-exports EstimateFeeDetails


DeployContractResponse

Re-exports DeployContractResponse


MultiDeployContractResponse

Re-exports MultiDeployContractResponse


DeployContractUDCResponse

Re-exports DeployContractUDCResponse


DeclareDeployUDCResponse

Re-exports DeclareDeployUDCResponse


SimulateTransactionDetails

Re-exports SimulateTransactionDetails


EstimateFeeAction

Re-exports EstimateFeeAction


StarkProfile

Re-exports StarkProfile


ValidateType

Re-exports ValidateType


Uint

Re-exports Uint


Literal

Re-exports Literal


AsyncContractFunction

Re-exports AsyncContractFunction


ContractFunction

Re-exports ContractFunction


Result

Re-exports Result


ArgsOrCalldata

Re-exports ArgsOrCalldata


ArgsOrCalldataWithOptions

Re-exports ArgsOrCalldataWithOptions


ContractOptions

Re-exports ContractOptions


CallOptions

Re-exports CallOptions


InvokeOptions

Re-exports InvokeOptions


ParsedEvent

Re-exports ParsedEvent


ParsedEvents

Re-exports ParsedEvents


WeierstrassSignatureType

Re-exports WeierstrassSignatureType


ArraySignatureType

Re-exports ArraySignatureType


Signature

Re-exports Signature


BigNumberish

Re-exports BigNumberish


ByteArray

Re-exports ByteArray


Calldata

Re-exports Calldata


Uint256

Re-exports Uint256


Uint512

Re-exports Uint512


RawCalldata

Re-exports RawCalldata


HexCalldata

Re-exports HexCalldata


AllowArray

Re-exports AllowArray


OptionalPayload

Re-exports OptionalPayload


RawArgs

Re-exports RawArgs


RawArgsObject

Re-exports RawArgsObject


RawArgsArray

Re-exports RawArgsArray


MultiType

Re-exports MultiType


UniversalDeployerContractPayload

Re-exports UniversalDeployerContractPayload


DeployAccountContractPayload

Re-exports DeployAccountContractPayload


DeployAccountContractTransaction

Re-exports DeployAccountContractTransaction


DeclareContractPayload

Re-exports DeclareContractPayload


CompleteDeclareContractPayload

Re-exports CompleteDeclareContractPayload


DeclareAndDeployContractPayload

Re-exports DeclareAndDeployContractPayload


DeclareContractTransaction

Re-exports DeclareContractTransaction


CallDetails

Re-exports CallDetails


Invocation

Re-exports Invocation


Call

Re-exports Call


CairoVersion

Re-exports CairoVersion


CompilerVersion

Re-exports CompilerVersion


InvocationsDetails

Re-exports InvocationsDetails


V3TransactionDetails

Re-exports V3TransactionDetails


Details

Re-exports Details


InvocationsDetailsWithNonce

Re-exports InvocationsDetailsWithNonce


TransactionType

Re-exports TransactionType


TransactionStatus

Re-exports TransactionStatus


TransactionFinalityStatus

Re-exports TransactionFinalityStatus


TransactionExecutionStatus

Re-exports TransactionExecutionStatus


BlockStatus

Re-exports BlockStatus


BlockTag

Re-exports BlockTag


BlockNumber

Re-exports BlockNumber


BlockIdentifier

Re-exports BlockIdentifier


AccountInvocationItem

Re-exports AccountInvocationItem


AccountInvocations

Re-exports AccountInvocations


Invocations

Re-exports Invocations


Tupled

Re-exports Tupled


Args

Re-exports Args


ParsedStruct

Re-exports ParsedStruct


waitForTransactionOptions

Re-exports waitForTransactionOptions


getSimulateTransactionOptions

Re-exports getSimulateTransactionOptions


getContractVersionOptions

Re-exports getContractVersionOptions


getEstimateFeeBulkOptions

Re-exports getEstimateFeeBulkOptions


CallStruct

Re-exports CallStruct


ContractVersion

Re-exports ContractVersion


ContractClass

Re-exports ContractClass


CompiledContract

Re-exports CompiledContract


CairoContract

Re-exports CairoContract


EntryPointType

Re-exports EntryPointType


Abi

Re-exports Abi


AbiEntry

Re-exports AbiEntry


EventEntry

Re-exports EventEntry


FunctionAbi

Re-exports FunctionAbi


AbiStructs

Re-exports AbiStructs


StructAbi

Re-exports StructAbi


AbiInterfaces

Re-exports AbiInterfaces


InterfaceAbi

Re-exports InterfaceAbi


AbiEnums

Re-exports AbiEnums


EnumAbi

Re-exports EnumAbi


AbiEvents

Re-exports AbiEvents


EventAbi

Re-exports EventAbi


Cairo1Event

Re-exports Cairo1Event


LegacyEvent

Re-exports LegacyEvent


LegacyContractClass

Re-exports LegacyContractClass


LegacyCompiledContract

Re-exports LegacyCompiledContract


Builtins

Re-exports Builtins


CompressedProgram

Re-exports CompressedProgram


EntryPointsByType

Re-exports EntryPointsByType


ContractEntryPointFields

Re-exports ContractEntryPointFields


Program

Re-exports Program


CairoAssembly

Re-exports CairoAssembly


CompiledSierra

Re-exports CompiledSierra


SierraContractClass

Re-exports SierraContractClass


CompiledSierraCasm

Re-exports CompiledSierraCasm


ByteCode

Re-exports ByteCode


PythonicHints

Re-exports PythonicHints


SierraProgramDebugInfo

Re-exports SierraProgramDebugInfo


SierraEntryPointsByType

Re-exports SierraEntryPointsByType


SierraContractEntryPointFields

Re-exports SierraContractEntryPointFields


ProviderOptions

Re-exports ProviderOptions


RpcProviderOptions

Re-exports RpcProviderOptions


BlockWithTxHashes

Re-exports BlockWithTxHashes


ContractClassPayload

Re-exports ContractClassPayload


FeeEstimate

Re-exports FeeEstimate


TransactionReceipt

Re-exports TransactionReceipt


GetBlockResponse

Re-exports GetBlockResponse


PendingBlock

Re-exports PendingBlock


Block

Re-exports Block


MessageToL1

Re-exports MessageToL1


RevertedTransactionReceiptResponse

Re-exports RevertedTransactionReceiptResponse


RejectedTransactionReceiptResponse

Re-exports RejectedTransactionReceiptResponse


GetTxReceiptResponseWithoutHelper

Re-exports GetTxReceiptResponseWithoutHelper


SuccessfulTransactionReceiptResponse

Re-exports SuccessfulTransactionReceiptResponse


GetTransactionResponse

Re-exports GetTransactionResponse


InvokeTransactionReceiptResponse

Re-exports InvokeTransactionReceiptResponse


DeclareTransactionReceiptResponse

Re-exports DeclareTransactionReceiptResponse


DeployTransactionReceiptResponse

Re-exports DeployTransactionReceiptResponse


DeployAccountTransactionReceiptResponse

Re-exports DeployAccountTransactionReceiptResponse


L1HandlerTransactionReceiptResponse

Re-exports L1HandlerTransactionReceiptResponse


EstimateFeeResponse

Re-exports EstimateFeeResponse


EstimateFeeResponseBulk

Re-exports EstimateFeeResponseBulk


InvokeFunctionResponse

Re-exports InvokeFunctionResponse


DeclareContractResponse

Re-exports DeclareContractResponse


CallContractResponse

Re-exports CallContractResponse


Storage

Re-exports Storage


Nonce

Re-exports Nonce


SIMULATION_FLAG

Re-exports SIMULATION_FLAG


SimulationFlags

Re-exports SimulationFlags


SimulatedTransaction

Re-exports SimulatedTransaction


SimulateTransactionResponse

Re-exports SimulateTransactionResponse


StateUpdateResponse

Re-exports StateUpdateResponse


StateUpdate

Re-exports StateUpdate


PendingStateUpdate

Re-exports PendingStateUpdate


ContractClassResponse

Re-exports ContractClassResponse


InvocationsSignerDetails

Re-exports InvocationsSignerDetails


V2InvocationsSignerDetails

Re-exports V2InvocationsSignerDetails


V3InvocationsSignerDetails

Re-exports V3InvocationsSignerDetails


DeclareSignerDetails

Re-exports DeclareSignerDetails


V2DeclareSignerDetails

Re-exports V2DeclareSignerDetails


V3DeclareSignerDetails

Re-exports V3DeclareSignerDetails


DeployAccountSignerDetails

Re-exports DeployAccountSignerDetails


V2DeployAccountSignerDetails

Re-exports V2DeployAccountSignerDetails


V3DeployAccountSignerDetails

Re-exports V3DeployAccountSignerDetails


TypedDataRevision

Re-exports TypedDataRevision


StarknetEnumType

Re-exports StarknetEnumType


StarknetMerkleType

Re-exports StarknetMerkleType


StarknetType

Re-exports StarknetType


StarknetDomain

Re-exports StarknetDomain


TypedData

Re-exports TypedData


CairoEnum

Re-exports CairoEnum


TransactionStatusReceiptSets

Re-exports TransactionStatusReceiptSets


TransactionReceiptStatus

Re-exports TransactionReceiptStatus


TransactionReceiptValue

Re-exports TransactionReceiptValue


TransactionReceiptCallbacksDefined

Re-exports TransactionReceiptCallbacksDefined


TransactionReceiptCallbacksDefault

Re-exports TransactionReceiptCallbacksDefault


TransactionReceiptCallbacks

Re-exports TransactionReceiptCallbacks


TransactionReceiptUtilityInterface

Re-exports TransactionReceiptUtilityInterface


UINT_128_MAX

Re-exports UINT_128_MAX


UINT_256_MAX

Re-exports UINT_256_MAX

Type Aliases

TypedContractV2

Ƭ TypedContractV2<TAbi>: AbiWanTypedContract<TAbi> & Contract

Type parameters

NameType
TAbiextends AbiKanabi

Defined in

src/contract/default.ts:35


ContractFactoryParams

Ƭ ContractFactoryParams: Object

Type declaration

NameType
compiledContractCompiledContract
accountany
casm?CairoAssembly
classHash?string
compiledClassHash?string
abi?Abi

Defined in

src/contract/contractFactory.ts:13


CairoEnumRaw

Ƭ CairoEnumRaw: Object

Index signature

[key: string]: any

Defined in

src/utils/calldata/enum/CairoCustomEnum.ts:1


GetTransactionReceiptResponse

Ƭ GetTransactionReceiptResponse: GetTxReceiptResponseWithoutHelper & ReceiptTx

Defined in

src/utils/transactionReceipt.ts:114

Variables

number

Const number: num = num

Deprecated

prefer the 'num' naming

Defined in

src/index.ts:55


defaultProvider

Const defaultProvider: RpcProvider

Defined in

src/provider/index.ts:8


UINT_256_MIN

Const UINT_256_MIN: 0n

Defined in

src/utils/cairoDataTypes/uint256.ts:12


UINT_256_LOW_MAX

Const UINT_256_LOW_MAX: 340282366920938463463374607431768211455n

Defined in

src/utils/cairoDataTypes/uint256.ts:13


UINT_256_HIGH_MAX

Const UINT_256_HIGH_MAX: 340282366920938463463374607431768211455n

Defined in

src/utils/cairoDataTypes/uint256.ts:14


UINT_256_LOW_MIN

Const UINT_256_LOW_MIN: 0n

Defined in

src/utils/cairoDataTypes/uint256.ts:15


UINT_256_HIGH_MIN

Const UINT_256_HIGH_MIN: 0n

Defined in

src/utils/cairoDataTypes/uint256.ts:16


UINT_512_MAX

Const UINT_512_MAX: bigint

Defined in

src/utils/cairoDataTypes/uint512.ts:11


UINT_512_MIN

Const UINT_512_MIN: 0n

Defined in

src/utils/cairoDataTypes/uint512.ts:12


UINT_128_MIN

Const UINT_128_MIN: 0n

Defined in

src/utils/cairoDataTypes/uint512.ts:13

Functions

getCalldata

getCalldata(args, callback): Calldata

Parameters

NameType
argsRawArgs
callbackFunction

Returns

Calldata

Defined in

src/contract/default.ts:110


splitArgsAndOptions

splitArgsAndOptions(args): { args: ArgsOrCalldata ; options: ContractOptions } | { args: ArgsOrCalldata ; options?: undefined }

Parameters

NameType
argsArgsOrCalldataWithOptions

Returns

{ args: ArgsOrCalldata ; options: ContractOptions } | { args: ArgsOrCalldata ; options?: undefined }

Defined in

src/contract/default.ts:37


fixStack

fixStack(target, fn?): void

Parameters

NameTypeDefault value
targetErrorundefined
fnFunctiontarget.constructor

Returns

void

Defined in

src/provider/errors.ts:2


fixProto

fixProto(target, prototype): void

Parameters

NameType
targetError
prototypeObject

Returns

void

Defined in

src/provider/errors.ts:8


addAddressPadding

addAddressPadding(address): string

Format a hex number to '0x' and 64 characters, adding leading zeros if necessary.

Parameters

NameType
addressBigNumberish

Returns

string

Hex string : 0x followed by 64 characters. No upper case characters in the response.

Example

const address = "0x90591d9fa3efc87067d95a643f8455e0b8190eb8cb7bfd39e4fb7571fdf";
const result = addAddressPadding(address);
// result = "0x0000090591d9fa3efc87067d95a643f8455e0b8190eb8cb7bfd39e4fb7571fdf"

Defined in

src/utils/address.ts:21


validateAndParseAddress

validateAndParseAddress(address): string

Check the validity of a Starknet address, and format it as a hex number : '0x' and 64 characters, adding leading zeros if necessary.

Parameters

NameType
addressBigNumberish

Returns

string

Hex string : 0x followed by 64 characters. No upper case characters in the response.

Example

const address = "0x90591d9fa3efc87067d95a643f8455e0b8190eb8cb7bfd39e4fb7571fdf";
const result = validateAndParseAddress(address);
// result = "0x0000090591d9fa3efc87067d95a643f8455e0b8190eb8cb7bfd39e4fb7571fdf"

Defined in

src/utils/address.ts:36


getChecksumAddress

getChecksumAddress(address): string

Convert an address to her checksum representation which uses a specific pattern of uppercase and lowercase letters within a given address to reduce the risk of errors introduced from typing an address or cut and paste issues.

Parameters

NameType
addressBigNumberish

Returns

string

Hex string : 0x followed by 64 characters. Mix of uppercase and lowercase

Example

const address = "0x90591d9fa3efc87067d95a643f8455e0b8190eb8cb7bfd39e4fb7571fdf";
const result = getChecksumAddress(address);
// result = "0x0000090591D9fA3EfC87067d95a643f8455E0b8190eb8Cb7bFd39e4fb7571fDF"

Defined in

src/utils/address.ts:61


validateChecksumAddress

validateChecksumAddress(address): boolean

If the casing of an address is mixed, it is a Checksum Address, which uses a specific pattern of uppercase and lowercase letters within a given address to reduce the risk of errors introduced from typing an address or cut and paste issues.

Parameters

NameTypeDescription
addressstringstring

Returns

boolean

true if the ChecksumAddress is valid

Example

const address = "0x0000090591D9fA3EfC87067d95a643f8455E0b8190eb8Cb7bFd39e4fb7571fDF";
const result = validateChecksumAddress(address);
// result = true

Defined in

src/utils/address.ts:92


isUrl

isUrl(s?): boolean

Loosely validate a URL string.

Parameters

NameTypeDescription
s?stringThe URL to check for

Returns

boolean

true if url is valid, false otherwise

Example

const s = "https://starknetjs.com/docs";
const result = isUrl(s);
// result == true

#### Defined in

[src/utils/url.ts:28](https://github.com/starknet-io/starknet.js/blob/develop/src/utils/url.ts#L28)

___

### buildUrl

**buildUrl**(`baseUrl`, `defaultPath`, `urlOrPath?`): `string`

Builds a URL using the provided base URL, default path, and optional URL or path.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `baseUrl` | `string` | The base URL of the URL being built. |
| `defaultPath` | `string` | The default path to use if no URL or path is provided. |
| `urlOrPath?` | `string` | The optional URL or path to append to the base URL. |

#### Returns

`string`

The built URL.

**`Example`**

```typescript
const baseUrl = "https://starknetjs.com";
const defaultPath = "/";
const urlOrPath = "/docs";
const result = buildUrl(baseUrl, defaultPath, urlOrPath);

result = "https://starknetjs.com/docs"

#### Defined in

[src/utils/url.ts:73](https://github.com/starknet-io/starknet.js/blob/develop/src/utils/url.ts#L73)

___

### parseCalldataField

▸ **parseCalldataField**(`argsIterator`, `input`, `structs`, `enums`): `string` \| `string`[]

Parse one field of the calldata by using input field from the abi for that method

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `argsIterator` | `Iterator`<`any`, `any`, `undefined`\> | Iterator for value of the field |
| `input` | [`AbiEntry`](/docs/next/API/namespaces/types#abientry) | input(field) information from the abi that will be used to parse the data |
| `structs` | [`AbiStructs`](/docs/next/API/namespaces/types#abistructs) | structs from abi |
| `enums` | [`AbiEnums`](/docs/next/API/namespaces/types#abienums) | enums from abi |

#### Returns

`string` \| `string`[]

- parsed arguments in format that contract is expecting

#### Defined in

[src/utils/calldata/requestParser.ts:279](https://github.com/starknet-io/starknet.js/blob/develop/src/utils/calldata/requestParser.ts#L279)

___

### isSierra

▸ **isSierra**(`contract`): contract is CompiledSierra \| SierraContractClass

Checks if a given contract is in Sierra (Safe Intermediate Representation) format.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `contract` | `string` \| [`CairoContract`](/docs/next/API/namespaces/types#cairocontract) | The contract to check. Can be either a CairoContract object or a string representation of the contract. |

#### Returns

contract is CompiledSierra \| SierraContractClass

- Returns true if the contract is a Sierra contract, otherwise false.

#### Defined in

[src/utils/contract.ts:22](https://github.com/starknet-io/starknet.js/blob/develop/src/utils/contract.ts#L22)

___

### extractContractHashes

▸ **extractContractHashes**(`payload`): [`CompleteDeclareContractPayload`](/docs/next/API/namespaces/types#completedeclarecontractpayload)

Extracts contract hashes from `DeclareContractPayload`.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `payload` | [`DeclareContractPayload`](/docs/next/API/namespaces/types#declarecontractpayload) | The payload containing contract information. |

#### Returns

[`CompleteDeclareContractPayload`](/docs/next/API/namespaces/types#completedeclarecontractpayload)

- The `CompleteDeclareContractPayload` with extracted contract hashes.

**`Throws`**

- If extraction of compiledClassHash or classHash fails.

#### Defined in

[src/utils/contract.ts:38](https://github.com/starknet-io/starknet.js/blob/develop/src/utils/contract.ts#L38)

___

### contractClassResponseToLegacyCompiledContract

▸ **contractClassResponseToLegacyCompiledContract**(`ccr`): [`LegacyCompiledContract`](/docs/next/API/namespaces/types#legacycompiledcontract)

Helper to redeclare response Cairo0 contract

#### Parameters

| Name | Type |
| :------ | :------ |
| `ccr` | [`ContractClassResponse`](/docs/next/API/namespaces/types#contractclassresponse) |

#### Returns

[`LegacyCompiledContract`](/docs/next/API/namespaces/types#legacycompiledcontract)

#### Defined in

[src/utils/contract.ts:63](https://github.com/starknet-io/starknet.js/blob/develop/src/utils/contract.ts#L63)

___

### parseUDCEvent

▸ **parseUDCEvent**(`txReceipt`): `Object`

Parse Transaction Receipt Event from UDC invoke transaction and
create DeployContractResponse compatible response with addition of the UDC Event data

#### Parameters

| Name | Type |
| :------ | :------ |
| `txReceipt` | [`InvokeTransactionReceiptResponse`](/docs/next/API/namespaces/types#invoketransactionreceiptresponse) |

#### Returns

`Object`

DeployContractResponse | UDC Event Response data

| Name | Type |
| :------ | :------ |
| `transaction_hash` | `string` |
| `contract_address` | `string` |
| `address` | `string` |
| `deployer` | `string` |
| `unique` | `string` |
| `classHash` | `string` |
| `calldata_len` | `string` |
| `calldata` | `string`[] |
| `salt` | `string` |

#### Defined in

[src/utils/events.ts:11](https://github.com/starknet-io/starknet.js/blob/develop/src/utils/events.ts#L11)