-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2402 from IntersectMBO/tests/assert-govActionId
Assert CIP129 and govActionId on governance action details page
- Loading branch information
Showing
5 changed files
with
45 additions
and
9 deletions.
There are no files selected for viewing
7 changes: 0 additions & 7 deletions
7
tests/govtool-frontend/playwright/lib/helpers/cborEncodeDecode.ts
This file was deleted.
Oops, something went wrong.
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
22 changes: 22 additions & 0 deletions
22
tests/govtool-frontend/playwright/lib/helpers/encodeDecode.ts
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,22 @@ | ||
import { bech32 } from "bech32"; | ||
import { Decoder, Encoder } from "cbor-x"; | ||
|
||
export const cborxEncoder = new Encoder({ | ||
mapsAsObjects: false, | ||
useRecords: false, | ||
}); | ||
export const cborxDecoder = new Decoder({ mapsAsObjects: false }); | ||
|
||
export const encodeCIP129Identifier = ({ | ||
txID, | ||
index, | ||
bech32Prefix, | ||
}: { | ||
txID: string; | ||
index?: string; | ||
bech32Prefix: string; | ||
}) => { | ||
const govActionBytes = Buffer.from(index ? txID + index : txID, "hex"); | ||
const words = bech32.toWords(govActionBytes); | ||
return bech32.encode(bech32Prefix, words); | ||
}; |
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