@0xknwn/starknet-test-helpers / Exports / Counter

Class: Counter

Represents a Counter contract.

Hierarchy

  • Contract

    Counter

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Counter(address, account): Counter

Creates an instance of the Counter contract.

Parameters

NameTypeDescription
addressstringThe address of the contract.
accountAccountThe account used to interact with the contract.

Returns

Counter

Overrides

Contract.constructor

Defined in

sdks/tests/helpers/src/counter.ts:50

Properties

abi

abi: Abi

Inherited from

Contract.abi

Defined in

node_modules/starknet/dist/index.d.ts:3957


address

address: string

Inherited from

Contract.address

Defined in

node_modules/starknet/dist/index.d.ts:3958


callStatic

Readonly callStatic: Object

Index signature

▪ [name: string]: AsyncContractFunction

Inherited from

Contract.callStatic

Defined in

node_modules/starknet/dist/index.d.ts:3968


deployTransactionHash

Optional deployTransactionHash: string

Inherited from

Contract.deployTransactionHash

Defined in

node_modules/starknet/dist/index.d.ts:3960


estimateFee

Readonly estimateFee: Object

Index signature

▪ [name: string]: ContractFunction

Inherited from

Contract.estimateFee

Defined in

node_modules/starknet/dist/index.d.ts:3974


events

Protected Readonly events: AbiEvents

Inherited from

Contract.events

Defined in

node_modules/starknet/dist/index.d.ts:3964


functions

Readonly functions: Object

Index signature

▪ [name: string]: AsyncContractFunction

Inherited from

Contract.functions

Defined in

node_modules/starknet/dist/index.d.ts:3965


populateTransaction

Readonly populateTransaction: Object

Index signature

▪ [name: string]: ContractFunction

Inherited from

Contract.populateTransaction

Defined in

node_modules/starknet/dist/index.d.ts:3971


providerOrAccount

providerOrAccount: ProviderInterface | AccountInterface

Inherited from

Contract.providerOrAccount

Defined in

node_modules/starknet/dist/index.d.ts:3959


structs

Protected Readonly structs: Object

Index signature

▪ [name: string]: StructAbi

Inherited from

Contract.structs

Defined in

node_modules/starknet/dist/index.d.ts:3961

Methods

attach

attach(address): void

Parameters

NameType
addressstring

Returns

void

Inherited from

Contract.attach

Defined in

node_modules/starknet/dist/index.d.ts:3987


call

call(method, args?, «destructured»?): Promise<Result>

Parameters

NameType
methodstring
args?ArgsOrCalldata
«destructured»CallOptions

Returns

Promise<Result>

Inherited from

Contract.call

Defined in

node_modules/starknet/dist/index.d.ts:3990


connect

connect(providerOrAccount): void

Parameters

NameType
providerOrAccountProviderInterface | AccountInterface

Returns

void

Inherited from

Contract.connect

Defined in

node_modules/starknet/dist/index.d.ts:3988


deployed

deployed(): Promise<Contract>

Returns

Promise<Contract>

Inherited from

Contract.deployed

Defined in

node_modules/starknet/dist/index.d.ts:3989


estimate

estimate(method, args?): Promise<EstimateFeeResponse>

Parameters

NameType
methodstring
args?ArgsOrCalldata

Returns

Promise<EstimateFeeResponse>

Inherited from

Contract.estimate

Defined in

node_modules/starknet/dist/index.d.ts:3992


getVersion

getVersion(): Promise<ContractVersion>

Returns

Promise<ContractVersion>

Inherited from

Contract.getVersion

Defined in

node_modules/starknet/dist/index.d.ts:3996


increment

increment(): Promise<{ transaction_hash: string }>

Increments the counter by 1.

Returns

Promise<{ transaction_hash: string }>

A promise that resolves to the result of the execution.

Defined in

sdks/tests/helpers/src/counter.ts:58


increment_by

increment_by(value): Promise<{ transaction_hash: string }>

Increments the counter by the specified value.

Parameters

NameTypeDescription
valuenumberThe value to increment the counter by.

Returns

Promise<{ transaction_hash: string }>

A promise that resolves to the result of the execution.

Defined in

sdks/tests/helpers/src/counter.ts:69


increment_by_array

increment_by_array(args): Promise<{ transaction_hash: string }>

Increments the counter by an array of numbers using increment_by_array.

Parameters

NameTypeDescription
argsnumber[]The array of values to increment the counter by.

Returns

Promise<{ transaction_hash: string }>

A promise that resolves to the result of the execution.

Defined in

sdks/tests/helpers/src/counter.ts:98


increment_by_multicall

increment_by_multicall(values): Promise<{ transaction_hash: string }>

Increments the counter by an array of numbers using a multicall of increment_by.

Parameters

NameTypeDescription
valuesnumber[]The array of values to increment the counter by.

Returns

Promise<{ transaction_hash: string }>

A promise that resolves to the result of the execution.

Defined in

sdks/tests/helpers/src/counter.ts:80


invoke

invoke(method, args?, «destructured»?): Promise<{ transaction_hash: string }>

Parameters

NameType
methodstring
args?ArgsOrCalldata
«destructured»InvokeOptions

Returns

Promise<{ transaction_hash: string }>

Inherited from

Contract.invoke

Defined in

node_modules/starknet/dist/index.d.ts:3991


isCairo1

isCairo1(): boolean

Returns

boolean

Inherited from

Contract.isCairo1

Defined in

node_modules/starknet/dist/index.d.ts:3995


parseEvents

parseEvents(receipt): ParsedEvents

Parameters

NameType
receiptGetTransactionReceiptResponse

Returns

ParsedEvents

Inherited from

Contract.parseEvents

Defined in

node_modules/starknet/dist/index.d.ts:3994


populate

populate(method, args?): Call

Parameters

NameType
methodstring
args?RawArgs

Returns

Call

Inherited from

Contract.populate

Defined in

node_modules/starknet/dist/index.d.ts:3993


reset

reset(): Promise<{ transaction_hash: string }>

Resets the counter.

Returns

Promise<{ transaction_hash: string }>

A promise that resolves to the result of the execution.

Remarks

This function requires the Account used by the Counter to be its owner.

Defined in

sdks/tests/helpers/src/counter.ts:112


typedv2

typedv2<TAbi>(tAbi): TypedContractV2<TAbi>

Type parameters

NameType
TAbiextends readonly (AbiImpl | AbiInterface | AbiConstructor | AbiFunction | AbiStruct | AbiEnum | AbiEvent)[]

Parameters

NameType
tAbiTAbi

Returns

TypedContractV2<TAbi>

Inherited from

Contract.typedv2

Defined in

node_modules/starknet/dist/index.d.ts:3997