Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion proto/agent/module/v1/module.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ message Module {
};

string authority = 1;
}
}
2 changes: 1 addition & 1 deletion proto/agent/v1/agent.proto
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,4 @@ message VrfSeed {
string account = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// The VRF seed for the user.
bytes seed = 2;
}
}
2 changes: 1 addition & 1 deletion proto/agent/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ message QueryVRFSeedRequest {

message QueryVRFSeedResponse {
bytes seed = 1;
}
}
2 changes: 1 addition & 1 deletion proto/agent/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,4 @@ message MsgSubmitChallengeOriginHash {
}

message MsgSubmitChallengeOriginHashResponse {
}
}
2 changes: 1 addition & 1 deletion proto/amino/amino.proto
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ extend google.protobuf.FieldOptions {
// by the Amino JSON encoder to encode the type of the oneof field, and must be the same string in
// the RegisterConcrete() method usage used to register the concrete type.
string oneof_name = 11110006;
}
}
2 changes: 1 addition & 1 deletion proto/dht/module/v1/module.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ message Module {
// authority defines the custom module authority. If not set, defaults to the
// governance module.
string authority = 1;
}
}
2 changes: 1 addition & 1 deletion proto/dht/v1/deposit.proto
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ message UnbondingEntry {
google.protobuf.Timestamp completion_time = 3
[ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ];
string receiver = 4 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
}
}
2 changes: 1 addition & 1 deletion proto/dht/v1/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ message Params {
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];
repeated string price_token_denoms = 10;
TokenPrice model_default_token_price = 11;
}
}
32 changes: 28 additions & 4 deletions scripts/codegen.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
#!/usr/bin/env node

const { join } = require("path");
const { writeFileSync } = require("fs");
const { readdirSync,readFileSync,writeFileSync } = require("fs");
const telescope = require("@cosmology/telescope").default;

const protoPath = join(__dirname, "/../proto");
const outPath = join(__dirname, "/../src/codec");

function addNewlineToEndOfFile(filePath) {
let data = readFileSync(filePath, 'utf8');
if (!data.endsWith('\n')) {
writeFileSync(filePath, data + '\n', 'utf8');
}
}

function processDirectory(directory) {
const items = readdirSync(directory, { withFileTypes: true });
items.forEach(item => {
const fullPath = join(directory, item.name);
if (item.isDirectory()) {
processDirectory(fullPath);
} else {
addNewlineToEndOfFile(fullPath);
}
});
}

// handle proto files, add newline to the end of each file
processDirectory(protoPath);

