Skip to content

Commit 5a54655

Browse files
committed
Remove unnecessary functions
1 parent 8e9fc2e commit 5a54655

File tree

2 files changed

+2
-68
lines changed

2 files changed

+2
-68
lines changed

src/txFactory/publicKeyRegistryTransactionFactory.ts

+2-64
Original file line numberDiff line numberDiff line change
@@ -156,42 +156,12 @@ export function getPublicKeyStatusHash(web3, did, publicKeyHash) {
156156
return transaction
157157
}
158158

159-
/**
160-
* THIS METHOD WILL BE DEPREATED
161-
* @param web3
162-
* @param did
163-
* @param publicKey
164-
*/
165-
export function getPublicKeyStatusDecodedAsJSON(
166-
web3,
167-
did,
168-
publicKey
169-
): Promise<PublicKeyStatus> {
170-
const publicKeyStatusTx = getPublicKeyStatus(web3, did, publicKey)
171-
172-
return new Promise((resolve) => {
173-
web3.eth.call(publicKeyStatusTx).then((data) => {
174-
const publicKeyStatusDecoded = web3.eth.abi.decodeParameters(
175-
['bool', 'uint8', 'uint', 'uint'],
176-
data
177-
)
178-
const publicKeyStatusDecodedAsJSON = {
179-
exists: publicKeyStatusDecoded['0'],
180-
status: publicKeyStatusDecoded['1'],
181-
startDate: parseInt(publicKeyStatusDecoded['2']),
182-
endDate: parseInt(publicKeyStatusDecoded['3'])
183-
}
184-
resolve(publicKeyStatusDecodedAsJSON)
185-
})
186-
})
187-
}
188-
189159
/**
190160
* @param web3
191161
* @param did
192162
* @param publicKeyHash
193163
*/
194-
export function getPublicKeyStatusDecodedAsJSONHash(
164+
export function getPublicKeyStatusDecodedAsJSON(
195165
web3,
196166
did,
197167
publicKeyHash
@@ -215,45 +185,13 @@ export function getPublicKeyStatusDecodedAsJSONHash(
215185
})
216186
}
217187

218-
/**
219-
* THIS METHOD WILL BE DEPREATED
220-
* @param web3
221-
* @param did
222-
* @param publicKey
223-
* @param date in milliseconds
224-
*/
225-
export function isPublicKeyValidForDate(web3, did, publicKey, date) {
226-
publicKey = AddressUtils.getAddressWithHexPrefix(publicKey)
227-
return new Promise((resolve, reject) => {
228-
transactionFactory.publicKeyRegistry
229-
.getPublicKeyStatusDecodedAsJSON(web3, did, publicKey)
230-
.then((publicKeyStatusAsJSON) => {
231-
const existsPublicKey = publicKeyStatusAsJSON.exists
232-
233-
if (existsPublicKey) {
234-
const isUserDateBetweenDates = _isUserDateBetweeenDates(
235-
date,
236-
publicKeyStatusAsJSON.startDate,
237-
publicKeyStatusAsJSON.endDate
238-
)
239-
resolve(isUserDateBetweenDates)
240-
} else {
241-
reject(new Error('Public key does not exist'))
242-
}
243-
})
244-
.catch(() => {
245-
reject(new Error('Unresolved error'))
246-
})
247-
})
248-
}
249-
250188
/**
251189
* @param web3
252190
* @param did
253191
* @param publicKeyHash
254192
* @param date in milliseconds
255193
*/
256-
export function isPublicKeyValidForDateHash(web3, did, publicKeyHash, date) {
194+
export function isPublicKeyValidForDate(web3, did, publicKeyHash, date) {
257195
publicKeyHash = AddressUtils.getAddressWithHexPrefix(publicKeyHash)
258196
return new Promise((resolve, reject) => {
259197
transactionFactory.publicKeyRegistry

src/txFactory/transactionFactory.ts

-4
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ import {
5454
getPublicKeyStatus,
5555
getPublicKeyStatusHash,
5656
getPublicKeyStatusDecodedAsJSON,
57-
getPublicKeyStatusDecodedAsJSONHash,
5857
isPublicKeyValidForDate,
59-
isPublicKeyValidForDateHash,
6058
} from './publicKeyRegistryTransactionFactory'
6159

6260
export const transactionFactory = {
@@ -112,8 +110,6 @@ export const transactionFactory = {
112110
getPublicKeyStatus: getPublicKeyStatus,
113111
getPublicKeyStatusHash: getPublicKeyStatusHash,
114112
getPublicKeyStatusDecodedAsJSON: getPublicKeyStatusDecodedAsJSON,
115-
getPublicKeyStatusDecodedAsJSONHash: getPublicKeyStatusDecodedAsJSONHash,
116113
isPublicKeyValidForDate: isPublicKeyValidForDate,
117-
isPublicKeyValidForDateHash: isPublicKeyValidForDateHash
118114
}
119115
}

0 commit comments

Comments
 (0)