Skip to main content
Version: 6.11.0

Starknet.js API - v7.0.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


AbiStruct​

Re-exports AbiStruct


AbiInterfaces​

Re-exports AbiInterfaces


InterfaceAbi​

Re-exports InterfaceAbi


AbiEnums​

Re-exports AbiEnums


AbiEnum​

Re-exports AbiEnum


AbiEvents​

Re-exports AbiEvents


AbiEvent​

Re-exports AbiEvent


CairoEvent​

Re-exports CairoEvent


CairoEventDefinition​

Re-exports CairoEventDefinition


CairoEventVariant​

Re-exports CairoEventVariant


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


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.

Throws

address argument must be a valid address inside the address range bound

Example

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

Defined in​

src/utils/address.ts:41


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


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


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/v6.11.0/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/v6.11.0/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`](namespaces/types.md#abientry) | input(field) information from the abi that will be used to parse the data |
| `structs` | [`AbiStructs`](namespaces/types.md#abistructs) | structs from abi |
| `enums` | [`AbiEnums`](namespaces/types.md#abienums) | enums from abi |

#### Returns

`string` \| `string`[]

- parsed arguments in format that contract is expecting

#### Defined in

[src/utils/calldata/requestParser.ts:284](https://github.com/starknet-io/starknet.js/blob/v6.11.0/src/utils/calldata/requestParser.ts#L284)

___

### 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`](namespaces/types.md#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.

**`Example`**

```typescript
const result = isSierra(contract);
// result = true | false

Defined in​

src/utils/contract.ts:27


extractContractHashes​

â–¸ extractContractHashes(payload): CompleteDeclareContractPayload

Extracts contract hashes from DeclareContractPayload.

Parameters​

NameTypeDescription
payloadDeclareContractPayloadThe payload containing contract information.

Returns​

CompleteDeclareContractPayload

  • The CompleteDeclareContractPayload with extracted contract hashes.

Throws

  • If extraction of compiledClassHash or classHash fails.

Example

const result = extractContractHashes(contract);
// result = {
// contract: ...,
// classHash: ...,
// casm: ...,
// compiledClassHash: ...,
// }

Defined in​

src/utils/contract.ts:51


contractClassResponseToLegacyCompiledContract​

â–¸ contractClassResponseToLegacyCompiledContract(ccr): LegacyCompiledContract

Helper to redeclare response Cairo0 contract

Parameters​

NameType
ccrContractClassResponse

Returns​

LegacyCompiledContract

Defined in​

src/utils/contract.ts:76