-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create/use factory for Protobuf Address types
- Loading branch information
1 parent
6b9ecce
commit 145d162
Showing
6 changed files
with
30 additions
and
18 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
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,13 @@ | ||
import { PlainMessage } from '@bufbuild/protobuf'; | ||
import { Address } from '@penumbra-zone/protobuf/penumbra/core/keys/v1/keys_pb'; | ||
import * as Factory from 'factory.ts'; | ||
import { generateRandomNumberBetween0And255 } from './helpers'; | ||
|
||
const addressFactory = Factory.makeFactory<PlainMessage<Address>>({ | ||
altBech32m: '', | ||
inner: Factory.each( | ||
() => new Uint8Array(Array(80).fill(null).map(generateRandomNumberBetween0And255)), | ||
), | ||
}); | ||
|
||
export default addressFactory; |
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,3 @@ | ||
export function generateRandomNumberBetween0And255() { | ||
return Math.round(Math.random() * 255); | ||
} |
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