github.com/nspcc-dev/neo-go@v0.105.2-0.20240517133400-6be757af3eba/cli/smartcontract/testdata/rpcbindings/notifications/rpcbindings_extended.out (about)

     1  // Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
     2  
     3  // Package structs contains RPC wrappers for Notifications contract.
     4  package structs
     5  
     6  import (
     7  	"errors"
     8  	"fmt"
     9  	"github.com/nspcc-dev/neo-go/pkg/core/transaction"
    10  	"github.com/nspcc-dev/neo-go/pkg/neorpc/result"
    11  	"github.com/nspcc-dev/neo-go/pkg/util"
    12  	"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
    13  	"math/big"
    14  	"unicode/utf8"
    15  )
    16  
    17  // Hash contains contract hash.
    18  var Hash = util.Uint160{0x33, 0x22, 0x11, 0x0, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x0}
    19  
    20  // CrazyStruct is a contract-specific crazyStruct type used by its methods.
    21  type CrazyStruct struct {
    22  	I *big.Int
    23  	B bool
    24  }
    25  
    26  // SimpleStruct is a contract-specific simpleStruct type used by its methods.
    27  type SimpleStruct struct {
    28  	I *big.Int
    29  }
    30  
    31  // ComplicatedNameEvent represents "! complicated name %$#" event emitted by the contract.
    32  type ComplicatedNameEvent struct {
    33  	ComplicatedParam string
    34  }
    35  
    36  // SomeMapEvent represents "SomeMap" event emitted by the contract.
    37  type SomeMapEvent struct {
    38  	M map[*big.Int]map[string][]util.Uint160
    39  }
    40  
    41  // SomeStructEvent represents "SomeStruct" event emitted by the contract.
    42  type SomeStructEvent struct {
    43  	S *CrazyStruct
    44  }
    45  
    46  // SomeArrayEvent represents "SomeArray" event emitted by the contract.
    47  type SomeArrayEvent struct {
    48  	A [][]*big.Int
    49  }
    50  
    51  // SomeUnexportedFieldEvent represents "SomeUnexportedField" event emitted by the contract.
    52  type SomeUnexportedFieldEvent struct {
    53  	S *SimpleStruct
    54  }
    55  
    56  // Actor is used by Contract to call state-changing methods.
    57  type Actor interface {
    58  	MakeCall(contract util.Uint160, method string, params ...any) (*transaction.Transaction, error)
    59  	MakeRun(script []byte) (*transaction.Transaction, error)
    60  	MakeUnsignedCall(contract util.Uint160, method string, attrs []transaction.Attribute, params ...any) (*transaction.Transaction, error)
    61  	MakeUnsignedRun(script []byte, attrs []transaction.Attribute) (*transaction.Transaction, error)
    62  	SendCall(contract util.Uint160, method string, params ...any) (util.Uint256, uint32, error)
    63  	SendRun(script []byte) (util.Uint256, uint32, error)
    64  }
    65  
    66  // Contract implements all contract methods.
    67  type Contract struct {
    68  	actor Actor
    69  	hash  util.Uint160
    70  }
    71  
    72  // New creates an instance of Contract using Hash and the given Actor.
    73  func New(actor Actor) *Contract {
    74  	var hash = Hash
    75  	return &Contract{actor, hash}
    76  }
    77  
    78  // Array creates a transaction invoking `array` method of the contract.
    79  // This transaction is signed and immediately sent to the network.
    80  // The values returned are its hash, ValidUntilBlock value and error if any.
    81  func (c *Contract) Array() (util.Uint256, uint32, error) {
    82  	return c.actor.SendCall(c.hash, "array")
    83  }
    84  
    85  // ArrayTransaction creates a transaction invoking `array` method of the contract.
    86  // This transaction is signed, but not sent to the network, instead it's
    87  // returned to the caller.
    88  func (c *Contract) ArrayTransaction() (*transaction.Transaction, error) {
    89  	return c.actor.MakeCall(c.hash, "array")
    90  }
    91  
    92  // ArrayUnsigned creates a transaction invoking `array` method of the contract.
    93  // This transaction is not signed, it's simply returned to the caller.
    94  // Any fields of it that do not affect fees can be changed (ValidUntilBlock,
    95  // Nonce), fee values (NetworkFee, SystemFee) can be increased as well.
    96  func (c *Contract) ArrayUnsigned() (*transaction.Transaction, error) {
    97  	return c.actor.MakeUnsignedCall(c.hash, "array", nil)
    98  }
    99  
   100  // CrazyMap creates a transaction invoking `crazyMap` method of the contract.
   101  // This transaction is signed and immediately sent to the network.
   102  // The values returned are its hash, ValidUntilBlock value and error if any.
   103  func (c *Contract) CrazyMap() (util.Uint256, uint32, error) {
   104  	return c.actor.SendCall(c.hash, "crazyMap")
   105  }
   106  
   107  // CrazyMapTransaction creates a transaction invoking `crazyMap` method of the contract.
   108  // This transaction is signed, but not sent to the network, instead it's
   109  // returned to the caller.
   110  func (c *Contract) CrazyMapTransaction() (*transaction.Transaction, error) {
   111  	return c.actor.MakeCall(c.hash, "crazyMap")
   112  }
   113  
   114  // CrazyMapUnsigned creates a transaction invoking `crazyMap` method of the contract.
   115  // This transaction is not signed, it's simply returned to the caller.
   116  // Any fields of it that do not affect fees can be changed (ValidUntilBlock,
   117  // Nonce), fee values (NetworkFee, SystemFee) can be increased as well.
   118  func (c *Contract) CrazyMapUnsigned() (*transaction.Transaction, error) {
   119  	return c.actor.MakeUnsignedCall(c.hash, "crazyMap", nil)
   120  }
   121  
   122  // Main creates a transaction invoking `main` method of the contract.
   123  // This transaction is signed and immediately sent to the network.
   124  // The values returned are its hash, ValidUntilBlock value and error if any.
   125  func (c *Contract) Main() (util.Uint256, uint32, error) {
   126  	return c.actor.SendCall(c.hash, "main")
   127  }
   128  
   129  // MainTransaction creates a transaction invoking `main` method of the contract.
   130  // This transaction is signed, but not sent to the network, instead it's
   131  // returned to the caller.
   132  func (c *Contract) MainTransaction() (*transaction.Transaction, error) {
   133  	return c.actor.MakeCall(c.hash, "main")
   134  }
   135  
   136  // MainUnsigned creates a transaction invoking `main` method of the contract.
   137  // This transaction is not signed, it's simply returned to the caller.
   138  // Any fields of it that do not affect fees can be changed (ValidUntilBlock,
   139  // Nonce), fee values (NetworkFee, SystemFee) can be increased as well.
   140  func (c *Contract) MainUnsigned() (*transaction.Transaction, error) {
   141  	return c.actor.MakeUnsignedCall(c.hash, "main", nil)
   142  }
   143  
   144  // Struct creates a transaction invoking `struct` method of the contract.
   145  // This transaction is signed and immediately sent to the network.
   146  // The values returned are its hash, ValidUntilBlock value and error if any.
   147  func (c *Contract) Struct() (util.Uint256, uint32, error) {
   148  	return c.actor.SendCall(c.hash, "struct")
   149  }
   150  
   151  // StructTransaction creates a transaction invoking `struct` method of the contract.
   152  // This transaction is signed, but not sent to the network, instead it's
   153  // returned to the caller.
   154  func (c *Contract) StructTransaction() (*transaction.Transaction, error) {
   155  	return c.actor.MakeCall(c.hash, "struct")
   156  }
   157  
   158  // StructUnsigned creates a transaction invoking `struct` method of the contract.
   159  // This transaction is not signed, it's simply returned to the caller.
   160  // Any fields of it that do not affect fees can be changed (ValidUntilBlock,
   161  // Nonce), fee values (NetworkFee, SystemFee) can be increased as well.
   162  func (c *Contract) StructUnsigned() (*transaction.Transaction, error) {
   163  	return c.actor.MakeUnsignedCall(c.hash, "struct", nil)
   164  }
   165  
   166  // UnexportedField creates a transaction invoking `unexportedField` method of the contract.
   167  // This transaction is signed and immediately sent to the network.
   168  // The values returned are its hash, ValidUntilBlock value and error if any.
   169  func (c *Contract) UnexportedField() (util.Uint256, uint32, error) {
   170  	return c.actor.SendCall(c.hash, "unexportedField")
   171  }
   172  
   173  // UnexportedFieldTransaction creates a transaction invoking `unexportedField` method of the contract.
   174  // This transaction is signed, but not sent to the network, instead it's
   175  // returned to the caller.
   176  func (c *Contract) UnexportedFieldTransaction() (*transaction.Transaction, error) {
   177  	return c.actor.MakeCall(c.hash, "unexportedField")
   178  }
   179  
   180  // UnexportedFieldUnsigned creates a transaction invoking `unexportedField` method of the contract.
   181  // This transaction is not signed, it's simply returned to the caller.
   182  // Any fields of it that do not affect fees can be changed (ValidUntilBlock,
   183  // Nonce), fee values (NetworkFee, SystemFee) can be increased as well.
   184  func (c *Contract) UnexportedFieldUnsigned() (*transaction.Transaction, error) {
   185  	return c.actor.MakeUnsignedCall(c.hash, "unexportedField", nil)
   186  }
   187  
   188  // itemToCrazyStruct converts stack item into *CrazyStruct.
   189  func itemToCrazyStruct(item stackitem.Item, err error) (*CrazyStruct, error) {
   190  	if err != nil {
   191  		return nil, err
   192  	}
   193  	var res = new(CrazyStruct)
   194  	err = res.FromStackItem(item)
   195  	return res, err
   196  }
   197  
   198  // FromStackItem retrieves fields of CrazyStruct from the given
   199  // [stackitem.Item] or returns an error if it's not possible to do to so.
   200  func (res *CrazyStruct) FromStackItem(item stackitem.Item) error {
   201  	arr, ok := item.Value().([]stackitem.Item)
   202  	if !ok {
   203  		return errors.New("not an array")
   204  	}
   205  	if len(arr) != 2 {
   206  		return errors.New("wrong number of structure elements")
   207  	}
   208  
   209  	var (
   210  		index = -1
   211  		err   error
   212  	)
   213  	index++
   214  	res.I, err = arr[index].TryInteger()
   215  	if err != nil {
   216  		return fmt.Errorf("field I: %w", err)
   217  	}
   218  
   219  	index++
   220  	res.B, err = arr[index].TryBool()
   221  	if err != nil {
   222  		return fmt.Errorf("field B: %w", err)
   223  	}
   224  
   225  	return nil
   226  }
   227  
   228  // itemToSimpleStruct converts stack item into *SimpleStruct.
   229  func itemToSimpleStruct(item stackitem.Item, err error) (*SimpleStruct, error) {
   230  	if err != nil {
   231  		return nil, err
   232  	}
   233  	var res = new(SimpleStruct)
   234  	err = res.FromStackItem(item)
   235  	return res, err
   236  }
   237  
   238  // FromStackItem retrieves fields of SimpleStruct from the given
   239  // [stackitem.Item] or returns an error if it's not possible to do to so.
   240  func (res *SimpleStruct) FromStackItem(item stackitem.Item) error {
   241  	arr, ok := item.Value().([]stackitem.Item)
   242  	if !ok {
   243  		return errors.New("not an array")
   244  	}
   245  	if len(arr) != 1 {
   246  		return errors.New("wrong number of structure elements")
   247  	}
   248  
   249  	var (
   250  		index = -1
   251  		err   error
   252  	)
   253  	index++
   254  	res.I, err = arr[index].TryInteger()
   255  	if err != nil {
   256  		return fmt.Errorf("field I: %w", err)
   257  	}
   258  
   259  	return nil
   260  }
   261  
   262  // ComplicatedNameEventsFromApplicationLog retrieves a set of all emitted events
   263  // with "! complicated name %$#" name from the provided [result.ApplicationLog].
   264  func ComplicatedNameEventsFromApplicationLog(log *result.ApplicationLog) ([]*ComplicatedNameEvent, error) {
   265  	if log == nil {
   266  		return nil, errors.New("nil application log")
   267  	}
   268  
   269  	var res []*ComplicatedNameEvent
   270  	for i, ex := range log.Executions {
   271  		for j, e := range ex.Events {
   272  			if e.Name != "! complicated name %$#" {
   273  				continue
   274  			}
   275  			event := new(ComplicatedNameEvent)
   276  			err := event.FromStackItem(e.Item)
   277  			if err != nil {
   278  				return nil, fmt.Errorf("failed to deserialize ComplicatedNameEvent from stackitem (execution #%d, event #%d): %w", i, j, err)
   279  			}
   280  			res = append(res, event)
   281  		}
   282  	}
   283  
   284  	return res, nil
   285  }
   286  
   287  // FromStackItem converts provided [stackitem.Array] to ComplicatedNameEvent or
   288  // returns an error if it's not possible to do to so.
   289  func (e *ComplicatedNameEvent) FromStackItem(item *stackitem.Array) error {
   290  	if item == nil {
   291  		return errors.New("nil item")
   292  	}
   293  	arr, ok := item.Value().([]stackitem.Item)
   294  	if !ok {
   295  		return errors.New("not an array")
   296  	}
   297  	if len(arr) != 1 {
   298  		return errors.New("wrong number of structure elements")
   299  	}
   300  
   301  	var (
   302  		index = -1
   303  		err   error
   304  	)
   305  	index++
   306  	e.ComplicatedParam, err = func(item stackitem.Item) (string, error) {
   307  		b, err := item.TryBytes()
   308  		if err != nil {
   309  			return "", err
   310  		}
   311  		if !utf8.Valid(b) {
   312  			return "", errors.New("not a UTF-8 string")
   313  		}
   314  		return string(b), nil
   315  	}(arr[index])
   316  	if err != nil {
   317  		return fmt.Errorf("field ComplicatedParam: %w", err)
   318  	}
   319  
   320  	return nil
   321  }
   322  
   323  // SomeMapEventsFromApplicationLog retrieves a set of all emitted events
   324  // with "SomeMap" name from the provided [result.ApplicationLog].
   325  func SomeMapEventsFromApplicationLog(log *result.ApplicationLog) ([]*SomeMapEvent, error) {
   326  	if log == nil {
   327  		return nil, errors.New("nil application log")
   328  	}
   329  
   330  	var res []*SomeMapEvent
   331  	for i, ex := range log.Executions {
   332  		for j, e := range ex.Events {
   333  			if e.Name != "SomeMap" {
   334  				continue
   335  			}
   336  			event := new(SomeMapEvent)
   337  			err := event.FromStackItem(e.Item)
   338  			if err != nil {
   339  				return nil, fmt.Errorf("failed to deserialize SomeMapEvent from stackitem (execution #%d, event #%d): %w", i, j, err)
   340  			}
   341  			res = append(res, event)
   342  		}
   343  	}
   344  
   345  	return res, nil
   346  }
   347  
   348  // FromStackItem converts provided [stackitem.Array] to SomeMapEvent or
   349  // returns an error if it's not possible to do to so.
   350  func (e *SomeMapEvent) FromStackItem(item *stackitem.Array) error {
   351  	if item == nil {
   352  		return errors.New("nil item")
   353  	}
   354  	arr, ok := item.Value().([]stackitem.Item)
   355  	if !ok {
   356  		return errors.New("not an array")
   357  	}
   358  	if len(arr) != 1 {
   359  		return errors.New("wrong number of structure elements")
   360  	}
   361  
   362  	var (
   363  		index = -1
   364  		err   error
   365  	)
   366  	index++
   367  	e.M, err = func(item stackitem.Item) (map[*big.Int]map[string][]util.Uint160, error) {
   368  		m, ok := item.Value().([]stackitem.MapElement)
   369  		if !ok {
   370  			return nil, fmt.Errorf("%s is not a map", item.Type().String())
   371  		}
   372  		res := make(map[*big.Int]map[string][]util.Uint160)
   373  		for i := range m {
   374  			k, err := m[i].Key.TryInteger()
   375  			if err != nil {
   376  				return nil, fmt.Errorf("key %d: %w", i, err)
   377  			}
   378  			v, err := func(item stackitem.Item) (map[string][]util.Uint160, error) {
   379  				m, ok := item.Value().([]stackitem.MapElement)
   380  				if !ok {
   381  					return nil, fmt.Errorf("%s is not a map", item.Type().String())
   382  				}
   383  				res := make(map[string][]util.Uint160)
   384  				for i := range m {
   385  					k, err := func(item stackitem.Item) (string, error) {
   386  						b, err := item.TryBytes()
   387  						if err != nil {
   388  							return "", err
   389  						}
   390  						if !utf8.Valid(b) {
   391  							return "", errors.New("not a UTF-8 string")
   392  						}
   393  						return string(b), nil
   394  					}(m[i].Key)
   395  					if err != nil {
   396  						return nil, fmt.Errorf("key %d: %w", i, err)
   397  					}
   398  					v, err := func(item stackitem.Item) ([]util.Uint160, error) {
   399  						arr, ok := item.Value().([]stackitem.Item)
   400  						if !ok {
   401  							return nil, errors.New("not an array")
   402  						}
   403  						res := make([]util.Uint160, len(arr))
   404  						for i := range res {
   405  							res[i], err = func(item stackitem.Item) (util.Uint160, error) {
   406  								b, err := item.TryBytes()
   407  								if err != nil {
   408  									return util.Uint160{}, err
   409  								}
   410  								u, err := util.Uint160DecodeBytesBE(b)
   411  								if err != nil {
   412  									return util.Uint160{}, err
   413  								}
   414  								return u, nil
   415  							}(arr[i])
   416  							if err != nil {
   417  								return nil, fmt.Errorf("item %d: %w", i, err)
   418  							}
   419  						}
   420  						return res, nil
   421  					}(m[i].Value)
   422  					if err != nil {
   423  						return nil, fmt.Errorf("value %d: %w", i, err)
   424  					}
   425  					res[k] = v
   426  				}
   427  				return res, nil
   428  			}(m[i].Value)
   429  			if err != nil {
   430  				return nil, fmt.Errorf("value %d: %w", i, err)
   431  			}
   432  			res[k] = v
   433  		}
   434  		return res, nil
   435  	}(arr[index])
   436  	if err != nil {
   437  		return fmt.Errorf("field M: %w", err)
   438  	}
   439  
   440  	return nil
   441  }
   442  
   443  // SomeStructEventsFromApplicationLog retrieves a set of all emitted events
   444  // with "SomeStruct" name from the provided [result.ApplicationLog].
   445  func SomeStructEventsFromApplicationLog(log *result.ApplicationLog) ([]*SomeStructEvent, error) {
   446  	if log == nil {
   447  		return nil, errors.New("nil application log")
   448  	}
   449  
   450  	var res []*SomeStructEvent
   451  	for i, ex := range log.Executions {
   452  		for j, e := range ex.Events {
   453  			if e.Name != "SomeStruct" {
   454  				continue
   455  			}
   456  			event := new(SomeStructEvent)
   457  			err := event.FromStackItem(e.Item)
   458  			if err != nil {
   459  				return nil, fmt.Errorf("failed to deserialize SomeStructEvent from stackitem (execution #%d, event #%d): %w", i, j, err)
   460  			}
   461  			res = append(res, event)
   462  		}
   463  	}
   464  
   465  	return res, nil
   466  }
   467  
   468  // FromStackItem converts provided [stackitem.Array] to SomeStructEvent or
   469  // returns an error if it's not possible to do to so.
   470  func (e *SomeStructEvent) FromStackItem(item *stackitem.Array) error {
   471  	if item == nil {
   472  		return errors.New("nil item")
   473  	}
   474  	arr, ok := item.Value().([]stackitem.Item)
   475  	if !ok {
   476  		return errors.New("not an array")
   477  	}
   478  	if len(arr) != 1 {
   479  		return errors.New("wrong number of structure elements")
   480  	}
   481  
   482  	var (
   483  		index = -1
   484  		err   error
   485  	)
   486  	index++
   487  	e.S, err = itemToCrazyStruct(arr[index], nil)
   488  	if err != nil {
   489  		return fmt.Errorf("field S: %w", err)
   490  	}
   491  
   492  	return nil
   493  }
   494  
   495  // SomeArrayEventsFromApplicationLog retrieves a set of all emitted events
   496  // with "SomeArray" name from the provided [result.ApplicationLog].
   497  func SomeArrayEventsFromApplicationLog(log *result.ApplicationLog) ([]*SomeArrayEvent, error) {
   498  	if log == nil {
   499  		return nil, errors.New("nil application log")
   500  	}
   501  
   502  	var res []*SomeArrayEvent
   503  	for i, ex := range log.Executions {
   504  		for j, e := range ex.Events {
   505  			if e.Name != "SomeArray" {
   506  				continue
   507  			}
   508  			event := new(SomeArrayEvent)
   509  			err := event.FromStackItem(e.Item)
   510  			if err != nil {
   511  				return nil, fmt.Errorf("failed to deserialize SomeArrayEvent from stackitem (execution #%d, event #%d): %w", i, j, err)
   512  			}
   513  			res = append(res, event)
   514  		}
   515  	}
   516  
   517  	return res, nil
   518  }
   519  
   520  // FromStackItem converts provided [stackitem.Array] to SomeArrayEvent or
   521  // returns an error if it's not possible to do to so.
   522  func (e *SomeArrayEvent) FromStackItem(item *stackitem.Array) error {
   523  	if item == nil {
   524  		return errors.New("nil item")
   525  	}
   526  	arr, ok := item.Value().([]stackitem.Item)
   527  	if !ok {
   528  		return errors.New("not an array")
   529  	}
   530  	if len(arr) != 1 {
   531  		return errors.New("wrong number of structure elements")
   532  	}
   533  
   534  	var (
   535  		index = -1
   536  		err   error
   537  	)
   538  	index++
   539  	e.A, err = func(item stackitem.Item) ([][]*big.Int, error) {
   540  		arr, ok := item.Value().([]stackitem.Item)
   541  		if !ok {
   542  			return nil, errors.New("not an array")
   543  		}
   544  		res := make([][]*big.Int, len(arr))
   545  		for i := range res {
   546  			res[i], err = func(item stackitem.Item) ([]*big.Int, error) {
   547  				arr, ok := item.Value().([]stackitem.Item)
   548  				if !ok {
   549  					return nil, errors.New("not an array")
   550  				}
   551  				res := make([]*big.Int, len(arr))
   552  				for i := range res {
   553  					res[i], err = arr[i].TryInteger()
   554  					if err != nil {
   555  						return nil, fmt.Errorf("item %d: %w", i, err)
   556  					}
   557  				}
   558  				return res, nil
   559  			}(arr[i])
   560  			if err != nil {
   561  				return nil, fmt.Errorf("item %d: %w", i, err)
   562  			}
   563  		}
   564  		return res, nil
   565  	}(arr[index])
   566  	if err != nil {
   567  		return fmt.Errorf("field A: %w", err)
   568  	}
   569  
   570  	return nil
   571  }
   572  
   573  // SomeUnexportedFieldEventsFromApplicationLog retrieves a set of all emitted events
   574  // with "SomeUnexportedField" name from the provided [result.ApplicationLog].
   575  func SomeUnexportedFieldEventsFromApplicationLog(log *result.ApplicationLog) ([]*SomeUnexportedFieldEvent, error) {
   576  	if log == nil {
   577  		return nil, errors.New("nil application log")
   578  	}
   579  
   580  	var res []*SomeUnexportedFieldEvent
   581  	for i, ex := range log.Executions {
   582  		for j, e := range ex.Events {
   583  			if e.Name != "SomeUnexportedField" {
   584  				continue
   585  			}
   586  			event := new(SomeUnexportedFieldEvent)
   587  			err := event.FromStackItem(e.Item)
   588  			if err != nil {
   589  				return nil, fmt.Errorf("failed to deserialize SomeUnexportedFieldEvent from stackitem (execution #%d, event #%d): %w", i, j, err)
   590  			}
   591  			res = append(res, event)
   592  		}
   593  	}
   594  
   595  	return res, nil
   596  }
   597  
   598  // FromStackItem converts provided [stackitem.Array] to SomeUnexportedFieldEvent or
   599  // returns an error if it's not possible to do to so.
   600  func (e *SomeUnexportedFieldEvent) FromStackItem(item *stackitem.Array) error {
   601  	if item == nil {
   602  		return errors.New("nil item")
   603  	}
   604  	arr, ok := item.Value().([]stackitem.Item)
   605  	if !ok {
   606  		return errors.New("not an array")
   607  	}
   608  	if len(arr) != 1 {
   609  		return errors.New("wrong number of structure elements")
   610  	}
   611  
   612  	var (
   613  		index = -1
   614  		err   error
   615  	)
   616  	index++
   617  	e.S, err = itemToSimpleStruct(arr[index], nil)
   618  	if err != nil {
   619  		return fmt.Errorf("field S: %w", err)
   620  	}
   621  
   622  	return nil
   623  }