Skip to content

Commit 3a25a1b

Browse files
authored
Merge branch 'main' into dudong2/refactor/remove-unsafe-balance-changing-methods
2 parents ada5202 + fed352c commit 3a25a1b

File tree

9 files changed

+1091
-123
lines changed

9 files changed

+1091
-123
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
5050
* (server/grpc) [\#607](https://github.com/line/lbm-sdk/pull/607) revert gRPC block height header.
5151
* (global) [\#611](https://github.com/line/lbm-sdk/pull/611) bump github.com/cosmos/cosmos-sdk from v0.45.1 to v0.45.6
5252
* (simapp) [\#620](https://github.com/line/lbm-sdk/pull/620) chore: add iterator feature for simapp
53+
* (x/collection) [\#622](https://github.com/line/lbm-sdk/pull/622) add Query/TokenClassTypeName
5354
* (x/bank) [\#629](https://github.com/line/lbm-sdk/pull/629) remove unsafe balance changing methods from bank keeper such as `SetBalance` and `SetSupply`.
5455

5556
### Improvements

client/docs/statik/statik.go

+1-1
Large diffs are not rendered by default.

client/docs/swagger-ui/swagger.yaml

+244
Original file line numberDiff line numberDiff line change
@@ -40418,6 +40418,238 @@ paths:
4041840418
type: string
4041940419
tags:
4042040420
- Query
40421+
'/lbm/collection/v1/contracts/{contract_id}/token_classes/{class_id}/type_name':
40422+
get:
40423+
summary: >-
40424+
TokenClassTypeName queries the fully qualified message type name of a
40425+
token class from its class id.
40426+
40427+
Throws:
40428+
40429+
- ErrInvalidRequest
40430+
- `contract_id` is of invalid format.
40431+
- `class_id` is of invalid format.
40432+
- ErrNotFound
40433+
- there is no token class of `class_id`.
40434+
Since: 0.46.0 (finschia)
40435+
operationId: TokenClassTypeName
40436+
responses:
40437+
'200':
40438+
description: A successful response.
40439+
schema:
40440+
type: object
40441+
properties:
40442+
name:
40443+
type: string
40444+
description: type name of the token class.
40445+
description: >-
40446+
QueryTokenClassTypeNameResponse is the response type for the
40447+
Query/TokenClassTypeName RPC method.
40448+
40449+
40450+
Since: 0.46.0 (finschia)
40451+
default:
40452+
description: An unexpected error response
40453+
schema:
40454+
type: object
40455+
properties:
40456+
error:
40457+
type: string
40458+
code:
40459+
type: integer
40460+
format: int32
40461+
message:
40462+
type: string
40463+
details:
40464+
type: array
40465+
items:
40466+
type: object
40467+
properties:
40468+
type_url:
40469+
type: string
40470+
description: >-
40471+
A URL/resource name that uniquely identifies the type of
40472+
the serialized
40473+
40474+
protocol buffer message. This string must contain at
40475+
least
40476+
40477+
one "/" character. The last segment of the URL's path
40478+
must represent
40479+
40480+
the fully qualified name of the type (as in
40481+
40482+
`path/google.protobuf.Duration`). The name should be in
40483+
a canonical form
40484+
40485+
(e.g., leading "." is not accepted).
40486+
40487+
40488+
In practice, teams usually precompile into the binary
40489+
all types that they
40490+
40491+
expect it to use in the context of Any. However, for
40492+
URLs which use the
40493+
40494+
scheme `http`, `https`, or no scheme, one can optionally
40495+
set up a type
40496+
40497+
server that maps type URLs to message definitions as
40498+
follows:
40499+
40500+
40501+
* If no scheme is provided, `https` is assumed.
40502+
40503+
* An HTTP GET on the URL must yield a
40504+
[google.protobuf.Type][]
40505+
value in binary format, or produce an error.
40506+
* Applications are allowed to cache lookup results based
40507+
on the
40508+
URL, or have them precompiled into a binary to avoid any
40509+
lookup. Therefore, binary compatibility needs to be preserved
40510+
on changes to types. (Use versioned type names to manage
40511+
breaking changes.)
40512+
40513+
Note: this functionality is not currently available in
40514+
the official
40515+
40516+
protobuf release, and it is not used for type URLs
40517+
beginning with
40518+
40519+
type.googleapis.com.
40520+
40521+
40522+
Schemes other than `http`, `https` (or the empty scheme)
40523+
might be
40524+
40525+
used with implementation specific semantics.
40526+
value:
40527+
type: string
40528+
format: byte
40529+
description: >-
40530+
Must be a valid serialized protocol buffer of the above
40531+
specified type.
40532+
description: >-
40533+
`Any` contains an arbitrary serialized protocol buffer
40534+
message along with a
40535+
40536+
URL that describes the type of the serialized message.
40537+
40538+
40539+
Protobuf library provides support to pack/unpack Any values
40540+
in the form
40541+
40542+
of utility functions or additional generated methods of the
40543+
Any type.
40544+
40545+
40546+
Example 1: Pack and unpack a message in C++.
40547+
40548+
Foo foo = ...;
40549+
Any any;
40550+
any.PackFrom(foo);
40551+
...
40552+
if (any.UnpackTo(&foo)) {
40553+
...
40554+
}
40555+
40556+
Example 2: Pack and unpack a message in Java.
40557+
40558+
Foo foo = ...;
40559+
Any any = Any.pack(foo);
40560+
...
40561+
if (any.is(Foo.class)) {
40562+
foo = any.unpack(Foo.class);
40563+
}
40564+
40565+
Example 3: Pack and unpack a message in Python.
40566+
40567+
foo = Foo(...)
40568+
any = Any()
40569+
any.Pack(foo)
40570+
...
40571+
if any.Is(Foo.DESCRIPTOR):
40572+
any.Unpack(foo)
40573+
...
40574+
40575+
Example 4: Pack and unpack a message in Go
40576+
40577+
foo := &pb.Foo{...}
40578+
any, err := ptypes.MarshalAny(foo)
40579+
...
40580+
foo := &pb.Foo{}
40581+
if err := ptypes.UnmarshalAny(any, foo); err != nil {
40582+
...
40583+
}
40584+
40585+
The pack methods provided by protobuf library will by
40586+
default use
40587+
40588+
'type.googleapis.com/full.type.name' as the type URL and the
40589+
unpack
40590+
40591+
methods only use the fully qualified type name after the
40592+
last '/'
40593+
40594+
in the type URL, for example "foo.bar.com/x/y.z" will yield
40595+
type
40596+
40597+
name "y.z".
40598+
40599+
40600+
40601+
JSON
40602+
40603+
====
40604+
40605+
The JSON representation of an `Any` value uses the regular
40606+
40607+
representation of the deserialized, embedded message, with
40608+
an
40609+
40610+
additional field `@type` which contains the type URL.
40611+
Example:
40612+
40613+
package google.profile;
40614+
message Person {
40615+
string first_name = 1;
40616+
string last_name = 2;
40617+
}
40618+
40619+
{
40620+
"@type": "type.googleapis.com/google.profile.Person",
40621+
"firstName": <string>,
40622+
"lastName": <string>
40623+
}
40624+
40625+
If the embedded message type is well-known and has a custom
40626+
JSON
40627+
40628+
representation, that representation will be embedded adding
40629+
a field
40630+
40631+
`value` which holds the custom JSON in addition to the
40632+
`@type`
40633+
40634+
field. Example (for message [google.protobuf.Duration][]):
40635+
40636+
{
40637+
"@type": "type.googleapis.com/google.protobuf.Duration",
40638+
"value": "1.212s"
40639+
}
40640+
parameters:
40641+
- name: contract_id
40642+
description: contract id associated with the contract.
40643+
in: path
40644+
required: true
40645+
type: string
40646+
- name: class_id
40647+
description: class id associated with the token class.
40648+
in: path
40649+
required: true
40650+
type: string
40651+
tags:
40652+
- Query
4042140653
'/lbm/collection/v1/contracts/{contract_id}/token_types':
4042240654
get:
4042340655
summary: |-
@@ -69400,6 +69632,18 @@ definitions:
6940069632

6940169633
Since: 0.46.0 (finschia)
6940269634
description: QueryRootResponse is the response type for the Query/Root RPC method.
69635+
lbm.collection.v1.QueryTokenClassTypeNameResponse:
69636+
type: object
69637+
properties:
69638+
name:
69639+
type: string
69640+
description: type name of the token class.
69641+
description: >-
69642+
QueryTokenClassTypeNameResponse is the response type for the
69643+
Query/TokenClassTypeName RPC method.
69644+
69645+
69646+
Since: 0.46.0 (finschia)
6940369647
lbm.collection.v1.QueryTokenResponse:
6940469648
type: object
6940569649
properties:

docs/core/proto-docs.md

+38
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,8 @@
989989
- [QueryParentResponse](#lbm.collection.v1.QueryParentResponse)
990990
- [QueryRootRequest](#lbm.collection.v1.QueryRootRequest)
991991
- [QueryRootResponse](#lbm.collection.v1.QueryRootResponse)
992+
- [QueryTokenClassTypeNameRequest](#lbm.collection.v1.QueryTokenClassTypeNameRequest)
993+
- [QueryTokenClassTypeNameResponse](#lbm.collection.v1.QueryTokenClassTypeNameResponse)
992994
- [QueryTokenRequest](#lbm.collection.v1.QueryTokenRequest)
993995
- [QueryTokenResponse](#lbm.collection.v1.QueryTokenResponse)
994996
- [QueryTokenTypeRequest](#lbm.collection.v1.QueryTokenTypeRequest)
@@ -15003,6 +15005,41 @@ QueryRootResponse is the response type for the Query/Root RPC method.
1500315005

1500415006

1500515007

15008+
<a name="lbm.collection.v1.QueryTokenClassTypeNameRequest"></a>
15009+
15010+
### QueryTokenClassTypeNameRequest
15011+
QueryTokenClassTypeNameRequest is the request type for the Query/TokenClassTypeName RPC method.
15012+
15013+
Since: 0.46.0 (finschia)
15014+
15015+
15016+
| Field | Type | Label | Description |
15017+
| ----- | ---- | ----- | ----------- |
15018+
| `contract_id` | [string](#string) | | contract id associated with the contract. |
15019+
| `class_id` | [string](#string) | | class id associated with the token class. |
15020+
15021+
15022+
15023+
15024+
15025+
15026+
<a name="lbm.collection.v1.QueryTokenClassTypeNameResponse"></a>
15027+
15028+
### QueryTokenClassTypeNameResponse
15029+
QueryTokenClassTypeNameResponse is the response type for the Query/TokenClassTypeName RPC method.
15030+
15031+
Since: 0.46.0 (finschia)
15032+
15033+
15034+
| Field | Type | Label | Description |
15035+
| ----- | ---- | ----- | ----------- |
15036+
| `name` | [string](#string) | | type name of the token class. |
15037+
15038+
15039+
15040+
15041+
15042+
1500615043
<a name="lbm.collection.v1.QueryTokenRequest"></a>
1500715044

1500815045
### QueryTokenRequest
@@ -15184,6 +15221,7 @@ Query defines the gRPC querier service.
1518415221
| `NFTMinted` | [QueryNFTMintedRequest](#lbm.collection.v1.QueryNFTMintedRequest) | [QueryNFTMintedResponse](#lbm.collection.v1.QueryNFTMintedResponse) | NFTMinted queries the number of minted tokens from a given contract id and token type. Throws: - ErrInvalidRequest - `contract_id` is of invalid format. - `class_id` is of invalid format. - ErrNotFound - there is no token class of `class_id`. | GET|/lbm/collection/v1/contracts/{contract_id}/token_types/{token_type}/minted|
1518515222
| `NFTBurnt` | [QueryNFTBurntRequest](#lbm.collection.v1.QueryNFTBurntRequest) | [QueryNFTBurntResponse](#lbm.collection.v1.QueryNFTBurntResponse) | NFTBurnt queries the number of burnt tokens from a given contract id and token type. Throws: - ErrInvalidRequest - `contract_id` is of invalid format. - `class_id` is of invalid format. - ErrNotFound - there is no token class of `class_id`. | GET|/lbm/collection/v1/contracts/{contract_id}/token_types/{token_type}/burnt|
1518615223
| `Contract` | [QueryContractRequest](#lbm.collection.v1.QueryContractRequest) | [QueryContractResponse](#lbm.collection.v1.QueryContractResponse) | Contract queries a contract metadata based on its contract id. Throws: - ErrInvalidRequest - `contract_id` is of invalid format. - ErrNotFound - there is no contract of `contract_id`. | GET|/lbm/collection/v1/contracts/{contract_id}|
15224+
| `TokenClassTypeName` | [QueryTokenClassTypeNameRequest](#lbm.collection.v1.QueryTokenClassTypeNameRequest) | [QueryTokenClassTypeNameResponse](#lbm.collection.v1.QueryTokenClassTypeNameResponse) | TokenClassTypeName queries the fully qualified message type name of a token class from its class id. Throws: - ErrInvalidRequest - `contract_id` is of invalid format. - `class_id` is of invalid format. - ErrNotFound - there is no token class of `class_id`. Since: 0.46.0 (finschia) | GET|/lbm/collection/v1/contracts/{contract_id}/token_classes/{class_id}/type_name|
1518715225
| `TokenType` | [QueryTokenTypeRequest](#lbm.collection.v1.QueryTokenTypeRequest) | [QueryTokenTypeResponse](#lbm.collection.v1.QueryTokenTypeResponse) | TokenType queries metadata of a token type. Throws: - ErrInvalidRequest - `contract_id` is of invalid format. - `class_id` is of invalid format. - ErrNotFound - there is no token class of `class_id`. | GET|/lbm/collection/v1/contracts/{contract_id}/token_types/{token_type}|
1518815226
| `TokenTypes` | [QueryTokenTypesRequest](#lbm.collection.v1.QueryTokenTypesRequest) | [QueryTokenTypesResponse](#lbm.collection.v1.QueryTokenTypesResponse) | TokenTypes queries metadata of all the token types. Throws: - ErrInvalidRequest - `contract_id` is of invalid format. - ErrNotFound - there is no token contract of `contract_id`. | GET|/lbm/collection/v1/contracts/{contract_id}/token_types|
1518915227
| `Token` | [QueryTokenRequest](#lbm.collection.v1.QueryTokenRequest) | [QueryTokenResponse](#lbm.collection.v1.QueryTokenResponse) | Token queries a metadata of a token from its token id. Throws: - ErrInvalidRequest - `contract_id` is of invalid format. - `token_id` is of invalid format. - ErrNotFound - there is no token of `token_id`. | GET|/lbm/collection/v1/contracts/{contract_id}/tokens/{token_id}|

proto/lbm/collection/v1/query.proto

+30
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,18 @@ service Query {
109109
option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}";
110110
}
111111

112+
// TokenClassTypeName queries the fully qualified message type name of a token class from its class id.
113+
// Throws:
114+
// - ErrInvalidRequest
115+
// - `contract_id` is of invalid format.
116+
// - `class_id` is of invalid format.
117+
// - ErrNotFound
118+
// - there is no token class of `class_id`.
119+
// Since: 0.46.0 (finschia)
120+
rpc TokenClassTypeName(QueryTokenClassTypeNameRequest) returns (QueryTokenClassTypeNameResponse) {
121+
option (google.api.http).get = "/lbm/collection/v1/contracts/{contract_id}/token_classes/{class_id}/type_name";
122+
}
123+
112124
// TokenType queries metadata of a token type.
113125
// Throws:
114126
// - ErrInvalidRequest
@@ -360,6 +372,24 @@ message QueryContractResponse {
360372
Contract contract = 1 [(gogoproto.nullable) = false];
361373
}
362374

375+
// QueryTokenClassTypeNameRequest is the request type for the Query/TokenClassTypeName RPC method.
376+
//
377+
// Since: 0.46.0 (finschia)
378+
message QueryTokenClassTypeNameRequest {
379+
// contract id associated with the contract.
380+
string contract_id = 1;
381+
// class id associated with the token class.
382+
string class_id = 2;
383+
}
384+
385+
// QueryTokenClassTypeNameResponse is the response type for the Query/TokenClassTypeName RPC method.
386+
//
387+
// Since: 0.46.0 (finschia)
388+
message QueryTokenClassTypeNameResponse {
389+
// type name of the token class.
390+
string name = 1;
391+
}
392+
363393
// QueryTokenTypeRequest is the request type for the Query/TokenType RPC method.
364394
message QueryTokenTypeRequest {
365395
// contract id associated with the contract.

0 commit comments

Comments
 (0)