feat: gateway: OpenRPC support

This commit is contained in:
Łukasz Magiera
2022-05-27 17:03:56 +02:00
parent 48aa0131bf
commit 032e598962
11 changed files with 35 additions and 1 deletions
+1
View File
@@ -66,4 +66,5 @@ type Gateway interface {
StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64, limit abi.ChainEpoch, allowReplaced bool) (*MsgLookup, error)
WalletBalance(context.Context, address.Address) (types.BigInt, error)
Version(context.Context) (APIVersion, error)
Discover(context.Context) (apitypes.OpenRPCDocument, error)
}
+4
View File
@@ -350,6 +350,10 @@ func GetAPIType(name, pkg string) (i interface{}, t reflect.Type, permStruct []r
i = &api.WorkerStruct{}
t = reflect.TypeOf(new(struct{ api.Worker })).Elem()
permStruct = append(permStruct, reflect.TypeOf(api.WorkerStruct{}.Internal))
case "Gateway":
i = &api.GatewayStruct{}
t = reflect.TypeOf(new(struct{ api.Gateway })).Elem()
permStruct = append(permStruct, reflect.TypeOf(api.GatewayStruct{}.Internal))
default:
panic("unknown type")
}
+13
View File
@@ -512,6 +512,8 @@ type GatewayStruct struct {
ChainReadObj func(p0 context.Context, p1 cid.Cid) ([]byte, error) ``
Discover func(p0 context.Context) (apitypes.OpenRPCDocument, error) ``
GasEstimateMessageGas func(p0 context.Context, p1 *types.Message, p2 *MessageSendSpec, p3 types.TipSetKey) (*types.Message, error) ``
MpoolPush func(p0 context.Context, p1 *types.SignedMessage) (cid.Cid, error) ``
@@ -3299,6 +3301,17 @@ func (s *GatewayStub) ChainReadObj(p0 context.Context, p1 cid.Cid) ([]byte, erro
return *new([]byte), ErrNotSupported
}
func (s *GatewayStruct) Discover(p0 context.Context) (apitypes.OpenRPCDocument, error) {
if s.Internal.Discover == nil {
return *new(apitypes.OpenRPCDocument), ErrNotSupported
}
return s.Internal.Discover(p0)
}
func (s *GatewayStub) Discover(p0 context.Context) (apitypes.OpenRPCDocument, error) {
return *new(apitypes.OpenRPCDocument), ErrNotSupported
}
func (s *GatewayStruct) GasEstimateMessageGas(p0 context.Context, p1 *types.Message, p2 *MessageSendSpec, p3 types.TipSetKey) (*types.Message, error) {
if s.Internal.GasEstimateMessageGas == nil {
return nil, ErrNotSupported