diff --git a/container/config.yml b/container/config.yml index c040d12..9778ed3 100644 --- a/container/config.yml +++ b/container/config.yml @@ -29,7 +29,7 @@ events: - name: DeleteSuccess parameters: - name: containerID - type: ByteArray + type: Hash256 - name: SetEACLSuccess parameters: - name: containerID diff --git a/container/container_contract.go b/container/container_contract.go index 7946923..c6b0420 100644 --- a/container/container_contract.go +++ b/container/container_contract.go @@ -279,7 +279,7 @@ func checkNiceNameAvailable(nnsContractAddr interop.Hash160, domain string) bool // API. // // If the container doesn't exist, it panics with NotFoundError. -func Delete(containerID []byte, signature interop.Signature, publicKey interop.PublicKey, token []byte) { +func Delete(containerID interop.Hash256, signature interop.Signature, publicKey interop.PublicKey, token []byte) { ctx := storage.GetContext() ownerID := getOwnerByID(ctx, containerID) diff --git a/rpcclient/container/client.go b/rpcclient/container/client.go index 4780ca5..216a912 100644 --- a/rpcclient/container/client.go +++ b/rpcclient/container/client.go @@ -25,7 +25,7 @@ type PutSuccessEvent struct { // DeleteSuccessEvent represents "DeleteSuccess" event emitted by the contract. type DeleteSuccessEvent struct { - ContainerID []byte + ContainerID util.Uint256 } // SetEACLSuccessEvent represents "SetEACLSuccess" event emitted by the contract. @@ -163,14 +163,14 @@ func (c *ContractReader) Version() (*big.Int, error) { // Delete creates a transaction invoking `delete` method of the contract. // This transaction is signed and immediately sent to the network. // The values returned are its hash, ValidUntilBlock value and error if any. -func (c *Contract) Delete(containerID []byte, signature []byte, publicKey *keys.PublicKey, token []byte) (util.Uint256, uint32, error) { +func (c *Contract) Delete(containerID util.Uint256, signature []byte, publicKey *keys.PublicKey, token []byte) (util.Uint256, uint32, error) { return c.actor.SendCall(c.hash, "delete", containerID, signature, publicKey, token) } // DeleteTransaction creates a transaction invoking `delete` method of the contract. // This transaction is signed, but not sent to the network, instead it's // returned to the caller. -func (c *Contract) DeleteTransaction(containerID []byte, signature []byte, publicKey *keys.PublicKey, token []byte) (*transaction.Transaction, error) { +func (c *Contract) DeleteTransaction(containerID util.Uint256, signature []byte, publicKey *keys.PublicKey, token []byte) (*transaction.Transaction, error) { return c.actor.MakeCall(c.hash, "delete", containerID, signature, publicKey, token) } @@ -178,7 +178,7 @@ func (c *Contract) DeleteTransaction(containerID []byte, signature []byte, publi // This transaction is not signed, it's simply returned to the caller. // Any fields of it that do not affect fees can be changed (ValidUntilBlock, // Nonce), fee values (NetworkFee, SystemFee) can be increased as well. -func (c *Contract) DeleteUnsigned(containerID []byte, signature []byte, publicKey *keys.PublicKey, token []byte) (*transaction.Transaction, error) { +func (c *Contract) DeleteUnsigned(containerID util.Uint256, signature []byte, publicKey *keys.PublicKey, token []byte) (*transaction.Transaction, error) { return c.actor.MakeUnsignedCall(c.hash, "delete", nil, containerID, signature, publicKey, token) } @@ -480,7 +480,17 @@ func (e *DeleteSuccessEvent) FromStackItem(item *stackitem.Array) error { err error ) index++ - e.ContainerID, err = arr[index].TryBytes() + e.ContainerID, err = func(item stackitem.Item) (util.Uint256, error) { + b, err := item.TryBytes() + if err != nil { + return util.Uint256{}, err + } + u, err := util.Uint256DecodeBytesBE(b) + if err != nil { + return util.Uint256{}, err + } + return u, nil + }(arr[index]) if err != nil { return fmt.Errorf("field ContainerID: %w", err) }