Skip to content

Commit 96679f6

Browse files
authored
Merge pull request #60 from persistenceOne/puneet/add-amino
feat: add amino encodings
2 parents dfca428 + 6ffff75 commit 96679f6

File tree

265 files changed

+21166
-9724
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

265 files changed

+21166
-9724
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
/persistence/
2424
/helpers.*
2525
/index.*
26+
/binary.*
27+
/utf8.*
28+
/varint.*
2629
/proofs.*
2730

2831
# misc

package-lock.json

Lines changed: 1142 additions & 888 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "persistenceonejs",
3-
"version": "2.2.0",
3+
"version": "2.3.0-rc0",
44
"description": "Client side JS libraries for persistenceSDK transaction generation, signing and broadcasting.",
55
"main": "main/index.js",
66
"module": "module/index.js",
@@ -33,13 +33,14 @@
3333
"url": "https://github.com/persistenceOne/persistenceJS/issues"
3434
},
3535
"homepage": "https://github.com/persistenceOne/persistenceJS#readme",
36-
"dependencies": {
37-
"long": "^4.0.0",
38-
"protobufjs": "~6.11.2"
39-
},
36+
"dependencies": {},
4037
"devDependencies": {
38+
"@cosmjs/amino": "^0.31.1",
39+
"@cosmjs/stargate": "^0.31.1",
40+
"@cosmjs/proto-signing": "^0.31.1",
41+
"@cosmjs/tendermint-rpc": "^0.31.1",
42+
"@cosmjs/encoding": "^0.31.1",
4143
"@types/node": "^18.6.3",
42-
"@types/long": "^4.0.1",
4344
"@cosmology/telescope": "^0.109.4",
4445
"cosmwasm-typescript-gen": "^0.3.9",
4546
"husky": "^8.0.1",

proto/pstake/liquidstakeibc/v1beta1/msgs.proto

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import "cosmos_proto/cosmos.proto";
66
import "gogoproto/gogo.proto";
77
import "cosmos/msg/v1/msg.proto";
88
import "cosmos/base/v1beta1/coin.proto";
9+
import "amino/amino.proto";
910

1011
import "pstake/liquidstakeibc/v1beta1/liquidstakeibc.proto";
1112
import "pstake/liquidstakeibc/v1beta1/params.proto";
@@ -39,6 +40,8 @@ service Msg {
3940
message MsgRegisterHostChain {
4041
option (gogoproto.equal) = false;
4142
option (gogoproto.goproto_getters) = false;
43+
option (cosmos.msg.v1.signer) = "authority";
44+
option (amino.name) = "pstake/MsgRegisterHostChain";
4245

4346
// authority is the address of the governance account
4447
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
@@ -81,18 +84,20 @@ message MsgRegisterHostChainResponse {}
8184
message MsgUpdateHostChain {
8285
option (gogoproto.equal) = false;
8386
option (gogoproto.goproto_getters) = false;
84-
87+
option (cosmos.msg.v1.signer) = "authority";
88+
option (amino.name) = "pstake/MsgUpdateHostChain";
8589
// authority is the address of the governance account
8690
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
8791

8892
string chain_id = 2;
89-
repeated KVUpdate updates = 3;
93+
repeated KVUpdate updates = 3 [(amino.dont_omitempty) = true];
9094
}
9195

9296
message MsgUpdateHostChainResponse {}
9397

9498
message MsgLiquidStake {
9599
option (cosmos.msg.v1.signer) = "delegator_address";
100+
option (amino.name) = "pstake/MsgLiquidStake";
96101

97102
string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
98103
cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false];
@@ -102,6 +107,7 @@ message MsgLiquidStakeResponse {}
102107

103108
message MsgLiquidStakeLSM {
104109
option (cosmos.msg.v1.signer) = "delegator_address";
110+
option (amino.name) = "pstake/MsgLiquidStakeLSM";
105111

106112
string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
107113
repeated cosmos.base.v1beta1.Coin delegations = 2 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
@@ -112,6 +118,7 @@ message MsgLiquidStakeLSMResponse {}
112118

113119
message MsgLiquidUnstake {
114120
option (cosmos.msg.v1.signer) = "delegator_address";
121+
option (amino.name) = "pstake/MsgLiquidUnstake";
115122

116123
string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
117124
cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false];
@@ -121,6 +128,7 @@ message MsgLiquidUnstakeResponse {}
121128

122129
message MsgRedeem {
123130
option (cosmos.msg.v1.signer) = "delegator_address";
131+
option (amino.name) = "pstake/MsgRedeem";
124132

125133
string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
126134
cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false];
@@ -133,9 +141,10 @@ message MsgUpdateParams {
133141
option (gogoproto.goproto_getters) = false;
134142

135143
option (cosmos.msg.v1.signer) = "authority";
144+
option (amino.name) = "pstake/MsgUpdateParams";
136145

137146
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
138-
Params params = 2 [(gogoproto.nullable) = false];
147+
Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
139148
}
140149

141150
message MsgUpdateParamsResponse {}

proto/pstake/liquidstakeibc/v1beta1/params.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ package pstake.liquidstakeibc.v1beta1;
33

44
import "gogoproto/gogo.proto";
55
import "cosmos_proto/cosmos.proto";
6+
import "amino/amino.proto";
67

78
option go_package = "github.com/persistenceOne/pstake-native/v2/x/liquidstakeibc/types";
89

910
// Params defines the parameters for the module.
1011
message Params {
12+
option (amino.name) = "pstake/x/liquidstakeibc/Params";
13+
1114
string admin_address = 1 [
1215
(cosmos_proto.scalar) = "cosmos.AddressString"
1316
]; // protocol admin address

scripts/prepare-publishing.sh

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,33 @@
11
#!/bin/bash
2+
23
set -o errexit -o nounset -o pipefail
34
command -v shellcheck >/dev/null && shellcheck "$0"
45

5-
DIRS="amino cosmos cosmos_proto cosmwasm gogoproto google ibc tendermint pstake persistence"
6-
FILES="helpers.d.ts helpers.js helpers.js.map index.d.ts index.js index.js.map"
6+
DIRS=(amino cosmos cosmos_proto cosmwasm gogoproto google ibc tendermint pstake persistence)
7+
FILES=(
8+
helpers.d.ts
9+
helpers.js
10+
helpers.js.map
11+
index.d.ts
12+
index.js
13+
index.js.map
14+
binary.d.ts
15+
binary.js
16+
binary.js.map
17+
utf8.d.ts
18+
utf8.js
19+
utf8.js.map
20+
varint.d.ts
21+
varint.js
22+
varint.js.map
23+
)
724

8-
for dir in $DIRS; do
25+
for dir in "${DIRS[@]}"; do
926
rm -rf "$dir"
1027
cp -R "./build/$dir" ./
1128
done
1229

13-
for f in $FILES; do
30+
for f in "${FILES[@]}"; do
1431
rm -rf "$f"
1532
cp "./build/$f" ./
16-
done
33+
done

scripts/telescope.ts

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,22 @@ telescope({
1212
logLevel: 0,
1313
useSDKTypes: false,
1414
tsDisable: {
15-
disableAll: false
15+
patterns: ["**/tx.registry.ts", "**/msgs.registry.ts"],
16+
files: [
17+
"ibc/core/types/v1/genesis.ts",
18+
"ibc/applications/interchain_accounts/genesis/v1/genesis.ts",
19+
"cosmos/tx/signing/v1beta1/signing.ts",
20+
"cosmos/staking/v1beta1/tx.ts",
21+
"cosmos/staking/v1beta1/staking.ts",
22+
23+
"cosmos/authz/v1beta1/tx.amino.ts",
24+
"cosmos/staking/v1beta1/tx.amino.ts",
25+
"cosmos/slashing/v1beta1/tx.amino.ts",
26+
"cosmos/upgrade/v1beta1/tx.amino.ts",
27+
28+
"cosmos/consensus/v1/tx.amino.ts",
29+
"cosmos/gov/v1/tx.amino.ts"
30+
]
1631
},
1732
eslintDisable: {
1833
disableAll: true
@@ -54,13 +69,25 @@ telescope({
5469
// There are users who need those functions. CosmJS does not need them directly.
5570
// See https://github.com/cosmos/cosmjs/pull/1329
5671
fromJSON: true,
57-
toJSON: true
72+
toJSON: true,
73+
fromPartial: true
74+
75+
// encode: true,
76+
// decode: true,
77+
// toSDK: true,
78+
// fromSDK: true,
79+
// toAmino: true,
80+
// fromAmino: true,
81+
// fromProto: true,
82+
// toProto: true
5883
},
5984
typingsFormat: {
60-
useDeepPartial: true,
61-
useExact: true,
85+
useDeepPartial: false,
86+
useExact: false,
6287
timestamp: "timestamp",
63-
duration: "duration"
88+
duration: "duration",
89+
num64: "bigint",
90+
setDefaultCustomTypesToUndefined: false
6491
}
6592
},
6693
lcdClients: {
@@ -79,8 +106,12 @@ telescope({
79106
"ABCIApplication"
80107
]
81108
},
109+
stargateClients: {
110+
enabled: false,
111+
includeCosmosDefaultTypes: false
112+
},
82113
aminoEncoding: {
83-
enabled: false
114+
enabled: true
84115
}
85116
}
86117
}).then(() => {

0 commit comments

Comments
 (0)