Skip to content

Commit a8eb52d

Browse files
committed
updated docs
1 parent aedfcb6 commit a8eb52d

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

jsr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nomadshiba/typed-contracts",
3-
"version": "0.2.5",
3+
"version": "0.2.6",
44
"exports": {
55
"./abi": "./types/abi.ts",
66
"./ethers6": "./types/ethers6/exports.ts"

types/abi.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export type Abi = readonly Abi.Item[]
2+
13
/**
24
* `Abi` represents the structure of an Ethereum contract's Application Binary Interface (ABI),
35
* which defines the functions, events, and errors that can be interacted with in the contract.
@@ -30,18 +32,12 @@
3032
* ];
3133
* ```
3234
*/
33-
export type Abi = readonly Abi.Item[]
34-
3535
export namespace Abi {
3636
/**
3737
* `Abi.Item` represents a single item in an ABI, which can be either a function, event, or error.
3838
*/
3939
export type Item = FunctionItem | EventItem | ErrorItem
4040

41-
/**
42-
* `Abi.FunctionItem` defines a function in a contract's ABI, including its name, inputs, outputs,
43-
* and state mutability.
44-
*/
4541
export type FunctionItem =
4642
| {
4743
type: "function"
@@ -57,9 +53,8 @@ export namespace Abi {
5753
}
5854

5955
/**
60-
* `Abi.FunctionItem.Input` and `Abi.FunctionItem.Output` represent the arguments and return values of a function.
61-
* They both share the same structure, defined by `Abi.Argument`, which includes the argument's type, name,
62-
* and internal type used in Solidity.
56+
* `Abi.FunctionItem` defines a function in a contract's ABI, including its name, inputs, outputs,
57+
* and state mutability.
6358
*/
6459
export namespace FunctionItem {
6560
export type Input = Argument & {}
@@ -81,17 +76,17 @@ export namespace Abi {
8176
| "payable"
8277
}
8378

84-
/**
85-
* `Abi.EventItem` defines an event in the contract's ABI, which can be emitted by the contract.
86-
* Each event has a name, inputs, and an `anonymous` flag indicating whether the event is anonymous.
87-
*/
8879
export type EventItem = {
8980
type: "event"
9081
name: string
9182
inputs: readonly EventItem.Input[]
9283
anonymous: boolean
9384
}
9485

86+
/**
87+
* `Abi.EventItem` defines an event in the contract's ABI, which can be emitted by the contract.
88+
* Each event has a name, inputs, and an `anonymous` flag indicating whether the event is anonymous.
89+
*/
9590
export namespace EventItem {
9691
/**
9792
* `Abi.EventItem.Input` represents an argument to an event, with an additional `indexed` flag
@@ -100,15 +95,15 @@ export namespace Abi {
10095
export type Input = Argument & { indexed: boolean }
10196
}
10297

103-
/**
104-
* `Abi.ErrorItem` defines an error in the contract's ABI, which can be used for custom error handling.
105-
*/
10698
export type ErrorItem = {
10799
type: "error"
108100
name: string
109101
inputs: readonly ErrorItem.Input[]
110102
}
111103

104+
/**
105+
* `Abi.ErrorItem` defines an error in the contract's ABI, which can be used for custom error handling.
106+
*/
112107
export namespace ErrorItem {
113108
/**
114109
* `Abi.ErrorItem.Input` represents an argument to an error.

types/ethers6/typedContract.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ type ProcessAbi<
8484
* `Contract` from ethers.js and ensures that function inputs and outputs are correctly
8585
* typed according to the ABI.
8686
*
87-
* @template TAbi - The ABI type representing the structure of the contract.
87+
* @template {Abi} TAbi - The ABI type representing the structure of the contract.
8888
*
8989
* Each function in the contract is dynamically typed based on its input and output
9090
* types as specified in the ABI. Functions with no outputs return a `ContractTransaction`,

0 commit comments

Comments
 (0)