API proxy struct codegen (#5854)

* mostly working api proxy gen

* api: Consistent api names

* fix docsgen

* regenerate api struct

* api: expand external interfaces

* Add missing gen files

* apigen: fix perm detection

* api: Move perm tags to the interface

* gofmt

* worker perms

* docsgen

* docsgen: ignore tag comments

* apigen: add codegen warning

* gofmt

* missing actor type

* docsgen

* make linter happy

* fix lint

* apigen: use directives for tags

* docsgen

* regen openrpc docs
This commit is contained in:
Łukasz Magiera
2021-03-23 13:42:56 +01:00
committed by GitHub
parent f145d4f46b
commit c41777dcd2
43 changed files with 2176 additions and 1534 deletions
+2 -2
View File
@@ -36,7 +36,7 @@ type LedgerKeyInfo struct {
Path []uint32
}
var _ api.WalletAPI = (*LedgerWallet)(nil)
var _ api.Wallet = (*LedgerWallet)(nil)
func (lw LedgerWallet) WalletSign(ctx context.Context, signer address.Address, toSign []byte, meta api.MsgMeta) (*crypto.Signature, error) {
ki, err := lw.getKeyInfo(signer)
@@ -227,7 +227,7 @@ func (lw LedgerWallet) WalletNew(ctx context.Context, t types.KeyType) (address.
return lw.importKey(lki)
}
func (lw *LedgerWallet) Get() api.WalletAPI {
func (lw *LedgerWallet) Get() api.Wallet {
if lw == nil {
return nil
}
+7 -7
View File
@@ -24,13 +24,13 @@ type MultiWallet struct {
}
type getif interface {
api.WalletAPI
api.Wallet
// workaround for the fact that iface(*struct(nil)) != nil
Get() api.WalletAPI
Get() api.Wallet
}
func firstNonNil(wallets ...getif) api.WalletAPI {
func firstNonNil(wallets ...getif) api.Wallet {
for _, w := range wallets {
if w.Get() != nil {
return w
@@ -40,8 +40,8 @@ func firstNonNil(wallets ...getif) api.WalletAPI {
return nil
}
func nonNil(wallets ...getif) []api.WalletAPI {
var out []api.WalletAPI
func nonNil(wallets ...getif) []api.Wallet {
var out []api.Wallet
for _, w := range wallets {
if w.Get() == nil {
continue
@@ -53,7 +53,7 @@ func nonNil(wallets ...getif) []api.WalletAPI {
return out
}
func (m MultiWallet) find(ctx context.Context, address address.Address, wallets ...getif) (api.WalletAPI, error) {
func (m MultiWallet) find(ctx context.Context, address address.Address, wallets ...getif) (api.Wallet, error) {
ws := nonNil(wallets...)
for _, w := range ws {
@@ -167,4 +167,4 @@ func (m MultiWallet) WalletDelete(ctx context.Context, address address.Address)
}
}
var _ api.WalletAPI = MultiWallet{}
var _ api.Wallet = MultiWallet{}
+2 -2
View File
@@ -13,7 +13,7 @@ import (
)
type RemoteWallet struct {
api.WalletAPI
api.Wallet
}
func SetupRemoteWallet(info string) func(mctx helpers.MetricsCtx, lc fx.Lifecycle) (*RemoteWallet, error) {
@@ -41,7 +41,7 @@ func SetupRemoteWallet(info string) func(mctx helpers.MetricsCtx, lc fx.Lifecycl
}
}
func (w *RemoteWallet) Get() api.WalletAPI {
func (w *RemoteWallet) Get() api.Wallet {
if w == nil {
return nil
}
+2 -2
View File
@@ -329,7 +329,7 @@ func (w *LocalWallet) WalletDelete(ctx context.Context, addr address.Address) er
return nil
}
func (w *LocalWallet) Get() api.WalletAPI {
func (w *LocalWallet) Get() api.Wallet {
if w == nil {
return nil
}
@@ -337,7 +337,7 @@ func (w *LocalWallet) Get() api.WalletAPI {
return w
}
var _ api.WalletAPI = &LocalWallet{}
var _ api.Wallet = &LocalWallet{}
func swapMainnetForTestnetPrefix(addr string) (string, error) {
aChars := []rune(addr)