-
Notifications
You must be signed in to change notification settings - Fork 1
/
Ens.kt
38 lines (32 loc) · 1.06 KB
/
Ens.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package ens
import io.polywrap.configBuilder.polywrapClient
import io.polywrap.core.resolution.Uri
import kotlin.test.Test
import kotlin.test.assertTrue
class Ens {
private val uri = Uri("ipfs/QmQS8cr21euKYW7hWAhiSYXgvdcAtbPbynKqRW2CzAJPYe")
private val client = polywrapClient {
addDefaults()
setRedirect("ens/wraps.eth:[email protected]" to "plugin/[email protected]")
}
@Test
fun getContentHash() {
val resolverAddress = client.invoke<String>(
uri = uri,
method = "getResolver",
args = mapOf(
"registryAddress" to "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
"domain" to "vitalik.eth"
)
).getOrThrow()
val contentHash = client.invoke<String>(
uri = uri,
method = "getContentHash",
args = mapOf(
"domain" to "vitalik.eth",
"resolverAddress" to resolverAddress
)
).getOrThrow()
assertTrue(contentHash.startsWith("0xe3010170"))
}
}