Skip to content

Commit

Permalink
fix: renterd pricepinning autopilot config structure
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Aug 16, 2024
1 parent 70d9d60 commit 56fa285
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .changeset/hip-trees-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@siafoundation/renterd-types': minor
'@siafoundation/renterd-js': minor
'@siafoundation/renterd-react': minor
---

Updated the pricepinning configuration structure to support multiple autopilots. Closes https://github.com/SiaFoundation/renterd/issues/1448
5 changes: 5 additions & 0 deletions .changeset/stupid-peaches-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

Fixed an issue where the pricepinning response was crashing the app. Closes https://github.com/SiaFoundation/renterd/issues/1448
4 changes: 2 additions & 2 deletions apps/renterd/contexts/config/transformDown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ export function transformDownPricePinning(
pinnedCurrency: p.currency,
forexEndpointURL: p.forexEndpointURL,
pinnedThreshold: new BigNumber(p.threshold).times(100),
shouldPinAllowance: p.autopilots?.allowance.pinned || false,
shouldPinAllowance: p.autopilots['autopilot']?.allowance.pinned || false,
allowanceMonthPinned: toFixedMaxBigNumber(
valuePerPeriodToPerMonth(
new BigNumber(p.autopilots?.allowance.value || 0),
new BigNumber(p.autopilots['autopilot']?.allowance.value || 0),
// If pinned allowance is non zero, the period value will be defined.
periodBlocks || weeksToBlocks(6)
),
Expand Down
2 changes: 1 addition & 1 deletion libs/renterd-types/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export type PricePinSettings = {
threshold: number

// Autopilots contains the pinned settings for every autopilot.
autopilots: AutopilotPins
autopilots: Record<string, AutopilotPins>

// GougingSettingsPins contains the pinned settings for the gouging
// settings.
Expand Down

0 comments on commit 56fa285

Please sign in to comment.