forked from TrueCloudLab/frostfs-contract
[#113] Regenerate wrappers
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
d36120014d
commit
3e221b973a
1 changed files with 0 additions and 73 deletions
|
@ -29,12 +29,6 @@ type AddRecordEvent struct {
|
||||||
Type *big.Int
|
Type *big.Int
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetRecordEvent represents "SetRecord" event emitted by the contract.
|
|
||||||
type SetRecordEvent struct {
|
|
||||||
Name string
|
|
||||||
Type *big.Int
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteRecordsEvent represents "DeleteRecords" event emitted by the contract.
|
// DeleteRecordsEvent represents "DeleteRecords" event emitted by the contract.
|
||||||
type DeleteRecordsEvent struct {
|
type DeleteRecordsEvent struct {
|
||||||
Name string
|
Name string
|
||||||
|
@ -516,73 +510,6 @@ func (e *AddRecordEvent) FromStackItem(item *stackitem.Array) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetRecordEventsFromApplicationLog retrieves a set of all emitted events
|
|
||||||
// with "SetRecord" name from the provided [result.ApplicationLog].
|
|
||||||
func SetRecordEventsFromApplicationLog(log *result.ApplicationLog) ([]*SetRecordEvent, error) {
|
|
||||||
if log == nil {
|
|
||||||
return nil, errors.New("nil application log")
|
|
||||||
}
|
|
||||||
|
|
||||||
var res []*SetRecordEvent
|
|
||||||
for i, ex := range log.Executions {
|
|
||||||
for j, e := range ex.Events {
|
|
||||||
if e.Name != "SetRecord" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
event := new(SetRecordEvent)
|
|
||||||
err := event.FromStackItem(e.Item)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("failed to deserialize SetRecordEvent from stackitem (execution #%d, event #%d): %w", i, j, err)
|
|
||||||
}
|
|
||||||
res = append(res, event)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// FromStackItem converts provided [stackitem.Array] to SetRecordEvent or
|
|
||||||
// returns an error if it's not possible to do to so.
|
|
||||||
func (e *SetRecordEvent) FromStackItem(item *stackitem.Array) error {
|
|
||||||
if item == nil {
|
|
||||||
return errors.New("nil item")
|
|
||||||
}
|
|
||||||
arr, ok := item.Value().([]stackitem.Item)
|
|
||||||
if !ok {
|
|
||||||
return errors.New("not an array")
|
|
||||||
}
|
|
||||||
if len(arr) != 2 {
|
|
||||||
return errors.New("wrong number of structure elements")
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
index = -1
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
index++
|
|
||||||
e.Name, err = func(item stackitem.Item) (string, error) {
|
|
||||||
b, err := item.TryBytes()
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
if !utf8.Valid(b) {
|
|
||||||
return "", errors.New("not a UTF-8 string")
|
|
||||||
}
|
|
||||||
return string(b), nil
|
|
||||||
}(arr[index])
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("field Name: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
index++
|
|
||||||
e.Type, err = arr[index].TryInteger()
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("field Type: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteRecordsEventsFromApplicationLog retrieves a set of all emitted events
|
// DeleteRecordsEventsFromApplicationLog retrieves a set of all emitted events
|
||||||
// with "DeleteRecords" name from the provided [result.ApplicationLog].
|
// with "DeleteRecords" name from the provided [result.ApplicationLog].
|
||||||
func DeleteRecordsEventsFromApplicationLog(log *result.ApplicationLog) ([]*DeleteRecordsEvent, error) {
|
func DeleteRecordsEventsFromApplicationLog(log *result.ApplicationLog) ([]*DeleteRecordsEvent, error) {
|
||||||
|
|
Loading…
Reference in a new issue