[#7] Add container delete notification handler

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-09-02 19:04:29 +03:00
parent 480b3fd1a9
commit 5e5e431534
5 changed files with 80 additions and 13 deletions

View file

@ -13,10 +13,17 @@ type (
Container []byte
Signature []byte
}
// ContainerParams for container put invocation.
RemoveContainerParams struct {
ContainerID []byte
Signature []byte
}
)
const (
putContainerMethod = "put"
putContainerMethod = "put"
deleteContainerMethod = "delete"
)
// RegisterContainer invokes Put method.
@ -31,3 +38,15 @@ func RegisterContainer(cli *client.Client, con util.Uint160, p *ContainerParams)
p.Key.Bytes(),
)
}
// RegisterContainer invokes Delete method.
func RemoveContainer(cli *client.Client, con util.Uint160, p *RemoveContainerParams) error {
if cli == nil {
return client.ErrNilClient
}
return cli.Invoke(con, extraFee, deleteContainerMethod,
p.ContainerID,
p.Signature,
)
}