neowolves/auth-server/logic/wrapper.go

127 lines
5.9 KiB
Go

// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
// Package passwordstorage contains RPC wrappers for Password storage contract.
package logic
import (
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
"github.com/nspcc-dev/neo-go/pkg/neorpc/result"
"github.com/nspcc-dev/neo-go/pkg/rpcclient/unwrap"
"github.com/nspcc-dev/neo-go/pkg/util"
)
// Invoker is used by ContractReader to call various safe methods.
type Invoker interface {
Call(contract util.Uint160, operation string, params ...any) (*result.Invoke, error)
}
// Actor is used by Contract to call state-changing methods.
type Actor interface {
Invoker
MakeCall(contract util.Uint160, method string, params ...any) (*transaction.Transaction, error)
MakeRun(script []byte) (*transaction.Transaction, error)
MakeUnsignedCall(contract util.Uint160, method string, attrs []transaction.Attribute, params ...any) (*transaction.Transaction, error)
MakeUnsignedRun(script []byte, attrs []transaction.Attribute) (*transaction.Transaction, error)
SendCall(contract util.Uint160, method string, params ...any) (util.Uint256, uint32, error)
SendRun(script []byte) (util.Uint256, uint32, error)
}
// ContractReader implements safe contract methods.
type ContractReader struct {
invoker Invoker
hash util.Uint160
}
// Contract implements all contract methods.
type Contract struct {
ContractReader
actor Actor
hash util.Uint160
}
// NewReader creates an instance of ContractReader using provided contract hash and the given Invoker.
func NewReader(invoker Invoker, hash util.Uint160) *ContractReader {
return &ContractReader{invoker, hash}
}
// New creates an instance of Contract using provided contract hash and the given Actor.
func New(actor Actor, hash util.Uint160) *Contract {
return &Contract{ContractReader{actor, hash}, actor, hash}
}
// CheckUser invokes `checkUser` method of contract.
func (c *ContractReader) CheckUser(login string, givenPassword util.Uint256) (*result.Invoke, error) {
return c.invoker.Call(c.hash, "checkUser", login, givenPassword)
}
// GetUser invokes `getUser` method of contract.
func (c *ContractReader) GetUser(login string) (util.Uint256, error) {
return unwrap.Uint256(c.invoker.Call(c.hash, "getUser", login))
}
// CreateUser creates a transaction invoking `createUser` 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) CreateUser(login string, password util.Uint256) (util.Uint256, uint32, error) {
return c.actor.SendCall(c.hash, "createUser", login, password)
}
// CreateUserTransaction creates a transaction invoking `createUser` method of the contract.
// This transaction is signed, but not sent to the network, instead it's
// returned to the caller.
func (c *Contract) CreateUserTransaction(login string, password util.Uint256) (*transaction.Transaction, error) {
return c.actor.MakeCall(c.hash, "createUser", login, password)
}
// CreateUserUnsigned creates a transaction invoking `createUser` method of the contract.
// 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) CreateUserUnsigned(login string, password util.Uint256) (*transaction.Transaction, error) {
return c.actor.MakeUnsignedCall(c.hash, "createUser", nil, login, password)
}
// DeleteUser creates a transaction invoking `deleteUser` 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) DeleteUser(login string) (util.Uint256, uint32, error) {
return c.actor.SendCall(c.hash, "deleteUser", login)
}
// DeleteUserTransaction creates a transaction invoking `deleteUser` method of the contract.
// This transaction is signed, but not sent to the network, instead it's
// returned to the caller.
func (c *Contract) DeleteUserTransaction(login string) (*transaction.Transaction, error) {
return c.actor.MakeCall(c.hash, "deleteUser", login)
}
// DeleteUserUnsigned creates a transaction invoking `deleteUser` method of the contract.
// 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) DeleteUserUnsigned(login string) (*transaction.Transaction, error) {
return c.actor.MakeUnsignedCall(c.hash, "deleteUser", nil, login)
}
// UpdateUser creates a transaction invoking `updateUser` 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) UpdateUser(login string, password util.Uint256) (util.Uint256, uint32, error) {
return c.actor.SendCall(c.hash, "updateUser", login, password)
}
// UpdateUserTransaction creates a transaction invoking `updateUser` method of the contract.
// This transaction is signed, but not sent to the network, instead it's
// returned to the caller.
func (c *Contract) UpdateUserTransaction(login string, password util.Uint256) (*transaction.Transaction, error) {
return c.actor.MakeCall(c.hash, "updateUser", login, password)
}
// UpdateUserUnsigned creates a transaction invoking `updateUser` method of the contract.
// 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) UpdateUserUnsigned(login string, password util.Uint256) (*transaction.Transaction, error) {
return c.actor.MakeUnsignedCall(c.hash, "updateUser", nil, login, password)
}