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.} =
|
proc registerENS(self: EnsManager, username: string, password: string) {.slot.} =
|
||||||
let pubKey = status_settings.getSetting[string](Setting.PublicKey, "0x0")
|
let pubKey = status_settings.getSetting[string](Setting.PublicKey, "0x0")
|
||||||
let address = parseAddress(status_wallet.getWalletAccounts()[0].address)
|
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)
|
self.connect(username, true)
|
||||||
|
|
||||||
proc setPubKey(self: EnsManager, username: string, password: string) {.slot.} =
|
proc setPubKey(self: EnsManager, username: string, password: string) {.slot.} =
|
||||||
|
|
|
@ -36,6 +36,11 @@ proc userNameOrAlias*(contact: Profile, removeSuffix: bool = false): string =
|
||||||
else:
|
else:
|
||||||
result = contact.alias
|
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 =
|
proc namehash*(ensName:string): string =
|
||||||
let name = ensName.toLower()
|
let name = ensName.toLower()
|
||||||
var node:array[32, byte]
|
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])
|
result = ("0x" & pubkey[4..67], "0x" & pubkey[68..131])
|
||||||
|
|
||||||
proc registerUsername*(username:string, address: EthAddress, pubKey: string, password: string): string =
|
proc registerUsername*(username:string, address: EthAddress, pubKey: string, password: string): string =
|
||||||
|
echo username, "................."
|
||||||
let
|
let
|
||||||
label = fromHex(FixedBytes[32], namehash(addDomain(username)))
|
label = fromHex(FixedBytes[32], label(username))
|
||||||
coordinates = extractCoordinates(pubkey)
|
coordinates = extractCoordinates(pubkey)
|
||||||
x = fromHex(FixedBytes[32], coordinates.x)
|
x = fromHex(FixedBytes[32], coordinates.x)
|
||||||
y = fromHex(FixedBytes[32], coordinates.y)
|
y = fromHex(FixedBytes[32], coordinates.y)
|
||||||
|
|
|
@ -96,7 +96,7 @@ proc allContracts(): seq[Contract] = @[
|
||||||
("getPrice", Method(signature: "getPrice()"))
|
("getPrice", Method(signature: "getPrice()"))
|
||||||
].toTable
|
].toTable
|
||||||
),
|
),
|
||||||
Contract(name: "ens-usernames", network: Network.Testnet, address: parseAddress("0x11d9F481effd20D76cEE832559bd9Aca25405841"),
|
Contract(name: "ens-usernames", network: Network.Testnet, address: parseAddress("0x76fbf2815ead80006d07a64c1fd5dc9964ab3c93"),
|
||||||
methods: [
|
methods: [
|
||||||
("register", Method(signature: "register(bytes32,address,bytes32,bytes32)")),
|
("register", Method(signature: "register(bytes32,address,bytes32,bytes32)")),
|
||||||
("getPrice", Method(signature: "getPrice()"))
|
("getPrice", Method(signature: "getPrice()"))
|
||||||
|
|
Loading…
Reference in New Issue