Skip to content

Commit

Permalink
feat: regenerate src and type for aurad, cosmos-sdk, wasmd, ibc-go-v3
Browse files Browse the repository at this point in the history
  • Loading branch information
fibonacci998 committed Mar 16, 2023
1 parent 8054e4f commit 3b1e7eb
Show file tree
Hide file tree
Showing 486 changed files with 50,664 additions and 100,587 deletions.
8 changes: 7 additions & 1 deletion .telescope.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"protoDirs": [
"./proto"
"cosmos-sdk-v0.45.11/proto",
"cosmos-sdk-v0.45.11/third_party/proto",
"ibc-go-v3.3.0/proto",
"ibc-go-v3.3.0/third_party/proto",
"wasmd-v0.29.1/proto",
"wasmd-v0.29.1/third_party/proto",
"aurad-v0.4.3/proto"
],
"outPath": "./src/codegen",
"options": {
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@ git clone https://github.com/cosmology-tech/stargazejs
yarn
yarn bootstrap
```

## Update guide
If the chain is upgraded to new version, aurajs must be regenerated:
```js
npm run codegen
npm run buidl
```
## Disclaimer

AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
Expand Down
42 changes: 3 additions & 39 deletions scripts/codegen.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,12 @@
import { join } from 'path';
import telescope from '@osmonauts/telescope';
import { sync as rimraf } from 'rimraf';
import { AMINO_MAP } from './aminos';

const protoDirs = [join(__dirname, '/../proto')];
const outPath = join(__dirname, '../src/codegen');
const TELESCOPE_CONFIG = require('../.telescope.json');
const outPath = join(TELESCOPE_CONFIG.outPath);
rimraf(outPath);

telescope({
protoDirs,
outPath,
options: {
tsDisable: {
files: [
'cosmos/authz/v1beta1/tx.amino.ts',
'cosmos/staking/v1beta1/tx.amino.ts'
]
},
prototypes: {
includePackageVar: false,
typingsFormat: {
useDeepPartial: false,
useExact: false,
timestamp: 'timestamp',
duration: 'duration'
},
methods: {
toJSON: true,
fromJSON: true
}
},
aminoEncoding: {
enabled: true,
exceptions: AMINO_MAP
},
lcdClients: {
enabled: false
},
rpcClients: {
enabled: true,
camelCase: true
}
}
})
telescope(TELESCOPE_CONFIG)
.then(() => {
console.log('✨ all done!');
})
Expand Down
3 changes: 1 addition & 2 deletions src/codegen/aura/aura/aura.ts → src/codegen/aura/aura.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as _m0 from "protobufjs/minimal";
import { DeepPartial } from "../../helpers";
import { DeepPartial } from "../helpers";
/** Params defines the parameters for the aura module. */

export interface Params {
Expand All @@ -10,7 +10,6 @@ export interface Params {
/** Params defines the parameters for the aura module. */

export interface ParamsSDKType {
/** max_supply defines the max supply of aura coin. */
max_supply: string;
exclude_circulating_addr: string[];
}
Expand Down
30 changes: 0 additions & 30 deletions src/codegen/aura/bundle.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Params, ParamsSDKType } from "./aura";
import * as _m0 from "protobufjs/minimal";
import { DeepPartial } from "../../helpers";
import { DeepPartial } from "../helpers";
/** GenesisState defines the aura module's genesis state. */

export interface GenesisState {
Expand All @@ -10,7 +10,6 @@ export interface GenesisState {
/** GenesisState defines the aura module's genesis state. */

export interface GenesisStateSDKType {
/** params defines all the parameters of related to aura. */
params?: ParamsSDKType;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Rpc } from "../../helpers";
import { Rpc } from "../helpers";
import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate";
/** Query defines the gRPC querier service. */

Expand Down
File renamed without changes.
File renamed without changes.
25 changes: 17 additions & 8 deletions src/codegen/auranw/bundle.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
import * as _0 from "../aura/aura/aura";
import * as _1 from "../aura/aura/genesis";
import * as _2 from "../aura/aura/query";
import * as _3 from "../aura/aura/tx";
import * as _131 from "../aura/aura";
import * as _132 from "../aura/genesis";
import * as _133 from "../aura/query";
import * as _134 from "../aura/tx";
import * as _224 from "../aura/query.rpc.Query";
import * as _234 from "./lcd";
import * as _235 from "./rpc.query";
import * as _236 from "./rpc.tx";
export namespace auranw {
export namespace aura {
export const aura = { ..._0,
..._1,
..._2,
..._3
export const aura = { ..._131,
..._132,
..._133,
..._134,
..._224
};
}
export const ClientFactory = { ..._234,
..._235,
..._236
};
}
91 changes: 91 additions & 0 deletions src/codegen/auranw/lcd.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { LCDClient } from "@osmonauts/lcd";
export const createLCDClient = async ({
restEndpoint
}: {
restEndpoint: string;
}) => {
const requestClient = new LCDClient({
restEndpoint
});
return {
cosmos: {
auth: {
v1beta1: new (await import("../cosmos/auth/v1beta1/query.lcd")).LCDQueryClient({
requestClient
})
},
authz: {
v1beta1: new (await import("../cosmos/authz/v1beta1/query.lcd")).LCDQueryClient({
requestClient
})
},
bank: {
v1beta1: new (await import("../cosmos/bank/v1beta1/query.lcd")).LCDQueryClient({
requestClient
})
},
base: {
node: {
v1beta1: new (await import("../cosmos/base/node/v1beta1/query.lcd")).LCDQueryClient({
requestClient
})
},
tendermint: {
v1beta1: new (await import("../cosmos/base/tendermint/v1beta1/query.lcd")).LCDQueryClient({
requestClient
})
}
},
distribution: {
v1beta1: new (await import("../cosmos/distribution/v1beta1/query.lcd")).LCDQueryClient({
requestClient
})
},
evidence: {
v1beta1: new (await import("../cosmos/evidence/v1beta1/query.lcd")).LCDQueryClient({
requestClient
})
},
feegrant: {
v1beta1: new (await import("../cosmos/feegrant/v1beta1/query.lcd")).LCDQueryClient({
requestClient
})
},
gov: {
v1beta1: new (await import("../cosmos/gov/v1beta1/query.lcd")).LCDQueryClient({
requestClient
})
},
mint: {
v1beta1: new (await import("../cosmos/mint/v1beta1/query.lcd")).LCDQueryClient({
requestClient
})
},
params: {
v1beta1: new (await import("../cosmos/params/v1beta1/query.lcd")).LCDQueryClient({
requestClient
})
},
slashing: {
v1beta1: new (await import("../cosmos/slashing/v1beta1/query.lcd")).LCDQueryClient({
requestClient
})
},
staking: {
v1beta1: new (await import("../cosmos/staking/v1beta1/query.lcd")).LCDQueryClient({
requestClient
})
},
tx: {
v1beta1: new (await import("../cosmos/tx/v1beta1/service.lcd")).LCDQueryClient({
requestClient
})
},
upgrade: {
v1beta1: new (await import("../cosmos/upgrade/v1beta1/query.lcd")).LCDQueryClient({
requestClient
})
}
}
};
};
25 changes: 10 additions & 15 deletions src/codegen/aura/rpc.query.ts → src/codegen/auranw/rpc.query.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc";
import { QueryClient } from "@cosmjs/stargate";
export const createRPCQueryClient = async ({
rpcEndpoint
}: {
rpcEndpoint: string;
rpcEndpoint: string | HttpEndpoint;
}) => {
const tmClient = await Tendermint34Client.connect(rpcEndpoint);
const client = new QueryClient(tmClient);
return {
aura: {
aura: (await import("./aura/query.rpc.Query")).createRpcQueryExtension(client)
},
cosmos: {
app: {
v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query")).createRpcQueryExtension(client)
},
auth: {
v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query")).createRpcQueryExtension(client)
},
Expand All @@ -25,6 +19,9 @@ export const createRPCQueryClient = async ({
v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client)
},
base: {
node: {
v1beta1: (await import("../cosmos/base/node/v1beta1/query.rpc.Service")).createRpcQueryExtension(client)
},
tendermint: {
v1beta1: (await import("../cosmos/base/tendermint/v1beta1/query.rpc.Service")).createRpcQueryExtension(client)
}
Expand All @@ -39,18 +36,11 @@ export const createRPCQueryClient = async ({
v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client)
},
gov: {
v1: (await import("../cosmos/gov/v1/query.rpc.Query")).createRpcQueryExtension(client),
v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client)
},
group: {
v1: (await import("../cosmos/group/v1/query.rpc.Query")).createRpcQueryExtension(client)
},
mint: {
v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query")).createRpcQueryExtension(client)
},
nft: {
v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query")).createRpcQueryExtension(client)
},
params: {
v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client)
},
Expand All @@ -66,6 +56,11 @@ export const createRPCQueryClient = async ({
upgrade: {
v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query")).createRpcQueryExtension(client)
}
},
auranw: {
aura: {
aura: (await import("../aura/query.rpc.Query")).createRpcQueryExtension(client)
}
}
};
};
10 changes: 0 additions & 10 deletions src/codegen/aura/rpc.tx.ts → src/codegen/auranw/rpc.tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,14 @@ export const createRPCMsgClient = async ({
v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc)
},
gov: {
v1: new (await import("../cosmos/gov/v1/tx.rpc.msg")).MsgClientImpl(rpc),
v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc)
},
group: {
v1: new (await import("../cosmos/group/v1/tx.rpc.msg")).MsgClientImpl(rpc)
},
nft: {
v1beta1: new (await import("../cosmos/nft/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc)
},
slashing: {
v1beta1: new (await import("../cosmos/slashing/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc)
},
staking: {
v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc)
},
upgrade: {
v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc)
},
vesting: {
v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc)
}
Expand Down
Loading

0 comments on commit 3b1e7eb

Please sign in to comment.