Skip to content

Commit 32c33f9

Browse files
authored
Merge pull request #14 from BootNodeDev/fix/formatter
fix: biome formatter rules
2 parents 8f66c86 + 5b1e1f1 commit 32c33f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+4885
-4747
lines changed

README.md

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Full API documentation with TypeDoc: [https://bootnodedev.github.io/uni-dev-kit]
7575
- [`buildSwapCallData`](#buildswapcalldata)
7676
- [`buildAddLiquidityCallData`](#buildaddliquiditycalldata)
7777
- [`preparePermit2BatchCallData`](#preparepermit2batchcalldata)
78+
- [Basis Points Reference](#basis-points-reference)
7879
- [Useful Links](#useful-links)
7980
- [Development](#development)
8081
- [Scripts](#scripts)
@@ -126,6 +127,7 @@ const poolKey = await uniDevKit.getPoolKeyFromPoolId({
126127

127128
### `buildSwapCallData`
128129
Construct calldata for a Universal Router swap.
130+
129131
```ts
130132
// Basic swap
131133
const { calldata, value } = await uniDevKit.buildSwapCallData({
@@ -143,23 +145,22 @@ const permitData = await uniDevKit.preparePermit2Data({
143145
owner: userAddress
144146
});
145147

146-
const signature = await signer._signTypedData(permitData.toSign);
148+
const signature = await signer._signTypedData(
149+
permitData.toSign.domain,
150+
{ PermitSingle: permitData.toSign.types.PermitSingle },
151+
permitData.toSign.values
152+
);
153+
147154
const permitWithSignature = permitData.buildPermit2DataWithSignature(signature);
148155

149-
const { calldata: calldataWithPermit, value: valueWithPermit } = await uniDevKit.buildSwapCallData({
150-
tokenIn: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
151-
amountIn: parseUnits("100", 6),
152-
pool: pool,
156+
const { calldata, value } = await uniDevKit.buildSwapCallData({
157+
tokenIn,
158+
amountIn,
159+
pool,
153160
slippageTolerance: 50,
154-
recipient: "0x...",
161+
recipient,
155162
permit2Signature: permitWithSignature
156163
});
157-
158-
const tx = await sendTransaction({
159-
to: uniDevKit.getContractAddress('universalRouter'),
160-
data: calldata,
161-
value
162-
});
163164
```
164165

165166
### `buildAddLiquidityCallData`
@@ -213,6 +214,19 @@ const permitData = await uniDevKit.preparePermit2BatchCallData({
213214
});
214215
```
215216

217+
#### Basis Points Reference
218+
219+
Throughout the library, percentages are represented in basis points (bps). For example, when setting a slippage tolerance of 0.5%, you would use `50` bps. Here's a quick reference:
220+
221+
| Basis Points (bps) | Fraction | Percentage |
222+
|:------------------:|:--------:|:----------:|
223+
| 1 | 1/10_000 | 0.01% |
224+
| 10 | 10/10_000 | 0.1% |
225+
| 100 | 100/10_000 | 1% |
226+
| 500 | 500/10_000 | 5% |
227+
| 1000 | 1000/10_000 | 10% |
228+
| 10_000 | 10_000/10_000 | 100% |
229+
216230
## Useful Links
217231
- [Uniswap V4 Docs](https://docs.uniswap.org/contracts/v4/overview)
218232

biome.json

Lines changed: 175 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,177 @@
11
{
2-
"formatter": {
3-
"ignore": ["dist/**/*"]
4-
},
5-
"linter": {
6-
"rules": {
7-
"recommended": true
8-
}
9-
},
10-
"files": {
11-
"include": ["src/**/*", "test/**/*"],
12-
"ignore": ["dist/**/*"]
13-
}
2+
"$schema": "https://biomejs.dev/schemas/1.9.2/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"include": ["src/**/*", "test/**/*"],
10+
"ignore": ["dist/**/*"]
11+
},
12+
"formatter": {
13+
"attributePosition": "multiline",
14+
"indentStyle": "space",
15+
"lineWidth": 100
16+
},
17+
"javascript": {
18+
"formatter": {
19+
"quoteStyle": "single",
20+
"semicolons": "asNeeded"
21+
}
22+
},
23+
"linter": {
24+
"rules": {
25+
"a11y": {
26+
"noAccessKey": "error",
27+
"noAriaUnsupportedElements": "error",
28+
"noAutofocus": "error",
29+
"noBlankTarget": "error",
30+
"noDistractingElements": "error",
31+
"noHeaderScope": "error",
32+
"noInteractiveElementToNoninteractiveRole": "error",
33+
"noLabelWithoutControl": "warn",
34+
"noNoninteractiveElementToInteractiveRole": "error",
35+
"noNoninteractiveTabindex": "error",
36+
"noPositiveTabindex": "error",
37+
"noRedundantAlt": "error",
38+
"noRedundantRoles": "error",
39+
"noSvgWithoutTitle": "off",
40+
"useAltText": "error",
41+
"useAnchorContent": "error",
42+
"useAriaActivedescendantWithTabindex": "error",
43+
"useAriaPropsForRole": "error",
44+
"useFocusableInteractive": "error",
45+
"useHeadingContent": "error",
46+
"useHtmlLang": "error",
47+
"useIframeTitle": "error",
48+
"useKeyWithClickEvents": "error",
49+
"useKeyWithMouseEvents": "error",
50+
"useMediaCaption": "error",
51+
"useValidAnchor": "error",
52+
"useValidAriaProps": "error",
53+
"useValidAriaRole": "error",
54+
"useValidAriaValues": "error"
55+
},
56+
"complexity": {
57+
"noExtraBooleanCast": "error",
58+
"noMultipleSpacesInRegularExpressionLiterals": "error",
59+
"noUselessCatch": "error",
60+
"noUselessTypeConstraint": "error",
61+
"noWith": "error"
62+
},
63+
"correctness": {
64+
"noChildrenProp": "error",
65+
"noConstAssign": "error",
66+
"noConstantCondition": "error",
67+
"noEmptyCharacterClassInRegex": "error",
68+
"noEmptyPattern": "error",
69+
"noGlobalObjectCalls": "error",
70+
"noInnerDeclarations": "error",
71+
"noInvalidConstructorSuper": "error",
72+
"noInvalidUseBeforeDeclaration": "error",
73+
"noNewSymbol": "error",
74+
"noNonoctalDecimalEscape": "error",
75+
"noPrecisionLoss": "error",
76+
"noSelfAssign": "error",
77+
"noSetterReturn": "error",
78+
"noSwitchDeclarations": "error",
79+
"noUndeclaredVariables": "error",
80+
"noUnreachable": "error",
81+
"noUnreachableSuper": "error",
82+
"noUnsafeFinally": "error",
83+
"noUnsafeOptionalChaining": "error",
84+
"noUnusedLabels": "error",
85+
"noUnusedVariables": "error",
86+
"useArrayLiterals": "off",
87+
"useExhaustiveDependencies": "error",
88+
"useHookAtTopLevel": "error",
89+
"useIsNan": "error",
90+
"useJsxKeyInIterable": "error",
91+
"useValidForDirection": "error",
92+
"useYield": "error"
93+
},
94+
"security": {
95+
"noDangerouslySetInnerHtmlWithChildren": "error"
96+
},
97+
"style": {
98+
"noNamespace": "error",
99+
"noRestrictedGlobals": {
100+
"level": "error",
101+
"options": {
102+
"deniedGlobals": ["React"]
103+
}
104+
},
105+
"useAsConstAssertion": "error",
106+
"useBlockStatements": "off"
107+
},
108+
"suspicious": {
109+
"noAsyncPromiseExecutor": "error",
110+
"noCatchAssign": "error",
111+
"noClassAssign": "error",
112+
"noCommentText": "error",
113+
"noCompareNegZero": "error",
114+
"noControlCharactersInRegex": "error",
115+
"noDebugger": "error",
116+
"noDuplicateCase": "error",
117+
"noDuplicateClassMembers": "error",
118+
"noDuplicateJsxProps": "error",
119+
"noDuplicateObjectKeys": "error",
120+
"noDuplicateParameters": "error",
121+
"noEmptyBlockStatements": "error",
122+
"noExplicitAny": "warn",
123+
"noExtraNonNullAssertion": "error",
124+
"noFallthroughSwitchClause": "error",
125+
"noFunctionAssign": "error",
126+
"noGlobalAssign": "error",
127+
"noImportAssign": "error",
128+
"noMisleadingCharacterClass": "error",
129+
"noMisleadingInstantiator": "error",
130+
"noPrototypeBuiltins": "error",
131+
"noRedeclare": "error",
132+
"noShadowRestrictedNames": "error",
133+
"noSparseArray": "error",
134+
"noUnsafeDeclarationMerging": "error",
135+
"noUnsafeNegation": "error",
136+
"useGetterReturn": "error",
137+
"useNamespaceKeyword": "error",
138+
"useValidTypeof": "error"
139+
}
140+
}
141+
},
142+
"overrides": [
143+
{
144+
"include": ["*.ts", "*.tsx", "*.mts", "*.cts"],
145+
"linter": {
146+
"rules": {
147+
"correctness": {
148+
"noConstAssign": "off",
149+
"noGlobalObjectCalls": "off",
150+
"noInvalidBuiltinInstantiation": "off",
151+
"noInvalidConstructorSuper": "off",
152+
"noNewSymbol": "off",
153+
"noSetterReturn": "off",
154+
"noUndeclaredVariables": "off",
155+
"noUnreachable": "off",
156+
"noUnreachableSuper": "off"
157+
},
158+
"style": {
159+
"noArguments": "error",
160+
"noVar": "error",
161+
"useConst": "error"
162+
},
163+
"suspicious": {
164+
"noDuplicateClassMembers": "off",
165+
"noDuplicateObjectKeys": "off",
166+
"noDuplicateParameters": "off",
167+
"noFunctionAssign": "off",
168+
"noImportAssign": "off",
169+
"noRedeclare": "off",
170+
"noUnsafeNegation": "off",
171+
"useGetterReturn": "off"
172+
}
173+
}
174+
}
175+
}
176+
]
14177
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "uniswap-dev-kit",
3-
"version": "1.0.10",
3+
"version": "1.0.11",
44
"description": "A modern TypeScript library for integrating Uniswap into your dapp.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

0 commit comments

Comments
 (0)