Skip to content

Commit 1c058e8

Browse files
committed
chore(sdk-coin-polyx): export utils for UI
Ticket: WIN-8664 TICKET: WIN-8664
1 parent f3704ad commit 1c058e8

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

modules/sdk-coin-polyx/src/lib/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,17 @@ export { BatchStakingBuilder as BatchBuilder } from './batchStakingBuilder';
2121
export { BatchUnstakingBuilder } from './batchUnstakingBuilder';
2222
export { UnbondBuilder } from './unbondBuilder';
2323
export { WithdrawUnbondedBuilder } from './withdrawUnbondedBuilder';
24+
import polyxUtils from './utils';
2425
export { Utils, default as utils } from './utils';
2526
export * from './iface';
2627

2728
export { BondArgs, NominateArgs, BatchCallObject, BatchArgs } from './iface';
29+
30+
/**
31+
* Checks if a string is a valid Polymesh DID (Decentralized Identifier)
32+
* DIDs are 32-byte hex strings (0x prefix + 64 hex characters)
33+
*
34+
* @param {string} did - The string to validate
35+
* @returns {boolean} true if valid DID format, false otherwise
36+
*/
37+
export const isValidDid = (did: string): boolean => polyxUtils.isValidDid(did);

modules/sdk-coin-polyx/src/lib/utils.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ export class Utils extends SubstrateUtils {
1717
return isMainnet ? 12 : 42;
1818
}
1919

20+
/**
21+
* Checks if a string is a valid Polymesh DID (Decentralized Identifier)
22+
* DIDs are 32-byte hex strings (0x prefix + 64 hex characters)
23+
*
24+
* @param {string} did - The string to validate
25+
* @returns {boolean} true if valid DID format, false otherwise
26+
*/
27+
isValidDid(did: string): boolean {
28+
return /^0x[a-fA-F0-9]{64}$/.test(did);
29+
}
30+
2031
getMaterial(networkType: NetworkType): Interface.Material {
2132
return (networkType === NetworkType.MAINNET ? mainnetMaterial : testnetMaterial) as unknown as Interface.Material;
2233
}

modules/statics/src/coinFeatures.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ export const POLYX_FEATURES = [
653653
CoinFeature.STAKING,
654654
CoinFeature.SUPPORTS_TOKENS,
655655
CoinFeature.STUCK_TRANSACTION_MANAGEMENT_TSS,
656+
CoinFeature.ALTERNATIVE_ADDRESS_IDENTIFIER,
656657
];
657658

658659
export const POLYX_TOKEN_FEATURES = [

0 commit comments

Comments
 (0)