mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 03:41:34 +00:00
nns: add admin to properties
See 14f43ba8cf/src/NameService/NameService.cs (L69)
.
This commit is contained in:
parent
c03e420355
commit
94852ab7f4
2 changed files with 8 additions and 0 deletions
|
@ -118,6 +118,7 @@ func Properties(tokenID []byte) map[string]interface{} {
|
|||
return map[string]interface{}{
|
||||
"name": ns.Name,
|
||||
"expiration": ns.Expiration,
|
||||
"admin": ns.Admin,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -182,6 +182,7 @@ func TestRegisterAndRenew(t *testing.T) {
|
|||
props := stackitem.NewMap()
|
||||
props.Add(stackitem.Make("name"), stackitem.Make("neo.com"))
|
||||
props.Add(stackitem.Make("expiration"), stackitem.Make(expectedExpiration))
|
||||
props.Add(stackitem.Make("admin"), stackitem.Null{}) // no admin was set
|
||||
c.Invoke(t, props, "properties", "neo.com")
|
||||
c.Invoke(t, 3, "balanceOf", e.CommitteeHash)
|
||||
c.Invoke(t, e.CommitteeHash.BytesBE(), "ownerOf", []byte("neo.com"))
|
||||
|
@ -319,6 +320,7 @@ func TestSetAdmin(t *testing.T) {
|
|||
c.Invoke(t, stackitem.Null{}, "addRoot", "com")
|
||||
|
||||
cOwner.Invoke(t, true, "register", "neo.com", owner.ScriptHash())
|
||||
expectedExpiration := e.TopBlock(t).Timestamp + millisecondsInYear
|
||||
cGuest.InvokeFail(t, "not witnessed", "setAdmin", "neo.com", admin.ScriptHash())
|
||||
|
||||
// Must be witnessed by both owner and admin.
|
||||
|
@ -326,6 +328,11 @@ func TestSetAdmin(t *testing.T) {
|
|||
cAdmin.InvokeFail(t, "not witnessed by owner", "setAdmin", "neo.com", admin.ScriptHash())
|
||||
cc := c.WithSigners(owner, admin)
|
||||
cc.Invoke(t, stackitem.Null{}, "setAdmin", "neo.com", admin.ScriptHash())
|
||||
props := stackitem.NewMap()
|
||||
props.Add(stackitem.Make("name"), stackitem.Make("neo.com"))
|
||||
props.Add(stackitem.Make("expiration"), stackitem.Make(expectedExpiration))
|
||||
props.Add(stackitem.Make("admin"), stackitem.Make(admin.ScriptHash().BytesBE()))
|
||||
c.Invoke(t, props, "properties", "neo.com")
|
||||
|
||||
t.Run("set and delete by admin", func(t *testing.T) {
|
||||
cAdmin.Invoke(t, stackitem.Null{}, "setRecord", "neo.com", int64(nns.TXT), "sometext")
|
||||
|
|
Loading…
Reference in a new issue