Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/statics/src/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ export interface AccountNetwork extends BaseNetwork {
readonly blockExplorerUrl?: string;
// bech32 HRP for chains that use one (e.g. Cosmos-family coins)
readonly addressPrefix?: string;
// Literal prefix shared by every address on the network, with no checksum or encoding
// (e.g. Hedera account IDs `0.0.<num>`: shard.realm). NOT a bech32 HRP, see addressPrefix.
readonly constantAddressPrefix?: string;
}

export interface CosmosNetwork extends AccountNetwork {
Expand Down Expand Up @@ -950,12 +953,14 @@ class Hedera extends Mainnet implements AccountNetwork {
name = 'Hedera';
family = CoinFamily.HBAR;
explorerUrl = 'https://hashscan.io/mainnet/transaction/';
constantAddressPrefix = '0.0.';
}

class HederaTestnet extends Testnet implements AccountNetwork {
name = 'HederaTestnet';
family = CoinFamily.HBAR;
explorerUrl = 'https://testnet.dragonglass.me/hedera/search?q=';
constantAddressPrefix = '0.0.';
}

class Litecoin extends Mainnet implements UtxoNetwork {
Expand Down
16 changes: 16 additions & 0 deletions modules/statics/test/unit/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,22 @@ describe('Cosmos-family addressPrefix', function () {
}
});

describe('Hedera constantAddressPrefix', function () {
// shard.realm prefix of every Hedera account ID (0.0.<num>), asserted per network.
for (const [label, network] of [
['main.hedera', Networks.main.hedera],
['test.hedera', Networks.test.hedera],
] as const) {
it(`Networks.${label} has constantAddressPrefix '0.0.'`, function () {
network.should.have.property('constantAddressPrefix', '0.0.');
});

it(`Networks.${label} leaves the bech32 addressPrefix unset`, function () {
network.should.not.have.property('addressPrefix');
});
}
});

describe('Polymesh (POLYX) v8 network fields', function () {
it('mainnet has v8SpecVersion and v8TxVersion', function () {
const network: PolyxNetwork = Networks.main.polyx as PolyxNetwork;
Expand Down
Loading