-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add governance voting tab [LW-11519] (#3240)
* feat: Add navigation with governance to voting page [LW-11519] * feat: add delegate votes API call and integrate it with mobx voting store * feat: Add governance voting form [LW-11519] * feat: voting power delegation confirmation dialog * chore: Add changelog entry [LW-11519] * feat: useconstructTx endpoint to calculate fee and for HWs, fix validation in form, improve styling * feat: Recognize and style voting transactions [LW-11519] * feat: redirect the user to the wallet of coice after successfull VP delegation * feat: add i18n to confirmation dialog and handle API error cases * feat: Track successfully casted votes [LW-11519] * feat: add final translations [LW-11519] * fix: Catch send error for staking conway wallets which have not registered voting rights yet [LW-11518] * feat: add HW support for VP delegation (#3243) * feat: add ledger support for VP delegation * feat: add trezor support for VP delegation --------- Signed-off-by: Dominik Guzei <[email protected]> Co-authored-by: Szymon Masłowski <[email protected]> Co-authored-by: Przemysław Włodek <[email protected]>
- Loading branch information
1 parent
a852174
commit ba63f08
Showing
48 changed files
with
2,113 additions
and
153 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { bech32, Decoded } from 'bech32'; | ||
|
||
const MAX_BECH32_LENGTH_LIMIT = 1023; | ||
|
||
const isOneOf = <T>(target: T, options: T | T[]) => | ||
(Array.isArray(options) && options.includes(target)) || target === options; | ||
|
||
export const assertIsBech32WithPrefix = ( | ||
target: string, | ||
prefix: string | string[], | ||
expectedDecodedLength?: number | number[] | ||
): void => { | ||
let decoded: Decoded; | ||
try { | ||
decoded = bech32.decode(target, MAX_BECH32_LENGTH_LIMIT); | ||
} catch (error) { | ||
throw new Error( | ||
`expected bech32-encoded string with '${prefix}' prefix; ${error}` | ||
); | ||
} | ||
if (!isOneOf(decoded.prefix, prefix)) { | ||
throw new Error( | ||
`expected bech32 prefix '${prefix}', got '${decoded.prefix}''` | ||
); | ||
} | ||
if ( | ||
expectedDecodedLength && | ||
!isOneOf(decoded.words.length, expectedDecodedLength) | ||
) { | ||
throw new Error( | ||
`expected decoded length of '${expectedDecodedLength}', got '${decoded.words.length}'` | ||
); | ||
} | ||
}; |
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.