You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part of KILTprotocol/ticket#3650, based on top
of #784. Last bit of
required functionality.
## Features
* Since it's not possible to batch multiple runtime API calls, I
introduced a `batch_` version for our old `did` runtime API, which
allows to do batching instead of firing one request per lookup
* Similarly to that, I introduced a new runtime API (since it's not
possible to implement the same API twice for the same runtime), which
resolves an account given a name, or a name given an account. This new
API also provides a batched version to resolve multiple names or
addresses at once. This was one of the requirements we got from Parity
to make the solution easier to integrate in the mobile app
## How to test
Polkadot Apps support new runtime APIs out of the box. So just compile
Peregrine or Spiritnet runtime and spin up a network with Chopsticks.
Then:
1. Create a new account-controlled DID. For the Sudo key, use this call
`0x401003921cbc0ffe09a865dbf4ae1d0410aa17c656881fe86666da0f97939e3701b674`
2. Claim a new dotname. For the Sudo key, use this call
`0x400f921cbc0ffe09a865dbf4ae1d0410aa17c656881fe86666da0f97939e3701b674490020746573742e646f74`
3. Link the Sudo account to the DID. Use this call
`0x400f921cbc0ffe09a865dbf4ae1d0410aa17c656881fe86666da0f97939e3701b6744a01`
4. Call the runtime API `uniqueLinking.addressForName("test.dot")` which
should return
```
{
Ok: {
address: {
AccountId32: 4rDeMGr3Hi4NfxRUp8qVyhvgW3BSUBLneQisGa9ASkhh2sXB
}
extra: 4rDeMGr3Hi4NfxRUp8qVyhvgW3BSUBLneQisGa9ASkhh2sXB
}
}
```
5. Call the runtime API `uniqueLinking.nameForAddress({AccountId32:
"4rDeMGr3Hi4NfxRUp8qVyhvgW3BSUBLneQisGa9ASkhh2sXB"})` which should
return
```
{
Ok: {
name: test.dot
extra: 4rDeMGr3Hi4NfxRUp8qVyhvgW3BSUBLneQisGa9ASkhh2sXB
}
}
```
/// Allows for batching multiple `query_by_web3_name` requests into one. For each requested name, the corresponding vector entry contains either `Some` or `None` depending on the result of each query.
/// Allows for batching multiple `query_by_account` requests into one. For each requested name, the corresponding vector entry contains either `Some` or `None` depending on the result of each query.
/// Allows for batching multiple `query` requests into one. For each requested name, the corresponding vector entry contains either `Some` or `None` depending on the result of each query.
0 commit comments