Skip to content

Commit

Permalink
lint: add spaces for readability, rename type
Browse files Browse the repository at this point in the history
  • Loading branch information
TravellerOnTheRun committed Feb 6, 2024
1 parent 791475d commit 5ec2145
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/rns/RnsProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Wallet } from 'shared/wallet'

import { RelayWallet } from '../relayWallet'

interface IDomainRegistrationProcess {
interface DomainRegistrationProcess {
domain: string
secret: string
hash: string
Expand All @@ -37,7 +37,7 @@ export enum DomainRegistrationEnum {
}

export interface IDomainRegistrationProcessIndex {
[domain: string]: IDomainRegistrationProcess
[domain: string]: DomainRegistrationProcess
}

export class RnsProcessor {
Expand Down Expand Up @@ -70,7 +70,7 @@ export class RnsProcessor {
}
private setIndex = (
domain: string,
domainRegistrationProcess: IDomainRegistrationProcess,
domainRegistrationProcess: DomainRegistrationProcess,
) => {
this.index[domain] = domainRegistrationProcess
saveRnsProcessIndex(this.index)
Expand Down Expand Up @@ -239,7 +239,7 @@ export class RnsProcessor {
}
}
}
public getStatus = (domain: string): IDomainRegistrationProcess => {
public getStatus = (domain: string): DomainRegistrationProcess => {
return this.index[domain]
}
}
9 changes: 9 additions & 0 deletions src/redux/slices/profileSlice/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@ export const requestUsername = createAsyncThunk(
}
thunkAPI.dispatch(setAlias(`${alias}.rsk`))
thunkAPI.dispatch(setDuration(duration))

let indexStatus = rnsProcessor.getStatus(alias)

if (!indexStatus?.commitmentRequested) {
thunkAPI.dispatch(setStatus(ProfileStatus.WAITING_FOR_USER_COMMIT))
await rnsProcessor.process(alias, duration)
thunkAPI.dispatch(setStatus(ProfileStatus.REQUESTING))
}

indexStatus = rnsProcessor.getStatus(alias)

if (indexStatus.commitmentRequested) {
return await commitment(
rnsProcessor,
Expand All @@ -75,9 +79,11 @@ export const purchaseUsername = createAsyncThunk(
async ({ domain, getRnsProcessor }: PurchaseUsername, thunkAPI) => {
try {
const rnsProcessor = getRnsProcessor()

if (!rnsProcessor) {
return thunkAPI.rejectWithValue('No RNS Processor created')
}

return await rnsProcessor.register(domain)
} catch (err) {
return thunkAPI.rejectWithValue(err)
Expand All @@ -90,11 +96,14 @@ export const deleteRnsProcess = createAsyncThunk(
async ({ getRnsProcessor, domain }: DeleteRnsProcess, thunkAPI) => {
try {
const rnsProcessor = getRnsProcessor()

if (!rnsProcessor) {
return thunkAPI.rejectWithValue('No RNS Processor created')
}

rnsProcessor.deleteRnsProcess(domain)
thunkAPI.dispatch(deleteProfile())

return true
} catch (err) {
thunkAPI.rejectWithValue(err)
Expand Down

0 comments on commit 5ec2145

Please sign in to comment.