Commit 50401c1
committed
fix: convert builder_fee bps to chain units before sending to contract
- Add bps_to_chain_units() utility function to convert basis points to chain units
(multiply by 100, aligning with FEE_PRECISION = 10000 in contract)
- Update place_order() and place_twap_order() to convert builder_fee/builder_fees
- Update approve_max_builder_fee() to accept int|float and convert to chain units
- Sync both async and sync versions of these methods
- Update ApproveBuilderFeeArgs type definition to accept int|float
This matches the TypeScript SDK implementation and fixes precision issues.1 parent 061b0da commit 50401c1
3 files changed
Lines changed: 40 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
385 | 386 | | |
386 | 387 | | |
387 | 388 | | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
388 | 404 | | |
389 | 405 | | |
390 | 406 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
270 | 271 | | |
271 | 272 | | |
272 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
273 | 277 | | |
274 | 278 | | |
275 | 279 | | |
| |||
293 | 297 | | |
294 | 298 | | |
295 | 299 | | |
296 | | - | |
| 300 | + | |
297 | 301 | | |
298 | 302 | | |
299 | 303 | | |
| |||
359 | 363 | | |
360 | 364 | | |
361 | 365 | | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
362 | 369 | | |
363 | 370 | | |
364 | 371 | | |
| |||
375 | 382 | | |
376 | 383 | | |
377 | 384 | | |
378 | | - | |
| 385 | + | |
379 | 386 | | |
380 | 387 | | |
381 | 388 | | |
| |||
1049 | 1056 | | |
1050 | 1057 | | |
1051 | 1058 | | |
1052 | | - | |
| 1059 | + | |
1053 | 1060 | | |
1054 | 1061 | | |
1055 | 1062 | | |
| 1063 | + | |
1056 | 1064 | | |
1057 | 1065 | | |
1058 | 1066 | | |
1059 | 1067 | | |
1060 | 1068 | | |
1061 | 1069 | | |
1062 | | - | |
| 1070 | + | |
1063 | 1071 | | |
1064 | 1072 | | |
1065 | 1073 | | |
| |||
1302 | 1310 | | |
1303 | 1311 | | |
1304 | 1312 | | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
1305 | 1316 | | |
1306 | 1317 | | |
1307 | 1318 | | |
| |||
1325 | 1336 | | |
1326 | 1337 | | |
1327 | 1338 | | |
1328 | | - | |
| 1339 | + | |
1329 | 1340 | | |
1330 | 1341 | | |
1331 | 1342 | | |
| |||
1391 | 1402 | | |
1392 | 1403 | | |
1393 | 1404 | | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
1394 | 1408 | | |
1395 | 1409 | | |
1396 | 1410 | | |
| |||
1407 | 1421 | | |
1408 | 1422 | | |
1409 | 1423 | | |
1410 | | - | |
| 1424 | + | |
1411 | 1425 | | |
1412 | 1426 | | |
1413 | 1427 | | |
| |||
2077 | 2091 | | |
2078 | 2092 | | |
2079 | 2093 | | |
2080 | | - | |
| 2094 | + | |
2081 | 2095 | | |
2082 | 2096 | | |
2083 | 2097 | | |
| 2098 | + | |
2084 | 2099 | | |
2085 | 2100 | | |
2086 | 2101 | | |
2087 | 2102 | | |
2088 | 2103 | | |
2089 | 2104 | | |
2090 | | - | |
| 2105 | + | |
2091 | 2106 | | |
2092 | 2107 | | |
2093 | 2108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| |||
0 commit comments