Skip to content

Commit f93d162

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

5 files changed

Lines changed: 21 additions & 0 deletions

File tree

examples/js/.DS_Store

-6 KB
Binary file not shown.

modules/abstract-utxo/.DS_Store

-6 KB
Binary file not shown.

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,12 @@ export { Utils, default as utils } from './utils';
2525
export * from './iface';
2626

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