telescope({
protoDirs: ["proto"],
outPath: outPath,
Expand Down Expand Up @@ -67,11 +90,12 @@ telescope({
}).then(
() => {
// Create index.ts
const index_ts = `
// Auto-generated, see scripts/codegen.js!
`;
const index_ts = `// Auto-generated, see scripts/codegen.js!`;
writeFileSync(`${outPath}/index.ts`, index_ts);

// handle generated ts files, add newline to the end of each file
processDirectory(outPath);

console.log("✨ All Done!");
},
(e) => {
Expand Down
2 changes: 1 addition & 1 deletion src/codec/agent/module/v1/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ export const Module = {
message.authority = object.authority ?? "";
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/agent/v1/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1523,4 +1523,4 @@ export const VrfSeed = {
message.seed = object.seed ?? new Uint8Array();
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/agent/v1/genesis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,4 @@ export const GenesisState = {
message.vrfSeeds = object.vrfSeeds?.map(e => VrfSeed.fromPartial(e)) || [];
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/agent/v1/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1054,4 +1054,4 @@ export class QueryClientImpl implements Query {
const promise = this.rpc.request("agent.v1.Query", "VRFSeedRequest", data);
return promise.then(data => QueryVRFSeedResponse.decode(new _m0.Reader(data)));
}
}
}
2 changes: 1 addition & 1 deletion src/codec/agent/v1/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1691,4 +1691,4 @@ export class MsgClientImpl implements Msg {
const promise = this.rpc.request("agent.v1.Msg", "SubmitChallengeOriginHash", data);
return promise.then(data => MsgSubmitChallengeOriginHashResponse.decode(new _m0.Reader(data)));
}
}
}
2 changes: 1 addition & 1 deletion src/codec/amino/amino.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {}
export {}
2 changes: 1 addition & 1 deletion src/codec/cosmos/app/v1alpha1/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,4 @@ export const MigrateFromInfo = {
message.module = object.module ?? "";
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/cosmos/bank/v1beta1/authz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ export const SendAuthorization = {
message.spendLimit = object.spendLimit?.map(e => Coin.fromPartial(e)) || [];
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/cosmos/bank/v1beta1/bank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,4 +532,4 @@ export const Metadata = {
message.symbol = object.symbol ?? "";
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/cosmos/bank/v1beta1/genesis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,4 @@ export const Balance = {
message.coins = object.coins?.map(e => Coin.fromPartial(e)) || [];
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/cosmos/bank/v1beta1/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -880,4 +880,4 @@ export class QueryClientImpl implements Query {
const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "DenomsMetadata", data);
return promise.then(data => QueryDenomsMetadataResponse.decode(new _m0.Reader(data)));
}
}
}
2 changes: 1 addition & 1 deletion src/codec/cosmos/bank/v1beta1/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,4 @@ export class MsgClientImpl implements Msg {
const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "MultiSend", data);
return promise.then(data => MsgMultiSendResponse.decode(new _m0.Reader(data)));
}
}
}
2 changes: 1 addition & 1 deletion src/codec/cosmos/base/query/v1beta1/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,4 @@ export const PageResponse = {
}
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/cosmos/base/v1beta1/coin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@ export const DecCoin = {
message.amount = object.amount ?? "";
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/cosmos/msg/v1/msg.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {}
export {}
2 changes: 1 addition & 1 deletion src/codec/cosmos_proto/cosmos.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {}
export {}
2 changes: 1 addition & 1 deletion src/codec/dht/module/v1/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ export const Module = {
message.authority = object.authority ?? "";
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/dht/v1/deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ export const UnbondingEntry = {
message.receiver = object.receiver ?? "";
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/dht/v1/genesis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,4 @@ export const GenesisState = {
message.modelAllowList = object.modelAllowList?.map(e => e) || [];
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/dht/v1/miner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,4 @@ export const Miner = {
message.reputations = object.reputations?.map(e => Reputation.fromPartial(e)) || [];
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/dht/v1/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,4 @@ export const Model = {
}
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/dht/v1/model_block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ export const ModelBlock = {
message.cid = object.cid ?? "";
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/dht/v1/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,4 @@ export const Node = {
message.labels = object.labels?.map(e => e) || [];
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/dht/v1/orchestrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,4 @@ export const Orchestrator = {
message.reputations = object.reputations?.map(e => Reputation.fromPartial(e)) || [];
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/dht/v1/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,4 @@ export const Params = {
}
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/dht/v1/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1200,4 +1200,4 @@ export class QueryClientImpl implements Query {
const promise = this.rpc.request("dht.v1.Query", "GetMinerHeartbeat", data);
return promise.then(data => QueryGetMinerHeartbeatResponse.decode(new _m0.Reader(data)));
}
}
}
2 changes: 1 addition & 1 deletion src/codec/dht/v1/reputation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ export const Reputation = {
}
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/dht/v1/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2490,4 +2490,4 @@ export class MsgClientImpl implements Msg {
const promise = this.rpc.request("dht.v1.Msg", "UpdateOrchestratorReputation", data);
return promise.then(data => MsgUpdateOrchestratorReputationResponse.decode(new _m0.Reader(data)));
}
}
}
2 changes: 1 addition & 1 deletion src/codec/gogoproto/gogo.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {}
export {}
2 changes: 1 addition & 1 deletion src/codec/google/api/annotations.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {}
export {}
2 changes: 1 addition & 1 deletion src/codec/google/api/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,4 +552,4 @@ export const CustomHttpPattern = {
message.path = object.path ?? "";
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/google/protobuf/descriptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3469,4 +3469,4 @@ export const GeneratedCodeInfo_Annotation = {
message.end = object.end ?? 0;
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/google/protobuf/duration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,4 @@ export const Duration = {
message.nanos = object.nanos ?? 0;
return message;
}
};
};
2 changes: 1 addition & 1 deletion src/codec/google/protobuf/timestamp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,4 @@ export const Timestamp = {
message.nanos = object.nanos ?? 0;
return message;
}
};
};
4 changes: 1 addition & 3 deletions src/codec/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@

// Auto-generated, see scripts/codegen.js!

// Auto-generated, see scripts/codegen.js!