Skip to content

Commit 3669164

Browse files
committed
refactor: rewrite POINTER_KEY_BY_PREFIX to enum
1 parent 5fdb80e commit 3669164

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/tx/builder/constants.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ export const NAME_BID_TIMEOUT_BLOCKS = 480 // # ~1 day
1919
// # this is the max length for a domain that requires a base fee to be paid
2020
export const NAME_MAX_LENGTH_FEE = 31
2121
export const NAME_BID_MAX_LENGTH = 12 // # this is the max length for a domain to be part of a bid
22-
export const POINTER_KEY_BY_PREFIX = {
23-
ak: 'account_pubkey',
24-
ok: 'oracle_pubkey',
25-
ct: 'contract_pubkey',
26-
ch: 'channel'
27-
} as const
22+
export enum POINTER_KEY_BY_PREFIX {
23+
ak = 'account_pubkey',
24+
ok = 'oracle_pubkey',
25+
ct = 'contract_pubkey',
26+
ch = 'channel'
27+
}
2828
// # https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L290
2929
// # https://github.com/aeternity/protocol/blob/master/AENS.md#protocol-fees-and-protection-times
3030
// # bid ranges:

src/tx/builder/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ export function isNameValid (name: string): boolean {
203203
*/
204204
export function getDefaultPointerKey (
205205
identifier: EncodedData<keyof typeof POINTER_KEY_BY_PREFIX>
206-
): typeof POINTER_KEY_BY_PREFIX[keyof typeof POINTER_KEY_BY_PREFIX] {
207-
decode(identifier as any)
206+
): POINTER_KEY_BY_PREFIX {
207+
decode(identifier)
208208
const prefix = identifier.substring(0, 2) as keyof typeof POINTER_KEY_BY_PREFIX
209209
return POINTER_KEY_BY_PREFIX[prefix]
210210
}

0 commit comments

Comments
 (0)