From c3440fb5b0e91d7549c88c6ef2e26b01cb18c384 Mon Sep 17 00:00:00 2001 From: Pierce Trey Date: Thu, 24 Mar 2022 11:29:17 -0600 Subject: [PATCH 1/2] allow setting of price/denom via environment variables - defaults to 19050 nhash - adds new /coin endpoint with coin proto representation --- Dockerfile | 12 +++++++++++- gas-prices.coin.json.template | 4 ++++ gas-prices.json | 4 ---- gas-prices.json.template | 4 ++++ nginx.conf | 6 +++++- 5 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 gas-prices.coin.json.template delete mode 100644 gas-prices.json create mode 100644 gas-prices.json.template diff --git a/Dockerfile b/Dockerfile index 4f461c2..4d14d5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,16 @@ FROM nginx:1.21.6-alpine +ENV GAS_PRICE 19050 +ENV GAS_PRICE_DENOM nhash + LABEL org.opencontainers.image.source=https://github.com/provenance-io/gas-price-service COPY ./nginx.conf /etc/nginx/conf.d/default.conf -COPY ./gas-prices.json /usr/share/nginx/html/gas-prices.json \ No newline at end of file +COPY ./gas-prices.json.template /usr/share/nginx/html/gas-prices.json.template +COPY ./gas-prices.coin.json.template /usr/share/nginx/html/gas-prices.coin.json.template + +CMD [ "sh", "-c", "\ + envsubst < /usr/share/nginx/html/gas-prices.json.template > /usr/share/nginx/html/gas-prices.json \ + && envsubst < /usr/share/nginx/html/gas-prices.coin.json.template > /usr/share/nginx/html/gas-prices.coin.json \ + && nginx -g 'daemon off;'\ +" ] \ No newline at end of file diff --git a/gas-prices.coin.json.template b/gas-prices.coin.json.template new file mode 100644 index 0000000..c7fb199 --- /dev/null +++ b/gas-prices.coin.json.template @@ -0,0 +1,4 @@ +{ + "amount": "${GAS_PRICE}", + "denom": "${GAS_PRICE_DENOM}" +} diff --git a/gas-prices.json b/gas-prices.json deleted file mode 100644 index a2a9778..0000000 --- a/gas-prices.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "gasPrice": 9525, - "gasPriceDenom": "nhash" -} diff --git a/gas-prices.json.template b/gas-prices.json.template new file mode 100644 index 0000000..d93b68b --- /dev/null +++ b/gas-prices.json.template @@ -0,0 +1,4 @@ +{ + "gasPrice": ${GAS_PRICE}, + "gasPriceDenom": "${GAS_PRICE_DENOM}" +} diff --git a/nginx.conf b/nginx.conf index 94c316e..85c629d 100644 --- a/nginx.conf +++ b/nginx.conf @@ -2,8 +2,12 @@ server { listen 80; server_name gas-prices; location / { - # This would be the directory where your React app's static files are stored at root /usr/share/nginx/html; try_files /gas-prices.json =404; } + + location /coin { + root /usr/share/nginx/html; + try_files /gas-prices.coin.json =404; + } } \ No newline at end of file From 3fa5b1b1dbe2474b58600a3afd02ddced772b05e Mon Sep 17 00:00:00 2001 From: Pierce Trey Date: Thu, 24 Mar 2022 12:56:10 -0600 Subject: [PATCH 2/2] add proto binary representation --- Dockerfile | 12 ++ .../cosmos/cosmos-sdk/types/coin.pb.go | 161 ++++++++++++++++++ go/convert.go | 31 ++++ go/go.mod | 8 + go/go.sum | 38 +++++ go/gogoproto/gogo.proto | 145 ++++++++++++++++ go/proto/coin.proto | 19 +++ nginx.conf | 5 + 8 files changed, 419 insertions(+) create mode 100644 go/coin/github.com/cosmos/cosmos-sdk/types/coin.pb.go create mode 100644 go/convert.go create mode 100644 go/go.mod create mode 100644 go/go.sum create mode 100644 go/gogoproto/gogo.proto create mode 100644 go/proto/coin.proto diff --git a/Dockerfile b/Dockerfile index 4d14d5f..e958ae6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,12 @@ +FROM golang:1.18 as go +RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest + +WORKDIR /coinconvert + +ADD ./go /coinconvert + +RUN go install /coinconvert + FROM nginx:1.21.6-alpine ENV GAS_PRICE 19050 @@ -5,6 +14,8 @@ ENV GAS_PRICE_DENOM nhash LABEL org.opencontainers.image.source=https://github.com/provenance-io/gas-price-service +COPY --from=go /go/bin/coin-json-to-proto /usr/bin/coin-json-to-proto + COPY ./nginx.conf /etc/nginx/conf.d/default.conf COPY ./gas-prices.json.template /usr/share/nginx/html/gas-prices.json.template COPY ./gas-prices.coin.json.template /usr/share/nginx/html/gas-prices.coin.json.template @@ -12,5 +23,6 @@ COPY ./gas-prices.coin.json.template /usr/share/nginx/html/gas-prices.coin.json. CMD [ "sh", "-c", "\ envsubst < /usr/share/nginx/html/gas-prices.json.template > /usr/share/nginx/html/gas-prices.json \ && envsubst < /usr/share/nginx/html/gas-prices.coin.json.template > /usr/share/nginx/html/gas-prices.coin.json \ + && coin-json-to-proto < /usr/share/nginx/html/gas-prices.coin.json > /usr/share/nginx/html/gas-prices.coin.bin \ && nginx -g 'daemon off;'\ " ] \ No newline at end of file diff --git a/go/coin/github.com/cosmos/cosmos-sdk/types/coin.pb.go b/go/coin/github.com/cosmos/cosmos-sdk/types/coin.pb.go new file mode 100644 index 0000000..a77d5dc --- /dev/null +++ b/go/coin/github.com/cosmos/cosmos-sdk/types/coin.pb.go @@ -0,0 +1,161 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.19.4 +// source: coin.proto + +package types + +import ( + _ "github.com/gogo/protobuf/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// 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. +type Coin struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (x *Coin) Reset() { + *x = Coin{} + if protoimpl.UnsafeEnabled { + mi := &file_coin_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Coin) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Coin) ProtoMessage() {} + +func (x *Coin) ProtoReflect() protoreflect.Message { + mi := &file_coin_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Coin.ProtoReflect.Descriptor instead. +func (*Coin) Descriptor() ([]byte, []int) { + return file_coin_proto_rawDescGZIP(), []int{0} +} + +func (x *Coin) GetDenom() string { + if x != nil { + return x.Denom + } + return "" +} + +func (x *Coin) GetAmount() string { + if x != nil { + return x.Amount + } + return "" +} + +var File_coin_proto protoreflect.FileDescriptor + +var file_coin_proto_rawDesc = []byte{ + 0x0a, 0x0a, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, + 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x47, 0x0a, 0x04, 0x43, 0x6f, 0x69, 0x6e, 0x12, + 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x23, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xda, 0xde, 0x1f, 0x03, 0x49, 0x6e, 0x74, 0xc8, 0xde, + 0x1f, 0x00, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, + 0x42, 0x2c, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0xd8, 0xe1, 0x1e, 0x00, 0x80, 0xe2, 0x1e, 0x00, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_coin_proto_rawDescOnce sync.Once + file_coin_proto_rawDescData = file_coin_proto_rawDesc +) + +func file_coin_proto_rawDescGZIP() []byte { + file_coin_proto_rawDescOnce.Do(func() { + file_coin_proto_rawDescData = protoimpl.X.CompressGZIP(file_coin_proto_rawDescData) + }) + return file_coin_proto_rawDescData +} + +var file_coin_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_coin_proto_goTypes = []interface{}{ + (*Coin)(nil), // 0: cosmos.base.v1beta1.Coin +} +var file_coin_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_coin_proto_init() } +func file_coin_proto_init() { + if File_coin_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_coin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Coin); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_coin_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_coin_proto_goTypes, + DependencyIndexes: file_coin_proto_depIdxs, + MessageInfos: file_coin_proto_msgTypes, + }.Build() + File_coin_proto = out.File + file_coin_proto_rawDesc = nil + file_coin_proto_goTypes = nil + file_coin_proto_depIdxs = nil +} \ No newline at end of file diff --git a/go/convert.go b/go/convert.go new file mode 100644 index 0000000..d82b496 --- /dev/null +++ b/go/convert.go @@ -0,0 +1,31 @@ +package main + +import ( + "io/ioutil" + "os" + + "github.com/gogo/protobuf/jsonpb" + "github.com/gogo/protobuf/proto" + "github.com/provenance-io/coin-json-to-proto/coin/github.com/cosmos/cosmos-sdk/types" +) + +func main() { + bytes, err := ioutil.ReadAll(os.Stdin) + if err != nil { + os.Exit(1) + } + json := string(bytes) + + coin := types.Coin{} + err = jsonpb.UnmarshalString(json, &coin) + if err != nil { + os.Exit(1) + } + + bytes, err = proto.Marshal(&coin) + if err != nil { + os.Exit(1) + } + + os.Stdout.Write(bytes) +} diff --git a/go/go.mod b/go/go.mod new file mode 100644 index 0000000..794f1fd --- /dev/null +++ b/go/go.mod @@ -0,0 +1,8 @@ +module github.com/provenance-io/coin-json-to-proto + +go 1.17 + +require ( + github.com/gogo/protobuf v1.3.2 + google.golang.org/protobuf v1.28.0 +) diff --git a/go/go.sum b/go/go.sum new file mode 100644 index 0000000..376a1aa --- /dev/null +++ b/go/go.sum @@ -0,0 +1,38 @@ +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= diff --git a/go/gogoproto/gogo.proto b/go/gogoproto/gogo.proto new file mode 100644 index 0000000..588291f --- /dev/null +++ b/go/gogoproto/gogo.proto @@ -0,0 +1,145 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto2"; +package gogoproto; + +import "google/protobuf/descriptor.proto"; + +option java_package = "com.google.protobuf"; +option java_outer_classname = "GoGoProtos"; +option go_package = "github.com/gogo/protobuf/gogoproto"; + +extend google.protobuf.EnumOptions { + optional bool goproto_enum_prefix = 62001; + optional bool goproto_enum_stringer = 62021; + optional bool enum_stringer = 62022; + optional string enum_customname = 62023; + optional bool enumdecl = 62024; +} + +extend google.protobuf.EnumValueOptions { + optional string enumvalue_customname = 66001; +} + +extend google.protobuf.FileOptions { + optional bool goproto_getters_all = 63001; + optional bool goproto_enum_prefix_all = 63002; + optional bool goproto_stringer_all = 63003; + optional bool verbose_equal_all = 63004; + optional bool face_all = 63005; + optional bool gostring_all = 63006; + optional bool populate_all = 63007; + optional bool stringer_all = 63008; + optional bool onlyone_all = 63009; + + optional bool equal_all = 63013; + optional bool description_all = 63014; + optional bool testgen_all = 63015; + optional bool benchgen_all = 63016; + optional bool marshaler_all = 63017; + optional bool unmarshaler_all = 63018; + optional bool stable_marshaler_all = 63019; + + optional bool sizer_all = 63020; + + optional bool goproto_enum_stringer_all = 63021; + optional bool enum_stringer_all = 63022; + + optional bool unsafe_marshaler_all = 63023; + optional bool unsafe_unmarshaler_all = 63024; + + optional bool goproto_extensions_map_all = 63025; + optional bool goproto_unrecognized_all = 63026; + optional bool gogoproto_import = 63027; + optional bool protosizer_all = 63028; + optional bool compare_all = 63029; + optional bool typedecl_all = 63030; + optional bool enumdecl_all = 63031; + + optional bool goproto_registration = 63032; + optional bool messagename_all = 63033; + + optional bool goproto_sizecache_all = 63034; + optional bool goproto_unkeyed_all = 63035; +} + +extend google.protobuf.MessageOptions { + optional bool goproto_getters = 64001; + optional bool goproto_stringer = 64003; + optional bool verbose_equal = 64004; + optional bool face = 64005; + optional bool gostring = 64006; + optional bool populate = 64007; + optional bool stringer = 67008; + optional bool onlyone = 64009; + + optional bool equal = 64013; + optional bool description = 64014; + optional bool testgen = 64015; + optional bool benchgen = 64016; + optional bool marshaler = 64017; + optional bool unmarshaler = 64018; + optional bool stable_marshaler = 64019; + + optional bool sizer = 64020; + + optional bool unsafe_marshaler = 64023; + optional bool unsafe_unmarshaler = 64024; + + optional bool goproto_extensions_map = 64025; + optional bool goproto_unrecognized = 64026; + + optional bool protosizer = 64028; + optional bool compare = 64029; + + optional bool typedecl = 64030; + + optional bool messagename = 64033; + + optional bool goproto_sizecache = 64034; + optional bool goproto_unkeyed = 64035; +} + +extend google.protobuf.FieldOptions { + optional bool nullable = 65001; + optional bool embed = 65002; + optional string customtype = 65003; + optional string customname = 65004; + optional string jsontag = 65005; + optional string moretags = 65006; + optional string casttype = 65007; + optional string castkey = 65008; + optional string castvalue = 65009; + + optional bool stdtime = 65010; + optional bool stdduration = 65011; + optional bool wktpointer = 65012; + + optional string castrepeated = 65013; +} \ No newline at end of file diff --git a/go/proto/coin.proto b/go/proto/coin.proto new file mode 100644 index 0000000..e163c5d --- /dev/null +++ b/go/proto/coin.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; +package cosmos.base.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/types"; +option (gogoproto.goproto_stringer_all) = false; +option (gogoproto.stringer_all) = false; + +// 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. +message Coin { + option (gogoproto.equal) = true; + + string denom = 1; + string amount = 2 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/nginx.conf b/nginx.conf index 85c629d..4c23ba1 100644 --- a/nginx.conf +++ b/nginx.conf @@ -7,6 +7,11 @@ server { } location /coin { + root /usr/share/nginx/html; + try_files /gas-prices.coin.bin =404; + } + + location /coin.json { root /usr/share/nginx/html; try_files /gas-prices.coin.json =404; }