-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sdl): move denom validation from cloudmos to sdl (#133)
As part of this: - run validation on the class init - add deprecation warning to static validation method - move along necessary deps types and deps from cloudmos
- Loading branch information
1 parent
7de1540
commit 245f7a9
Showing
7 changed files
with
71 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"extends": ["@commitlint/config-conventional"], | ||
"rules": { | ||
"scope-enum": [2, "always", ["certificates", "network", "wallet", "api", "stargate"]] | ||
"scope-enum": [2, "always", ["certificates", "network", "wallet", "api", "stargate", "sdl"]] | ||
} | ||
} |
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,11 @@ | ||
import { MainnetNetworkId, NetworkId, SandboxNetworkId, TestnetNetworkId } from "../types/network"; | ||
|
||
export const MAINNET_ID: MainnetNetworkId = "mainnet"; | ||
export const SANDBOX_ID: SandboxNetworkId = "sandbox"; | ||
export const TESTNET_ID: TestnetNetworkId = "testnet"; | ||
|
||
export const USDC_IBC_DENOMS: Record<NetworkId, string> = { | ||
[MAINNET_ID]: "ibc/170C677610AC31DF0904FFE09CD3B5C657492170E7E52372E48756B71E56F2F1", | ||
[SANDBOX_ID]: "ibc/12C6A0C374171B595A0A9E18B83FA09D295FB1F2D8C6DAA3AC28683471752D84", | ||
[TESTNET_ID]: "" | ||
}; |
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,12 @@ | ||
export class CustomValidationError extends Error { | ||
static assert(condition: boolean, message: string): asserts condition { | ||
if (!condition) { | ||
throw new CustomValidationError(message); | ||
} | ||
} | ||
|
||
constructor(message: string) { | ||
super(message); | ||
this.name = "CustomValidationError"; | ||
} | ||
} |
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 @@ | ||
export * from "./CustomValidationError"; |
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,4 @@ | ||
export type MainnetNetworkId = "mainnet"; | ||
export type TestnetNetworkId = "testnet"; | ||
export type SandboxNetworkId = "sandbox"; | ||
export type NetworkId = MainnetNetworkId | TestnetNetworkId | SandboxNetworkId; |