Skip to content

Commit 3bdfbc1

Browse files
committed
Create new function getCurrentPublicKeyHash
1 parent 7d56a55 commit 3bdfbc1

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/txFactory/publicKeyRegistryTransactionFactory.ts

+18-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export function deletePublicKeyHash(web3, publicKeyHash) {
105105
}
106106

107107
/**
108-
* function getCurrentPublicKey(address subject) view public validAddress(subject) returns (string)
108+
* THIS METHOD WILL BE DEPREATED
109109
* @param web3
110110
* @param did
111111
*/
@@ -121,6 +121,23 @@ export function getCurrentPublicKey(web3, did) {
121121
return transaction
122122
}
123123

124+
/**
125+
* @param web3
126+
* @param did
127+
* @param publicKeyHash
128+
*/
129+
export function getCurrentPublicKeyHash(web3, did, publicKeyHash) {
130+
const subjectAddr = AIdUtils.getProxyAddress(did)
131+
const transaction = Object.assign({}, config.basicTransaction)
132+
transaction.data = web3.eth.abi.encodeFunctionCall(
133+
config.contractsAbi.AlastriaPublicKeyRegistry.getCurrentPublicKey,
134+
[subjectAddr, publicKeyHash]
135+
)
136+
transaction.to = config.alastriaPublicKeyRegistry
137+
transaction.gasLimit = 600000
138+
return transaction
139+
}
140+
124141
/**
125142
* THIS METHOD WILL BE DEPREATED
126143
* @param web3

src/txFactory/transactionFactory.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ import {
5656
getPublicKeyStatusHash,
5757
deletePublicKeyHash,
5858
revokePublicKeyHash,
59-
addPublicKey
59+
addPublicKey,
60+
getCurrentPublicKeyHash
6061
} from './publicKeyRegistryTransactionFactory'
6162

6263
export const transactionFactory = {
@@ -109,6 +110,7 @@ export const transactionFactory = {
109110
deletePublicKey: deletePublicKey,
110111
deletePublicKeyHash: deletePublicKeyHash,
111112
getCurrentPublicKey: getCurrentPublicKey,
113+
getCurrentPublicKeyHash: getCurrentPublicKeyHash,
112114
getPublicKeyStatus: getPublicKeyStatus,
113115
getPublicKeyStatusHash: getPublicKeyStatusHash,
114116
getPublicKeyStatusDecodedAsJSON: getPublicKeyStatusDecodedAsJSON,

0 commit comments

Comments
 (0)