Starknet.js API - v7.4.0
Namespaces​
- types
- constants
- encode
- hash
- v3hash
- v2hash
- json
- num
- transaction
- stark
- eth
- merkle
- uint256
- shortString
- typedData
- ec
- starknetId
- paymaster
- provider
- selector
- events
- outsideExecution
- src5
- wallet
- RPC07
- RPC08
- cairo
- byteArray
Classes​
- WalletAccount
- Account
- AccountInterface
- Contract
- ContractInterface
- ContractFactory
- PaymasterRpc
- PaymasterInterface
- Provider
- CustomError
- LibraryError
- RpcError
- ProviderInterface
- LedgerSigner111
- LedgerSigner221
- LedgerSigner231
- SignerInterface
- Signer
- EthSigner
- WebSocketChannel
- BatchClient
- ResponseParser
- RPCResponseParser
- CairoUint256
- CairoUint512
- CairoFixedArray
- CallData
- CairoCustomEnum
- CairoOption
- CairoResult
- ReceiptTx
References​
RpcProvider​
Renames and re-exports Provider
LedgerSigner​
Renames and re-exports LedgerSigner111
getLedgerPathBuffer​
Renames and re-exports getLedgerPathBuffer111
RpcChannel​
Re-exports RpcChannel
RPC​
Re-exports RPC
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
TransactionFinalityStatus​
Re-exports TransactionFinalityStatus
TransactionExecutionStatus​
Re-exports TransactionExecutionStatus
BlockStatus​
Re-exports BlockStatus
BlockTag​
Re-exports BlockTag
BlockNumber​
Re-exports BlockNumber
BlockIdentifier​
Re-exports BlockIdentifier
SubscriptionBlockIdentifier​
Re-exports SubscriptionBlockIdentifier
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
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
Hint​
Re-exports Hint
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
FeeMarginPercentage​
Re-exports FeeMarginPercentage
RpcProviderOptions​
Re-exports RpcProviderOptions
Block​
Re-exports Block
PendingBlock​
Re-exports PendingBlock
GetBlockResponse​
Re-exports GetBlockResponse
GetTxReceiptResponseWithoutHelper​
Re-exports GetTxReceiptResponseWithoutHelper
SuccessfulTransactionReceiptResponse​
Re-exports SuccessfulTransactionReceiptResponse
RevertedTransactionReceiptResponse​
Re-exports RevertedTransactionReceiptResponse
InvokeTransactionReceiptResponse​
Re-exports InvokeTransactionReceiptResponse
DeployTransactionReceiptResponse​
Re-exports DeployTransactionReceiptResponse
DeclareTransactionReceiptResponse​
Re-exports DeclareTransactionReceiptResponse
DeployAccountTransactionReceiptResponse​
Re-exports DeployAccountTransactionReceiptResponse
L1HandlerTransactionReceiptResponse​
Re-exports L1HandlerTransactionReceiptResponse
GetTransactionResponse​
Re-exports GetTransactionResponse
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
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
isRPC08_FeeEstimate​
Re-exports isRPC08_FeeEstimate
isRPC08_ResourceBounds​
Re-exports isRPC08_ResourceBounds
Simplify​
Re-exports Simplify
RequiredKeysOf​
Re-exports RequiredKeysOf
ETransactionVersion​
Re-exports ETransactionVersion
ETransactionVersion2​
Re-exports ETransactionVersion2
ETransactionVersion3​
Re-exports ETransactionVersion3
BLOCK_HASH​
Re-exports BLOCK_HASH
BLOCK_NUMBER​
Re-exports BLOCK_NUMBER
FELT​
Re-exports FELT
TXN_HASH​
Re-exports TXN_HASH
PRICE_UNIT​
Re-exports PRICE_UNIT
RESOURCE_PRICE​
Re-exports RESOURCE_PRICE
SIMULATION_FLAG​
Re-exports SIMULATION_FLAG
STATE_UPDATE​
Re-exports STATE_UPDATE
PENDING_STATE_UPDATE​
Re-exports PENDING_STATE_UPDATE
PENDING_INVOKE_TXN_RECEIPT​
Re-exports PENDING_INVOKE_TXN_RECEIPT
PENDING_DECLARE_TXN_RECEIPT​
Re-exports PENDING_DECLARE_TXN_RECEIPT
PENDING_DEPLOY_ACCOUNT_TXN_RECEIPT​
Re-exports PENDING_DEPLOY_ACCOUNT_TXN_RECEIPT
PENDING_L1_HANDLER_TXN_RECEIPT​
Re-exports PENDING_L1_HANDLER_TXN_RECEIPT
BlockWithTxHashes​
Re-exports BlockWithTxHashes
ContractClassPayload​
Re-exports ContractClassPayload
DeclaredTransaction​
Re-exports DeclaredTransaction
InvokedTransaction​
Re-exports InvokedTransaction
DeployedAccountTransaction​
Re-exports DeployedAccountTransaction
L1Message​
Re-exports L1Message
EventFilter​
Re-exports EventFilter
L1_HANDLER_TXN​
Re-exports L1_HANDLER_TXN
EDataAvailabilityMode​
Re-exports EDataAvailabilityMode
EDAMode​
Re-exports EDAMode
EmittedEvent​
Re-exports EmittedEvent
Event​
Re-exports Event
PendingReceipt​
Re-exports PendingReceipt
Receipt​
Re-exports Receipt
FeeEstimate​
Re-exports FeeEstimate
ResourceBounds​
Re-exports ResourceBounds
ResourceBoundsOverhead​
Re-exports ResourceBoundsOverhead
ResourceBoundsOverheadRPC08​
Re-exports ResourceBoundsOverheadRPC08
ResourceBoundsOverheadRPC07​
Re-exports ResourceBoundsOverheadRPC07
SimulateTransaction​
Re-exports SimulateTransaction
TransactionWithHash​
Re-exports TransactionWithHash
TransactionReceipt​
Re-exports TransactionReceipt
Methods​
Re-exports Methods
TXN_STATUS​
Re-exports TXN_STATUS
TXN_EXECUTION_STATUS​
Re-exports TXN_EXECUTION_STATUS
TransactionStatus​
Re-exports TransactionStatus
ETransactionStatus​
Re-exports ETransactionStatus
ETransactionExecutionStatus​
Re-exports ETransactionExecutionStatus
TRANSACTION_TRACE​
Re-exports TRANSACTION_TRACE
FEE_ESTIMATE​
Re-exports FEE_ESTIMATE
EVENTS_CHUNK​
Re-exports EVENTS_CHUNK
EstimateFee​
Re-exports EstimateFee
UniversalSuggestedFee​
Re-exports UniversalSuggestedFee
EstimateFeeBulk​
Re-exports EstimateFeeBulk
AccountInvocationsFactoryDetails​
Re-exports AccountInvocationsFactoryDetails
UniversalDetails​
Re-exports UniversalDetails
PaymasterDetails​
Re-exports PaymasterDetails
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
CairoEnum​
Re-exports CairoEnum
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
RPC_ERROR_SET​
Re-exports RPC_ERROR_SET
RPC_ERROR​
Re-exports RPC_ERROR
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
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
LedgerPathCalculation​
Re-exports LedgerPathCalculation
TransactionStatusReceiptSets​
Re-exports TransactionStatusReceiptSets
TransactionReceiptStatus​
Re-exports TransactionReceiptStatus
TransactionReceiptValue​
Re-exports TransactionReceiptValue
TransactionReceiptCallbacksDefined​
Re-exports TransactionReceiptCallbacksDefined
TransactionReceiptCallbacksDefault​
Re-exports TransactionReceiptCallbacksDefault
TransactionReceiptCallbacks​
Re-exports TransactionReceiptCallbacks
GetTransactionReceiptResponse​
Re-exports GetTransactionReceiptResponse
TypedDataRevision​
Re-exports TypedDataRevision
StarknetEnumType​
Re-exports StarknetEnumType
StarknetMerkleType​
Re-exports StarknetMerkleType
StarknetType​
Re-exports StarknetType
StarknetDomain​
Re-exports StarknetDomain
TypedData​
Re-exports TypedData
PaymasterOptions​
Re-exports PaymasterOptions
PaymasterRpcOptions​
Re-exports PaymasterRpcOptions
PaymasterFeeEstimate​
Re-exports PaymasterFeeEstimate
PreparedDeployTransaction​
Re-exports PreparedDeployTransaction
PreparedInvokeTransaction​
Re-exports PreparedInvokeTransaction
PreparedDeployAndInvokeTransaction​
Re-exports PreparedDeployAndInvokeTransaction
PreparedTransaction​
Re-exports PreparedTransaction
TokenData​
Re-exports TokenData
DeployTransaction​
Re-exports DeployTransaction
InvokeTransaction​
Re-exports InvokeTransaction
UserInvoke​
Re-exports UserInvoke
DeployAndInvokeTransaction​
Re-exports DeployAndInvokeTransaction
UserTransaction​
Re-exports UserTransaction
ExecutableDeployTransaction​
Re-exports ExecutableDeployTransaction
ExecutableInvokeTransaction​
Re-exports ExecutableInvokeTransaction
ExecutableUserInvoke​
Re-exports ExecutableUserInvoke
ExecutableDeployAndInvokeTransaction​
Re-exports ExecutableDeployAndInvokeTransaction
ExecutableUserTransaction​
Re-exports ExecutableUserTransaction
FeeMode​
Re-exports FeeMode
ExecutionParameters​
Re-exports ExecutionParameters
PaymasterTimeBounds​
Re-exports PaymasterTimeBounds
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 |
contractOptions? | ContractOptions |
Defined in​
src/contract/contractFactory.ts:15
WebSocketOptions​
Ƭ WebSocketOptions: Object
Type declaration​
Name | Type | Description |
---|---|---|
nodeUrl? | string | websocket node url address Example ts 'ws://www.host.com/path' Default ts public websocket enabled starknet node |
websocket? | WebSocket | This parameter should be used when working in an environment without native WebSocket support by providing an equivalent WebSocket object that conforms to the protocol, e.g. from the 'isows' and/or 'ws' modules https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/WebSocket#protocols . https://www.rfc-editor.org/rfc/rfc6455.html#section-1 . Default ts WebSocket |
Defined in​
BatchClientOptions​
Ƭ BatchClientOptions: Object
Type declaration​
Name | Type |
---|---|
nodeUrl | string |
headers | object |
interval | number |
baseFetch | NonNullable <RpcProviderOptions ["baseFetch" ]> |
Defined in​
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
LogLevelIndex​
Ƭ LogLevelIndex: ValuesType
<typeof LogLevelIndex
>
Defined in​
LogLevel​
Ƭ LogLevel: keyof typeof LogLevelIndex
Defined in​
Variables​
defaultPaymaster​
• Const
defaultPaymaster: PaymasterRpc
Defined in​
defaultProvider​
• Const
defaultProvider: RpcProvider
Defined in​
WSSubscriptions​
• Const
WSSubscriptions: Object
Type declaration​
Name | Type |
---|---|
NEW_HEADS | "newHeads" |
EVENTS | "events" |
TRANSACTION_STATUS | "transactionStatus" |
PENDING_TRANSACTION | "pendingTransactions" |
Defined in​
UINT_128_MAX​
• Const
UINT_128_MAX: bigint
Defined in​
src/utils/cairoDataTypes/uint256.ts:10
UINT_256_MAX​
• Const
UINT_256_MAX: bigint
Defined in​
src/utils/cairoDataTypes/uint256.ts:11
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
config​
• Const
config: Configuration
Defined in​
logger​
• Const
logger: Logger
Logger instance, use for the system logging. Higher the logger level index, higher the LogLevel required to display log. Default should be INFO
DEBUG: 5, INFO: 4, WARN: 3, ERROR: 2, FATAL: 1,
Defined in​
LogLevelIndex​
• Const
LogLevelIndex: Object
Type declaration​
Name | Type |
---|---|
DEBUG | number |
INFO | number |
WARN | number |
ERROR | number |
FATAL | number |
OFF | number |
Defined in​
Functions​
getCalldata​
â–¸ getCalldata(args
, callback
): Calldata
Parameters​
Name | Type |
---|---|
args | RawArgs |
callback | Function |
Returns​
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​
getLedgerPathBuffer111​
â–¸ getLedgerPathBuffer111(accountId
, applicationName?
): Uint8Array
Format the Ledger wallet path to an Uint8Array for a Ledger Starknet DAPP v1.1.1.
EIP2645 path = 2645'/starknet/application/0/accountId/0
Parameters​
Name | Type | Default value | Description |
---|---|---|---|
accountId | number | undefined | Id of account. < 2**31. |
applicationName? | string | 'LedgerW' | utf8 string of application name. |
Returns​
Uint8Array
an Uint8array of 24 bytes.
Example
const result = getLedgerPathBuffer111(0);
// result = Uint8Array(24) [
128, 0, 10, 85, 71, 65, 233, 201,
43, 206, 231, 219, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
]
Defined in​
src/signer/ledgerSigner111.ts:362
getLedgerPathBuffer221​
â–¸ getLedgerPathBuffer221(accountId
, applicationName?
): Uint8Array
Format the Ledger wallet path to an Uint8Array. for a Ledger Starknet DAPP v2.2.0 EIP2645 path = 2645'/starknet'/application'/0'/accountId'/0
Parameters​
Name | Type | Default value | Description |
---|---|---|---|
accountId | number | undefined | Id of account. < 2**31. |
applicationName? | string | 'LedgerW' | utf8 string of application name. |
Returns​
Uint8Array
an Uint8array of 24 bytes.
Example
const result = getLedgerPathBuffer211(0);
// result = Uint8Array(24) [
128, 0, 10, 85, 199, 65, 233, 201,
171, 206, 231, 219, 128, 0, 0, 0,
128, 0, 0, 0, 0, 0, 0, 0
]
Defined in​
src/signer/ledgerSigner221.ts:644
isV3Tx​
â–¸ isV3Tx(details
): details is V3TransactionDetails
Check if the given transaction details is a V3 transaction.
Parameters​
Name | Type | Description |
---|---|---|
details | InvocationsDetailsWithNonce | The transaction details to be checked. |
Returns​
details is V3TransactionDetails
Returns true if the transaction is a V3 transaction, otherwise false.
Example
const invocation: InvocationsDetailsWithNonce = {
nonce: 1,
version: 3,
maxFee: 10 ** 15,
feeDataAvailabilityMode: RPC.EDataAvailabilityMode.L1,
tip: 10 ** 13,
paymasterData: [],
resourceBounds: {
l1_gas: { max_amount: num.toHex(10 ** 14), max_price_per_unit: num.toHex(50) },
l2_gas: { max_amount: num.toHex(0), max_price_per_unit: num.toHex(0) }}};
const result = provider.isV3Tx(invocation);
// result = true
Defined in​
isVersion​
â–¸ isVersion(expected
, provided
): boolean
Determines if the provided version matches the specified version. Version must be formatted "major.minor.patch" using dot delimiters. Use wildcard or unspecified to match 'any' value on the position. ex. 7.3. == 7.3.15, * == 1.1.1, 0.8 == 0.8.5. '' != 0.8.5
Parameters​
Name | Type | Description |
---|---|---|
expected | string | version. |
provided | string | to check against the expected version. |
Returns​
boolean
True if the response matches the version, false otherwise.
Example
const result = provider.isVersion("0.7","0.7.1");
// result = true
Defined in​
isSupportedSpecVersion​
â–¸ isSupportedSpecVersion(version
, options?
): version is "0.7.1" | "0.8.1"
Define if provided version is SDK supported rpc specification version
Parameters​
Name | Type |
---|---|
version | string |
options | Object |
options.allowAnyPatchVersion | boolean |
Returns​
version is "0.7.1" | "0.8.1"
Defined in​
toAnyPatchVersion​
â–¸ toAnyPatchVersion(version
): string
Convert fixed version to any patch version. ex. 0.8.1 -> 0.8.*
Parameters​
Name | Type |
---|---|
version | string |
Returns​
string
Defined in​
isPendingBlock​
â–¸ isPendingBlock(response
): response is Object
Guard Pending Block
Parameters​
Name | Type | Description |
---|---|---|
response | GetBlockResponse | answer of myProvider.getBlock() |
Returns​
response is Object
true if block is the pending block
Example
const block = await myProvider.getBlock("pending");
const result = provider.isPendingBlock(block);
// result = true
Defined in​
isPendingTransaction​
â–¸ isPendingTransaction(response
): boolean
Guard Pending Transaction
Parameters​
Name | Type | Description |
---|---|---|
response | GetTransactionReceiptResponse | transaction Receipt |
Returns​
boolean
true if the transaction is part of the pending block
Example
const block = await myProvider.getBlockWithTxs("pending");
const txR = await myProvider.getTransactionReceipt(block.transactions[0].transaction_hash);
const result = provider.isPendingTransaction(txR);
// result = true
Defined in​
isPendingStateUpdate​
â–¸ isPendingStateUpdate(response
): response is Object
Guard Pending State Update
Parameters​
Name | Type | Description |
---|---|---|
response | StateUpdateResponse | State of a block |
Returns​
response is Object
true if the block is pending
Example
const state: StateUpdateResponse = await myProvider.getStateUpdate("pending");
const result = provider.isPendingStateUpdate(state);
// result = true
Defined in​
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 result = [31, 0x1f, '31', '0x1f', '0x90591d9fa3efc87067d95a643f8455e0b8190eb8cb7bfd39e4fb7571fdf'].map(addAddressPadding);
// result = [
// '0x000000000000000000000000000000000000000000000000000000000000001f',
// '0x000000000000000000000000000000000000000000000000000000000000001f',
// '0x0000000000000000000000000000000000000000000000000000000000000031',
// '0x000000000000000000000000000000000000000000000000000000000000001f',
// '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 result = [31, 0x1f, '31', '0x1f', '0x90591d9fa3efc87067d95a643f8455e0b8190eb8cb7bfd39e4fb7571fdf'].map(addAddressPadding);
// result = [
// '0x000000000000000000000000000000000000000000000000000000000000001f',
// '0x000000000000000000000000000000000000000000000000000000000000001f',
// '0x0000000000000000000000000000000000000000000000000000000000000031',
// '0x000000000000000000000000000000000000000000000000000000000000001f',
// '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:352
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 |
Returns​
Defined in​
units​
â–¸ units(amount
, simbol?
): string
Convert strk to fri or fri to strk
Parameters​
Name | Type | Default value |
---|---|---|
amount | string | bigint | undefined |
simbol | "fri" | "strk" | 'fri' |
Returns​
string
Example
units(1000n, 'fri') // '0.000000000000001' strk
units('1', 'strk') // '1000000000000000000' fri