-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
710 changed files
with
47,074 additions
and
343,437 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
set -uox pipefail | ||
|
||
# Get protoc executions | ||
go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos 2>/dev/null | ||
|
||
# Get cosmos sdk from github | ||
go get github.com/cosmos/[email protected] 2>/dev/null | ||
|
||
cd 'src' | ||
echo "Generating proto code" | ||
|
||
# Generate Static Protos | ||
static_dirs_regex='(bank|distribution|gov|staking)' | ||
static_proto_dirs=$(find -E . -iregex ".*\/staticProto\/cosmos\/$static_dirs_regex.*\.proto") | ||
for file in $static_proto_dirs; do | ||
buf generate --template ./cfg/buf.gen.yaml $file | ||
done | ||
|
||
# Generate Custom Protos | ||
proto_dirs=$(find ./proto -name '*.proto') | ||
for file in $proto_dirs; do | ||
buf generate --template ./cfg/buf.gen.yaml $file | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: v1beta1 | ||
plugins: | ||
- name: gocosmos | ||
out: .. | ||
opt: | ||
- plugins=grpc | ||
- Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types | ||
- Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types | ||
- Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types | ||
- Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types | ||
- Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types | ||
- Mcosmos/orm/v1beta1/orm.proto=github.com/cosmos/cosmos-sdk/api/cosmos/orm/v1beta1 | ||
- name: grpc-gateway | ||
out: .. | ||
opt: | ||
- logtostderr=true | ||
- allow_colon_final_segments=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: v1beta1 | ||
plugins: | ||
- name: ts | ||
out: ./postgen | ||
path: ../node_modules/ts-proto/protoc-gen-ts_proto | ||
strategy: all | ||
opt: | ||
- esModuleInterop=true | ||
- outputClientImpl=grpc-web |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,163 @@ | ||
/** | ||
* Jackal Custom Protos | ||
*/ | ||
|
||
export { genBroadcaster as makeMasterBroadcaster } from './customBroadcast' | ||
|
||
/** | ||
* Jackal Custom Protos | ||
*/ | ||
|
||
export { txClient as dsigTxClient, queryClient as dsigQueryClient } from './protos/jackal-dao/canine/jackaldao.canine.dsig/module' | ||
export { txClient as filetreeTxClient, queryClient as filetreeQueryClient } from './protos/jackal-dao/canine/jackaldao.canine.filetree/module' | ||
export { txClient as jklMintTxClient, queryClient as jklMintQueryClient } from './protos/jackal-dao/canine/jackaldao.canine.jklmint/module' | ||
// export { txClient as lpTxClient, queryClient as lpQueryClient } from './protos/jackal-dao/canine/jackaldao.canine.lp/module' | ||
export { txClient as notificationTxClient, queryClient as notificationQueryClient } from './protos/jackal-dao/canine/jackaldao.canine.notifications/module' | ||
export { txClient as rnsTxClient, queryClient as rnsQueryClient } from './protos/jackal-dao/canine/jackaldao.canine.rns/module' | ||
export { txClient as storageTxClient, queryClient as storageQueryClient } from './protos/jackal-dao/canine/jackaldao.canine.storage/module' | ||
|
||
export { Api as dsigQueryApi } from './protos/jackal-dao/canine/jackaldao.canine.dsig/module/rest' | ||
export { Api as filetreeQueryApi } from './protos/jackal-dao/canine/jackaldao.canine.filetree/module/rest' | ||
export { Api as jklMintQueryApi } from './protos/jackal-dao/canine/jackaldao.canine.jklmint/module/rest' | ||
// export { Api as lpQueryApi } from './protos/jackal-dao/canine/jackaldao.canine.lp/module/rest' | ||
export { Api as notificationQueryApi } from './protos/jackal-dao/canine/jackaldao.canine.notifications/module/rest' | ||
export { Api as rnsQueryApi } from './protos/jackal-dao/canine/jackaldao.canine.rns/module/rest' | ||
export { Api as storageQueryApi } from './protos/jackal-dao/canine/jackaldao.canine.storage/module/rest' | ||
|
||
/** | ||
* Jackal Stock CosmosSDK Protos | ||
*/ | ||
|
||
export { txClient as cosmTxClient, queryClient as cosmQueryClient } from './protos/CosmWasm/wasmd/cosmwasm.wasm.v1/module' | ||
|
||
export { txClient as bankTxClient, queryClient as bankQueryClient } from './protos/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module' | ||
export { txClient as distributionTxClient, queryClient as distributionQueryClient } from './protos/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module' | ||
export { txClient as govTxClient, queryClient as govQueryClient } from './protos/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module' | ||
export { txClient as stakingTxClient, queryClient as stakingQueryClient } from './protos/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module' | ||
|
||
export { Api as cosmQueryApi } from './protos/CosmWasm/wasmd/cosmwasm.wasm.v1/module/rest' | ||
|
||
export { Api as bankQueryApi } from './protos/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/rest' | ||
export { Api as distributionQueryApi } from './protos/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/rest' | ||
export { Api as govQueryApi } from './protos/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/rest' | ||
export { Api as stakingQueryApi } from './protos/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/rest' | ||
import { OfflineSigner } from '@cosmjs/proto-signing' | ||
import { genBroadcaster, IGenBroadcaster, TMasterBroadcaster } from '@/customBroadcast' | ||
import IProtoBuilder from '@/interfaces/classes/IProtoBuilder' | ||
import IQueryFileTree from '@/interfaces/classes/IQueryFileTree' | ||
import IQueryJklMint from '@/interfaces/classes/IQueryJklMint' | ||
import IQueryRns from '@/interfaces/classes/IQueryRns' | ||
import IQueryStorage from '@/interfaces/classes/IQueryStorage' | ||
import IQueryBank from '@/interfaces/classes/IQueryBank' | ||
import IQueryDistribution from '@/interfaces/classes/IQueryDistribution' | ||
import IQueryGov from '@/interfaces/classes/IQueryGov' | ||
import IQueryStaking from '@/interfaces/classes/IQueryStaking' | ||
import { | ||
GrpcWebImpl, | ||
IFileTreeGrpc, | ||
IJklMintGrpc, | ||
IRnsGrpc, | ||
IStorageGrpc, | ||
IBankGrpc, | ||
IDistributionGrpc, | ||
IGovGrpc, | ||
IStakingGrpc, | ||
TGrpc | ||
} from '@/interfaces/IGrpcWebImpl' | ||
|
||
import QueryFileTree from '@/snackages/query/custom/fileTree' | ||
import QueryJklMint from '@/snackages/query/custom/jklMint' | ||
import QueryRns from '@/snackages/query/custom/rns' | ||
import QueryStorage from '@/snackages/query/custom/storage' | ||
import QueryBank from '@/snackages/query/static/bank' | ||
import QueryDistribution from '@/snackages/query/static/distribution' | ||
import QueryGov from '@/snackages/query/static/gov' | ||
import QueryStaking from '@/snackages/query/static/staking' | ||
|
||
import { ITxFileTree, TxFileTree } from '@/snackages/tx/custom/fileTree' | ||
import { ITxRns, TxRns } from '@/snackages/tx/custom/rns' | ||
import { ITxStorage, TxStorage } from '@/snackages/tx/custom/storage' | ||
import { ITxBank, TxBank } from '@/snackages/tx/static/bank' | ||
import { ITxDistribution, TxDistribution } from '@/snackages/tx/static/distribution' | ||
import { ITxGov, TxGov } from '@/snackages/tx/static/gov' | ||
import { ITxStaking, TxStaking } from '@/snackages/tx/static/staking' | ||
import IAllQuery from '@/interfaces/IAllQuery' | ||
import IAllTx from '@/interfaces/IAllTx' | ||
|
||
export default class ProtoBuilder implements IProtoBuilder { | ||
private readonly signer: OfflineSigner | ||
private readonly txUrl: string | ||
private readonly GRpc: TGrpc | ||
|
||
constructor (signer: OfflineSigner, txUrl?: string, queryUrl?: string) { | ||
const qUrl = queryUrl || 'http://localhost:9091' | ||
this.signer = signer | ||
this.txUrl = txUrl || 'http://localhost:26657' | ||
this.GRpc = new GrpcWebImpl(qUrl, {}) | ||
} | ||
|
||
/** General */ | ||
makeMasterBroadcaster (): Promise<IGenBroadcaster> { | ||
return genBroadcaster(this.signer, { addr: this.txUrl }) | ||
} | ||
makeAllQuery (): IAllQuery { | ||
return { | ||
/** Custom */ | ||
fileTree: this.makeFileTreeQuery(), | ||
jklMint: this.makeJklMintQuery(), | ||
rns: this.makeRnsQuery(), | ||
storage: this.makeStorageQuery(), | ||
/** Static */ | ||
bank: this.makeBankQuery(), | ||
distribution: this.makeDistributionQuery(), | ||
gov: this.makeGovQuery(), | ||
staking: this.makeStakingQuery() | ||
} | ||
} | ||
makeAllTx (): IAllTx { | ||
return { | ||
/** Custom */ | ||
fileTree: this.makeFileTreeTx(), | ||
jklMint: null, | ||
rns: this.makeRnsTx(), | ||
storage: this.makeStorageTx(), | ||
/** Static */ | ||
bank: this.makeBankTx(), | ||
distribution: this.makeDistributionTx(), | ||
gov: this.makeGovTx(), | ||
staking: this.makeStakingTx() | ||
} | ||
} | ||
|
||
/** Custom */ | ||
makeFileTreeQuery (): IQueryFileTree { | ||
return new QueryFileTree(this.GRpc as IFileTreeGrpc) | ||
} | ||
makeFileTreeTx (): ITxFileTree { | ||
return new TxFileTree() | ||
} | ||
makeJklMintQuery (): IQueryJklMint { | ||
return new QueryJklMint(this.GRpc as IJklMintGrpc) | ||
} | ||
makeRnsQuery (): IQueryRns { | ||
return new QueryRns(this.GRpc as IRnsGrpc) | ||
} | ||
makeRnsTx (): ITxRns { | ||
return new TxRns() | ||
} | ||
makeStorageQuery (): IQueryStorage { | ||
return new QueryStorage(this.GRpc as IStorageGrpc) | ||
} | ||
makeStorageTx (): ITxStorage { | ||
return new TxStorage() | ||
} | ||
|
||
/** Static */ | ||
makeBankQuery (): IQueryBank { | ||
return new QueryBank(this.GRpc as IBankGrpc) | ||
} | ||
makeBankTx (): ITxBank { | ||
return new TxBank() | ||
} | ||
makeDistributionQuery (): IQueryDistribution { | ||
return new QueryDistribution(this.GRpc as IDistributionGrpc) | ||
} | ||
makeDistributionTx (): ITxDistribution { | ||
return new TxDistribution() | ||
} | ||
makeGovQuery (): IQueryGov { | ||
return new QueryGov(this.GRpc as IGovGrpc) | ||
} | ||
makeGovTx (): ITxGov { | ||
return new TxGov() | ||
} | ||
makeStakingQuery (): IQueryStaking { | ||
return new QueryStaking(this.GRpc as IStakingGrpc) | ||
} | ||
makeStakingTx (): ITxStaking { | ||
return new TxStaking() | ||
} | ||
} | ||
|
||
export { | ||
/** General */ | ||
IAllQuery, | ||
IAllTx, | ||
IGenBroadcaster, | ||
IProtoBuilder, | ||
TMasterBroadcaster, | ||
|
||
/** Custom */ | ||
IQueryJklMint, | ||
IQueryRns, | ||
ITxRns, | ||
IQueryStorage, | ||
ITxStorage, | ||
|
||
/** Static */ | ||
IQueryBank, | ||
ITxBank, | ||
IQueryDistribution, | ||
ITxDistribution, | ||
IQueryGov, | ||
ITxGov, | ||
IQueryStaking, | ||
ITxStaking | ||
} |
Oops, something went wrong.