generated from PolymeshAssociation/typescript-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 馃幐 export typeguards for every Entity
They are now exported from `/utils` BREAKING CHANGE: 馃Ж move `isEntity` and `isPolymeshError` from `/types` to `/utils`
- Loading branch information
Showing
9 changed files
with
191 additions
and
73 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
/* istanbul ignore file */ | ||
|
||
export { tickerToDid, isCusipValid, isLeiValid, isIsinValid, txGroupToTxTags } from './conversion'; | ||
export * from './typeguards'; | ||
export { cryptoWaitReady } from '@polkadot/util-crypto'; |
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,158 @@ | ||
/* istanbul ignore file */ | ||
|
||
import { | ||
Account, | ||
AuthorizationRequest, | ||
Checkpoint, | ||
CheckpointSchedule, | ||
CorporateAction, | ||
CustomPermissionGroup, | ||
DefaultPortfolio, | ||
DefaultTrustedClaimIssuer, | ||
DividendDistribution, | ||
Entity, | ||
Identity, | ||
Instruction, | ||
KnownPermissionGroup, | ||
NumberedPortfolio, | ||
PolymeshError, | ||
SecurityToken, | ||
Sto, | ||
TickerReservation, | ||
Venue, | ||
} from '~/internal'; | ||
|
||
/** | ||
* Return whether value is an Entity | ||
*/ | ||
export function isEntity<Identifiers = unknown, HumanReadable = unknown>( | ||
value: unknown | ||
): value is Entity<Identifiers, HumanReadable> { | ||
return value instanceof Entity; | ||
} | ||
|
||
/** | ||
* Return whether value is an Account | ||
*/ | ||
export function isAccount(value: unknown): value is Account { | ||
return value instanceof Account; | ||
} | ||
|
||
/** | ||
* Return whether value is an AuthorizationRequest | ||
*/ | ||
export function isAuthorizationRequest(value: unknown): value is AuthorizationRequest { | ||
return value instanceof AuthorizationRequest; | ||
} | ||
|
||
/** | ||
* Return whether value is a Checkpoint | ||
*/ | ||
export function isCheckpoint(value: unknown): value is Checkpoint { | ||
return value instanceof Checkpoint; | ||
} | ||
|
||
/** | ||
* Return whether value is a CheckpointSchedule | ||
*/ | ||
export function isCheckpointSchedule(value: unknown): value is CheckpointSchedule { | ||
return value instanceof CheckpointSchedule; | ||
} | ||
|
||
/** | ||
* Return whether value is a CorporateAction | ||
*/ | ||
export function isCorporateAction(value: unknown): value is CorporateAction { | ||
return value instanceof CorporateAction; | ||
} | ||
|
||
/** | ||
* Return whether value is a CustomPermissionGroup | ||
*/ | ||
export function isCustomPermissionGroup(value: unknown): value is CustomPermissionGroup { | ||
return value instanceof CustomPermissionGroup; | ||
} | ||
|
||
/** | ||
* Return whether value is a DefaultPortfolio | ||
*/ | ||
export function isDefaultPortfolio(value: unknown): value is DefaultPortfolio { | ||
return value instanceof DefaultPortfolio; | ||
} | ||
|
||
/** | ||
* Return whether value is a DefaultTrustedClaimIssuer | ||
*/ | ||
export function isDefaultTrustedClaimIssuer(value: unknown): value is DefaultTrustedClaimIssuer { | ||
return value instanceof DefaultTrustedClaimIssuer; | ||
} | ||
|
||
/** | ||
* Return whether value is a DividendDistribution | ||
*/ | ||
export function isDividendDistribution(value: unknown): value is DividendDistribution { | ||
return value instanceof DividendDistribution; | ||
} | ||
|
||
/** | ||
* Return whether value is an Identity | ||
*/ | ||
export function isIdentity(value: unknown): value is Identity { | ||
return value instanceof Identity; | ||
} | ||
|
||
/** | ||
* Return whether value is an Instruction | ||
*/ | ||
export function isInstruction(value: unknown): value is Instruction { | ||
return value instanceof Instruction; | ||
} | ||
|
||
/** | ||
* Return whether value is a KnownPermissionGroup | ||
*/ | ||
export function isKnownPermissionGroup(value: unknown): value is KnownPermissionGroup { | ||
return value instanceof KnownPermissionGroup; | ||
} | ||
|
||
/** | ||
* Return whether value is a NumberedPortfolio | ||
*/ | ||
export function isNumberedPortfolio(value: unknown): value is NumberedPortfolio { | ||
return value instanceof NumberedPortfolio; | ||
} | ||
|
||
/** | ||
* Return whether value is a SecurityToken | ||
*/ | ||
export function isSecurityToken(value: unknown): value is SecurityToken { | ||
return value instanceof SecurityToken; | ||
} | ||
|
||
/** | ||
* Return whether value is an Sto | ||
*/ | ||
export function isSto(value: unknown): value is Sto { | ||
return value instanceof Sto; | ||
} | ||
|
||
/** | ||
* Return whether value is a TickerReservation | ||
*/ | ||
export function isTickerReservation(value: unknown): value is TickerReservation { | ||
return value instanceof TickerReservation; | ||
} | ||
|
||
/** | ||
* Return whether value is a Venue | ||
*/ | ||
export function isVenue(value: unknown): value is Venue { | ||
return value instanceof Venue; | ||
} | ||
|
||
/** | ||
* Return whether value is a PolymeshError | ||
*/ | ||
export function isPolymeshError(value: unknown): value is PolymeshError { | ||
return value instanceof PolymeshError; | ||
} |