Skip to content

Commit 29c564f

Browse files
committed
Remove unused function and commented functions
1 parent c54d8b6 commit 29c564f

4 files changed

+0
-115
lines changed

src/txFactory/credentialRegistryTransactionFactory.ts

-18
Original file line numberDiff line numberDiff line change
@@ -78,24 +78,6 @@ export function getSubjectCredentialStatus(
7878
return transaction
7979
}
8080

81-
/**
82-
* function getSubjectCredentialList(web3, subject)
83-
* Dev: get invoke getSubjectCredentialList transaction object
84-
* @param web3 ethereum connection
85-
* @param didSubject subject to recover credential list
86-
*/
87-
// export function getSubjectCredentialList(web3, didSubject) {
88-
// const subjectAddr = AIdUtils.getProxyAddress(didSubject)
89-
// const transaction = Object.assign({}, config.basicTransaction)
90-
// transaction.data = web3.eth.abi.encodeFunctionCall(
91-
// config.contractsAbi.AlastriaCredentialRegistry.getSubjectCredentialList,
92-
// [subjectAddr]
93-
// )
94-
// transaction.to = config.alastriaCredentialRegistry
95-
// transaction.gasLimit = 600000
96-
// return transaction
97-
// }
98-
9981
/**
10082
* function updateCredentialStatus(web3, issuerCredentialHash, status)
10183
* @param web3

src/txFactory/presentationRegistryTransactionFactory.ts

-17
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,6 @@ export function getSubjectPresentationStatus(
6060
return transaction
6161
}
6262

63-
/**
64-
* function getSubjectPresentationList(address subject) public view returns(uint, bytes32[])
65-
* @param web3
66-
* @param didSubject
67-
*/
68-
/** export function getSubjectPresentationList(web3, didSubject) {
69-
const subjectAddr = AIdUtils.getProxyAddress(didSubject)
70-
const transaction = Object.assign({}, config.basicTransaction)
71-
transaction.data = web3.eth.abi.encodeFunctionCall(
72-
config.contractsAbi.AlastriaPresentationRegistry.getSubjectPresentationList,
73-
[subjectAddr]
74-
)
75-
transaction.to = config.alastriaPresentationRegistry
76-
transaction.gasLimit = 600000
77-
return transaction
78-
} */
79-
8063
/**
8164
* Receiver functions
8265
* function updateReceiverPresentation(bytes32 receiverPresentationHash, Status status) public validStatus(status)

src/txFactory/publicKeyRegistryTransactionFactory.ts

-76
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { config } from '../config'
2-
import { transactionFactory } from './transactionFactory'
32
import { AIdUtils } from '../utils/AIdUtils'
4-
import { PublicKeyStatus } from '../interfaces'
53
import { AddressUtils } from '../utils/AddressUtils'
64

75
/**
@@ -156,80 +154,6 @@ export function getPublicKeyStatusHash(web3, did, publicKeyHash) {
156154
return transaction
157155
}
158156

159-
/**
160-
* @param web3
161-
* @param did
162-
* @param publicKeyHash
163-
*/
164-
export function getPublicKeyStatusDecodedAsJSON(
165-
web3,
166-
did,
167-
publicKeyHash
168-
): Promise<PublicKeyStatus> {
169-
const publicKeyStatusTx = getPublicKeyStatus(web3, did, publicKeyHash)
170-
171-
return new Promise((resolve) => {
172-
web3.eth.call(publicKeyStatusTx).then((data) => {
173-
const publicKeyStatusDecoded = web3.eth.abi.decodeParameters(
174-
['bool', 'uint8', 'uint', 'uint'],
175-
data
176-
)
177-
const publicKeyStatusDecodedAsJSON = {
178-
exists: publicKeyStatusDecoded['0'],
179-
status: publicKeyStatusDecoded['1'],
180-
startDate: parseInt(publicKeyStatusDecoded['2']),
181-
endDate: parseInt(publicKeyStatusDecoded['3'])
182-
}
183-
resolve(publicKeyStatusDecodedAsJSON)
184-
})
185-
})
186-
}
187-
188-
/**
189-
* @param web3
190-
* @param did
191-
* @param publicKeyHash
192-
* @param date in milliseconds
193-
*/
194-
export function isPublicKeyValidForDate(web3, did, publicKeyHash, date) {
195-
publicKeyHash = AddressUtils.getAddressWithHexPrefix(publicKeyHash)
196-
return new Promise((resolve, reject) => {
197-
transactionFactory.publicKeyRegistry
198-
.getPublicKeyStatusDecodedAsJSON(web3, did, publicKeyHash)
199-
.then((publicKeyStatusAsJSON) => {
200-
const existsPublicKey = publicKeyStatusAsJSON.exists
201-
202-
if (existsPublicKey) {
203-
const isUserDateBetweenDates = _isUserDateBetweeenDates(
204-
date,
205-
publicKeyStatusAsJSON.startDate,
206-
publicKeyStatusAsJSON.endDate
207-
)
208-
resolve(isUserDateBetweenDates)
209-
} else {
210-
reject(new Error('Public key does not exist'))
211-
}
212-
})
213-
.catch(() => {
214-
reject(new Error('Unresolved error'))
215-
})
216-
})
217-
}
218-
219-
/**
220-
* @param userDate in milliseconds
221-
* @param publicKeyStartDate in milliseconds
222-
* @param publicKeyEndDate in milliseconds. If equals to 0, there is no enddate
223-
*/
224-
function _isUserDateBetweeenDates(
225-
userDate,
226-
publicKeyStartDate,
227-
publicKeyEndDate
228-
) {
229-
if (publicKeyStartDate && publicKeyEndDate === 0) return true
230-
else return userDate >= publicKeyStartDate && userDate <= publicKeyEndDate
231-
}
232-
233157
function delegated(web3, delegatedData) {
234158
return web3.eth.abi.encodeFunctionCall(
235159
config.contractsAbi.AlastriaIdentityManager.delegateCall,

src/txFactory/transactionFactory.ts

-4
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ import {
5353
getCurrentPublicKey,
5454
getPublicKeyStatus,
5555
getPublicKeyStatusHash,
56-
getPublicKeyStatusDecodedAsJSON,
57-
isPublicKeyValidForDate,
5856
} from './publicKeyRegistryTransactionFactory'
5957

6058
export const transactionFactory = {
@@ -109,7 +107,5 @@ export const transactionFactory = {
109107
getCurrentPublicKey: getCurrentPublicKey,
110108
getPublicKeyStatus: getPublicKeyStatus,
111109
getPublicKeyStatusHash: getPublicKeyStatusHash,
112-
getPublicKeyStatusDecodedAsJSON: getPublicKeyStatusDecodedAsJSON,
113-
isPublicKeyValidForDate: isPublicKeyValidForDate,
114110
}
115111
}

0 commit comments

Comments
 (0)