Starknet.js API - v6.14.1
Namespaces​
- types
- constants
- encode
- hash
- v3hash
- v2hash
- json
- num
- transaction
- stark
- eth
- merkle
- uint256
- shortString
- typedData
- ec
- starknetId
- provider
- selector
- events
- outsideExecution
- src5
- wallet
- RPC06
- RPC07
- cairo
- byteArray
Classes​
- WalletAccount
- Account
- AccountInterface
- Contract
- ContractInterface
- ContractFactory
- Provider
- CustomError
- LibraryError
- GatewayError
- HttpError
- ProviderInterface
- SignerInterface
- Signer
- EthSigner
- LedgerSigner
- ResponseParser
- RPCResponseParser
- CairoUint256
- CairoUint512
- CallData
- CairoCustomEnum
- CairoOption
- CairoResult
- ReceiptTx
References​
RpcProvider​
Renames and re-exports Provider
RpcChannel​
Re-exports RpcChannel
RPC​
Re-exports RPC
EstimateFee​
Re-exports EstimateFee
UniversalSuggestedFee​
Re-exports UniversalSuggestedFee
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
ETH_ADDRESS​
Re-exports ETH_ADDRESS
NON_ZERO_PREFIX​
Re-exports NON_ZERO_PREFIX
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
ContractClassIdentifier​
Re-exports ContractClassIdentifier
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
OutsideExecutionOptions​
Re-exports OutsideExecutionOptions
OutsideCall​
Re-exports OutsideCall
OutsideExecution​
Re-exports OutsideExecution
OutsideTransaction​
Re-exports OutsideTransaction
OutsideExecutionTypesV1​
Re-exports OutsideExecutionTypesV1
OutsideExecutionTypesV2​
Re-exports OutsideExecutionTypesV2
OutsideExecutionVersion​
Re-exports OutsideExecutionVersion
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​
Name | Type |
---|---|
TAbi | extends AbiKanabi |
Defined in​
ContractFactoryParams​
Ƭ ContractFactoryParams: Object
Type declaration​
Name | Type |
---|---|
compiledContract | CompiledContract |
account | any |
casm? | CairoAssembly |
classHash? | string |
compiledClassHash? | string |
abi? | Abi |
Defined in​
src/contract/contractFactory.ts:13
CairoEnumRaw​
Ƭ CairoEnumRaw: Record
<string
, any
>
Defined in​
src/utils/calldata/enum/CairoCustomEnum.ts:3
CairoOptionVariant​
Ƭ CairoOptionVariant: ValuesType
<typeof CairoOptionVariant
>
Defined in​
src/utils/calldata/enum/CairoOption.ts:4
src/utils/calldata/enum/CairoOption.ts:9
CairoResultVariant​
Ƭ CairoResultVariant: ValuesType
<typeof CairoResultVariant
>
Defined in​
src/utils/calldata/enum/CairoResult.ts:4
src/utils/calldata/enum/CairoResult.ts:9
GetTransactionReceiptResponse​
Ƭ GetTransactionReceiptResponse: GetTxReceiptResponseWithoutHelper
& ReceiptTx
Defined in​
src/utils/transactionReceipt.ts:114
Variables​
number​
• Const
number: num
= num
Deprecated
prefer the 'num' naming
Defined in​
defaultProvider​
• Const
defaultProvider: RpcProvider
Defined in​
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
CairoOptionVariant​
• Const
CairoOptionVariant: Object
Type declaration​
Name | Type |
---|---|
Some | 0 |
None | 1 |
Defined in​
src/utils/calldata/enum/CairoOption.ts:4
src/utils/calldata/enum/CairoOption.ts:9
CairoResultVariant​
• Const
CairoResultVariant: Object
Type declaration​
Name | Type |
---|---|
Ok | 0 |
Err | 1 |
Defined in​
src/utils/calldata/enum/CairoResult.ts:4
src/utils/calldata/enum/CairoResult.ts:9
Functions​
getCalldata​
â–¸ getCalldata(args
, callback
): Calldata
Parameters​
Name | Type |
---|---|
args | RawArgs |
callback | Function |
Returns​
Defined in​
splitArgsAndOptions​
â–¸ splitArgsAndOptions(args
): { args
: ArgsOrCalldata
; options
: ContractOptions
} | { args
: ArgsOrCalldata
; options?
: undefined
}
Parameters​
Name | Type |
---|---|
args | ArgsOrCalldataWithOptions |
Returns​
{ args
: ArgsOrCalldata
; options
: ContractOptions
} | { args
: ArgsOrCalldata
; options?
: undefined
}
Defined in​
fixStack​
â–¸ fixStack(target
, fn?
): void
Parameters​
Name | Type | Default value |
---|---|---|
target | Error | undefined |
fn | Function | target.constructor |
Returns​
void
Defined in​
fixProto​
â–¸ fixProto(target
, prototype
): void
Parameters​
Name | Type |
---|---|
target | Error |
prototype | Object |
Returns​
void
Defined in​
getLedgerPathBuffer​
â–¸ getLedgerPathBuffer(accountId
, applicationName?
): Uint8Array
format the Ledger wallet path to an Uint8Array. EIP2645 path = 2645'/starknet'/application'/0'/accountId'/0
Parameters​
Name | Type | Description |
---|---|---|
accountId | number | Id of account. < 2**31. |
applicationName? | string | utf8 string of application name. |
Returns​
Uint8Array
an Uint8array of 24 bytes.
Defined in​
src/signer/ledgerSigner.ts:256
addAddressPadding​
â–¸ addAddressPadding(address
): string
Format a hex number to '0x' and 64 characters, adding leading zeros if necessary.
Parameters​
Name | Type |
---|---|
address | BigNumberish |
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​
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​
Name | Type |
---|---|
address | BigNumberish |
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​
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​
Name | Type |
---|---|
address | BigNumberish |
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​
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​
Name | Type | Description |
---|---|---|
address | string | string |
Returns​
boolean
true if the ChecksumAddress is valid
Example
const address = "0x0000090591D9fA3EfC87067d95a643f8455E0b8190eb8Cb7bFd39e4fb7571fDF";
const result = validateChecksumAddress(address);
// result = true
Defined in​
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 | input(field) information from the abi that will be used to parse the data |
structs | AbiStructs | structs from abi |
enums | AbiEnums | enums from abi |
Returns​
string
| string
[]
- parsed arguments in format that contract is expecting
Example
const abiEntry = { name: 'test', type: 'struct' };
const abiStructs: AbiStructs = {
struct: {
members: [
{
name: 'test_name',
type: 'test_type',
offset: 1,
},
],
size: 2,
name: 'cairo__struct',
type: 'struct',
},
};
const abiEnums: AbiEnums = {
enum: {
variants: [
{
name: 'test_name',
type: 'cairo_struct_variant',
offset: 1,
},
],
size: 2,
name: 'test_cairo',
type: 'enum',
},
};
const args = [{ test_name: 'test' }];
const argsIterator = args[Symbol.iterator]();
const parsedField = parseCalldataField(
argsIterator,
abiEntry,
abiStructs,
abiEnums
);
// parsedField === ['1952805748']
Defined in​
src/utils/calldata/requestParser.ts:329
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 | 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
const result = isSierra(contract);
// result = true | false
Defined in​
extractContractHashes​
â–¸ extractContractHashes(payload
): CompleteDeclareContractPayload
Extracts contract hashes from DeclareContractPayload
.
Parameters​
Name | Type | Description |
---|---|---|
payload | DeclareContractPayload | The 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​
contractClassResponseToLegacyCompiledContract​
â–¸ contractClassResponseToLegacyCompiledContract(ccr
): LegacyCompiledContract
Helper to redeclare response Cairo0 contract
Parameters​
Name | Type |
---|---|
ccr | ContractClassResponse |