Skip to content

Commit

Permalink
feat: add "uri" for MsgModify and deprecate the old ones (#900)
Browse files Browse the repository at this point in the history
* Add uri to x/token

* Add tests

* Add uri to x/collection

* Add tests

* Update CHANGELOG.md

* Update CHANGELOG.md

* Emit both old and new change

* Add tests

* Remove xxx_uri from events

* Revert irrelevant changes

* Lint
  • Loading branch information
0Tech authored Feb 28, 2023
1 parent 6192e0d commit 81fec6d
Show file tree
Hide file tree
Showing 25 changed files with 326 additions and 249 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (client) [\#890](https://github.com/line/lbm-sdk/pull/890) Map Ostracon:ErrTxInMap to lbm-sdk:ErrTxInMempoolCache
* (x/collection) [\#894](https://github.com/line/lbm-sdk/pull/894) Change the default params of x/collection
* (ante) [\#895](https://github.com/line/lbm-sdk/pull/895) Remove max gas validation
* (x/collection,token) [\#900](https://github.com/line/lbm-sdk/pull/900) Add uri for MsgModify and deprecate the old ones

### Bug Fixes
* (client) [\#817](https://github.com/line/lbm-sdk/pull/817) remove support for composite (BLS) type
Expand Down
10 changes: 6 additions & 4 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -9694,7 +9694,7 @@ AttributeKey enumerates the valid attribute keys on x/collection.
| ATTRIBUTE_KEY_OWNER | 5 | |
| ATTRIBUTE_KEY_AMOUNT | 6 | |
| ATTRIBUTE_KEY_DECIMALS | 7 | |
| ATTRIBUTE_KEY_BASE_IMG_URI | 8 | |
| ATTRIBUTE_KEY_BASE_IMG_URI | 8 | deprecated: use ATTRIBUTE_KEY_URI |
| ATTRIBUTE_KEY_MINTABLE | 9 | |
| ATTRIBUTE_KEY_TOKEN_TYPE | 10 | |
| ATTRIBUTE_KEY_FROM | 11 | |
Expand All @@ -9706,6 +9706,7 @@ AttributeKey enumerates the valid attribute keys on x/collection.
| ATTRIBUTE_KEY_PROXY | 17 | |
| ATTRIBUTE_KEY_OLD_ROOT_TOKEN_ID | 18 | |
| ATTRIBUTE_KEY_NEW_ROOT_TOKEN_ID | 19 | |
| ATTRIBUTE_KEY_URI | 20 | |



Expand Down Expand Up @@ -11003,7 +11004,7 @@ MsgModify is the Msg/Modify request type.
| `owner` | [string](#string) | | the address of the grantee which must have modify permission. |
| `token_type` | [string](#string) | | token type of the token. refer to TokenType for the definition. |
| `token_index` | [string](#string) | | token index of the token. if index is empty, it would modify the corresponding token type. if index is not empty, it would modify the corresponding nft. Note: if token type is of FTs, the index cannot be empty. |
| `changes` | [Attribute](#lbm.collection.v1.Attribute) | repeated | changes to apply. possible attribute keys on modifying collection: name, base_img_uri, meta. possible attribute keys on modifying token type and token: name, meta. |
| `changes` | [Attribute](#lbm.collection.v1.Attribute) | repeated | changes to apply. possible attribute keys on modifying collection: name, uri, base_img_uri (deprecated), meta. possible attribute keys on modifying token type and token: name, meta. |



Expand Down Expand Up @@ -13009,13 +13010,14 @@ AttributeKey enumerates the valid attribute keys on x/token.
| ATTRIBUTE_KEY_OWNER | 5 | |
| ATTRIBUTE_KEY_AMOUNT | 6 | |
| ATTRIBUTE_KEY_DECIMALS | 7 | |
| ATTRIBUTE_KEY_IMG_URI | 8 | |
| ATTRIBUTE_KEY_IMG_URI | 8 | deprecated: use ATTRIBUTE_KEY_URI |
| ATTRIBUTE_KEY_MINTABLE | 9 | |
| ATTRIBUTE_KEY_FROM | 10 | |
| ATTRIBUTE_KEY_TO | 11 | |
| ATTRIBUTE_KEY_PERM | 12 | |
| ATTRIBUTE_KEY_APPROVER | 13 | |
| ATTRIBUTE_KEY_PROXY | 14 | |
| ATTRIBUTE_KEY_URI | 15 | |



Expand Down Expand Up @@ -13644,7 +13646,7 @@ Signer: `owner`
| ----- | ---- | ----- | ----------- |
| `contract_id` | [string](#string) | | contract id associated with the contract. |
| `owner` | [string](#string) | | the address of the grantee which must have modify permission. |
| `changes` | [Attribute](#lbm.token.v1.Attribute) | repeated | changes to apply. possible attribute keys are: name, img_uri, meta |
| `changes` | [Attribute](#lbm.token.v1.Attribute) | repeated | changes to apply. possible attribute keys are: name, uri, img_uri (deprecated), meta |



Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ require (
github.com/minio/highwayhash v1.0.2 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/onsi/gomega v1.20.0 // indirect
github.com/onsi/gomega v1.22.1 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand All @@ -114,6 +114,7 @@ require (
github.com/rs/cors v1.8.3 // indirect
github.com/rs/zerolog v1.29.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
Expand All @@ -124,6 +125,7 @@ require (
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/tools v0.5.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
13 changes: 8 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -873,8 +873,8 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y
github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY=
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs=
github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q=
github.com/onsi/gomega v1.20.0/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo=
github.com/onsi/gomega v1.22.1 h1:pY8O4lBfsHKZHM/6nrxkhVPUznOlIu3quZcKP/M20KI=
github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM=
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
Expand Down Expand Up @@ -1057,8 +1057,9 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sivchari/containedctx v1.0.2/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw=
github.com/sivchari/tenv v1.5.0/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
Expand Down Expand Up @@ -1334,8 +1335,8 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -1557,6 +1558,7 @@ golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
Expand Down Expand Up @@ -1689,7 +1691,8 @@ golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4=
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
golang.org/x/tools v0.5.0 h1:+bSpV5HIeWkuvgaMfI3UmKRThoTA5ODJTUd8T17NO+4=
golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k=
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=
Expand Down
18 changes: 10 additions & 8 deletions proto/lbm/collection/v1/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ enum AttributeKey {
option (gogoproto.goproto_enum_stringer) = false;
option (gogoproto.goproto_enum_prefix) = false;

ATTRIBUTE_KEY_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "AttributeKeyUnspecified"];
ATTRIBUTE_KEY_NAME = 1 [(gogoproto.enumvalue_customname) = "AttributeKeyName"];
ATTRIBUTE_KEY_META = 2 [(gogoproto.enumvalue_customname) = "AttributeKeyMeta"];
ATTRIBUTE_KEY_CONTRACT_ID = 3 [(gogoproto.enumvalue_customname) = "AttributeKeyContractID"];
ATTRIBUTE_KEY_TOKEN_ID = 4 [(gogoproto.enumvalue_customname) = "AttributeKeyTokenID"];
ATTRIBUTE_KEY_OWNER = 5 [(gogoproto.enumvalue_customname) = "AttributeKeyOwner"];
ATTRIBUTE_KEY_AMOUNT = 6 [(gogoproto.enumvalue_customname) = "AttributeKeyAmount"];
ATTRIBUTE_KEY_DECIMALS = 7 [(gogoproto.enumvalue_customname) = "AttributeKeyDecimals"];
ATTRIBUTE_KEY_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "AttributeKeyUnspecified"];
ATTRIBUTE_KEY_NAME = 1 [(gogoproto.enumvalue_customname) = "AttributeKeyName"];
ATTRIBUTE_KEY_META = 2 [(gogoproto.enumvalue_customname) = "AttributeKeyMeta"];
ATTRIBUTE_KEY_CONTRACT_ID = 3 [(gogoproto.enumvalue_customname) = "AttributeKeyContractID"];
ATTRIBUTE_KEY_TOKEN_ID = 4 [(gogoproto.enumvalue_customname) = "AttributeKeyTokenID"];
ATTRIBUTE_KEY_OWNER = 5 [(gogoproto.enumvalue_customname) = "AttributeKeyOwner"];
ATTRIBUTE_KEY_AMOUNT = 6 [(gogoproto.enumvalue_customname) = "AttributeKeyAmount"];
ATTRIBUTE_KEY_DECIMALS = 7 [(gogoproto.enumvalue_customname) = "AttributeKeyDecimals"];
// deprecated: use ATTRIBUTE_KEY_URI
ATTRIBUTE_KEY_BASE_IMG_URI = 8 [(gogoproto.enumvalue_customname) = "AttributeKeyBaseImgURI"];
ATTRIBUTE_KEY_MINTABLE = 9 [(gogoproto.enumvalue_customname) = "AttributeKeyMintable"];
ATTRIBUTE_KEY_TOKEN_TYPE = 10 [(gogoproto.enumvalue_customname) = "AttributeKeyTokenType"];
Expand All @@ -72,6 +73,7 @@ enum AttributeKey {
ATTRIBUTE_KEY_PROXY = 17 [(gogoproto.enumvalue_customname) = "AttributeKeyProxy"];
ATTRIBUTE_KEY_OLD_ROOT_TOKEN_ID = 18 [(gogoproto.enumvalue_customname) = "AttributeKeyOldRoot"];
ATTRIBUTE_KEY_NEW_ROOT_TOKEN_ID = 19 [(gogoproto.enumvalue_customname) = "AttributeKeyNewRoot"];
ATTRIBUTE_KEY_URI = 20 [(gogoproto.enumvalue_customname) = "AttributeKeyURI"];
}

// EventSent is emitted when tokens are transferred.
Expand Down
2 changes: 1 addition & 1 deletion proto/lbm/collection/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ message MsgModify {
// Note: if token type is of FTs, the index cannot be empty.
string token_index = 4;
// changes to apply.
// possible attribute keys on modifying collection: name, base_img_uri, meta.
// possible attribute keys on modifying collection: name, uri, base_img_uri (deprecated), meta.
// possible attribute keys on modifying token type and token: name, meta.
repeated Attribute changes = 5 [(gogoproto.nullable) = false];
}
Expand Down
16 changes: 9 additions & 7 deletions proto/lbm/token/v1/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ enum AttributeKey {
ATTRIBUTE_KEY_OWNER = 5 [(gogoproto.enumvalue_customname) = "AttributeKeyOwner"];
ATTRIBUTE_KEY_AMOUNT = 6 [(gogoproto.enumvalue_customname) = "AttributeKeyAmount"];
ATTRIBUTE_KEY_DECIMALS = 7 [(gogoproto.enumvalue_customname) = "AttributeKeyDecimals"];
ATTRIBUTE_KEY_IMG_URI = 8 [(gogoproto.enumvalue_customname) = "AttributeKeyImageURI"];
ATTRIBUTE_KEY_MINTABLE = 9 [(gogoproto.enumvalue_customname) = "AttributeKeyMintable"];
ATTRIBUTE_KEY_FROM = 10 [(gogoproto.enumvalue_customname) = "AttributeKeyFrom"];
ATTRIBUTE_KEY_TO = 11 [(gogoproto.enumvalue_customname) = "AttributeKeyTo"];
ATTRIBUTE_KEY_PERM = 12 [(gogoproto.enumvalue_customname) = "AttributeKeyPerm"];
ATTRIBUTE_KEY_APPROVER = 13 [(gogoproto.enumvalue_customname) = "AttributeKeyApprover"];
ATTRIBUTE_KEY_PROXY = 14 [(gogoproto.enumvalue_customname) = "AttributeKeyProxy"];
// deprecated: use ATTRIBUTE_KEY_URI
ATTRIBUTE_KEY_IMG_URI = 8 [(gogoproto.enumvalue_customname) = "AttributeKeyImageURI"];
ATTRIBUTE_KEY_MINTABLE = 9 [(gogoproto.enumvalue_customname) = "AttributeKeyMintable"];
ATTRIBUTE_KEY_FROM = 10 [(gogoproto.enumvalue_customname) = "AttributeKeyFrom"];
ATTRIBUTE_KEY_TO = 11 [(gogoproto.enumvalue_customname) = "AttributeKeyTo"];
ATTRIBUTE_KEY_PERM = 12 [(gogoproto.enumvalue_customname) = "AttributeKeyPerm"];
ATTRIBUTE_KEY_APPROVER = 13 [(gogoproto.enumvalue_customname) = "AttributeKeyApprover"];
ATTRIBUTE_KEY_PROXY = 14 [(gogoproto.enumvalue_customname) = "AttributeKeyProxy"];
ATTRIBUTE_KEY_URI = 15 [(gogoproto.enumvalue_customname) = "AttributeKeyURI"];
}

// EventSent is emitted when tokens are transferred.
Expand Down
2 changes: 1 addition & 1 deletion proto/lbm/token/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ message MsgModify {
// the address of the grantee which must have modify permission.
string owner = 2;
// changes to apply.
// possible attribute keys are: name, img_uri, meta
// possible attribute keys are: name, uri, img_uri (deprecated), meta
repeated Attribute changes = 3 [(gogoproto.nullable) = false];
}

Expand Down
Loading

0 comments on commit 81fec6d

Please sign in to comment.