Skip to content

Commit

Permalink
Proto: Build/Export Fix & Update TSC (#140)
Browse files Browse the repository at this point in the history
* Proto: Build/Export Fix & Update TSC

- Fixed typos in package.json
- Switched bundler of /proto to use TSC over Babel
- Updated Telescope to latest version
- Lowered threshold of target and module compiler options in tsconfig for every package for a more general audience

* Added changeset
  • Loading branch information
codebycarson authored Apr 4, 2024
1 parent 48fe7e9 commit 07951bc
Show file tree
Hide file tree
Showing 119 changed files with 1,795 additions and 3,891 deletions.
5 changes: 5 additions & 0 deletions .changeset/brave-lies-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sei-js/proto": patch
---

Updated Telescope to latest version, changed build tool from babel to TSC, fixed typos in exports
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
"ts-node": "10.9.1",
"typedoc": "^0.25.12",
"typedoc-material-theme": "^1.0.2",
"typescript": "5.4.2"
"typescript": "5.4.4",
"viem": "2.x",
"wagmi": "^2.5.17"
}
}

16 changes: 8 additions & 8 deletions packages/proto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
"publishConfig": {
"access": "public"
},
"main": "./dist/cjs/codgen/index.js",
"module": "./dist/esm/codgen/index.js",
"types": "./dist/types/codgen/index.d.ts",
"main": "./dist/cjs/codegen/index.js",
"module": "./dist/esm/codegen/index.js",
"types": "./dist/types/codegen/index.d.ts",
"sideEffects": false,
"directories": {
"lib": "src",
"test": "__tests__"
},
"scripts": {
"prebuild": "rimraf dist",
"build": "yarn build:cjs && yarn build:esm && yarn build:ts",
"build:cjs": "BABEL_ENV=cjs babel src --out-dir dist/cjs --delete-dir-on-start --extensions \".tsx,.ts,.js\"",
"build:esm": "BABEL_ENV=esm babel src --out-dir dist/esm --delete-dir-on-start --extensions \".tsx,.ts,.js\"",
"build:ts": "tsc --project ./tsconfig.json",
"build": "yarn build:cjs && yarn build:esm && yarn build:types",
"build:cjs": "tsc --outDir dist/cjs --module commonjs",
"build:esm": "tsc --outDir dist/esm --module esnext",
"build:types": "tsc --project ./tsconfig.declaration.json",
"codegen": "cross-env NODE_ENV=development babel-node scripts/codegen.js",
"postcodegen": "yarn prettier --write ./src/codegen/**/*.ts --config ../../.prettierrc",
"dev": "cross-env NODE_ENV=development babel-node src/index --extensions \".tsx,.ts,.js\"",
Expand Down Expand Up @@ -77,7 +77,7 @@
"@cosmjs/stargate": "^0.32.2",
"@cosmjs/tendermint-rpc": "^0.32.2",
"@cosmology/lcd": "^0.13.3",
"@cosmology/telescope": "^1.4.12",
"@cosmology/telescope": "^1.5.3",
"@osmonauts/helpers": "^0.7.0",
"cosmjs-types": "^0.9.0",
"protobufjs": "^7.2.6"
Expand Down
2 changes: 1 addition & 1 deletion packages/proto/src/codegen/binary.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file and any referenced files were automatically generated by @cosmology/telescope@1.4.12
* This file and any referenced files were automatically generated by @cosmology/telescope@1.5.3
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
* and run the transpile command or yarn proto command to regenerate this bundle.
*/
Expand Down
46 changes: 23 additions & 23 deletions packages/proto/src/codegen/confio/proofs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ export const ExistenceProof = {
if (message.path) {
obj.path = message.path.map((e) => (e ? InnerOp.toAmino(e) : undefined));
} else {
obj.path = [];
obj.path = message.path;
}
return obj;
},
Expand Down Expand Up @@ -1110,16 +1110,16 @@ export const LeafOp = {
fromAmino(object: LeafOpAmino): LeafOp {
const message = createBaseLeafOp();
if (object.hash !== undefined && object.hash !== null) {
message.hash = hashOpFromJSON(object.hash);
message.hash = object.hash;
}
if (object.prehash_key !== undefined && object.prehash_key !== null) {
message.prehashKey = hashOpFromJSON(object.prehash_key);
message.prehashKey = object.prehash_key;
}
if (object.prehash_value !== undefined && object.prehash_value !== null) {
message.prehashValue = hashOpFromJSON(object.prehash_value);
message.prehashValue = object.prehash_value;
}
if (object.length !== undefined && object.length !== null) {
message.length = lengthOpFromJSON(object.length);
message.length = object.length;
}
if (object.prefix !== undefined && object.prefix !== null) {
message.prefix = bytesFromBase64(object.prefix);
Expand All @@ -1128,10 +1128,10 @@ export const LeafOp = {
},
toAmino(message: LeafOp): LeafOpAmino {
const obj: any = {};
obj.hash = message.hash;
obj.prehash_key = message.prehashKey;
obj.prehash_value = message.prehashValue;
obj.length = message.length;
obj.hash = message.hash === 0 ? undefined : message.hash;
obj.prehash_key = message.prehashKey === 0 ? undefined : message.prehashKey;
obj.prehash_value = message.prehashValue === 0 ? undefined : message.prehashValue;
obj.length = message.length === 0 ? undefined : message.length;
obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined;
return obj;
},
Expand Down Expand Up @@ -1205,7 +1205,7 @@ export const InnerOp = {
fromAmino(object: InnerOpAmino): InnerOp {
const message = createBaseInnerOp();
if (object.hash !== undefined && object.hash !== null) {
message.hash = hashOpFromJSON(object.hash);
message.hash = object.hash;
}
if (object.prefix !== undefined && object.prefix !== null) {
message.prefix = bytesFromBase64(object.prefix);
Expand All @@ -1217,7 +1217,7 @@ export const InnerOp = {
},
toAmino(message: InnerOp): InnerOpAmino {
const obj: any = {};
obj.hash = message.hash;
obj.hash = message.hash === 0 ? undefined : message.hash;
obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined;
obj.suffix = message.suffix ? base64FromBytes(message.suffix) : undefined;
return obj;
Expand Down Expand Up @@ -1317,8 +1317,8 @@ export const ProofSpec = {
const obj: any = {};
obj.leaf_spec = message.leafSpec ? LeafOp.toAmino(message.leafSpec) : undefined;
obj.inner_spec = message.innerSpec ? InnerSpec.toAmino(message.innerSpec) : undefined;
obj.max_depth = message.maxDepth;
obj.min_depth = message.minDepth;
obj.max_depth = message.maxDepth === 0 ? undefined : message.maxDepth;
obj.min_depth = message.minDepth === 0 ? undefined : message.minDepth;
return obj;
},
fromAminoMsg(object: ProofSpecAminoMsg): ProofSpec {
Expand Down Expand Up @@ -1437,7 +1437,7 @@ export const InnerSpec = {
message.emptyChild = bytesFromBase64(object.empty_child);
}
if (object.hash !== undefined && object.hash !== null) {
message.hash = hashOpFromJSON(object.hash);
message.hash = object.hash;
}
return message;
},
Expand All @@ -1446,13 +1446,13 @@ export const InnerSpec = {
if (message.childOrder) {
obj.child_order = message.childOrder.map((e) => e);
} else {
obj.child_order = [];
obj.child_order = message.childOrder;
}
obj.child_size = message.childSize;
obj.min_prefix_length = message.minPrefixLength;
obj.max_prefix_length = message.maxPrefixLength;
obj.child_size = message.childSize === 0 ? undefined : message.childSize;
obj.min_prefix_length = message.minPrefixLength === 0 ? undefined : message.minPrefixLength;
obj.max_prefix_length = message.maxPrefixLength === 0 ? undefined : message.maxPrefixLength;
obj.empty_child = message.emptyChild ? base64FromBytes(message.emptyChild) : undefined;
obj.hash = message.hash;
obj.hash = message.hash === 0 ? undefined : message.hash;
return obj;
},
fromAminoMsg(object: InnerSpecAminoMsg): InnerSpec {
Expand Down Expand Up @@ -1516,7 +1516,7 @@ export const BatchProof = {
if (message.entries) {
obj.entries = message.entries.map((e) => (e ? BatchEntry.toAmino(e) : undefined));
} else {
obj.entries = [];
obj.entries = message.entries;
}
return obj;
},
Expand Down Expand Up @@ -1665,12 +1665,12 @@ export const CompressedBatchProof = {
if (message.entries) {
obj.entries = message.entries.map((e) => (e ? CompressedBatchEntry.toAmino(e) : undefined));
} else {
obj.entries = [];
obj.entries = message.entries;
}
if (message.lookupInners) {
obj.lookup_inners = message.lookupInners.map((e) => (e ? InnerOp.toAmino(e) : undefined));
} else {
obj.lookup_inners = [];
obj.lookup_inners = message.lookupInners;
}
return obj;
},
Expand Down Expand Up @@ -1855,7 +1855,7 @@ export const CompressedExistenceProof = {
if (message.path) {
obj.path = message.path.map((e) => e);
} else {
obj.path = [];
obj.path = message.path;
}
return obj;
},
Expand Down
20 changes: 10 additions & 10 deletions packages/proto/src/codegen/cosmos/auth/v1beta1/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ export const BaseAccount = {
},
toAmino(message: BaseAccount): BaseAccountAmino {
const obj: any = {};
obj.address = message.address;
obj.address = message.address === "" ? undefined : message.address;
obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined;
obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined;
obj.sequence = message.sequence ? message.sequence.toString() : undefined;
obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined;
obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined;
return obj;
},
fromAminoMsg(object: BaseAccountAminoMsg): BaseAccount {
Expand Down Expand Up @@ -275,11 +275,11 @@ export const ModuleAccount = {
toAmino(message: ModuleAccount): ModuleAccountAmino {
const obj: any = {};
obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined;
obj.name = message.name;
obj.name = message.name === "" ? undefined : message.name;
if (message.permissions) {
obj.permissions = message.permissions.map(e => e);
} else {
obj.permissions = [];
obj.permissions = message.permissions;
}
return obj;
},
Expand Down Expand Up @@ -393,11 +393,11 @@ export const Params = {
},
toAmino(message: Params): ParamsAmino {
const obj: any = {};
obj.max_memo_characters = message.maxMemoCharacters ? message.maxMemoCharacters.toString() : undefined;
obj.tx_sig_limit = message.txSigLimit ? message.txSigLimit.toString() : undefined;
obj.tx_size_cost_per_byte = message.txSizeCostPerByte ? message.txSizeCostPerByte.toString() : undefined;
obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 ? message.sigVerifyCostEd25519.toString() : undefined;
obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 ? message.sigVerifyCostSecp256k1.toString() : undefined;
obj.max_memo_characters = message.maxMemoCharacters !== BigInt(0) ? message.maxMemoCharacters.toString() : undefined;
obj.tx_sig_limit = message.txSigLimit !== BigInt(0) ? message.txSigLimit.toString() : undefined;
obj.tx_size_cost_per_byte = message.txSizeCostPerByte !== BigInt(0) ? message.txSizeCostPerByte.toString() : undefined;
obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 !== BigInt(0) ? message.sigVerifyCostEd25519.toString() : undefined;
obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 !== BigInt(0) ? message.sigVerifyCostSecp256k1.toString() : undefined;
return obj;
},
fromAminoMsg(object: ParamsAminoMsg): Params {
Expand Down
2 changes: 1 addition & 1 deletion packages/proto/src/codegen/cosmos/auth/v1beta1/genesis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const GenesisState = {
if (message.accounts) {
obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined);
} else {
obj.accounts = [];
obj.accounts = message.accounts;
}
return obj;
},
Expand Down
16 changes: 8 additions & 8 deletions packages/proto/src/codegen/cosmos/auth/v1beta1/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ export const QueryAccountsResponse = {
if (message.accounts) {
obj.accounts = message.accounts.map(e => e ? Cosmos_authAccountI_ToAmino((e as Any)) : undefined);
} else {
obj.accounts = [];
obj.accounts = message.accounts;
}
obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined;
return obj;
Expand Down Expand Up @@ -509,7 +509,7 @@ export const QueryAccountRequest = {
},
toAmino(message: QueryAccountRequest): QueryAccountRequestAmino {
const obj: any = {};
obj.address = message.address;
obj.address = message.address === "" ? undefined : message.address;
return obj;
},
fromAminoMsg(object: QueryAccountRequestAminoMsg): QueryAccountRequest {
Expand Down Expand Up @@ -829,7 +829,7 @@ export const QueryModuleAccountsResponse = {
if (message.accounts) {
obj.accounts = message.accounts.map(e => e ? Cosmos_authModuleAccountI_ToAmino((e as Any)) : undefined);
} else {
obj.accounts = [];
obj.accounts = message.accounts;
}
return obj;
},
Expand Down Expand Up @@ -955,7 +955,7 @@ export const Bech32PrefixResponse = {
},
toAmino(message: Bech32PrefixResponse): Bech32PrefixResponseAmino {
const obj: any = {};
obj.bech32_prefix = message.bech32Prefix;
obj.bech32_prefix = message.bech32Prefix === "" ? undefined : message.bech32Prefix;
return obj;
},
fromAminoMsg(object: Bech32PrefixResponseAminoMsg): Bech32PrefixResponse {
Expand Down Expand Up @@ -1093,7 +1093,7 @@ export const AddressBytesToStringResponse = {
},
toAmino(message: AddressBytesToStringResponse): AddressBytesToStringResponseAmino {
const obj: any = {};
obj.address_string = message.addressString;
obj.address_string = message.addressString === "" ? undefined : message.addressString;
return obj;
},
fromAminoMsg(object: AddressBytesToStringResponseAminoMsg): AddressBytesToStringResponse {
Expand Down Expand Up @@ -1162,7 +1162,7 @@ export const AddressStringToBytesRequest = {
},
toAmino(message: AddressStringToBytesRequest): AddressStringToBytesRequestAmino {
const obj: any = {};
obj.address_string = message.addressString;
obj.address_string = message.addressString === "" ? undefined : message.addressString;
return obj;
},
fromAminoMsg(object: AddressStringToBytesRequestAminoMsg): AddressStringToBytesRequest {
Expand Down Expand Up @@ -1266,7 +1266,7 @@ export const Cosmos_authAccountI_InterfaceDecoder = (input: BinaryReader | Uint8
return data;
}
};
export const Cosmos_authAccountI_FromAmino = (content: AnyAmino) => {
export const Cosmos_authAccountI_FromAmino = (content: AnyAmino): Any => {
switch (content.type) {
case "cosmos-sdk/BaseAccount":
return Any.fromPartial({
Expand Down Expand Up @@ -1298,7 +1298,7 @@ export const Cosmos_authModuleAccountI_InterfaceDecoder = (input: BinaryReader |
return data;
}
};
export const Cosmos_authModuleAccountI_FromAmino = (content: AnyAmino) => {
export const Cosmos_authModuleAccountI_FromAmino = (content: AnyAmino): Any => {
switch (content.type) {
case "cosmos-sdk/ModuleAccount":
return Any.fromPartial({
Expand Down
2 changes: 1 addition & 1 deletion packages/proto/src/codegen/cosmos/bank/v1beta1/authz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const SendAuthorization = {
if (message.spendLimit) {
obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined);
} else {
obj.spend_limit = [];
obj.spend_limit = message.spendLimit;
}
return obj;
},
Expand Down
Loading

0 comments on commit 07951bc

Please sign in to comment.