diff --git a/docs/proto/provider.md b/docs/proto/provider.md index 51b32224..af0eff7c 100644 --- a/docs/proto/provider.md +++ b/docs/proto/provider.md @@ -46,6 +46,10 @@ - [Status](#akash.provider.v1.Status) - [akash/provider/v1/service.proto](#akash/provider/v1/service.proto) + - [BidPreCheckRequest](#akash.provider.v1.BidPreCheckRequest) + - [BidPreCheckResponse](#akash.provider.v1.BidPreCheckResponse) + - [GroupBidPreCheck](#akash.provider.v1.GroupBidPreCheck) + - [ProviderRPC](#akash.provider.v1.ProviderRPC) - [akash/inventory/v1/memory.proto](#akash/inventory/v1/memory.proto) @@ -646,6 +650,55 @@ ## akash/provider/v1/service.proto + + + + ### BidPreCheckRequest + BidPreCheckRequest is request type for the BidPreCheck RPC method + + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `groups` | [akash.deployment.v1beta3.GroupSpec](#akash.deployment.v1beta3.GroupSpec) | repeated | | + + + + + + + + + ### BidPreCheckResponse + PreBidCheckResponse is response type for the PreBidCheck RPC method + + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `group_bid_pre_checks` | [GroupBidPreCheck](#akash.provider.v1.GroupBidPreCheck) | repeated | | + | `total_price` | [cosmos.base.v1beta1.DecCoin](#cosmos.base.v1beta1.DecCoin) | | | + + + + + + + + + ### GroupBidPreCheck + GroupBidPreCheck contains bid information for a specific group + + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `name` | [string](#string) | | | + | `min_bid_price` | [cosmos.base.v1beta1.DecCoin](#cosmos.base.v1beta1.DecCoin) | | | + | `reason` | [string](#string) | | | + | `can_bid` | [bool](#bool) | | | + + + + + @@ -662,6 +715,7 @@ | ----------- | ------------ | ------------- | ------------| ------- | -------- | | `GetStatus` | [.google.protobuf.Empty](#google.protobuf.Empty) | [Status](#akash.provider.v1.Status) | GetStatus defines a method to query provider state buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE buf:lint:ignore RPC_RESPONSE_STANDARD_NAME | GET|/v1/status| | `StreamStatus` | [.google.protobuf.Empty](#google.protobuf.Empty) | [Status](#akash.provider.v1.Status) stream | Status defines a method to stream provider state buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE buf:lint:ignore RPC_RESPONSE_STANDARD_NAME | | + | `BidPreCheck` | [BidPreCheckRequest](#akash.provider.v1.BidPreCheckRequest) | [BidPreCheckResponse](#akash.provider.v1.BidPreCheckResponse) | BidPreCheck defines a method to check if a provider can bid on a manifest buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE buf:lint:ignore RPC_RESPONSE_STANDARD_NAME | POST|/v1/bidprecheck| diff --git a/go/node/types/v1beta3/attribute.go b/go/node/types/v1beta3/attribute.go index a2bb42b6..5d5613e0 100644 --- a/go/node/types/v1beta3/attribute.go +++ b/go/node/types/v1beta3/attribute.go @@ -1,6 +1,7 @@ package v1beta3 import ( + fmt "fmt" "path/filepath" "reflect" "regexp" @@ -378,3 +379,52 @@ func (attr Attributes) AnyIN(group AttributesGroup) bool { } return false } + +// GetNonMatchingAttributes returns attributes from 'a' that don't match any attribute in 'b'. +// For example: +// a: +// +// region: us-east-1 +// class: beta1 +// persistent: true +// +// b: +// +// region: us-east-1 +// class: beta2 +// +// Returns: +// +// class: beta1 +// persistent: true +// +// This is useful for finding attributes that need to be satisfied when matching requirements. +func (attr Attributes) GetNonMatchingAttributes(b Attributes) Attributes { + var nonMatching Attributes + + for _, req := range attr { + found := false + for _, attr := range b { + if req.SubsetOf(attr) { + found = true + break + } + } + if !found { + nonMatching = append(nonMatching, req) + } + } + + return nonMatching +} + +func (attr Attributes) String() string { + out := "" + for i, v := range attr { + out += fmt.Sprintf("%s=%s", v.Key, v.Value) + if i < len(attr)-1 { + out += ", " + } + } + return out +} diff --git a/go/node/types/v1beta3/attribute_test.go b/go/node/types/v1beta3/attribute_test.go index 17894962..c10f7437 100644 --- a/go/node/types/v1beta3/attribute_test.go +++ b/go/node/types/v1beta3/attribute_test.go @@ -180,3 +180,80 @@ func TestAttributes_Dup(t *testing.T) { dAttrs := attrs.Dup() require.Equal(t, attrs, dAttrs) } + +func TestAttributes_GetNonMatchingAttributes(t *testing.T) { + attr1 := Attributes{ + {Key: "key1", Value: "val1"}, + {Key: "key2", Value: "val2"}, + {Key: "key3", Value: "val3"}, + } + + attr2 := Attributes{ + {Key: "key1", Value: "val1"}, + {Key: "key3", Value: "val3"}, + {Key: "key4", Value: "val4"}, + } + + nonMatching := attr1.GetNonMatchingAttributes(attr2) + require.Len(t, nonMatching, 1) + require.Equal(t, "key2", nonMatching[0].Key) + require.Equal(t, "val2", nonMatching[0].Value) + + // Test with empty attributes + empty := Attributes{} + nonMatching = empty.GetNonMatchingAttributes(attr1) + require.Empty(t, nonMatching) + + // Test with no matches + attr3 := Attributes{ + {Key: "key5", Value: "val5"}, + {Key: "key6", Value: "val6"}, + } + nonMatching = attr3.GetNonMatchingAttributes(attr1) + require.Equal(t, nonMatching, attr3) +} + +func TestAttributes_String(t *testing.T) { + tests := []struct { + name string + attrs Attributes + expected string + }{ + { + "single attribute", + Attributes{ + {Key: "key1", Value: "val1"}, + }, + "key1=val1", + }, + { + "multiple attributes", + Attributes{ + {Key: "key1", Value: "val1"}, + {Key: "key2", Value: "val2"}, + {Key: "key3", Value: "val3"}, + }, + "key1=val1, key2=val2, key3=val3", + }, + { + "empty attributes", + Attributes{}, + "", + }, + { + "attributes with special characters", + Attributes{ + {Key: "key/1", Value: "val/1"}, + {Key: "key.2", Value: "val.2"}, + }, + "key/1=val/1, key.2=val.2", + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + result := test.attrs.String() + require.Equal(t, test.expected, result) + }) + } +} diff --git a/go/provider/client/client.go b/go/provider/client/client.go index e5aa97a5..29623934 100644 --- a/go/provider/client/client.go +++ b/go/provider/client/client.go @@ -30,6 +30,7 @@ import ( dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4" ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3" + providerv1 "github.com/akash-network/akash-api/go/provider/v1" ajwt "github.com/akash-network/akash-api/go/util/jwt" atls "github.com/akash-network/akash-api/go/util/tls" ) @@ -52,9 +53,7 @@ const ( PingPeriod = 10 * time.Second ) -var ( - ErrNotInitialized = errors.New("rest: not initialized") -) +var ErrNotInitialized = errors.New("rest: not initialized") type ReqClient interface { DialContext(ctx context.Context, urlStr string, requestHeader http.Header) (*websocket.Conn, *http.Response, error) @@ -65,7 +64,7 @@ type ReqClient interface { type Client interface { NewReqClient(ctx context.Context) ReqClient Status(ctx context.Context) (*ProviderStatus, error) - Validate(ctx context.Context, gspec dtypes.GroupSpec) (ValidateGroupSpecResult, error) + Validate(ctx context.Context, gspecs dtypes.GroupSpecs) (providerv1.BidPreCheckResponse, error) SubmitManifest(ctx context.Context, dseq uint64, mani manifest.Manifest) error GetManifest(ctx context.Context, id mtypes.LeaseID) (manifest.Manifest, error) LeaseStatus(ctx context.Context, id mtypes.LeaseID) (LeaseStatus, error) @@ -381,35 +380,37 @@ func (c *client) Status(ctx context.Context) (*ProviderStatus, error) { return &obj, nil } -func (c *client) Validate(ctx context.Context, gspec dtypes.GroupSpec) (ValidateGroupSpecResult, error) { +func (c *client) Validate(ctx context.Context, gspecs dtypes.GroupSpecs) (providerv1.BidPreCheckResponse, error) { uri, err := MakeURI(c.host, ValidatePath()) if err != nil { - return ValidateGroupSpecResult{}, err + return providerv1.BidPreCheckResponse{}, err } - if err = gspec.ValidateBasic(); err != nil { - return ValidateGroupSpecResult{}, err + for _, gspec := range gspecs { + if err = gspec.ValidateBasic(); err != nil { + return providerv1.BidPreCheckResponse{}, err + } } - bgspec, err := json.Marshal(gspec) + bgspecs, err := json.Marshal(gspecs) if err != nil { - return ValidateGroupSpecResult{}, err + return providerv1.BidPreCheckResponse{}, err } - req, err := http.NewRequestWithContext(ctx, "GET", uri, bytes.NewReader(bgspec)) + req, err := http.NewRequestWithContext(ctx, "GET", uri, bytes.NewReader(bgspecs)) if err != nil { - return ValidateGroupSpecResult{}, err + return providerv1.BidPreCheckResponse{}, err } req.Header.Set("Content-Type", contentTypeJSON) if err = c.setAuth(req.Header); err != nil { - return ValidateGroupSpecResult{}, err + return providerv1.BidPreCheckResponse{}, err } rCl := c.NewReqClient(ctx) resp, err := rCl.Do(req) if err != nil { - return ValidateGroupSpecResult{}, err + return providerv1.BidPreCheckResponse{}, err } buf := &bytes.Buffer{} @@ -419,17 +420,17 @@ func (c *client) Validate(ctx context.Context, gspec dtypes.GroupSpec) (Validate }() if err != nil { - return ValidateGroupSpecResult{}, err + return providerv1.BidPreCheckResponse{}, err } err = createClientResponseErrorIfNotOK(resp, buf) if err != nil { - return ValidateGroupSpecResult{}, err + return providerv1.BidPreCheckResponse{}, err } - var obj ValidateGroupSpecResult + var obj providerv1.BidPreCheckResponse if err = json.NewDecoder(buf).Decode(&obj); err != nil { - return ValidateGroupSpecResult{}, err + return providerv1.BidPreCheckResponse{}, err } return obj, nil @@ -459,7 +460,6 @@ func (c *client) SubmitManifest(ctx context.Context, dseq uint64, mani manifest. rCl := c.NewReqClient(ctx) resp, err := rCl.Do(req) - if err != nil { return err } @@ -493,7 +493,6 @@ func (c *client) GetManifest(ctx context.Context, lid mtypes.LeaseID) (manifest. rCl := c.NewReqClient(ctx) resp, err := rCl.Do(req) - if err != nil { return nil, err } @@ -803,8 +802,8 @@ func (c *client) LeaseLogs(ctx context.Context, id mtypes.LeaseID, services string, follow bool, - _ int64) (*ServiceLogs, error) { - + _ int64, +) (*ServiceLogs, error) { endpoint, err := url.Parse(c.host.String() + "/" + ServiceLogsPath(id)) if err != nil { return nil, err diff --git a/go/provider/client/types.go b/go/provider/client/types.go index 522e67cf..201760d0 100644 --- a/go/provider/client/types.go +++ b/go/provider/client/types.go @@ -1,8 +1,6 @@ package rest import ( - sdk "github.com/cosmos/cosmos-sdk/types" - inventoryV1 "github.com/akash-network/akash-api/go/inventory/v1" manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" ) @@ -108,12 +106,6 @@ type LeaseEvent struct { Object LeaseEventObject `json:"object" yaml:"object"` } -// ValidateGroupSpecResult represents the result of validating a group specification, -// including the minimum bid price required. -type ValidateGroupSpecResult struct { - MinBidPrice sdk.DecCoin `json:"min_bid_price"` -} - // MigrateRequestBody represents a request to migrate hostnames to a new deployment, // including the list of hostnames and destination deployment/group sequence numbers. type MigrateRequestBody struct { diff --git a/go/provider/v1/service.pb.go b/go/provider/v1/service.pb.go index af0766e8..23305847 100644 --- a/go/provider/v1/service.pb.go +++ b/go/provider/v1/service.pb.go @@ -6,6 +6,9 @@ package v1 import ( context "context" fmt "fmt" + v1beta3 "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -13,7 +16,9 @@ import ( codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" emptypb "google.golang.org/protobuf/types/known/emptypb" + io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -27,26 +32,227 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// BidPreCheckRequest is request type for the BidPreCheck RPC method +type BidPreCheckRequest struct { + Groups []v1beta3.GroupSpec `protobuf:"bytes,1,rep,name=groups,proto3" json:"groups" yaml:"groups"` +} + +func (m *BidPreCheckRequest) Reset() { *m = BidPreCheckRequest{} } +func (m *BidPreCheckRequest) String() string { return proto.CompactTextString(m) } +func (*BidPreCheckRequest) ProtoMessage() {} +func (*BidPreCheckRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_518d1307e7e58072, []int{0} +} +func (m *BidPreCheckRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BidPreCheckRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BidPreCheckRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BidPreCheckRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BidPreCheckRequest.Merge(m, src) +} +func (m *BidPreCheckRequest) XXX_Size() int { + return m.Size() +} +func (m *BidPreCheckRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BidPreCheckRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BidPreCheckRequest proto.InternalMessageInfo + +func (m *BidPreCheckRequest) GetGroups() []v1beta3.GroupSpec { + if m != nil { + return m.Groups + } + return nil +} + +// GroupBidPreCheck contains bid information for a specific group +type GroupBidPreCheck struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name" yaml:"name"` + MinBidPrice types.DecCoin `protobuf:"bytes,2,opt,name=min_bid_price,json=minBidPrice,proto3" json:"min_bid_price" yaml:"min_bid_price"` + Reason string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason" yaml:"reason"` + CanBid bool `protobuf:"varint,4,opt,name=can_bid,json=canBid,proto3" json:"can_bid" yaml:"can_bid"` +} + +func (m *GroupBidPreCheck) Reset() { *m = GroupBidPreCheck{} } +func (m *GroupBidPreCheck) String() string { return proto.CompactTextString(m) } +func (*GroupBidPreCheck) ProtoMessage() {} +func (*GroupBidPreCheck) Descriptor() ([]byte, []int) { + return fileDescriptor_518d1307e7e58072, []int{1} +} +func (m *GroupBidPreCheck) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GroupBidPreCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GroupBidPreCheck.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GroupBidPreCheck) XXX_Merge(src proto.Message) { + xxx_messageInfo_GroupBidPreCheck.Merge(m, src) +} +func (m *GroupBidPreCheck) XXX_Size() int { + return m.Size() +} +func (m *GroupBidPreCheck) XXX_DiscardUnknown() { + xxx_messageInfo_GroupBidPreCheck.DiscardUnknown(m) +} + +var xxx_messageInfo_GroupBidPreCheck proto.InternalMessageInfo + +func (m *GroupBidPreCheck) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *GroupBidPreCheck) GetMinBidPrice() types.DecCoin { + if m != nil { + return m.MinBidPrice + } + return types.DecCoin{} +} + +func (m *GroupBidPreCheck) GetReason() string { + if m != nil { + return m.Reason + } + return "" +} + +func (m *GroupBidPreCheck) GetCanBid() bool { + if m != nil { + return m.CanBid + } + return false +} + +// PreBidCheckResponse is response type for the PreBidCheck RPC method +type BidPreCheckResponse struct { + GroupBidPreChecks []*GroupBidPreCheck `protobuf:"bytes,1,rep,name=group_bid_pre_checks,json=groupBidPreChecks,proto3" json:"group_bid_pre_checks" yaml:"group_bid_pre_checks"` + TotalPrice types.DecCoin `protobuf:"bytes,2,opt,name=total_price,json=totalPrice,proto3" json:"total_price" yaml:"total_price"` +} + +func (m *BidPreCheckResponse) Reset() { *m = BidPreCheckResponse{} } +func (m *BidPreCheckResponse) String() string { return proto.CompactTextString(m) } +func (*BidPreCheckResponse) ProtoMessage() {} +func (*BidPreCheckResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_518d1307e7e58072, []int{2} +} +func (m *BidPreCheckResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BidPreCheckResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BidPreCheckResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BidPreCheckResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BidPreCheckResponse.Merge(m, src) +} +func (m *BidPreCheckResponse) XXX_Size() int { + return m.Size() +} +func (m *BidPreCheckResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BidPreCheckResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BidPreCheckResponse proto.InternalMessageInfo + +func (m *BidPreCheckResponse) GetGroupBidPreChecks() []*GroupBidPreCheck { + if m != nil { + return m.GroupBidPreChecks + } + return nil +} + +func (m *BidPreCheckResponse) GetTotalPrice() types.DecCoin { + if m != nil { + return m.TotalPrice + } + return types.DecCoin{} +} + +func init() { + proto.RegisterType((*BidPreCheckRequest)(nil), "akash.provider.v1.BidPreCheckRequest") + proto.RegisterType((*GroupBidPreCheck)(nil), "akash.provider.v1.GroupBidPreCheck") + proto.RegisterType((*BidPreCheckResponse)(nil), "akash.provider.v1.BidPreCheckResponse") +} + func init() { proto.RegisterFile("akash/provider/v1/service.proto", fileDescriptor_518d1307e7e58072) } var fileDescriptor_518d1307e7e58072 = []byte{ - // 255 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xcc, 0x4e, 0x2c, - 0xce, 0xd0, 0x2f, 0x28, 0xca, 0x2f, 0xcb, 0x4c, 0x49, 0x2d, 0xd2, 0x2f, 0x33, 0xd4, 0x2f, 0x4e, - 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x04, 0x2b, 0xd0, - 0x83, 0x29, 0xd0, 0x2b, 0x33, 0x94, 0x92, 0x4e, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x07, 0x2b, - 0x48, 0x2a, 0x4d, 0xd3, 0x4f, 0xcd, 0x2d, 0x28, 0xa9, 0x84, 0xa8, 0x97, 0x92, 0x81, 0x4a, 0x26, - 0x16, 0x64, 0xea, 0x27, 0xe6, 0xe5, 0xe5, 0x97, 0x24, 0x96, 0x64, 0xe6, 0xe7, 0x15, 0x43, 0x65, - 0xe5, 0xb0, 0x58, 0x57, 0x92, 0x58, 0x52, 0x0a, 0x95, 0x37, 0x5a, 0xc9, 0xc8, 0xc5, 0x1d, 0x00, - 0x95, 0x0c, 0x0a, 0x70, 0x16, 0x0a, 0xe5, 0xe2, 0x74, 0x4f, 0x2d, 0x09, 0x06, 0x2b, 0x11, 0x12, - 0xd3, 0x83, 0x98, 0xad, 0x07, 0xb3, 0x58, 0xcf, 0x15, 0x64, 0xb1, 0x94, 0xa4, 0x1e, 0x86, 0x1b, - 0xf5, 0x20, 0x5a, 0x94, 0x44, 0x9b, 0x2e, 0x3f, 0x99, 0xcc, 0xc4, 0x2f, 0xc4, 0x85, 0xb0, 0x29, - 0x89, 0x51, 0x4b, 0xc8, 0x99, 0x8b, 0x27, 0xb8, 0xa4, 0x28, 0x35, 0x31, 0x97, 0x6c, 0x93, 0x0d, - 0x18, 0x9d, 0xbc, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, - 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x30, 0x3d, - 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0x6c, 0x80, 0x6e, 0x5e, 0x6a, 0x49, - 0x79, 0x7e, 0x51, 0x36, 0x94, 0x07, 0x0a, 0x9b, 0xf4, 0x7c, 0xe4, 0x50, 0x48, 0x62, 0x03, 0xdb, - 0x6c, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x6a, 0xc2, 0xd5, 0x1b, 0x90, 0x01, 0x00, 0x00, + // 700 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcf, 0x6e, 0xd3, 0x4e, + 0x10, 0x8e, 0xd3, 0x2a, 0xbf, 0x5f, 0xd7, 0x94, 0xd2, 0x25, 0xa0, 0x90, 0x56, 0xd9, 0xc8, 0xa8, + 0x10, 0x55, 0xc2, 0x26, 0xed, 0x01, 0xa9, 0x02, 0x09, 0x25, 0xa0, 0x1e, 0xf8, 0xa3, 0xca, 0x85, + 0x0b, 0x42, 0xaa, 0xd6, 0xce, 0xe2, 0xae, 0x1a, 0x7b, 0x8d, 0xbd, 0x09, 0xf4, 0xc2, 0x81, 0x27, + 0x40, 0xe2, 0x0d, 0xe0, 0x0d, 0x78, 0x8a, 0x1e, 0x2b, 0x71, 0xe1, 0xb4, 0x42, 0x29, 0xa7, 0x1c, + 0xf3, 0x04, 0x68, 0xff, 0x84, 0xa4, 0x21, 0x12, 0x82, 0x9b, 0x67, 0xbe, 0x6f, 0x66, 0xbe, 0x99, + 0xf1, 0x2c, 0x40, 0xf8, 0x08, 0xe7, 0x87, 0x5e, 0x9a, 0xb1, 0x3e, 0xed, 0x90, 0xcc, 0xeb, 0x37, + 0xbd, 0x9c, 0x64, 0x7d, 0x1a, 0x12, 0x37, 0xcd, 0x18, 0x67, 0x70, 0x55, 0x11, 0xdc, 0x31, 0xc1, + 0xed, 0x37, 0xab, 0xe5, 0x88, 0x45, 0x4c, 0xa1, 0x9e, 0xfc, 0xd2, 0xc4, 0x6a, 0x2d, 0x64, 0x79, + 0xcc, 0x72, 0x2f, 0xc0, 0x39, 0xf1, 0xfa, 0xcd, 0x80, 0x70, 0xdc, 0xf4, 0x42, 0x46, 0x13, 0x83, + 0x37, 0x74, 0xa5, 0x0e, 0x49, 0xbb, 0xec, 0x38, 0x26, 0x09, 0x37, 0xa4, 0x6d, 0x2f, 0xca, 0x58, + 0x2f, 0xcd, 0x53, 0x12, 0x1a, 0xe6, 0x5a, 0xc4, 0x58, 0xd4, 0x25, 0x9e, 0xb2, 0x82, 0xde, 0x2b, + 0x8f, 0xc4, 0x29, 0x3f, 0x36, 0xe0, 0xba, 0x01, 0x71, 0x4a, 0x3d, 0x9c, 0x24, 0x8c, 0x63, 0x4e, + 0x59, 0x92, 0x8f, 0x45, 0xcc, 0x69, 0x87, 0x63, 0xde, 0x33, 0xb8, 0x93, 0x01, 0xd8, 0xa2, 0x9d, + 0xbd, 0x8c, 0xb4, 0x0f, 0x49, 0x78, 0xe4, 0x93, 0xd7, 0x3d, 0x92, 0x73, 0xf8, 0x12, 0x94, 0xb4, + 0x86, 0x8a, 0x55, 0x5f, 0x68, 0xd8, 0x5b, 0xd7, 0x5d, 0xdd, 0xf4, 0x44, 0xab, 0x6b, 0xb4, 0xba, + 0xbb, 0x92, 0xb7, 0x9f, 0x92, 0xb0, 0x85, 0x4e, 0x04, 0x2a, 0x0c, 0x05, 0x32, 0xa1, 0x23, 0x81, + 0x96, 0x8f, 0x71, 0xdc, 0xdd, 0x71, 0xb4, 0xed, 0xf8, 0x06, 0x70, 0x4e, 0x8a, 0xe0, 0x92, 0x0a, + 0x9b, 0xaa, 0x0c, 0xb7, 0xc1, 0x62, 0x82, 0x63, 0x52, 0xb1, 0xea, 0x56, 0x63, 0xa9, 0x85, 0x06, + 0x02, 0x2d, 0x3e, 0xc5, 0x31, 0x19, 0x0a, 0xa4, 0xfc, 0x23, 0x81, 0x6c, 0x9d, 0x4d, 0x5a, 0x8e, + 0xaf, 0x9c, 0xf0, 0x1d, 0x58, 0x8e, 0x69, 0x72, 0x10, 0xd0, 0xce, 0x41, 0x9a, 0xd1, 0x90, 0x54, + 0x8a, 0x75, 0xab, 0x61, 0x6f, 0xad, 0xbb, 0x7a, 0xf4, 0xae, 0x1c, 0xbd, 0x51, 0xda, 0x74, 0x1f, + 0x90, 0xb0, 0xcd, 0x68, 0xd2, 0xba, 0x2b, 0x75, 0x0e, 0x04, 0xb2, 0x9f, 0xd0, 0x44, 0x29, 0xa0, + 0xa1, 0x2c, 0x73, 0x3e, 0xd3, 0x48, 0xa0, 0xb2, 0xae, 0x77, 0xce, 0xed, 0xf8, 0x76, 0x3c, 0x89, + 0x82, 0xf7, 0x40, 0x29, 0x23, 0x38, 0x67, 0x49, 0x65, 0x41, 0xc9, 0xde, 0x18, 0x08, 0x54, 0xf2, + 0x95, 0x47, 0x0e, 0x42, 0x63, 0x93, 0x41, 0x68, 0xdb, 0xf1, 0x0d, 0x00, 0xef, 0x83, 0xff, 0x42, + 0xac, 0xb2, 0x57, 0x16, 0xeb, 0x56, 0xe3, 0xff, 0xd6, 0x4d, 0x19, 0xdf, 0xc6, 0xb2, 0xc0, 0x50, + 0xa0, 0x31, 0x38, 0x12, 0xe8, 0xa2, 0x4e, 0x60, 0x1c, 0x8e, 0x5f, 0x0a, 0x15, 0xc9, 0xf9, 0x52, + 0x04, 0x97, 0xcf, 0xed, 0x2f, 0x4f, 0x59, 0x92, 0x13, 0xf8, 0xc9, 0x02, 0x65, 0x35, 0x6d, 0x23, + 0x9d, 0x1c, 0x84, 0x12, 0x9f, 0xdd, 0xe7, 0xd4, 0x4f, 0xec, 0xce, 0x6e, 0xa4, 0xf5, 0x78, 0x20, + 0xd0, 0xea, 0xac, 0x37, 0x1f, 0x0a, 0x34, 0x37, 0xf3, 0x48, 0xa0, 0xb5, 0xa9, 0x75, 0xcf, 0xa0, + 0x8e, 0xbf, 0x1a, 0xcd, 0x66, 0x82, 0x7d, 0x60, 0x73, 0xc6, 0x71, 0xf7, 0x2f, 0x76, 0x77, 0xc7, + 0xec, 0x0e, 0x3c, 0x93, 0x81, 0xe3, 0xd5, 0x4d, 0xa7, 0x19, 0x09, 0x04, 0xb5, 0x8e, 0x29, 0xa7, + 0xe3, 0x03, 0xfe, 0x2b, 0x60, 0xeb, 0x73, 0x11, 0xd8, 0x7b, 0xa6, 0x73, 0x7f, 0xaf, 0x0d, 0x9f, + 0x83, 0xa5, 0x5d, 0xc2, 0xf7, 0xd5, 0x59, 0xc0, 0xab, 0xae, 0xbe, 0x27, 0x77, 0x7c, 0x6c, 0xee, + 0x43, 0x79, 0x6c, 0xd5, 0x6b, 0x73, 0x46, 0xa6, 0x43, 0x9c, 0x2b, 0xef, 0xbf, 0xfe, 0xf8, 0x58, + 0x5c, 0x81, 0x60, 0x72, 0x5d, 0x81, 0xb5, 0x09, 0xdb, 0xe0, 0xc2, 0x3e, 0xcf, 0x08, 0x8e, 0xff, + 0x39, 0xf3, 0x6d, 0x0b, 0xbe, 0x05, 0xf6, 0xf4, 0x95, 0x6c, 0xcc, 0xe1, 0xfe, 0x7e, 0xbf, 0xd5, + 0x1b, 0x7f, 0xa2, 0xe9, 0xdf, 0xc4, 0xa9, 0x2a, 0xe5, 0x65, 0x67, 0x45, 0x2a, 0x0f, 0x68, 0x27, + 0xcd, 0x88, 0xda, 0xd7, 0x8e, 0xb5, 0xd9, 0x7a, 0x74, 0x32, 0xa8, 0x59, 0xa7, 0x83, 0x9a, 0xf5, + 0x7d, 0x50, 0xb3, 0x3e, 0x9c, 0xd5, 0x0a, 0xa7, 0x67, 0xb5, 0xc2, 0xb7, 0xb3, 0x5a, 0xe1, 0x45, + 0x33, 0xa2, 0xfc, 0xb0, 0x17, 0xb8, 0x21, 0x8b, 0x3d, 0x55, 0xe7, 0x56, 0x42, 0xf8, 0x1b, 0x96, + 0x1d, 0x19, 0x4b, 0xbe, 0x44, 0x11, 0x9b, 0x7e, 0x73, 0x82, 0x92, 0xea, 0x79, 0xfb, 0x67, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x5f, 0x24, 0x82, 0x7a, 0x5e, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -69,6 +275,10 @@ type ProviderRPCClient interface { // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME StreamStatus(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (ProviderRPC_StreamStatusClient, error) + // BidPreCheck defines a method to check if a provider can bid on a manifest + // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + BidPreCheck(ctx context.Context, in *BidPreCheckRequest, opts ...grpc.CallOption) (*BidPreCheckResponse, error) } type providerRPCClient struct { @@ -120,6 +330,15 @@ func (x *providerRPCStreamStatusClient) Recv() (*Status, error) { return m, nil } +func (c *providerRPCClient) BidPreCheck(ctx context.Context, in *BidPreCheckRequest, opts ...grpc.CallOption) (*BidPreCheckResponse, error) { + out := new(BidPreCheckResponse) + err := c.cc.Invoke(ctx, "/akash.provider.v1.ProviderRPC/BidPreCheck", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ProviderRPCServer is the server API for ProviderRPC service. type ProviderRPCServer interface { // GetStatus defines a method to query provider state @@ -130,6 +349,10 @@ type ProviderRPCServer interface { // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME StreamStatus(*emptypb.Empty, ProviderRPC_StreamStatusServer) error + // BidPreCheck defines a method to check if a provider can bid on a manifest + // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + BidPreCheck(context.Context, *BidPreCheckRequest) (*BidPreCheckResponse, error) } // UnimplementedProviderRPCServer can be embedded to have forward compatible implementations. @@ -142,6 +365,9 @@ func (*UnimplementedProviderRPCServer) GetStatus(ctx context.Context, req *empty func (*UnimplementedProviderRPCServer) StreamStatus(req *emptypb.Empty, srv ProviderRPC_StreamStatusServer) error { return status.Errorf(codes.Unimplemented, "method StreamStatus not implemented") } +func (*UnimplementedProviderRPCServer) BidPreCheck(ctx context.Context, req *BidPreCheckRequest) (*BidPreCheckResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BidPreCheck not implemented") +} func RegisterProviderRPCServer(s grpc1.Server, srv ProviderRPCServer) { s.RegisterService(&_ProviderRPC_serviceDesc, srv) @@ -186,6 +412,24 @@ func (x *providerRPCStreamStatusServer) Send(m *Status) error { return x.ServerStream.SendMsg(m) } +func _ProviderRPC_BidPreCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BidPreCheckRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderRPCServer).BidPreCheck(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/akash.provider.v1.ProviderRPC/BidPreCheck", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderRPCServer).BidPreCheck(ctx, req.(*BidPreCheckRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _ProviderRPC_serviceDesc = grpc.ServiceDesc{ ServiceName: "akash.provider.v1.ProviderRPC", HandlerType: (*ProviderRPCServer)(nil), @@ -194,6 +438,10 @@ var _ProviderRPC_serviceDesc = grpc.ServiceDesc{ MethodName: "GetStatus", Handler: _ProviderRPC_GetStatus_Handler, }, + { + MethodName: "BidPreCheck", + Handler: _ProviderRPC_BidPreCheck_Handler, + }, }, Streams: []grpc.StreamDesc{ { @@ -204,3 +452,668 @@ var _ProviderRPC_serviceDesc = grpc.ServiceDesc{ }, Metadata: "akash/provider/v1/service.proto", } + +func (m *BidPreCheckRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BidPreCheckRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BidPreCheckRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Groups) > 0 { + for iNdEx := len(m.Groups) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Groups[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *GroupBidPreCheck) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GroupBidPreCheck) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GroupBidPreCheck) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CanBid { + i-- + if m.CanBid { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(m.Reason) > 0 { + i -= len(m.Reason) + copy(dAtA[i:], m.Reason) + i = encodeVarintService(dAtA, i, uint64(len(m.Reason))) + i-- + dAtA[i] = 0x1a + } + { + size, err := m.MinBidPrice.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintService(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BidPreCheckResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BidPreCheckResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BidPreCheckResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.TotalPrice.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.GroupBidPreChecks) > 0 { + for iNdEx := len(m.GroupBidPreChecks) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.GroupBidPreChecks[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintService(dAtA []byte, offset int, v uint64) int { + offset -= sovService(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *BidPreCheckRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Groups) > 0 { + for _, e := range m.Groups { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + return n +} + +func (m *GroupBidPreCheck) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = m.MinBidPrice.Size() + n += 1 + l + sovService(uint64(l)) + l = len(m.Reason) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.CanBid { + n += 2 + } + return n +} + +func (m *BidPreCheckResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.GroupBidPreChecks) > 0 { + for _, e := range m.GroupBidPreChecks { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + l = m.TotalPrice.Size() + n += 1 + l + sovService(uint64(l)) + return n +} + +func sovService(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozService(x uint64) (n int) { + return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *BidPreCheckRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BidPreCheckRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BidPreCheckRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Groups", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Groups = append(m.Groups, v1beta3.GroupSpec{}) + if err := m.Groups[len(m.Groups)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GroupBidPreCheck) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GroupBidPreCheck: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GroupBidPreCheck: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinBidPrice", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinBidPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Reason = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CanBid", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.CanBid = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BidPreCheckResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BidPreCheckResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BidPreCheckResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GroupBidPreChecks", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GroupBidPreChecks = append(m.GroupBidPreChecks, &GroupBidPreCheck{}) + if err := m.GroupBidPreChecks[len(m.GroupBidPreChecks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalPrice", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TotalPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipService(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthService + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupService + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthService + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") +) diff --git a/go/provider/v1/service.pb.gw.go b/go/provider/v1/service.pb.gw.go index 3a891120..932097be 100644 --- a/go/provider/v1/service.pb.gw.go +++ b/go/provider/v1/service.pb.gw.go @@ -52,6 +52,40 @@ func local_request_ProviderRPC_GetStatus_0(ctx context.Context, marshaler runtim } +func request_ProviderRPC_BidPreCheck_0(ctx context.Context, marshaler runtime.Marshaler, client ProviderRPCClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq BidPreCheckRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.BidPreCheck(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ProviderRPC_BidPreCheck_0(ctx context.Context, marshaler runtime.Marshaler, server ProviderRPCServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq BidPreCheckRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.BidPreCheck(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterProviderRPCHandlerServer registers the http handlers for service ProviderRPC to "mux". // UnaryRPC :call ProviderRPCServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -81,6 +115,29 @@ func RegisterProviderRPCHandlerServer(ctx context.Context, mux *runtime.ServeMux }) + mux.Handle("POST", pattern_ProviderRPC_BidPreCheck_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ProviderRPC_BidPreCheck_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ProviderRPC_BidPreCheck_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -142,13 +199,37 @@ func RegisterProviderRPCHandlerClient(ctx context.Context, mux *runtime.ServeMux }) + mux.Handle("POST", pattern_ProviderRPC_BidPreCheck_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ProviderRPC_BidPreCheck_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ProviderRPC_BidPreCheck_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( pattern_ProviderRPC_GetStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "status"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_ProviderRPC_BidPreCheck_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "bidprecheck"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( forward_ProviderRPC_GetStatus_0 = runtime.ForwardResponseMessage + + forward_ProviderRPC_BidPreCheck_0 = runtime.ForwardResponseMessage ) diff --git a/go/testutil/deployment.go b/go/testutil/deployment.go index 5d66ebc8..1a73efb6 100644 --- a/go/testutil/deployment.go +++ b/go/testutil/deployment.go @@ -49,6 +49,18 @@ func GroupSpec(t testing.TB) dtypes.GroupSpec { } } +// GroupSpecs generator +func GroupSpecs(t testing.TB) dtypes.GroupSpecs { + t.Helper() + return dtypes.GroupSpecs{ + &dtypes.GroupSpec{ + Name: Name(t, "dgroup"), + Requirements: PlacementRequirements(t), + Resources: Resources(t), + }, + } +} + // DeploymentGroups returns a set of deployment groups generated by DeploymentGroup func DeploymentGroups(t testing.TB, did dtypes.DeploymentID, gseq uint32) []dtypes.Group { t.Helper() diff --git a/go/testutil/v1beta3/deployment.go b/go/testutil/v1beta3/deployment.go index b27a9ad8..a1d0cc3a 100644 --- a/go/testutil/v1beta3/deployment.go +++ b/go/testutil/v1beta3/deployment.go @@ -50,6 +50,18 @@ func GroupSpec(t testing.TB) dtypes.GroupSpec { } } +// GroupSpecs generator +func GroupSpecs(t testing.TB) dtypes.GroupSpecs { + t.Helper() + return dtypes.GroupSpecs{ + &dtypes.GroupSpec{ + Name: testutil.Name(t, "dgroup"), + Requirements: PlacementRequirements(t), + Resources: ResourcesList(t, 1), + }, + } +} + // DeploymentGroups returns a set of deployment groups generated by DeploymentGroup func DeploymentGroups(t testing.TB, did dtypes.DeploymentID, gseq uint32) []dtypes.Group { t.Helper() diff --git a/proto/provider/akash/provider/v1/service.proto b/proto/provider/akash/provider/v1/service.proto index 1abb2985..c8e37a65 100644 --- a/proto/provider/akash/provider/v1/service.proto +++ b/proto/provider/akash/provider/v1/service.proto @@ -1,6 +1,10 @@ syntax = "proto3"; package akash.provider.v1; +import "gogoproto/gogo.proto"; + +import "cosmos/base/v1beta1/coin.proto"; +import "akash/deployment/v1beta3/groupspec.proto"; import "google/protobuf/empty.proto"; import "google/api/annotations.proto"; import "akash/provider/v1/status.proto"; @@ -23,4 +27,66 @@ service ProviderRPC { // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME rpc StreamStatus(google.protobuf.Empty) returns (stream Status); + + // BidPreCheck defines a method to check if a provider can bid on a manifest + // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + rpc BidPreCheck(BidPreCheckRequest) returns (BidPreCheckResponse) { + option (google.api.http) = { + post: "/v1/bidprecheck", + body: "*" + }; + } +} + + +// BidPreCheckRequest is request type for the BidPreCheck RPC method +message BidPreCheckRequest { + repeated akash.deployment.v1beta3.GroupSpec groups = 1 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "groups", + (gogoproto.moretags) = "yaml:\"groups\"" + ]; +} + +// GroupBidPreCheck contains bid information for a specific group +message GroupBidPreCheck { + string name = 1 [ + (gogoproto.customname) = "Name", + (gogoproto.jsontag) = "name", + (gogoproto.moretags) = "yaml:\"name\"" + + ]; + cosmos.base.v1beta1.DecCoin min_bid_price = 2 [ + (gogoproto.customname) = "MinBidPrice", + (gogoproto.jsontag) = "min_bid_price", + (gogoproto.moretags) = "yaml:\"min_bid_price\"", + (gogoproto.nullable) = false + ]; + string reason = 3 [ + (gogoproto.customname) = "Reason", + (gogoproto.jsontag) = "reason", + (gogoproto.moretags) = "yaml:\"reason\"" + ]; + bool can_bid = 4 [ + (gogoproto.customname) = "CanBid", + (gogoproto.jsontag) = "can_bid", + (gogoproto.moretags) = "yaml:\"can_bid\"" + ]; +} + +// PreBidCheckResponse is response type for the PreBidCheck RPC method +message BidPreCheckResponse { + repeated GroupBidPreCheck group_bid_pre_checks = 1 [ + (gogoproto.customname) = "GroupBidPreChecks", + (gogoproto.jsontag) = "group_bid_pre_checks", + (gogoproto.moretags) = "yaml:\"group_bid_pre_checks\"" + ]; + cosmos.base.v1beta1.DecCoin total_price = 2 [ // TODO: Support different coins? + (gogoproto.customname) = "TotalPrice", + (gogoproto.jsontag) = "total_price", + (gogoproto.moretags) = "yaml:\"total_price\"", + (gogoproto.nullable) = false + ]; + } diff --git a/ts/src/generated/akash/inventory/v1/resourcepair.ts b/ts/src/generated/akash/inventory/v1/resourcepair.ts index 43a772fd..a59ebb71 100644 --- a/ts/src/generated/akash/inventory/v1/resourcepair.ts +++ b/ts/src/generated/akash/inventory/v1/resourcepair.ts @@ -11,6 +11,7 @@ export interface ResourcePair { allocatable: Quantity | undefined; allocated: Quantity | undefined; attributes: Attribute[]; + capacity: Quantity | undefined; } function createBaseResourcePair(): ResourcePair { @@ -19,6 +20,7 @@ function createBaseResourcePair(): ResourcePair { allocatable: undefined, allocated: undefined, attributes: [], + capacity: undefined, }; } @@ -38,6 +40,9 @@ export const ResourcePair = { for (const v of message.attributes) { Attribute.encode(v!, writer.uint32(26).fork()).ldelim(); } + if (message.capacity !== undefined) { + Quantity.encode(message.capacity, writer.uint32(34).fork()).ldelim(); + } return writer; }, @@ -70,6 +75,13 @@ export const ResourcePair = { message.attributes.push(Attribute.decode(reader, reader.uint32())); continue; + case 4: + if (tag !== 34) { + break; + } + + message.capacity = Quantity.decode(reader, reader.uint32()); + continue; } if ((tag & 7) === 4 || tag === 0) { break; @@ -91,6 +103,9 @@ export const ResourcePair = { attributes: globalThis.Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [], + capacity: isSet(object.capacity) + ? Quantity.fromJSON(object.capacity) + : undefined, }; }, @@ -105,6 +120,9 @@ export const ResourcePair = { if (message.attributes?.length) { obj.attributes = message.attributes.map((e) => Attribute.toJSON(e)); } + if (message.capacity !== undefined) { + obj.capacity = Quantity.toJSON(message.capacity); + } return obj; }, @@ -123,6 +141,10 @@ export const ResourcePair = { : undefined; message.attributes = object.attributes?.map((e) => Attribute.fromPartial(e)) || []; + message.capacity = + object.capacity !== undefined && object.capacity !== null + ? Quantity.fromPartial(object.capacity) + : undefined; return message; }, }; diff --git a/ts/src/generated/akash/provider/v1/service.grpc-js.ts b/ts/src/generated/akash/provider/v1/service.grpc-js.ts index 675a62e9..9a7936f8 100644 --- a/ts/src/generated/akash/provider/v1/service.grpc-js.ts +++ b/ts/src/generated/akash/provider/v1/service.grpc-js.ts @@ -15,11 +15,332 @@ import type { ServiceError, UntypedServiceImplementation, } from "@grpc/grpc-js"; +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { DecCoin } from "../../../cosmos/base/v1beta1/coin"; import { Empty } from "../../../google/protobuf/empty"; +import { messageTypeRegistry } from "../../../typeRegistry"; +import { GroupSpec } from "../../deployment/v1beta3/groupspec"; import { Status } from "./status"; export const protobufPackage = "akash.provider.v1"; +/** BidPreCheckRequest is request type for the BidPreCheck RPC method */ +export interface BidPreCheckRequest { + $type: "akash.provider.v1.BidPreCheckRequest"; + groups: GroupSpec[]; +} + +/** GroupBidPreCheck contains bid information for a specific group */ +export interface GroupBidPreCheck { + $type: "akash.provider.v1.GroupBidPreCheck"; + name: string; + minBidPrice: DecCoin | undefined; + reason: string; + canBid: boolean; +} + +/** PreBidCheckResponse is response type for the PreBidCheck RPC method */ +export interface BidPreCheckResponse { + $type: "akash.provider.v1.BidPreCheckResponse"; + groupBidPreChecks: GroupBidPreCheck[]; + totalPrice: DecCoin | undefined; +} + +function createBaseBidPreCheckRequest(): BidPreCheckRequest { + return { $type: "akash.provider.v1.BidPreCheckRequest", groups: [] }; +} + +export const BidPreCheckRequest = { + $type: "akash.provider.v1.BidPreCheckRequest" as const, + + encode( + message: BidPreCheckRequest, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + for (const v of message.groups) { + GroupSpec.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BidPreCheckRequest { + const reader = + input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBidPreCheckRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.groups.push(GroupSpec.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BidPreCheckRequest { + return { + $type: BidPreCheckRequest.$type, + groups: globalThis.Array.isArray(object?.groups) + ? object.groups.map((e: any) => GroupSpec.fromJSON(e)) + : [], + }; + }, + + toJSON(message: BidPreCheckRequest): unknown { + const obj: any = {}; + if (message.groups?.length) { + obj.groups = message.groups.map((e) => GroupSpec.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): BidPreCheckRequest { + return BidPreCheckRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BidPreCheckRequest { + const message = createBaseBidPreCheckRequest(); + message.groups = object.groups?.map((e) => GroupSpec.fromPartial(e)) || []; + return message; + }, +}; + +messageTypeRegistry.set(BidPreCheckRequest.$type, BidPreCheckRequest); + +function createBaseGroupBidPreCheck(): GroupBidPreCheck { + return { + $type: "akash.provider.v1.GroupBidPreCheck", + name: "", + minBidPrice: undefined, + reason: "", + canBid: false, + }; +} + +export const GroupBidPreCheck = { + $type: "akash.provider.v1.GroupBidPreCheck" as const, + + encode( + message: GroupBidPreCheck, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.minBidPrice !== undefined) { + DecCoin.encode(message.minBidPrice, writer.uint32(18).fork()).ldelim(); + } + if (message.reason !== "") { + writer.uint32(26).string(message.reason); + } + if (message.canBid !== false) { + writer.uint32(32).bool(message.canBid); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GroupBidPreCheck { + const reader = + input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupBidPreCheck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.minBidPrice = DecCoin.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reason = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.canBid = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GroupBidPreCheck { + return { + $type: GroupBidPreCheck.$type, + name: isSet(object.name) ? globalThis.String(object.name) : "", + minBidPrice: isSet(object.minBidPrice) + ? DecCoin.fromJSON(object.minBidPrice) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : "", + canBid: isSet(object.canBid) ? globalThis.Boolean(object.canBid) : false, + }; + }, + + toJSON(message: GroupBidPreCheck): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.minBidPrice !== undefined) { + obj.minBidPrice = DecCoin.toJSON(message.minBidPrice); + } + if (message.reason !== "") { + obj.reason = message.reason; + } + if (message.canBid !== false) { + obj.canBid = message.canBid; + } + return obj; + }, + + create(base?: DeepPartial): GroupBidPreCheck { + return GroupBidPreCheck.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GroupBidPreCheck { + const message = createBaseGroupBidPreCheck(); + message.name = object.name ?? ""; + message.minBidPrice = + object.minBidPrice !== undefined && object.minBidPrice !== null + ? DecCoin.fromPartial(object.minBidPrice) + : undefined; + message.reason = object.reason ?? ""; + message.canBid = object.canBid ?? false; + return message; + }, +}; + +messageTypeRegistry.set(GroupBidPreCheck.$type, GroupBidPreCheck); + +function createBaseBidPreCheckResponse(): BidPreCheckResponse { + return { + $type: "akash.provider.v1.BidPreCheckResponse", + groupBidPreChecks: [], + totalPrice: undefined, + }; +} + +export const BidPreCheckResponse = { + $type: "akash.provider.v1.BidPreCheckResponse" as const, + + encode( + message: BidPreCheckResponse, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + for (const v of message.groupBidPreChecks) { + GroupBidPreCheck.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.totalPrice !== undefined) { + DecCoin.encode(message.totalPrice, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BidPreCheckResponse { + const reader = + input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBidPreCheckResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.groupBidPreChecks.push( + GroupBidPreCheck.decode(reader, reader.uint32()), + ); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.totalPrice = DecCoin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BidPreCheckResponse { + return { + $type: BidPreCheckResponse.$type, + groupBidPreChecks: globalThis.Array.isArray(object?.groupBidPreChecks) + ? object.groupBidPreChecks.map((e: any) => GroupBidPreCheck.fromJSON(e)) + : [], + totalPrice: isSet(object.totalPrice) + ? DecCoin.fromJSON(object.totalPrice) + : undefined, + }; + }, + + toJSON(message: BidPreCheckResponse): unknown { + const obj: any = {}; + if (message.groupBidPreChecks?.length) { + obj.groupBidPreChecks = message.groupBidPreChecks.map((e) => + GroupBidPreCheck.toJSON(e), + ); + } + if (message.totalPrice !== undefined) { + obj.totalPrice = DecCoin.toJSON(message.totalPrice); + } + return obj; + }, + + create(base?: DeepPartial): BidPreCheckResponse { + return BidPreCheckResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BidPreCheckResponse { + const message = createBaseBidPreCheckResponse(); + message.groupBidPreChecks = + object.groupBidPreChecks?.map((e) => GroupBidPreCheck.fromPartial(e)) || + []; + message.totalPrice = + object.totalPrice !== undefined && object.totalPrice !== null + ? DecCoin.fromPartial(object.totalPrice) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(BidPreCheckResponse.$type, BidPreCheckResponse); + /** ProviderRPC defines the RPC server for provider */ export type ProviderRPCService = typeof ProviderRPCService; export const ProviderRPCService = { @@ -55,6 +376,22 @@ export const ProviderRPCService = { Buffer.from(Status.encode(value).finish()), responseDeserialize: (value: Buffer) => Status.decode(value), }, + /** + * BidPreCheck defines a method to check if a provider can bid on a manifest + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + */ + bidPreCheck: { + path: "/akash.provider.v1.ProviderRPC/BidPreCheck", + requestStream: false, + responseStream: false, + requestSerialize: (value: BidPreCheckRequest) => + Buffer.from(BidPreCheckRequest.encode(value).finish()), + requestDeserialize: (value: Buffer) => BidPreCheckRequest.decode(value), + responseSerialize: (value: BidPreCheckResponse) => + Buffer.from(BidPreCheckResponse.encode(value).finish()), + responseDeserialize: (value: Buffer) => BidPreCheckResponse.decode(value), + }, } as const; export interface ProviderRPCServer extends UntypedServiceImplementation { @@ -70,6 +407,12 @@ export interface ProviderRPCServer extends UntypedServiceImplementation { * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME */ streamStatus: handleServerStreamingCall; + /** + * BidPreCheck defines a method to check if a provider can bid on a manifest + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + */ + bidPreCheck: handleUnaryCall; } export interface ProviderRPCClient extends Client { @@ -107,6 +450,35 @@ export interface ProviderRPCClient extends Client { metadata?: Metadata, options?: Partial, ): ClientReadableStream; + /** + * BidPreCheck defines a method to check if a provider can bid on a manifest + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + */ + bidPreCheck( + request: BidPreCheckRequest, + callback: ( + error: ServiceError | null, + response: BidPreCheckResponse, + ) => void, + ): ClientUnaryCall; + bidPreCheck( + request: BidPreCheckRequest, + metadata: Metadata, + callback: ( + error: ServiceError | null, + response: BidPreCheckResponse, + ) => void, + ): ClientUnaryCall; + bidPreCheck( + request: BidPreCheckRequest, + metadata: Metadata, + options: Partial, + callback: ( + error: ServiceError | null, + response: BidPreCheckResponse, + ) => void, + ): ClientUnaryCall; } export const ProviderRPCClient = makeGenericClientConstructor( @@ -121,3 +493,33 @@ export const ProviderRPCClient = makeGenericClientConstructor( service: typeof ProviderRPCService; serviceName: string; }; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in Exclude]?: DeepPartial } + : Partial; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/ts/src/generated/akash/provider/v1/service.ts b/ts/src/generated/akash/provider/v1/service.ts index bdef34da..2f8e3486 100644 --- a/ts/src/generated/akash/provider/v1/service.ts +++ b/ts/src/generated/akash/provider/v1/service.ts @@ -1,10 +1,330 @@ /* eslint-disable */ +import Long from "long"; import _m0 from "protobufjs/minimal"; import { Observable } from "rxjs"; import { map } from "rxjs/operators"; +import { DecCoin } from "../../../cosmos/base/v1beta1/coin"; import { Empty } from "../../../google/protobuf/empty"; +import { messageTypeRegistry } from "../../../typeRegistry"; +import { GroupSpec } from "../../deployment/v1beta3/groupspec"; import { Status } from "./status"; +/** BidPreCheckRequest is request type for the BidPreCheck RPC method */ +export interface BidPreCheckRequest { + $type: "akash.provider.v1.BidPreCheckRequest"; + groups: GroupSpec[]; +} + +/** GroupBidPreCheck contains bid information for a specific group */ +export interface GroupBidPreCheck { + $type: "akash.provider.v1.GroupBidPreCheck"; + name: string; + minBidPrice: DecCoin | undefined; + reason: string; + canBid: boolean; +} + +/** PreBidCheckResponse is response type for the PreBidCheck RPC method */ +export interface BidPreCheckResponse { + $type: "akash.provider.v1.BidPreCheckResponse"; + groupBidPreChecks: GroupBidPreCheck[]; + totalPrice: DecCoin | undefined; +} + +function createBaseBidPreCheckRequest(): BidPreCheckRequest { + return { $type: "akash.provider.v1.BidPreCheckRequest", groups: [] }; +} + +export const BidPreCheckRequest = { + $type: "akash.provider.v1.BidPreCheckRequest" as const, + + encode( + message: BidPreCheckRequest, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + for (const v of message.groups) { + GroupSpec.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BidPreCheckRequest { + const reader = + input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBidPreCheckRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.groups.push(GroupSpec.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BidPreCheckRequest { + return { + $type: BidPreCheckRequest.$type, + groups: globalThis.Array.isArray(object?.groups) + ? object.groups.map((e: any) => GroupSpec.fromJSON(e)) + : [], + }; + }, + + toJSON(message: BidPreCheckRequest): unknown { + const obj: any = {}; + if (message.groups?.length) { + obj.groups = message.groups.map((e) => GroupSpec.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): BidPreCheckRequest { + return BidPreCheckRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BidPreCheckRequest { + const message = createBaseBidPreCheckRequest(); + message.groups = object.groups?.map((e) => GroupSpec.fromPartial(e)) || []; + return message; + }, +}; + +messageTypeRegistry.set(BidPreCheckRequest.$type, BidPreCheckRequest); + +function createBaseGroupBidPreCheck(): GroupBidPreCheck { + return { + $type: "akash.provider.v1.GroupBidPreCheck", + name: "", + minBidPrice: undefined, + reason: "", + canBid: false, + }; +} + +export const GroupBidPreCheck = { + $type: "akash.provider.v1.GroupBidPreCheck" as const, + + encode( + message: GroupBidPreCheck, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.minBidPrice !== undefined) { + DecCoin.encode(message.minBidPrice, writer.uint32(18).fork()).ldelim(); + } + if (message.reason !== "") { + writer.uint32(26).string(message.reason); + } + if (message.canBid !== false) { + writer.uint32(32).bool(message.canBid); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GroupBidPreCheck { + const reader = + input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupBidPreCheck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.minBidPrice = DecCoin.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reason = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.canBid = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GroupBidPreCheck { + return { + $type: GroupBidPreCheck.$type, + name: isSet(object.name) ? globalThis.String(object.name) : "", + minBidPrice: isSet(object.minBidPrice) + ? DecCoin.fromJSON(object.minBidPrice) + : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : "", + canBid: isSet(object.canBid) ? globalThis.Boolean(object.canBid) : false, + }; + }, + + toJSON(message: GroupBidPreCheck): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.minBidPrice !== undefined) { + obj.minBidPrice = DecCoin.toJSON(message.minBidPrice); + } + if (message.reason !== "") { + obj.reason = message.reason; + } + if (message.canBid !== false) { + obj.canBid = message.canBid; + } + return obj; + }, + + create(base?: DeepPartial): GroupBidPreCheck { + return GroupBidPreCheck.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GroupBidPreCheck { + const message = createBaseGroupBidPreCheck(); + message.name = object.name ?? ""; + message.minBidPrice = + object.minBidPrice !== undefined && object.minBidPrice !== null + ? DecCoin.fromPartial(object.minBidPrice) + : undefined; + message.reason = object.reason ?? ""; + message.canBid = object.canBid ?? false; + return message; + }, +}; + +messageTypeRegistry.set(GroupBidPreCheck.$type, GroupBidPreCheck); + +function createBaseBidPreCheckResponse(): BidPreCheckResponse { + return { + $type: "akash.provider.v1.BidPreCheckResponse", + groupBidPreChecks: [], + totalPrice: undefined, + }; +} + +export const BidPreCheckResponse = { + $type: "akash.provider.v1.BidPreCheckResponse" as const, + + encode( + message: BidPreCheckResponse, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + for (const v of message.groupBidPreChecks) { + GroupBidPreCheck.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.totalPrice !== undefined) { + DecCoin.encode(message.totalPrice, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BidPreCheckResponse { + const reader = + input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBidPreCheckResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.groupBidPreChecks.push( + GroupBidPreCheck.decode(reader, reader.uint32()), + ); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.totalPrice = DecCoin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BidPreCheckResponse { + return { + $type: BidPreCheckResponse.$type, + groupBidPreChecks: globalThis.Array.isArray(object?.groupBidPreChecks) + ? object.groupBidPreChecks.map((e: any) => GroupBidPreCheck.fromJSON(e)) + : [], + totalPrice: isSet(object.totalPrice) + ? DecCoin.fromJSON(object.totalPrice) + : undefined, + }; + }, + + toJSON(message: BidPreCheckResponse): unknown { + const obj: any = {}; + if (message.groupBidPreChecks?.length) { + obj.groupBidPreChecks = message.groupBidPreChecks.map((e) => + GroupBidPreCheck.toJSON(e), + ); + } + if (message.totalPrice !== undefined) { + obj.totalPrice = DecCoin.toJSON(message.totalPrice); + } + return obj; + }, + + create(base?: DeepPartial): BidPreCheckResponse { + return BidPreCheckResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BidPreCheckResponse { + const message = createBaseBidPreCheckResponse(); + message.groupBidPreChecks = + object.groupBidPreChecks?.map((e) => GroupBidPreCheck.fromPartial(e)) || + []; + message.totalPrice = + object.totalPrice !== undefined && object.totalPrice !== null + ? DecCoin.fromPartial(object.totalPrice) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(BidPreCheckResponse.$type, BidPreCheckResponse); + /** ProviderRPC defines the RPC server for provider */ export interface ProviderRPC { /** @@ -19,6 +339,12 @@ export interface ProviderRPC { * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME */ StreamStatus(request: Empty): Observable; + /** + * BidPreCheck defines a method to check if a provider can bid on a manifest + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + */ + BidPreCheck(request: BidPreCheckRequest): Promise; } export const ProviderRPCServiceName = "akash.provider.v1.ProviderRPC"; @@ -30,6 +356,7 @@ export class ProviderRPCClientImpl implements ProviderRPC { this.rpc = rpc; this.GetStatus = this.GetStatus.bind(this); this.StreamStatus = this.StreamStatus.bind(this); + this.BidPreCheck = this.BidPreCheck.bind(this); } GetStatus(request: Empty): Promise { const data = Empty.encode(request).finish(); @@ -46,6 +373,14 @@ export class ProviderRPCClientImpl implements ProviderRPC { ); return result.pipe(map((data) => Status.decode(_m0.Reader.create(data)))); } + + BidPreCheck(request: BidPreCheckRequest): Promise { + const data = BidPreCheckRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "BidPreCheck", data); + return promise.then((data) => + BidPreCheckResponse.decode(_m0.Reader.create(data)), + ); + } } interface Rpc { @@ -70,3 +405,33 @@ interface Rpc { data: Observable, ): Observable; } + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in Exclude]?: DeepPartial } + : Partial; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/ts/src/generated/cosmos/base/v1beta1/coin.ts b/ts/src/generated/cosmos/base/v1beta1/coin.ts index ca0fdc37..845af104 100644 --- a/ts/src/generated/cosmos/base/v1beta1/coin.ts +++ b/ts/src/generated/cosmos/base/v1beta1/coin.ts @@ -1 +1,369 @@ -export * from "../../../../patch/cosmos/base/v1beta1/coin"; +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { messageTypeRegistry } from "../../../typeRegistry"; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + $type: "cosmos.base.v1beta1.Coin"; + denom: string; + amount: string; +} + +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + $type: "cosmos.base.v1beta1.DecCoin"; + denom: string; + amount: string; +} + +/** IntProto defines a Protobuf wrapper around an Int object. */ +export interface IntProto { + $type: "cosmos.base.v1beta1.IntProto"; + int: string; +} + +/** DecProto defines a Protobuf wrapper around a Dec object. */ +export interface DecProto { + $type: "cosmos.base.v1beta1.DecProto"; + dec: string; +} + +function createBaseCoin(): Coin { + return { $type: "cosmos.base.v1beta1.Coin", denom: "", amount: "" }; +} + +export const Coin = { + $type: "cosmos.base.v1beta1.Coin" as const, + + encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Coin { + const reader = + input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + $type: Coin.$type, + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + return obj; + }, + + create(base?: DeepPartial): Coin { + return Coin.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Coin { + const message = createBaseCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +messageTypeRegistry.set(Coin.$type, Coin); + +function createBaseDecCoin(): DecCoin { + return { $type: "cosmos.base.v1beta1.DecCoin", denom: "", amount: "" }; +} + +export const DecCoin = { + $type: "cosmos.base.v1beta1.DecCoin" as const, + + encode( + message: DecCoin, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { + const reader = + input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + $type: DecCoin.$type, + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + return obj; + }, + + create(base?: DeepPartial): DecCoin { + return DecCoin.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DecCoin { + const message = createBaseDecCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +messageTypeRegistry.set(DecCoin.$type, DecCoin); + +function createBaseIntProto(): IntProto { + return { $type: "cosmos.base.v1beta1.IntProto", int: "" }; +} + +export const IntProto = { + $type: "cosmos.base.v1beta1.IntProto" as const, + + encode( + message: IntProto, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.int !== "") { + writer.uint32(10).string(message.int); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): IntProto { + const reader = + input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIntProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.int = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): IntProto { + return { + $type: IntProto.$type, + int: isSet(object.int) ? globalThis.String(object.int) : "", + }; + }, + + toJSON(message: IntProto): unknown { + const obj: any = {}; + if (message.int !== "") { + obj.int = message.int; + } + return obj; + }, + + create(base?: DeepPartial): IntProto { + return IntProto.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): IntProto { + const message = createBaseIntProto(); + message.int = object.int ?? ""; + return message; + }, +}; + +messageTypeRegistry.set(IntProto.$type, IntProto); + +function createBaseDecProto(): DecProto { + return { $type: "cosmos.base.v1beta1.DecProto", dec: "" }; +} + +export const DecProto = { + $type: "cosmos.base.v1beta1.DecProto" as const, + + encode( + message: DecProto, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DecProto { + const reader = + input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.dec = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecProto { + return { + $type: DecProto.$type, + dec: isSet(object.dec) ? globalThis.String(object.dec) : "", + }; + }, + + toJSON(message: DecProto): unknown { + const obj: any = {}; + if (message.dec !== "") { + obj.dec = message.dec; + } + return obj; + }, + + create(base?: DeepPartial): DecProto { + return DecProto.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DecProto { + const message = createBaseDecProto(); + message.dec = object.dec ?? ""; + return message; + }, +}; + +messageTypeRegistry.set(DecProto.$type, DecProto); + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in Exclude]?: DeepPartial } + : Partial; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/ts/src/generated/index.akash.base.v1beta3.ts b/ts/src/generated/index.akash.base.v1beta3.ts index a9744583..466dea9a 100644 --- a/ts/src/generated/index.akash.base.v1beta3.ts +++ b/ts/src/generated/index.akash.base.v1beta3.ts @@ -1,3 +1,10 @@ /* eslint-disable */ export * from "./akash/base/v1beta3/attribute"; +export * from "./akash/base/v1beta3/resourcevalue"; +export * from "./akash/base/v1beta3/cpu"; +export * from "./akash/base/v1beta3/gpu"; +export * from "./akash/base/v1beta3/memory"; +export * from "./akash/base/v1beta3/storage"; +export * from "./akash/base/v1beta3/endpoint"; +export * from "./akash/base/v1beta3/resources"; diff --git a/ts/src/generated/index.akash.ts b/ts/src/generated/index.akash.ts index f680aefc..93cda50f 100644 --- a/ts/src/generated/index.akash.ts +++ b/ts/src/generated/index.akash.ts @@ -3,3 +3,4 @@ export * as base from "./index.akash.base"; export * as inventory from "./index.akash.inventory"; export * as provider from "./index.akash.provider"; +export * as deployment from "./index.akash.deployment"; diff --git a/ts/src/generated/index.ts b/ts/src/generated/index.ts index 30153d27..821878cf 100644 --- a/ts/src/generated/index.ts +++ b/ts/src/generated/index.ts @@ -4,3 +4,4 @@ export * as google from "./index.google"; export * as gogoproto from "./index.gogoproto"; export * as akash from "./index.akash"; export * as k8s from "./index.k8s"; +export * as cosmos from "./index.cosmos";