-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a92696
commit c4d777d
Showing
10 changed files
with
92 additions
and
0 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,6 @@ | ||
import { z } from 'zod'; | ||
|
||
export const address = z.object({ | ||
inner: z.instanceof(Uint8Array), | ||
altBech32m: z.string(), | ||
}); |
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,7 @@ | ||
import { z } from 'zod'; | ||
|
||
export const assetId = z.object({ | ||
inner: z.instanceof(Uint8Array), | ||
altBech32m: z.string(), | ||
altBaseDenom: z.string(), | ||
}); |
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,7 @@ | ||
import { z } from 'zod'; | ||
|
||
export const assetImage_Theme = z.object({ | ||
primaryColorHex: z.string(), | ||
circle: z.boolean(), | ||
darkMode: z.boolean(), | ||
}); |
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,8 @@ | ||
import { z } from 'zod'; | ||
import { assetImage_Theme } from './asset-image--theme'; | ||
|
||
export const assetImage = z.object({ | ||
png: z.string(), | ||
svg: z.string(), | ||
theme: assetImage_Theme.optional(), | ||
}); |
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,15 @@ | ||
import { z } from 'zod'; | ||
import { denomUnit } from './denom-unit'; | ||
import { assetId } from './asset-id'; | ||
import { assetImage } from './asset-image'; | ||
|
||
export const denomMetadata = z.object({ | ||
description: z.string(), | ||
denomUnits: z.array(denomUnit), | ||
base: z.string(), | ||
display: z.string(), | ||
name: z.string(), | ||
symbol: z.string(), | ||
penumbraAssetId: assetId.optional(), | ||
images: z.array(assetImage), | ||
}); |
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,7 @@ | ||
import { z } from 'zod'; | ||
|
||
export const denomUnit = z.object({ | ||
denom: z.string(), | ||
exponent: z.number().int(), | ||
aliases: z.array(z.string()), | ||
}); |
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,25 @@ | ||
import { address } from '../schemas/address'; | ||
import { isType } from '../validation'; | ||
import { z } from 'zod'; | ||
|
||
export const hasAccountIndex = isType( | ||
z.object({ | ||
addressView: z.object({ | ||
case: z.enum(['visible']), | ||
value: z.object({ | ||
index: z.object({ | ||
account: z.number(), | ||
}), | ||
}), | ||
}), | ||
}), | ||
); | ||
|
||
export const hasAddress = isType( | ||
z.object({ | ||
addressView: z.object({ | ||
case: z.enum(['visible', 'opaque']), | ||
value: z.object({ address }), | ||
}), | ||
}), | ||
); |
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,2 @@ | ||
export * from './address-view'; | ||
export * from './value-view'; |
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,14 @@ | ||
import { denomMetadata } from '../schemas/denom-metadata'; | ||
import { isType } from '../validation'; | ||
import { z } from 'zod'; | ||
|
||
export const hasDenomMetadata = isType( | ||
z.object({ | ||
valueView: z.object({ | ||
case: z.enum(['knownDenom']), | ||
value: z.object({ | ||
denom: denomMetadata, | ||
}), | ||
}), | ||
}), | ||
); |