-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add documentation for smart account provider fee options and ov…
…errides (#277) * feat: support one-off percentage overrides for user operations * feat: apply user op override or fee option utils in aa-core * docs: add documentation for smart account provider fee options and overrides * docs: add glossary section and add general types doc in the section
- Loading branch information
Showing
19 changed files
with
426 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
outline: deep | ||
head: | ||
- - meta | ||
- property: og:title | ||
content: BigNumberish | ||
- - meta | ||
- name: description | ||
content: Overview of the BigNumberish type in aa-core types | ||
- - meta | ||
- property: og:description | ||
content: Overview of the BigNumberish type in aa-core types | ||
--- | ||
|
||
# BigNumberish | ||
|
||
one of `Hex` (`0x{string}`), `bigint` or `number` type for representing `bigint` convertible values | ||
|
||
```ts | ||
import { z } from "zod"; | ||
|
||
export const HexSchema = z.custom<`0x${string}` | "0x">((val) => { | ||
return isHex(val) || val === "0x"; | ||
}); | ||
|
||
/* | ||
* type BigNumberish = Hex | number | bigint | ||
*/ | ||
export const BigNumberishSchema = z.union([HexSchema, z.number(), z.bigint()]); | ||
``` | ||
|
||
## Usage | ||
|
||
::: code-group | ||
|
||
```ts [example.ts] | ||
import { type BigNumberish, isBigNumberish } from "@alchemy/aa-core"; | ||
|
||
const bigNumberish1 = 10000000n; | ||
const bigNumberish2 = 0xf23cde; | ||
|
||
console.log(isBigNumberish(bigNumberish1)); // true | ||
console.log(isBigNumberish(bigNumberish2)); // true | ||
``` | ||
|
||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
outline: deep | ||
head: | ||
- - meta | ||
- property: og:title | ||
content: BigNumberishRange | ||
- - meta | ||
- name: description | ||
content: Overview of the BigNumberishRange type in aa-core types | ||
- - meta | ||
- property: og:description | ||
content: Overview of the BigNumberishRange type in aa-core types | ||
--- | ||
|
||
# BigNumberishRange | ||
|
||
object with optional fields `min` and `max` where each field is of type [`BigNumberish`](./bigNumberish.md) to represent a range type value between `min` and `max` inclusive | ||
|
||
```ts | ||
import { z } from "zod"; | ||
|
||
/* | ||
* type BigNumberishRange = { | ||
* min?: Hex | number | bigint | ||
* max?: Hex | number | bigint | ||
* } | ||
*/ | ||
|
||
export const BigNumberishRangeSchema = z | ||
.object({ | ||
min: BigNumberishSchema.optional(), | ||
max: BigNumberishSchema.optional(), | ||
}) | ||
.strict(); | ||
``` | ||
|
||
## Usage | ||
|
||
::: code-group | ||
|
||
```ts [example.ts] | ||
import { type BigNumberishRange } from "@alchemy/aa-core"; | ||
|
||
const bigNumberishRange = { | ||
min: 1n, | ||
max: "0x345dfe", | ||
}; | ||
``` | ||
|
||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
outline: deep | ||
head: | ||
- - meta | ||
- property: og:title | ||
content: Percentage | ||
- - meta | ||
- name: description | ||
content: Overview of the Percentage type in aa-core types | ||
- - meta | ||
- property: og:description | ||
content: Overview of the Percentage type in aa-core types | ||
--- | ||
|
||
# Percentage | ||
|
||
object with required field `percentage` with a `number` value between 1 and 1000 inclusive | ||
|
||
```ts | ||
import { z } from "zod"; | ||
|
||
/* | ||
* type Percentage = { | ||
* percentage?: number | ||
* } | ||
*/ | ||
|
||
export const PercentageSchema = z | ||
.object({ | ||
/** | ||
* Percent value between 1 and 1000 inclusive | ||
*/ | ||
percentage: z.number().min(1).max(1000), | ||
}) | ||
.strict(); | ||
``` | ||
|
||
## Usage | ||
|
||
::: code-group | ||
|
||
```ts [example.ts] | ||
import { type Percentage, isPercentage } from "@alchemy/aa-core"; | ||
|
||
const percentage1 = { | ||
percentage: 10, | ||
}; | ||
const percentage2 = { | ||
percentage: 100000, | ||
}; | ||
|
||
console.log(isPercentage(percentage1)); // true | ||
console.log(isPercentage(percentage2)); // false | ||
``` | ||
|
||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.