Skip to content

Commit

Permalink
Merge pull request #3164 from nspcc-dev/pretty-generator
Browse files Browse the repository at this point in the history
Apply `gofmt` to autogenerated bindings
  • Loading branch information
roman-khimov authored Oct 18, 2023
2 parents d245797 + 6a706d5 commit ef2bc7c
Show file tree
Hide file tree
Showing 16 changed files with 784 additions and 757 deletions.
2 changes: 1 addition & 1 deletion cli/smartcontract/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ type Invoker interface {
// ContractReader implements safe contract methods.
type ContractReader struct {
invoker Invoker
hash util.Uint160
hash util.Uint160
}
// NewReader creates an instance of ContractReader using Hash and the given Invoker.
Expand Down
4 changes: 2 additions & 2 deletions cli/smartcontract/testdata/gas/gas.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ type Actor interface {
type ContractReader struct {
nep17.TokenReader
invoker Invoker
hash util.Uint160
hash util.Uint160
}

// Contract implements all contract methods.
type Contract struct {
ContractReader
nep17.TokenWriter
actor Actor
hash util.Uint160
hash util.Uint160
}

// NewReader creates an instance of ContractReader using Hash and the given Invoker.
Expand Down
28 changes: 14 additions & 14 deletions cli/smartcontract/testdata/nameservice/nns.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ var Hash = util.Uint160{0xde, 0x46, 0x5f, 0x5d, 0x50, 0x57, 0xcf, 0x33, 0x28, 0x

// SetAdminEvent represents "SetAdmin" event emitted by the contract.
type SetAdminEvent struct {
Name string
Name string
OldAdmin util.Uint160
NewAdmin util.Uint160
}

// RenewEvent represents "Renew" event emitted by the contract.
type RenewEvent struct {
Name string
Name string
OldExpiration *big.Int
NewExpiration *big.Int
}
Expand Down Expand Up @@ -56,15 +56,15 @@ type Actor interface {
type ContractReader struct {
nep11.NonDivisibleReader
invoker Invoker
hash util.Uint160
hash util.Uint160
}

// Contract implements all contract methods.
type Contract struct {
ContractReader
nep11.BaseWriter
actor Actor
hash util.Uint160
hash util.Uint160
}

// NewReader creates an instance of ContractReader using Hash and the given Invoker.
Expand Down Expand Up @@ -383,10 +383,10 @@ func (e *SetAdminEvent) FromStackItem(item *stackitem.Array) error {

var (
index = -1
err error
err error
)
index++
e.Name, err = func (item stackitem.Item) (string, error) {
e.Name, err = func(item stackitem.Item) (string, error) {
b, err := item.TryBytes()
if err != nil {
return "", err
Expand All @@ -395,13 +395,13 @@ func (e *SetAdminEvent) FromStackItem(item *stackitem.Array) error {
return "", errors.New("not a UTF-8 string")
}
return string(b), nil
} (arr[index])
}(arr[index])
if err != nil {
return fmt.Errorf("field Name: %w", err)
}

index++
e.OldAdmin, err = func (item stackitem.Item) (util.Uint160, error) {
e.OldAdmin, err = func(item stackitem.Item) (util.Uint160, error) {
b, err := item.TryBytes()
if err != nil {
return util.Uint160{}, err
Expand All @@ -411,13 +411,13 @@ func (e *SetAdminEvent) FromStackItem(item *stackitem.Array) error {
return util.Uint160{}, err
}
return u, nil
} (arr[index])
}(arr[index])
if err != nil {
return fmt.Errorf("field OldAdmin: %w", err)
}

index++
e.NewAdmin, err = func (item stackitem.Item) (util.Uint160, error) {
e.NewAdmin, err = func(item stackitem.Item) (util.Uint160, error) {
b, err := item.TryBytes()
if err != nil {
return util.Uint160{}, err
Expand All @@ -427,7 +427,7 @@ func (e *SetAdminEvent) FromStackItem(item *stackitem.Array) error {
return util.Uint160{}, err
}
return u, nil
} (arr[index])
}(arr[index])
if err != nil {
return fmt.Errorf("field NewAdmin: %w", err)
}
Expand Down Expand Up @@ -476,10 +476,10 @@ func (e *RenewEvent) FromStackItem(item *stackitem.Array) error {

var (
index = -1
err error
err error
)
index++
e.Name, err = func (item stackitem.Item) (string, error) {
e.Name, err = func(item stackitem.Item) (string, error) {
b, err := item.TryBytes()
if err != nil {
return "", err
Expand All @@ -488,7 +488,7 @@ func (e *RenewEvent) FromStackItem(item *stackitem.Array) error {
return "", errors.New("not a UTF-8 string")
}
return string(b), nil
} (arr[index])
}(arr[index])
if err != nil {
return fmt.Errorf("field Name: %w", err)
}
Expand Down
18 changes: 9 additions & 9 deletions cli/smartcontract/testdata/nex/nex.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ var Hash = util.Uint160{0xa8, 0x1a, 0xa1, 0xf0, 0x4b, 0xf, 0xdc, 0x4a, 0xa2, 0xc

// OnMintEvent represents "OnMint" event emitted by the contract.
type OnMintEvent struct {
From util.Uint160
To util.Uint160
From util.Uint160
To util.Uint160
Amount *big.Int
SwapId *big.Int
}
Expand Down Expand Up @@ -48,15 +48,15 @@ type Actor interface {
type ContractReader struct {
nep17.TokenReader
invoker Invoker
hash util.Uint160
hash util.Uint160
}

// Contract implements all contract methods.
type Contract struct {
ContractReader
nep17.TokenWriter
actor Actor
hash util.Uint160
hash util.Uint160
}

// NewReader creates an instance of ContractReader using Hash and the given Invoker.
Expand Down Expand Up @@ -287,10 +287,10 @@ func (e *OnMintEvent) FromStackItem(item *stackitem.Array) error {

var (
index = -1
err error
err error
)
index++
e.From, err = func (item stackitem.Item) (util.Uint160, error) {
e.From, err = func(item stackitem.Item) (util.Uint160, error) {
b, err := item.TryBytes()
if err != nil {
return util.Uint160{}, err
Expand All @@ -300,13 +300,13 @@ func (e *OnMintEvent) FromStackItem(item *stackitem.Array) error {
return util.Uint160{}, err
}
return u, nil
} (arr[index])
}(arr[index])
if err != nil {
return fmt.Errorf("field From: %w", err)
}

index++
e.To, err = func (item stackitem.Item) (util.Uint160, error) {
e.To, err = func(item stackitem.Item) (util.Uint160, error) {
b, err := item.TryBytes()
if err != nil {
return util.Uint160{}, err
Expand All @@ -316,7 +316,7 @@ func (e *OnMintEvent) FromStackItem(item *stackitem.Array) error {
return util.Uint160{}, err
}
return u, nil
} (arr[index])
}(arr[index])
if err != nil {
return fmt.Errorf("field To: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cli/smartcontract/testdata/nonepiter/iter.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Invoker interface {
// ContractReader implements safe contract methods.
type ContractReader struct {
invoker Invoker
hash util.Uint160
hash util.Uint160
}

// NewReader creates an instance of ContractReader using Hash and the given Invoker.
Expand Down
Loading

0 comments on commit ef2bc7c

Please sign in to comment.