fix: update contract address on ropsten and use label instead of namehash
This commit is contained in:
parent
7d4c4ac4c7
commit
8bf2e394c6
|
@ -148,7 +148,7 @@ QtObject:
|
|||
proc registerENS(self: EnsManager, username: string, password: string) {.slot.} =
|
||||
let pubKey = status_settings.getSetting[string](Setting.PublicKey, "0x0")
|
||||
let address = parseAddress(status_wallet.getWalletAccounts()[0].address)
|
||||
discard registerUsername(username & status_ens.domain, address, pubKey, password)
|
||||
discard registerUsername(username, address, pubKey, password)
|
||||
self.connect(username, true)
|
||||
|
||||
proc setPubKey(self: EnsManager, username: string, password: string) {.slot.} =
|
||||
|
|
|
@ -36,6 +36,11 @@ proc userNameOrAlias*(contact: Profile, removeSuffix: bool = false): string =
|
|||
else:
|
||||
result = contact.alias
|
||||
|
||||
proc label*(username:string): string =
|
||||
let name = username.toLower()
|
||||
var node:array[32, byte] = keccak_256.digest(username).data
|
||||
result = "0x" & node.toHex()
|
||||
|
||||
proc namehash*(ensName:string): string =
|
||||
let name = ensName.toLower()
|
||||
var node:array[32, byte]
|
||||
|
@ -137,8 +142,9 @@ proc extractCoordinates*(pubkey: string):tuple[x: string, y:string] =
|
|||
result = ("0x" & pubkey[4..67], "0x" & pubkey[68..131])
|
||||
|
||||
proc registerUsername*(username:string, address: EthAddress, pubKey: string, password: string): string =
|
||||
echo username, "................."
|
||||
let
|
||||
label = fromHex(FixedBytes[32], namehash(addDomain(username)))
|
||||
label = fromHex(FixedBytes[32], label(username))
|
||||
coordinates = extractCoordinates(pubkey)
|
||||
x = fromHex(FixedBytes[32], coordinates.x)
|
||||
y = fromHex(FixedBytes[32], coordinates.y)
|
||||
|
|
|
@ -96,7 +96,7 @@ proc allContracts(): seq[Contract] = @[
|
|||
("getPrice", Method(signature: "getPrice()"))
|
||||
].toTable
|
||||
),
|
||||
Contract(name: "ens-usernames", network: Network.Testnet, address: parseAddress("0x11d9F481effd20D76cEE832559bd9Aca25405841"),
|
||||
Contract(name: "ens-usernames", network: Network.Testnet, address: parseAddress("0x76fbf2815ead80006d07a64c1fd5dc9964ab3c93"),
|
||||
methods: [
|
||||
("register", Method(signature: "register(bytes32,address,bytes32,bytes32)")),
|
||||
("getPrice", Method(signature: "getPrice()"))
|
||||
|
|
Loading…
Reference in New Issue