@0xknwn/starknet-test-helpers / Exports / Counter
Class: Counter
Represents a Counter contract.
Hierarchy
-
Contract
↳
Counter
Table of contents
Constructors
Properties
- abi
- address
- callStatic
- deployTransactionHash
- estimateFee
- events
- functions
- populateTransaction
- providerOrAccount
- structs
Methods
- attach
- call
- connect
- deployed
- estimate
- getVersion
- increment
- increment_by
- increment_by_array
- increment_by_multicall
- invoke
- isCairo1
- parseEvents
- populate
- reset
- typedv2
Constructors
constructor
• new Counter(address
, account
): Counter
Creates an instance of the Counter contract.
Parameters
Name | Type | Description |
---|---|---|
address | string | The address of the contract. |
account | Account | The account used to interact with the contract. |
Returns
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
Name | Type |
---|---|
address | string |
Returns
void
Inherited from
Contract.attach
Defined in
node_modules/starknet/dist/index.d.ts:3987
call
▸ call(method
, args?
, «destructured»?
): Promise
<Result
>
Parameters
Name | Type |
---|---|
method | string |
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
Name | Type |
---|---|
providerOrAccount | ProviderInterface | 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
Name | Type |
---|---|
method | string |
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
Name | Type | Description |
---|---|---|
value | number | The 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
Name | Type | Description |
---|---|---|
args | number [] | 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
Name | Type | Description |
---|---|---|
values | number [] | 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
Name | Type |
---|---|
method | string |
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
Name | Type |
---|---|
receipt | GetTransactionReceiptResponse |
Returns
ParsedEvents
Inherited from
Contract.parseEvents
Defined in
node_modules/starknet/dist/index.d.ts:3994
populate
▸ populate(method
, args?
): Call
Parameters
Name | Type |
---|---|
method | string |
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
Name | Type |
---|---|
TAbi | extends readonly (AbiImpl | AbiInterface | AbiConstructor | AbiFunction | AbiStruct | AbiEnum | AbiEvent )[] |
Parameters
Name | Type |
---|---|
tAbi | TAbi |
Returns
TypedContractV2
<TAbi
>
Inherited from
Contract.typedv2
Defined in
node_modules/starknet/dist/index.d.ts:3997