Compare commits
1 Commits
main
...
ng-send-to
Author | SHA1 | Date | |
---|---|---|---|
91d48d9943 |
@ -1,2 +0,0 @@
|
||||
Dockerfile
|
||||
node_modules
|
@ -1,2 +0,0 @@
|
||||
PRIVATE_KEY=75f719e613d05efab06a3f1dde5250b497723b13d4afa4f8ed80145764e40cf7
|
||||
COSMOS_CHAIN_ID=laconic_9000-1
|
@ -1,36 +0,0 @@
|
||||
name: Publish npm package to gitea
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
jobs:
|
||||
npm_publish:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [ 18.x ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Download yarn
|
||||
run: |
|
||||
curl -fsSL -o /usr/local/bin/yarn https://github.com/yarnpkg/yarn/releases/download/v1.22.21/yarn-1.22.21.js
|
||||
chmod +x /usr/local/bin/yarn
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- run: yarn
|
||||
- name: Run yarn build
|
||||
run: |
|
||||
yarn build
|
||||
- name: Configure git.vdb.to npm registry
|
||||
run: |
|
||||
npm config set registry https://git.vdb.to/api/packages/cerc-io/npm/
|
||||
- name: Authenticate to git.vdb.to registry
|
||||
run: |
|
||||
npm config set -- '//git.vdb.to/api/packages/cerc-io/npm/:_authToken' "${{ secrets.CICD_PUBLISH_TOKEN }}"
|
||||
- name: npm publish
|
||||
run: |
|
||||
npm publish
|
@ -1,63 +0,0 @@
|
||||
name: Tests
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/**
|
||||
|
||||
env:
|
||||
DOCKER_HOST: unix:///var/run/dind.sock
|
||||
|
||||
jobs:
|
||||
sdk_tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout laconicd
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: "./laconicd/"
|
||||
repository: cerc-io/laconicd
|
||||
fetch-depth: 0
|
||||
ref: main
|
||||
- name: Environment
|
||||
run: ls -tlh && env
|
||||
|
||||
- name: Start dockerd
|
||||
run: |
|
||||
dockerd -H $DOCKER_HOST --userland-proxy=false &
|
||||
sleep 5
|
||||
|
||||
- name: Build laconicd container
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: ./build-laconicd-container.sh
|
||||
- name: Build laconic-sdk container
|
||||
run: ./scripts/build-sdk-test-container.sh
|
||||
|
||||
- name: Start containers
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: docker compose up -d
|
||||
- name: Run tests
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: ./run-tests.sh
|
||||
|
||||
- name: Start containers (auctions enabled)
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
env:
|
||||
TEST_AUCTION_ENABLED: true
|
||||
run: docker compose up -d
|
||||
- name: Run auction tests
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: ./run-tests.sh test:auctions
|
||||
|
||||
- name: Start containers (expiry enabled)
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
env:
|
||||
TEST_REGISTRY_EXPIRY: true
|
||||
run: docker compose up -d
|
||||
- name: Run nameservice expiry tests
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: ./run-tests.sh test:nameservice-expiry
|
32
.github/workflows/publish.yaml
vendored
32
.github/workflows/publish.yaml
vendored
@ -1,32 +0,0 @@
|
||||
name: Publish npm package to gitea
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
jobs:
|
||||
npm_publish:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [ 16.x ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- run: yarn
|
||||
- name: Run yarn build
|
||||
run: |
|
||||
yarn build
|
||||
- name: Configure git.vdb.to npm registry
|
||||
run: |
|
||||
npm config set registry https://git.vdb.to/api/packages/cerc-io/npm/
|
||||
- name: Authenticate to git.vdb.to registry
|
||||
run: |
|
||||
npm config set -- '//git.vdb.to/api/packages/cerc-io/npm/:_authToken' "${{ secrets.GITEA_PUBLISH_TOKEN }}"
|
||||
- name: npm publish
|
||||
run: |
|
||||
npm publish
|
53
.github/workflows/test.yml
vendored
53
.github/workflows/test.yml
vendored
@ -1,53 +0,0 @@
|
||||
name: Tests
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/**
|
||||
|
||||
jobs:
|
||||
sdk_tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout laconicd
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: "./laconicd/"
|
||||
repository: cerc-io/laconicd
|
||||
fetch-depth: 0
|
||||
ref: main
|
||||
- name: Environment
|
||||
run: ls -tlh && env
|
||||
|
||||
- name: Build laconicd container
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: ./build-laconicd-container.sh
|
||||
- name: Build laconic-sdk container
|
||||
run: ./scripts/build-sdk-test-container.sh
|
||||
|
||||
- name: Start containers
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: docker compose up -d
|
||||
- name: Run tests
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: ./run-tests.sh
|
||||
|
||||
- name: Start containers (auctions enabled)
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
env:
|
||||
TEST_AUCTION_ENABLED: true
|
||||
run: docker compose up -d
|
||||
- name: Run auction tests
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: ./run-tests.sh test:auctions
|
||||
|
||||
- name: Start containers (expiry enabled)
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
env:
|
||||
TEST_REGISTRY_EXPIRY: true
|
||||
run: docker compose up -d
|
||||
- name: Run nameservice expiry tests
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: ./run-tests.sh test:nameservice-expiry
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1 @@
|
||||
node_modules
|
||||
dist
|
||||
.env
|
||||
.idea*
|
@ -1,16 +0,0 @@
|
||||
# Development
|
||||
|
||||
## Protobuf
|
||||
|
||||
Run following scripts when [proto files](./proto/) are updated.
|
||||
|
||||
1. Install dependencies
|
||||
```bash
|
||||
yarn
|
||||
```
|
||||
|
||||
2. Generate typescript code for the proto files
|
||||
|
||||
```bash
|
||||
./scripts/proto-gen.sh
|
||||
```
|
38
Dockerfile
38
Dockerfile
@ -1,38 +0,0 @@
|
||||
# Originally from: https://github.com/devcontainers/images/blob/main/src/javascript-node/.devcontainer/Dockerfile
|
||||
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
|
||||
ARG VARIANT=16-bullseye
|
||||
FROM node:${VARIANT}
|
||||
|
||||
ARG USERNAME=node
|
||||
ARG NPM_GLOBAL=/usr/local/share/npm-global
|
||||
|
||||
# Add NPM global to PATH.
|
||||
ENV PATH=${NPM_GLOBAL}/bin:${PATH}
|
||||
|
||||
RUN \
|
||||
# Configure global npm install location, use group to adapt to UID/GID changes
|
||||
if ! cat /etc/group | grep -e "^npm:" > /dev/null 2>&1; then groupadd -r npm; fi \
|
||||
&& usermod -a -G npm ${USERNAME} \
|
||||
&& umask 0002 \
|
||||
&& mkdir -p ${NPM_GLOBAL} \
|
||||
&& touch /usr/local/etc/npmrc \
|
||||
&& chown ${USERNAME}:npm ${NPM_GLOBAL} /usr/local/etc/npmrc \
|
||||
&& chmod g+s ${NPM_GLOBAL} \
|
||||
&& npm config -g set prefix ${NPM_GLOBAL} \
|
||||
&& su ${USERNAME} -c "npm config -g set prefix ${NPM_GLOBAL}" \
|
||||
# Install eslint
|
||||
&& su ${USERNAME} -c "umask 0002 && npm install -g eslint" \
|
||||
&& npm cache clean --force > /dev/null 2>&1
|
||||
|
||||
WORKDIR /
|
||||
COPY entrypoint.sh .
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD node --version
|
||||
|
||||
WORKDIR /app/laconic-sdk
|
||||
|
||||
COPY package*.json .
|
||||
RUN yarn install
|
||||
COPY . .
|
||||
|
||||
WORKDIR /app/laconic-sdk
|
93
README.md
93
README.md
@ -1,8 +1,6 @@
|
||||
# laconic-sdk
|
||||
# chiba-clonk-client
|
||||
|
||||
Client library used by TS/JS applications to communicate with laconicd.
|
||||
|
||||
## Tests
|
||||
## Development
|
||||
|
||||
Follow these steps to run the tests:
|
||||
|
||||
@ -12,93 +10,30 @@ Follow these steps to run the tests:
|
||||
yarn
|
||||
```
|
||||
|
||||
- Copy [.env.example](./.env.example) file and create a `.env` file.
|
||||
|
||||
- Clone the [laconicd repo](https://github.com/cerc-io/laconicd) and change to repo directory.
|
||||
- Clone the [chiba-clonk repo](https://github.com/vulcanize/chiba-clonk) and change directory to repo directory.
|
||||
|
||||
- Run the chain using `./init.sh`.
|
||||
|
||||
- Export the private key using:
|
||||
- The mnemonic phrase can be seen in the console at the start just after the script is executed.
|
||||
|
||||
- Copy the mnemonic phrase and assign it to variable `MNEMONIC` in the [test file](./src/index.test.ts).
|
||||
|
||||
- To export the private key run:
|
||||
|
||||
```bash
|
||||
laconicd keys export mykey --unarmored-hex --unsafe
|
||||
ethermintd keys export mykey --unarmored-hex --unsafe
|
||||
```
|
||||
|
||||
- Copy the private key and assign it to variable `PRIVATE_KEY` in the `.env` file.
|
||||
- Copy the private key and assign it to variable `PRIVATE_KEY` in the [test file](./src/index.test.ts).
|
||||
|
||||
- Run the tests in laconic-sdk repo:
|
||||
- Run the test in chiba-clonk-client repo:
|
||||
|
||||
```bash
|
||||
yarn test
|
||||
```
|
||||
|
||||
- Run the tests with auctions enabled
|
||||
- The account details can be seen using
|
||||
|
||||
- Remove laconicd data from previous run
|
||||
|
||||
```bash
|
||||
rm -rf ~/.laconicd
|
||||
```
|
||||
|
||||
- In laconicd repo run:
|
||||
|
||||
```bash
|
||||
TEST_AUCTION_ENABLED=true ./init.sh
|
||||
```
|
||||
|
||||
- Export the private key and change it in `.env` file again using:
|
||||
|
||||
```bash
|
||||
laconicd keys export mykey --unarmored-hex --unsafe
|
||||
```
|
||||
|
||||
- Run tests:
|
||||
|
||||
```bash
|
||||
yarn test:auctions
|
||||
```
|
||||
|
||||
- Run the tests for record and authority expiry
|
||||
|
||||
- Remove laconicd data from previous run
|
||||
|
||||
```bash
|
||||
rm -rf ~/.laconicd
|
||||
```
|
||||
|
||||
- In laconicd repo run:
|
||||
|
||||
```bash
|
||||
TEST_REGISTRY_EXPIRY=true ./init.sh
|
||||
```
|
||||
|
||||
- Export the private key and change it in `.env` file again using:
|
||||
|
||||
```bash
|
||||
laconicd keys export mykey --unarmored-hex --unsafe
|
||||
```
|
||||
|
||||
- Run tests:
|
||||
|
||||
```bash
|
||||
yarn test:nameservice-expiry
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
[README](./DEVELOPMENT.md)
|
||||
|
||||
## Known Issues
|
||||
|
||||
- Passing a float type value in [watcher attributes](./src/testing/data/watcher.yml) throws error when sending `setRecord` message.
|
||||
```bash
|
||||
ethermintd keys list
|
||||
```
|
||||
failed to execute message; message index: 0: Invalid signature.: unauthorized
|
||||
```
|
||||
|
||||
- When sending `setRecord` message, an integer value passed in watcher attributes is parsed as float type in laconicd while [unmarshalling json](https://pkg.go.dev/encoding/json#Unmarshal).
|
||||
|
||||
- `setRecord` message throws error when fileds in [Record](./src/types.ts) message are not assigned.
|
||||
```
|
||||
failed to pack and hash typedData primary type: provided data '<nil>' doesn't match type 'string' [tharsis/ethermint/ethereum/eip712/eip712.go:33]
|
||||
```
|
||||
Passing dummy values to work around issue.
|
||||
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
exec "$@"
|
||||
|
@ -2,5 +2,4 @@
|
||||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
setupFiles: ["dotenv/config"]
|
||||
};
|
||||
|
56
package.json
56
package.json
@ -1,56 +1,20 @@
|
||||
{
|
||||
"name": "@cerc-io/laconic-sdk",
|
||||
"version": "0.1.16",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"repository": "git@github.com:cerc-io/laconic-sdk.git",
|
||||
"author": "",
|
||||
"license": "UNLICENSED",
|
||||
"name": "chiba-clonk-client",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"repository": "git@github.com:vulcanize/chiba-clonk-client.git",
|
||||
"author": "contact@deepstacksoft.com",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/lodash": "^4.14.181",
|
||||
"@types/semver": "^7.3.9",
|
||||
"@types/tiny-secp256k1": "1.0.0",
|
||||
"dotenv": "^16.0.0",
|
||||
"google-protobuf": "^3.21.0",
|
||||
"jest": "29.0.0",
|
||||
"protoc-gen-ts": "^0.8.7",
|
||||
"ts-jest": "^29.0.2",
|
||||
"jest": "^27.5.1",
|
||||
"ts-jest": "^27.1.3",
|
||||
"typescript": "^4.6.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cosmjs/amino": "^0.28.1",
|
||||
"@cosmjs/crypto": "^0.28.1",
|
||||
"@cosmjs/encoding": "^0.28.1",
|
||||
"@ipld/dag-cbor": "^7.0.1",
|
||||
"@ipld/dag-json": "^8.0.9",
|
||||
"@metamask/eth-sig-util": "^4.0.0",
|
||||
"@tharsis/address-converter": "^0.1.7",
|
||||
"@tharsis/eip712": "^0.2.1",
|
||||
"@tharsis/proto": "^0.1.16",
|
||||
"@tharsis/provider": "^0.2.4",
|
||||
"@tharsis/transactions": "^0.2.2",
|
||||
"axios": "^0.26.1",
|
||||
"bip32": "3.0.1",
|
||||
"bip39": "^3.0.4",
|
||||
"canonical-json": "^0.0.4",
|
||||
"ethers": "^5.6.2",
|
||||
"evmosjs": "^0.2.5",
|
||||
"graphql.js": "^0.6.8",
|
||||
"js-sha256": "^0.9.0",
|
||||
"js-yaml": "^3.14.1",
|
||||
"jsonschema": "^1.4.0",
|
||||
"lodash": "^4.17.21",
|
||||
"multiformats": "^9.5.4",
|
||||
"node-yaml": "^4.0.1",
|
||||
"secp256k1": "^4.0.1",
|
||||
"semver": "^7.3.5",
|
||||
"tiny-secp256k1": "^1.1.6"
|
||||
"@cosmjs/proto-signing": "^0.28.0",
|
||||
"@cosmjs/stargate": "^0.28.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest --runInBand --verbose --testPathPattern=src",
|
||||
"test:auctions": "TEST_AUCTIONS_ENABLED=1 jest --runInBand --verbose src/auction.test.ts",
|
||||
"test:nameservice-expiry": "TEST_NAMESERVICE_EXPIRY=1 jest --runInBand --verbose src/nameservice-expiry.test.ts",
|
||||
"build": "tsc"
|
||||
"test": "jest"
|
||||
}
|
||||
}
|
||||
|
@ -1,137 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.base.abci.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "tendermint/abci/types.proto";
|
||||
import "google/protobuf/any.proto";
|
||||
|
||||
option go_package = "github.com/cosmos/cosmos-sdk/types";
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
|
||||
// TxResponse defines a structure containing relevant tx data and metadata. The
|
||||
// tags are stringified and the log is JSON decoded.
|
||||
message TxResponse {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
// The block height
|
||||
int64 height = 1;
|
||||
// The transaction hash.
|
||||
string txhash = 2 [(gogoproto.customname) = "TxHash"];
|
||||
// Namespace for the Code
|
||||
string codespace = 3;
|
||||
// Response code.
|
||||
uint32 code = 4;
|
||||
// Result bytes, if any.
|
||||
string data = 5;
|
||||
// The output of the application's logger (raw string). May be
|
||||
// non-deterministic.
|
||||
string raw_log = 6;
|
||||
// The output of the application's logger (typed). May be non-deterministic.
|
||||
repeated ABCIMessageLog logs = 7 [(gogoproto.castrepeated) = "ABCIMessageLogs", (gogoproto.nullable) = false];
|
||||
// Additional information. May be non-deterministic.
|
||||
string info = 8;
|
||||
// Amount of gas requested for transaction.
|
||||
int64 gas_wanted = 9;
|
||||
// Amount of gas consumed by transaction.
|
||||
int64 gas_used = 10;
|
||||
// The request transaction bytes.
|
||||
google.protobuf.Any tx = 11;
|
||||
// Time of the previous block. For heights > 1, it's the weighted median of
|
||||
// the timestamps of the valid votes in the block.LastCommit. For height == 1,
|
||||
// it's genesis time.
|
||||
string timestamp = 12;
|
||||
}
|
||||
|
||||
// ABCIMessageLog defines a structure containing an indexed tx ABCI message log.
|
||||
message ABCIMessageLog {
|
||||
option (gogoproto.stringer) = true;
|
||||
|
||||
uint32 msg_index = 1;
|
||||
string log = 2;
|
||||
|
||||
// Events contains a slice of Event objects that were emitted during some
|
||||
// execution.
|
||||
repeated StringEvent events = 3 [(gogoproto.castrepeated) = "StringEvents", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// StringEvent defines en Event object wrapper where all the attributes
|
||||
// contain key/value pairs that are strings instead of raw bytes.
|
||||
message StringEvent {
|
||||
option (gogoproto.stringer) = true;
|
||||
|
||||
string type = 1;
|
||||
repeated Attribute attributes = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// Attribute defines an attribute wrapper where the key and value are
|
||||
// strings instead of raw bytes.
|
||||
message Attribute {
|
||||
string key = 1;
|
||||
string value = 2;
|
||||
}
|
||||
|
||||
// GasInfo defines tx execution gas context.
|
||||
message GasInfo {
|
||||
// GasWanted is the maximum units of work we allow this tx to perform.
|
||||
uint64 gas_wanted = 1 [(gogoproto.moretags) = "yaml:\"gas_wanted\""];
|
||||
|
||||
// GasUsed is the amount of gas actually consumed.
|
||||
uint64 gas_used = 2 [(gogoproto.moretags) = "yaml:\"gas_used\""];
|
||||
}
|
||||
|
||||
// Result is the union of ResponseFormat and ResponseCheckTx.
|
||||
message Result {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
// Data is any data returned from message or handler execution. It MUST be
|
||||
// length prefixed in order to separate data from multiple message executions.
|
||||
bytes data = 1;
|
||||
|
||||
// Log contains the log information from message or handler execution.
|
||||
string log = 2;
|
||||
|
||||
// Events contains a slice of Event objects that were emitted during message
|
||||
// or handler execution.
|
||||
repeated tendermint.abci.Event events = 3 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// SimulationResponse defines the response generated when a transaction is
|
||||
// successfully simulated.
|
||||
message SimulationResponse {
|
||||
GasInfo gas_info = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
|
||||
Result result = 2;
|
||||
}
|
||||
|
||||
// MsgData defines the data returned in a Result object during message
|
||||
// execution.
|
||||
message MsgData {
|
||||
option (gogoproto.stringer) = true;
|
||||
|
||||
string msg_type = 1;
|
||||
bytes data = 2;
|
||||
}
|
||||
|
||||
// TxMsgData defines a list of MsgData. A transaction will have a MsgData object
|
||||
// for each message.
|
||||
message TxMsgData {
|
||||
option (gogoproto.stringer) = true;
|
||||
|
||||
repeated MsgData data = 1;
|
||||
}
|
||||
|
||||
// SearchTxsResult defines a structure for querying txs pageable
|
||||
message SearchTxsResult {
|
||||
option (gogoproto.stringer) = true;
|
||||
|
||||
// Count of all txs
|
||||
uint64 total_count = 1 [(gogoproto.moretags) = "yaml:\"total_count\"", (gogoproto.jsontag) = "total_count"];
|
||||
// Count of txs in current page
|
||||
uint64 count = 2;
|
||||
// Index of current page, start from 1
|
||||
uint64 page_number = 3 [(gogoproto.moretags) = "yaml:\"page_number\"", (gogoproto.jsontag) = "page_number"];
|
||||
// Count of total pages
|
||||
uint64 page_total = 4 [(gogoproto.moretags) = "yaml:\"page_total\"", (gogoproto.jsontag) = "page_total"];
|
||||
// Max count txs per page
|
||||
uint64 limit = 5;
|
||||
// List of txs in current page
|
||||
repeated TxResponse txs = 6;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.base.kv.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option go_package = "github.com/cosmos/cosmos-sdk/types/kv";
|
||||
|
||||
// Pairs defines a repeated slice of Pair objects.
|
||||
message Pairs {
|
||||
repeated Pair pairs = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// Pair defines a key/value bytes tuple.
|
||||
message Pair {
|
||||
bytes key = 1;
|
||||
bytes value = 2;
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.base.query.v1beta1;
|
||||
|
||||
option go_package = "github.com/cosmos/cosmos-sdk/types/query";
|
||||
|
||||
// PageRequest is to be embedded in gRPC request messages for efficient
|
||||
// pagination. Ex:
|
||||
//
|
||||
// message SomeRequest {
|
||||
// Foo some_parameter = 1;
|
||||
// PageRequest pagination = 2;
|
||||
// }
|
||||
message PageRequest {
|
||||
// key is a value returned in PageResponse.next_key to begin
|
||||
// querying the next page most efficiently. Only one of offset or key
|
||||
// should be set.
|
||||
bytes key = 1;
|
||||
|
||||
// offset is a numeric offset that can be used when key is unavailable.
|
||||
// It is less efficient than using key. Only one of offset or key should
|
||||
// be set.
|
||||
uint64 offset = 2;
|
||||
|
||||
// limit is the total number of results to be returned in the result page.
|
||||
// If left empty it will default to a value to be set by each app.
|
||||
uint64 limit = 3;
|
||||
|
||||
// count_total is set to true to indicate that the result set should include
|
||||
// a count of the total number of items available for pagination in UIs.
|
||||
// count_total is only respected when offset is used. It is ignored when key
|
||||
// is set.
|
||||
bool count_total = 4;
|
||||
|
||||
// reverse is set to true if results are to be returned in the descending order.
|
||||
bool reverse = 5;
|
||||
}
|
||||
|
||||
// PageResponse is to be embedded in gRPC response messages where the
|
||||
// corresponding request message has used PageRequest.
|
||||
//
|
||||
// message SomeResponse {
|
||||
// repeated Bar results = 1;
|
||||
// PageResponse page = 2;
|
||||
// }
|
||||
message PageResponse {
|
||||
// next_key is the key to be passed to PageRequest.key to
|
||||
// query the next page most efficiently
|
||||
bytes next_key = 1;
|
||||
|
||||
// total is total number of results available if PageRequest.count_total
|
||||
// was set, its value is undefined otherwise
|
||||
uint64 total = 2;
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.base.reflection.v1beta1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/reflection";
|
||||
|
||||
// ReflectionService defines a service for interface reflection.
|
||||
service ReflectionService {
|
||||
// ListAllInterfaces lists all the interfaces registered in the interface
|
||||
// registry.
|
||||
rpc ListAllInterfaces(ListAllInterfacesRequest) returns (ListAllInterfacesResponse) {
|
||||
option (google.api.http).get = "/cosmos/base/reflection/v1beta1/interfaces";
|
||||
};
|
||||
|
||||
// ListImplementations list all the concrete types that implement a given
|
||||
// interface.
|
||||
rpc ListImplementations(ListImplementationsRequest) returns (ListImplementationsResponse) {
|
||||
option (google.api.http).get = "/cosmos/base/reflection/v1beta1/interfaces/"
|
||||
"{interface_name}/implementations";
|
||||
};
|
||||
}
|
||||
|
||||
// ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC.
|
||||
message ListAllInterfacesRequest {}
|
||||
|
||||
// ListAllInterfacesResponse is the response type of the ListAllInterfaces RPC.
|
||||
message ListAllInterfacesResponse {
|
||||
// interface_names is an array of all the registered interfaces.
|
||||
repeated string interface_names = 1;
|
||||
}
|
||||
|
||||
// ListImplementationsRequest is the request type of the ListImplementations
|
||||
// RPC.
|
||||
message ListImplementationsRequest {
|
||||
// interface_name defines the interface to query the implementations for.
|
||||
string interface_name = 1;
|
||||
}
|
||||
|
||||
// ListImplementationsResponse is the response type of the ListImplementations
|
||||
// RPC.
|
||||
message ListImplementationsResponse {
|
||||
repeated string implementation_message_names = 1;
|
||||
}
|
@ -1,217 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.base.reflection.v2alpha1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option go_package = "github.com/cosmos/cosmos-sdk/server/grpc/reflection/v2alpha1";
|
||||
|
||||
// AppDescriptor describes a cosmos-sdk based application
|
||||
message AppDescriptor {
|
||||
// AuthnDescriptor provides information on how to authenticate transactions on the application
|
||||
// NOTE: experimental and subject to change in future releases.
|
||||
AuthnDescriptor authn = 1;
|
||||
// chain provides the chain descriptor
|
||||
ChainDescriptor chain = 2;
|
||||
// codec provides metadata information regarding codec related types
|
||||
CodecDescriptor codec = 3;
|
||||
// configuration provides metadata information regarding the sdk.Config type
|
||||
ConfigurationDescriptor configuration = 4;
|
||||
// query_services provides metadata information regarding the available queriable endpoints
|
||||
QueryServicesDescriptor query_services = 5;
|
||||
// tx provides metadata information regarding how to send transactions to the given application
|
||||
TxDescriptor tx = 6;
|
||||
}
|
||||
|
||||
// TxDescriptor describes the accepted transaction type
|
||||
message TxDescriptor {
|
||||
// fullname is the protobuf fullname of the raw transaction type (for instance the tx.Tx type)
|
||||
// it is not meant to support polymorphism of transaction types, it is supposed to be used by
|
||||
// reflection clients to understand if they can handle a specific transaction type in an application.
|
||||
string fullname = 1;
|
||||
// msgs lists the accepted application messages (sdk.Msg)
|
||||
repeated MsgDescriptor msgs = 2;
|
||||
}
|
||||
|
||||
// AuthnDescriptor provides information on how to sign transactions without relying
|
||||
// on the online RPCs GetTxMetadata and CombineUnsignedTxAndSignatures
|
||||
message AuthnDescriptor {
|
||||
// sign_modes defines the supported signature algorithm
|
||||
repeated SigningModeDescriptor sign_modes = 1;
|
||||
}
|
||||
|
||||
// SigningModeDescriptor provides information on a signing flow of the application
|
||||
// NOTE(fdymylja): here we could go as far as providing an entire flow on how
|
||||
// to sign a message given a SigningModeDescriptor, but it's better to think about
|
||||
// this another time
|
||||
message SigningModeDescriptor {
|
||||
// name defines the unique name of the signing mode
|
||||
string name = 1;
|
||||
// number is the unique int32 identifier for the sign_mode enum
|
||||
int32 number = 2;
|
||||
// authn_info_provider_method_fullname defines the fullname of the method to call to get
|
||||
// the metadata required to authenticate using the provided sign_modes
|
||||
string authn_info_provider_method_fullname = 3;
|
||||
}
|
||||
|
||||
// ChainDescriptor describes chain information of the application
|
||||
message ChainDescriptor {
|
||||
// id is the chain id
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
// CodecDescriptor describes the registered interfaces and provides metadata information on the types
|
||||
message CodecDescriptor {
|
||||
// interfaces is a list of the registerted interfaces descriptors
|
||||
repeated InterfaceDescriptor interfaces = 1;
|
||||
}
|
||||
|
||||
// InterfaceDescriptor describes the implementation of an interface
|
||||
message InterfaceDescriptor {
|
||||
// fullname is the name of the interface
|
||||
string fullname = 1;
|
||||
// interface_accepting_messages contains information regarding the proto messages which contain the interface as
|
||||
// google.protobuf.Any field
|
||||
repeated InterfaceAcceptingMessageDescriptor interface_accepting_messages = 2;
|
||||
// interface_implementers is a list of the descriptors of the interface implementers
|
||||
repeated InterfaceImplementerDescriptor interface_implementers = 3;
|
||||
}
|
||||
|
||||
// InterfaceImplementerDescriptor describes an interface implementer
|
||||
message InterfaceImplementerDescriptor {
|
||||
// fullname is the protobuf queryable name of the interface implementer
|
||||
string fullname = 1;
|
||||
// type_url defines the type URL used when marshalling the type as any
|
||||
// this is required so we can provide type safe google.protobuf.Any marshalling and
|
||||
// unmarshalling, making sure that we don't accept just 'any' type
|
||||
// in our interface fields
|
||||
string type_url = 2;
|
||||
}
|
||||
|
||||
// InterfaceAcceptingMessageDescriptor describes a protobuf message which contains
|
||||
// an interface represented as a google.protobuf.Any
|
||||
message InterfaceAcceptingMessageDescriptor {
|
||||
// fullname is the protobuf fullname of the type containing the interface
|
||||
string fullname = 1;
|
||||
// field_descriptor_names is a list of the protobuf name (not fullname) of the field
|
||||
// which contains the interface as google.protobuf.Any (the interface is the same, but
|
||||
// it can be in multiple fields of the same proto message)
|
||||
repeated string field_descriptor_names = 2;
|
||||
}
|
||||
|
||||
// ConfigurationDescriptor contains metadata information on the sdk.Config
|
||||
message ConfigurationDescriptor {
|
||||
// bech32_account_address_prefix is the account address prefix
|
||||
string bech32_account_address_prefix = 1;
|
||||
}
|
||||
|
||||
// MsgDescriptor describes a cosmos-sdk message that can be delivered with a transaction
|
||||
message MsgDescriptor {
|
||||
// msg_type_url contains the TypeURL of a sdk.Msg.
|
||||
string msg_type_url = 1;
|
||||
}
|
||||
|
||||
// ReflectionService defines a service for application reflection.
|
||||
service ReflectionService {
|
||||
// GetAuthnDescriptor returns information on how to authenticate transactions in the application
|
||||
// NOTE: this RPC is still experimental and might be subject to breaking changes or removal in
|
||||
// future releases of the cosmos-sdk.
|
||||
rpc GetAuthnDescriptor(GetAuthnDescriptorRequest) returns (GetAuthnDescriptorResponse) {
|
||||
option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/authn";
|
||||
}
|
||||
// GetChainDescriptor returns the description of the chain
|
||||
rpc GetChainDescriptor(GetChainDescriptorRequest) returns (GetChainDescriptorResponse) {
|
||||
option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/chain";
|
||||
};
|
||||
// GetCodecDescriptor returns the descriptor of the codec of the application
|
||||
rpc GetCodecDescriptor(GetCodecDescriptorRequest) returns (GetCodecDescriptorResponse) {
|
||||
option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/codec";
|
||||
}
|
||||
// GetConfigurationDescriptor returns the descriptor for the sdk.Config of the application
|
||||
rpc GetConfigurationDescriptor(GetConfigurationDescriptorRequest) returns (GetConfigurationDescriptorResponse) {
|
||||
option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/configuration";
|
||||
}
|
||||
// GetQueryServicesDescriptor returns the available gRPC queryable services of the application
|
||||
rpc GetQueryServicesDescriptor(GetQueryServicesDescriptorRequest) returns (GetQueryServicesDescriptorResponse) {
|
||||
option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/query_services";
|
||||
}
|
||||
// GetTxDescriptor returns information on the used transaction object and available msgs that can be used
|
||||
rpc GetTxDescriptor(GetTxDescriptorRequest) returns (GetTxDescriptorResponse) {
|
||||
option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/tx_descriptor";
|
||||
}
|
||||
}
|
||||
|
||||
// GetAuthnDescriptorRequest is the request used for the GetAuthnDescriptor RPC
|
||||
message GetAuthnDescriptorRequest {}
|
||||
// GetAuthnDescriptorResponse is the response returned by the GetAuthnDescriptor RPC
|
||||
message GetAuthnDescriptorResponse {
|
||||
// authn describes how to authenticate to the application when sending transactions
|
||||
AuthnDescriptor authn = 1;
|
||||
}
|
||||
|
||||
// GetChainDescriptorRequest is the request used for the GetChainDescriptor RPC
|
||||
message GetChainDescriptorRequest {}
|
||||
// GetChainDescriptorResponse is the response returned by the GetChainDescriptor RPC
|
||||
message GetChainDescriptorResponse {
|
||||
// chain describes application chain information
|
||||
ChainDescriptor chain = 1;
|
||||
}
|
||||
|
||||
// GetCodecDescriptorRequest is the request used for the GetCodecDescriptor RPC
|
||||
message GetCodecDescriptorRequest {}
|
||||
// GetCodecDescriptorResponse is the response returned by the GetCodecDescriptor RPC
|
||||
message GetCodecDescriptorResponse {
|
||||
// codec describes the application codec such as registered interfaces and implementations
|
||||
CodecDescriptor codec = 1;
|
||||
}
|
||||
|
||||
// GetConfigurationDescriptorRequest is the request used for the GetConfigurationDescriptor RPC
|
||||
message GetConfigurationDescriptorRequest {}
|
||||
// GetConfigurationDescriptorResponse is the response returned by the GetConfigurationDescriptor RPC
|
||||
message GetConfigurationDescriptorResponse {
|
||||
// config describes the application's sdk.Config
|
||||
ConfigurationDescriptor config = 1;
|
||||
}
|
||||
|
||||
// GetQueryServicesDescriptorRequest is the request used for the GetQueryServicesDescriptor RPC
|
||||
message GetQueryServicesDescriptorRequest {}
|
||||
// GetQueryServicesDescriptorResponse is the response returned by the GetQueryServicesDescriptor RPC
|
||||
message GetQueryServicesDescriptorResponse {
|
||||
// queries provides information on the available queryable services
|
||||
QueryServicesDescriptor queries = 1;
|
||||
}
|
||||
|
||||
// GetTxDescriptorRequest is the request used for the GetTxDescriptor RPC
|
||||
message GetTxDescriptorRequest {}
|
||||
// GetTxDescriptorResponse is the response returned by the GetTxDescriptor RPC
|
||||
message GetTxDescriptorResponse {
|
||||
// tx provides information on msgs that can be forwarded to the application
|
||||
// alongside the accepted transaction protobuf type
|
||||
TxDescriptor tx = 1;
|
||||
}
|
||||
|
||||
// QueryServicesDescriptor contains the list of cosmos-sdk queriable services
|
||||
message QueryServicesDescriptor {
|
||||
// query_services is a list of cosmos-sdk QueryServiceDescriptor
|
||||
repeated QueryServiceDescriptor query_services = 1;
|
||||
}
|
||||
|
||||
// QueryServiceDescriptor describes a cosmos-sdk queryable service
|
||||
message QueryServiceDescriptor {
|
||||
// fullname is the protobuf fullname of the service descriptor
|
||||
string fullname = 1;
|
||||
// is_module describes if this service is actually exposed by an application's module
|
||||
bool is_module = 2;
|
||||
// methods provides a list of query service methods
|
||||
repeated QueryMethodDescriptor methods = 3;
|
||||
}
|
||||
|
||||
// QueryMethodDescriptor describes a queryable method of a query service
|
||||
// no other info is provided beside method name and tendermint queryable path
|
||||
// because it would be redundant with the grpc reflection service
|
||||
message QueryMethodDescriptor {
|
||||
// name is the protobuf name (not fullname) of the method
|
||||
string name = 1;
|
||||
// full_query_path is the path that can be used to query
|
||||
// this method via tendermint abci.Query
|
||||
string full_query_path = 2;
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.base.snapshots.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option go_package = "github.com/cosmos/cosmos-sdk/snapshots/types";
|
||||
|
||||
// Snapshot contains Tendermint state sync snapshot info.
|
||||
message Snapshot {
|
||||
uint64 height = 1;
|
||||
uint32 format = 2;
|
||||
uint32 chunks = 3;
|
||||
bytes hash = 4;
|
||||
Metadata metadata = 5 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// Metadata contains SDK-specific snapshot metadata.
|
||||
message Metadata {
|
||||
repeated bytes chunk_hashes = 1; // SHA-256 chunk hashes
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.base.store.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option go_package = "github.com/cosmos/cosmos-sdk/store/types";
|
||||
|
||||
// CommitInfo defines commit information used by the multi-store when committing
|
||||
// a version/height.
|
||||
message CommitInfo {
|
||||
int64 version = 1;
|
||||
repeated StoreInfo store_infos = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// StoreInfo defines store-specific commit information. It contains a reference
|
||||
// between a store name and the commit ID.
|
||||
message StoreInfo {
|
||||
string name = 1;
|
||||
CommitID commit_id = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// CommitID defines the committment information when a specific store is
|
||||
// committed.
|
||||
message CommitID {
|
||||
option (gogoproto.goproto_stringer) = false;
|
||||
|
||||
int64 version = 1;
|
||||
bytes hash = 2;
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.base.store.v1beta1;
|
||||
|
||||
option go_package = "github.com/cosmos/cosmos-sdk/store/types";
|
||||
|
||||
// StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes)
|
||||
// It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and
|
||||
// Deletes
|
||||
message StoreKVPair {
|
||||
string store_key = 1; // the store key for the KVStore this pair originates from
|
||||
bool delete = 2; // true indicates a delete operation, false indicates a set operation
|
||||
bytes key = 3;
|
||||
bytes value = 4;
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.base.store.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option go_package = "github.com/cosmos/cosmos-sdk/store/types";
|
||||
|
||||
// SnapshotItem is an item contained in a rootmulti.Store snapshot.
|
||||
message SnapshotItem {
|
||||
// item is the specific type of snapshot item.
|
||||
oneof item {
|
||||
SnapshotStoreItem store = 1;
|
||||
SnapshotIAVLItem iavl = 2 [(gogoproto.customname) = "IAVL"];
|
||||
}
|
||||
}
|
||||
|
||||
// SnapshotStoreItem contains metadata about a snapshotted store.
|
||||
message SnapshotStoreItem {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
// SnapshotIAVLItem is an exported IAVL node.
|
||||
message SnapshotIAVLItem {
|
||||
bytes key = 1;
|
||||
bytes value = 2;
|
||||
int64 version = 3;
|
||||
int32 height = 4;
|
||||
}
|
@ -1,136 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.base.tendermint.v1beta1;
|
||||
|
||||
import "google/protobuf/any.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "tendermint/p2p/types.proto";
|
||||
import "tendermint/types/block.proto";
|
||||
import "tendermint/types/types.proto";
|
||||
import "cosmos/base/query/v1beta1/pagination.proto";
|
||||
|
||||
option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/tmservice";
|
||||
|
||||
// Service defines the gRPC querier service for tendermint queries.
|
||||
service Service {
|
||||
// GetNodeInfo queries the current node info.
|
||||
rpc GetNodeInfo(GetNodeInfoRequest) returns (GetNodeInfoResponse) {
|
||||
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/node_info";
|
||||
}
|
||||
// GetSyncing queries node syncing.
|
||||
rpc GetSyncing(GetSyncingRequest) returns (GetSyncingResponse) {
|
||||
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/syncing";
|
||||
}
|
||||
// GetLatestBlock returns the latest block.
|
||||
rpc GetLatestBlock(GetLatestBlockRequest) returns (GetLatestBlockResponse) {
|
||||
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/blocks/latest";
|
||||
}
|
||||
// GetBlockByHeight queries block for given height.
|
||||
rpc GetBlockByHeight(GetBlockByHeightRequest) returns (GetBlockByHeightResponse) {
|
||||
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/blocks/{height}";
|
||||
}
|
||||
|
||||
// GetLatestValidatorSet queries latest validator-set.
|
||||
rpc GetLatestValidatorSet(GetLatestValidatorSetRequest) returns (GetLatestValidatorSetResponse) {
|
||||
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/validatorsets/latest";
|
||||
}
|
||||
// GetValidatorSetByHeight queries validator-set at a given height.
|
||||
rpc GetValidatorSetByHeight(GetValidatorSetByHeightRequest) returns (GetValidatorSetByHeightResponse) {
|
||||
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/validatorsets/{height}";
|
||||
}
|
||||
}
|
||||
|
||||
// GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method.
|
||||
message GetValidatorSetByHeightRequest {
|
||||
int64 height = 1;
|
||||
// pagination defines an pagination for the request.
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 2;
|
||||
}
|
||||
|
||||
// GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method.
|
||||
message GetValidatorSetByHeightResponse {
|
||||
int64 block_height = 1;
|
||||
repeated Validator validators = 2;
|
||||
// pagination defines an pagination for the response.
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 3;
|
||||
}
|
||||
|
||||
// GetLatestValidatorSetRequest is the request type for the Query/GetValidatorSetByHeight RPC method.
|
||||
message GetLatestValidatorSetRequest {
|
||||
// pagination defines an pagination for the request.
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 1;
|
||||
}
|
||||
|
||||
// GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method.
|
||||
message GetLatestValidatorSetResponse {
|
||||
int64 block_height = 1;
|
||||
repeated Validator validators = 2;
|
||||
// pagination defines an pagination for the response.
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 3;
|
||||
}
|
||||
|
||||
// Validator is the type for the validator-set.
|
||||
message Validator {
|
||||
string address = 1;
|
||||
google.protobuf.Any pub_key = 2;
|
||||
int64 voting_power = 3;
|
||||
int64 proposer_priority = 4;
|
||||
}
|
||||
|
||||
// GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight RPC method.
|
||||
message GetBlockByHeightRequest {
|
||||
int64 height = 1;
|
||||
}
|
||||
|
||||
// GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method.
|
||||
message GetBlockByHeightResponse {
|
||||
.tendermint.types.BlockID block_id = 1;
|
||||
.tendermint.types.Block block = 2;
|
||||
}
|
||||
|
||||
// GetLatestBlockRequest is the request type for the Query/GetLatestBlock RPC method.
|
||||
message GetLatestBlockRequest {}
|
||||
|
||||
// GetLatestBlockResponse is the response type for the Query/GetLatestBlock RPC method.
|
||||
message GetLatestBlockResponse {
|
||||
.tendermint.types.BlockID block_id = 1;
|
||||
.tendermint.types.Block block = 2;
|
||||
}
|
||||
|
||||
// GetSyncingRequest is the request type for the Query/GetSyncing RPC method.
|
||||
message GetSyncingRequest {}
|
||||
|
||||
// GetSyncingResponse is the response type for the Query/GetSyncing RPC method.
|
||||
message GetSyncingResponse {
|
||||
bool syncing = 1;
|
||||
}
|
||||
|
||||
// GetNodeInfoRequest is the request type for the Query/GetNodeInfo RPC method.
|
||||
message GetNodeInfoRequest {}
|
||||
|
||||
// GetNodeInfoResponse is the request type for the Query/GetNodeInfo RPC method.
|
||||
message GetNodeInfoResponse {
|
||||
.tendermint.p2p.DefaultNodeInfo default_node_info = 1;
|
||||
VersionInfo application_version = 2;
|
||||
}
|
||||
|
||||
// VersionInfo is the type for the GetNodeInfoResponse message.
|
||||
message VersionInfo {
|
||||
string name = 1;
|
||||
string app_name = 2;
|
||||
string version = 3;
|
||||
string git_commit = 4;
|
||||
string build_tags = 5;
|
||||
string go_version = 6;
|
||||
repeated Module build_deps = 7;
|
||||
string cosmos_sdk_version = 8;
|
||||
}
|
||||
|
||||
// Module is the type for VersionInfo
|
||||
message Module {
|
||||
// module path
|
||||
string path = 1;
|
||||
// module version
|
||||
string version = 2;
|
||||
// checksum
|
||||
string sum = 3;
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.base.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option go_package = "github.com/cosmos/cosmos-sdk/types";
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
option (gogoproto.stringer_all) = false;
|
||||
|
||||
// Coin defines a token with a denomination and an amount.
|
||||
//
|
||||
// NOTE: The amount field is an Int which implements the custom method
|
||||
// signatures required by gogoproto.
|
||||
message Coin {
|
||||
option (gogoproto.equal) = true;
|
||||
|
||||
string denom = 1;
|
||||
string amount = 2 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// DecCoin defines a token with a denomination and a decimal amount.
|
||||
//
|
||||
// NOTE: The amount field is an Dec which implements the custom method
|
||||
// signatures required by gogoproto.
|
||||
message DecCoin {
|
||||
option (gogoproto.equal) = true;
|
||||
|
||||
string denom = 1;
|
||||
string amount = 2 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// IntProto defines a Protobuf wrapper around an Int object.
|
||||
message IntProto {
|
||||
string int = 1 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// DecProto defines a Protobuf wrapper around a Dec object.
|
||||
message DecProto {
|
||||
string dec = 1 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false];
|
||||
}
|
@ -1,145 +0,0 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package gogoproto;
|
||||
|
||||
import "google/protobuf/descriptor.proto";
|
||||
|
||||
option java_package = "com.google.protobuf";
|
||||
option java_outer_classname = "GoGoProtos";
|
||||
option go_package = "github.com/gogo/protobuf/gogoproto";
|
||||
|
||||
extend google.protobuf.EnumOptions {
|
||||
optional bool goproto_enum_prefix = 62001;
|
||||
optional bool goproto_enum_stringer = 62021;
|
||||
optional bool enum_stringer = 62022;
|
||||
optional string enum_customname = 62023;
|
||||
optional bool enumdecl = 62024;
|
||||
}
|
||||
|
||||
extend google.protobuf.EnumValueOptions {
|
||||
optional string enumvalue_customname = 66001;
|
||||
}
|
||||
|
||||
extend google.protobuf.FileOptions {
|
||||
optional bool goproto_getters_all = 63001;
|
||||
optional bool goproto_enum_prefix_all = 63002;
|
||||
optional bool goproto_stringer_all = 63003;
|
||||
optional bool verbose_equal_all = 63004;
|
||||
optional bool face_all = 63005;
|
||||
optional bool gostring_all = 63006;
|
||||
optional bool populate_all = 63007;
|
||||
optional bool stringer_all = 63008;
|
||||
optional bool onlyone_all = 63009;
|
||||
|
||||
optional bool equal_all = 63013;
|
||||
optional bool description_all = 63014;
|
||||
optional bool testgen_all = 63015;
|
||||
optional bool benchgen_all = 63016;
|
||||
optional bool marshaler_all = 63017;
|
||||
optional bool unmarshaler_all = 63018;
|
||||
optional bool stable_marshaler_all = 63019;
|
||||
|
||||
optional bool sizer_all = 63020;
|
||||
|
||||
optional bool goproto_enum_stringer_all = 63021;
|
||||
optional bool enum_stringer_all = 63022;
|
||||
|
||||
optional bool unsafe_marshaler_all = 63023;
|
||||
optional bool unsafe_unmarshaler_all = 63024;
|
||||
|
||||
optional bool goproto_extensions_map_all = 63025;
|
||||
optional bool goproto_unrecognized_all = 63026;
|
||||
optional bool gogoproto_import = 63027;
|
||||
optional bool protosizer_all = 63028;
|
||||
optional bool compare_all = 63029;
|
||||
optional bool typedecl_all = 63030;
|
||||
optional bool enumdecl_all = 63031;
|
||||
|
||||
optional bool goproto_registration = 63032;
|
||||
optional bool messagename_all = 63033;
|
||||
|
||||
optional bool goproto_sizecache_all = 63034;
|
||||
optional bool goproto_unkeyed_all = 63035;
|
||||
}
|
||||
|
||||
extend google.protobuf.MessageOptions {
|
||||
optional bool goproto_getters = 64001;
|
||||
optional bool goproto_stringer = 64003;
|
||||
optional bool verbose_equal = 64004;
|
||||
optional bool face = 64005;
|
||||
optional bool gostring = 64006;
|
||||
optional bool populate = 64007;
|
||||
optional bool stringer = 67008;
|
||||
optional bool onlyone = 64009;
|
||||
|
||||
optional bool equal = 64013;
|
||||
optional bool description = 64014;
|
||||
optional bool testgen = 64015;
|
||||
optional bool benchgen = 64016;
|
||||
optional bool marshaler = 64017;
|
||||
optional bool unmarshaler = 64018;
|
||||
optional bool stable_marshaler = 64019;
|
||||
|
||||
optional bool sizer = 64020;
|
||||
|
||||
optional bool unsafe_marshaler = 64023;
|
||||
optional bool unsafe_unmarshaler = 64024;
|
||||
|
||||
optional bool goproto_extensions_map = 64025;
|
||||
optional bool goproto_unrecognized = 64026;
|
||||
|
||||
optional bool protosizer = 64028;
|
||||
optional bool compare = 64029;
|
||||
|
||||
optional bool typedecl = 64030;
|
||||
|
||||
optional bool messagename = 64033;
|
||||
|
||||
optional bool goproto_sizecache = 64034;
|
||||
optional bool goproto_unkeyed = 64035;
|
||||
}
|
||||
|
||||
extend google.protobuf.FieldOptions {
|
||||
optional bool nullable = 65001;
|
||||
optional bool embed = 65002;
|
||||
optional string customtype = 65003;
|
||||
optional string customname = 65004;
|
||||
optional string jsontag = 65005;
|
||||
optional string moretags = 65006;
|
||||
optional string casttype = 65007;
|
||||
optional string castkey = 65008;
|
||||
optional string castvalue = 65009;
|
||||
|
||||
optional bool stdtime = 65010;
|
||||
optional bool stdduration = 65011;
|
||||
optional bool wktpointer = 65012;
|
||||
|
||||
optional string castrepeated = 65013;
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
// Copyright (c) 2015, Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
import "google/api/http.proto";
|
||||
import "google/protobuf/descriptor.proto";
|
||||
|
||||
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "AnnotationsProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
extend google.protobuf.MethodOptions {
|
||||
// See `HttpRule`.
|
||||
HttpRule http = 72295728;
|
||||
}
|
@ -1,325 +0,0 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "HttpProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
// Defines the HTTP configuration for an API service. It contains a list of
|
||||
// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
|
||||
// to one or more HTTP REST API methods.
|
||||
message Http {
|
||||
// A list of HTTP configuration rules that apply to individual API methods.
|
||||
//
|
||||
// **NOTE:** All service configuration rules follow "last one wins" order.
|
||||
repeated HttpRule rules = 1;
|
||||
|
||||
// When set to true, URL path parmeters will be fully URI-decoded except in
|
||||
// cases of single segment matches in reserved expansion, where "%2F" will be
|
||||
// left encoded.
|
||||
//
|
||||
// The default behavior is to not decode RFC 6570 reserved characters in multi
|
||||
// segment matches.
|
||||
bool fully_decode_reserved_expansion = 2;
|
||||
}
|
||||
|
||||
// `HttpRule` defines the mapping of an RPC method to one or more HTTP
|
||||
// REST API methods. The mapping specifies how different portions of the RPC
|
||||
// request message are mapped to URL path, URL query parameters, and
|
||||
// HTTP request body. The mapping is typically specified as an
|
||||
// `google.api.http` annotation on the RPC method,
|
||||
// see "google/api/annotations.proto" for details.
|
||||
//
|
||||
// The mapping consists of a field specifying the path template and
|
||||
// method kind. The path template can refer to fields in the request
|
||||
// message, as in the example below which describes a REST GET
|
||||
// operation on a resource collection of messages:
|
||||
//
|
||||
//
|
||||
// service Messaging {
|
||||
// rpc GetMessage(GetMessageRequest) returns (Message) {
|
||||
// option (google.api.http).get =
|
||||
// "/v1/messages/{message_id}/{sub.subfield}";
|
||||
// }
|
||||
// }
|
||||
// message GetMessageRequest {
|
||||
// message SubMessage {
|
||||
// string subfield = 1;
|
||||
// }
|
||||
// string message_id = 1; // mapped to the URL
|
||||
// SubMessage sub = 2; // `sub.subfield` is url-mapped
|
||||
// }
|
||||
// message Message {
|
||||
// string text = 1; // content of the resource
|
||||
// }
|
||||
//
|
||||
// The same http annotation can alternatively be expressed inside the
|
||||
// `GRPC API Configuration` YAML file.
|
||||
//
|
||||
// http:
|
||||
// rules:
|
||||
// - selector: <proto_package_name>.Messaging.GetMessage
|
||||
// get: /v1/messages/{message_id}/{sub.subfield}
|
||||
//
|
||||
// This definition enables an automatic, bidrectional mapping of HTTP
|
||||
// JSON to RPC. Example:
|
||||
//
|
||||
// HTTP | RPC
|
||||
// -----|-----
|
||||
// `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub:
|
||||
// SubMessage(subfield: "foo"))`
|
||||
//
|
||||
// In general, not only fields but also field paths can be referenced
|
||||
// from a path pattern. Fields mapped to the path pattern cannot be
|
||||
// repeated and must have a primitive (non-message) type.
|
||||
//
|
||||
// Any fields in the request message which are not bound by the path
|
||||
// pattern automatically become (optional) HTTP query
|
||||
// parameters. Assume the following definition of the request message:
|
||||
//
|
||||
//
|
||||
// service Messaging {
|
||||
// rpc GetMessage(GetMessageRequest) returns (Message) {
|
||||
// option (google.api.http).get = "/v1/messages/{message_id}";
|
||||
// }
|
||||
// }
|
||||
// message GetMessageRequest {
|
||||
// message SubMessage {
|
||||
// string subfield = 1;
|
||||
// }
|
||||
// string message_id = 1; // mapped to the URL
|
||||
// int64 revision = 2; // becomes a parameter
|
||||
// SubMessage sub = 3; // `sub.subfield` becomes a parameter
|
||||
// }
|
||||
//
|
||||
//
|
||||
// This enables a HTTP JSON to RPC mapping as below:
|
||||
//
|
||||
// HTTP | RPC
|
||||
// -----|-----
|
||||
// `GET /v1/messages/123456?revision=2&sub.subfield=foo` |
|
||||
// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:
|
||||
// "foo"))`
|
||||
//
|
||||
// Note that fields which are mapped to HTTP parameters must have a
|
||||
// primitive type or a repeated primitive type. Message types are not
|
||||
// allowed. In the case of a repeated type, the parameter can be
|
||||
// repeated in the URL, as in `...?param=A¶m=B`.
|
||||
//
|
||||
// For HTTP method kinds which allow a request body, the `body` field
|
||||
// specifies the mapping. Consider a REST update method on the
|
||||
// message resource collection:
|
||||
//
|
||||
//
|
||||
// service Messaging {
|
||||
// rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
|
||||
// option (google.api.http) = {
|
||||
// put: "/v1/messages/{message_id}"
|
||||
// body: "message"
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
// message UpdateMessageRequest {
|
||||
// string message_id = 1; // mapped to the URL
|
||||
// Message message = 2; // mapped to the body
|
||||
// }
|
||||
//
|
||||
//
|
||||
// The following HTTP JSON to RPC mapping is enabled, where the
|
||||
// representation of the JSON in the request body is determined by
|
||||
// protos JSON encoding:
|
||||
//
|
||||
// HTTP | RPC
|
||||
// -----|-----
|
||||
// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
|
||||
// "123456" message { text: "Hi!" })`
|
||||
//
|
||||
// The special name `*` can be used in the body mapping to define that
|
||||
// every field not bound by the path template should be mapped to the
|
||||
// request body. This enables the following alternative definition of
|
||||
// the update method:
|
||||
//
|
||||
// service Messaging {
|
||||
// rpc UpdateMessage(Message) returns (Message) {
|
||||
// option (google.api.http) = {
|
||||
// put: "/v1/messages/{message_id}"
|
||||
// body: "*"
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
// message Message {
|
||||
// string message_id = 1;
|
||||
// string text = 2;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// The following HTTP JSON to RPC mapping is enabled:
|
||||
//
|
||||
// HTTP | RPC
|
||||
// -----|-----
|
||||
// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
|
||||
// "123456" text: "Hi!")`
|
||||
//
|
||||
// Note that when using `*` in the body mapping, it is not possible to
|
||||
// have HTTP parameters, as all fields not bound by the path end in
|
||||
// the body. This makes this option more rarely used in practice of
|
||||
// defining REST APIs. The common usage of `*` is in custom methods
|
||||
// which don't use the URL at all for transferring data.
|
||||
//
|
||||
// It is possible to define multiple HTTP methods for one RPC by using
|
||||
// the `additional_bindings` option. Example:
|
||||
//
|
||||
// service Messaging {
|
||||
// rpc GetMessage(GetMessageRequest) returns (Message) {
|
||||
// option (google.api.http) = {
|
||||
// get: "/v1/messages/{message_id}"
|
||||
// additional_bindings {
|
||||
// get: "/v1/users/{user_id}/messages/{message_id}"
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
// message GetMessageRequest {
|
||||
// string message_id = 1;
|
||||
// string user_id = 2;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// This enables the following two alternative HTTP JSON to RPC
|
||||
// mappings:
|
||||
//
|
||||
// HTTP | RPC
|
||||
// -----|-----
|
||||
// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
|
||||
// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id:
|
||||
// "123456")`
|
||||
//
|
||||
// # Rules for HTTP mapping
|
||||
//
|
||||
// The rules for mapping HTTP path, query parameters, and body fields
|
||||
// to the request message are as follows:
|
||||
//
|
||||
// 1. The `body` field specifies either `*` or a field path, or is
|
||||
// omitted. If omitted, it indicates there is no HTTP request body.
|
||||
// 2. Leaf fields (recursive expansion of nested messages in the
|
||||
// request) can be classified into three types:
|
||||
// (a) Matched in the URL template.
|
||||
// (b) Covered by body (if body is `*`, everything except (a) fields;
|
||||
// else everything under the body field)
|
||||
// (c) All other fields.
|
||||
// 3. URL query parameters found in the HTTP request are mapped to (c) fields.
|
||||
// 4. Any body sent with an HTTP request can contain only (b) fields.
|
||||
//
|
||||
// The syntax of the path template is as follows:
|
||||
//
|
||||
// Template = "/" Segments [ Verb ] ;
|
||||
// Segments = Segment { "/" Segment } ;
|
||||
// Segment = "*" | "**" | LITERAL | Variable ;
|
||||
// Variable = "{" FieldPath [ "=" Segments ] "}" ;
|
||||
// FieldPath = IDENT { "." IDENT } ;
|
||||
// Verb = ":" LITERAL ;
|
||||
//
|
||||
// The syntax `*` matches a single path segment. The syntax `**` matches zero
|
||||
// or more path segments, which must be the last part of the path except the
|
||||
// `Verb`. The syntax `LITERAL` matches literal text in the path.
|
||||
//
|
||||
// The syntax `Variable` matches part of the URL path as specified by its
|
||||
// template. A variable template must not contain other variables. If a variable
|
||||
// matches a single path segment, its template may be omitted, e.g. `{var}`
|
||||
// is equivalent to `{var=*}`.
|
||||
//
|
||||
// If a variable contains exactly one path segment, such as `"{var}"` or
|
||||
// `"{var=*}"`, when such a variable is expanded into a URL path, all characters
|
||||
// except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the
|
||||
// Discovery Document as `{var}`.
|
||||
//
|
||||
// If a variable contains one or more path segments, such as `"{var=foo/*}"`
|
||||
// or `"{var=**}"`, when such a variable is expanded into a URL path, all
|
||||
// characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables
|
||||
// show up in the Discovery Document as `{+var}`.
|
||||
//
|
||||
// NOTE: While the single segment variable matches the semantics of
|
||||
// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2
|
||||
// Simple String Expansion, the multi segment variable **does not** match
|
||||
// RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion
|
||||
// does not expand special characters like `?` and `#`, which would lead
|
||||
// to invalid URLs.
|
||||
//
|
||||
// NOTE: the field paths in variables and in the `body` must not refer to
|
||||
// repeated fields or map fields.
|
||||
message HttpRule {
|
||||
// Selects methods to which this rule applies.
|
||||
//
|
||||
// Refer to [selector][google.api.DocumentationRule.selector] for syntax
|
||||
// details.
|
||||
string selector = 1;
|
||||
|
||||
// Determines the URL pattern is matched by this rules. This pattern can be
|
||||
// used with any of the {get|put|post|delete|patch} methods. A custom method
|
||||
// can be defined using the 'custom' field.
|
||||
oneof pattern {
|
||||
// Used for listing and getting information about resources.
|
||||
string get = 2;
|
||||
|
||||
// Used for updating a resource.
|
||||
string put = 3;
|
||||
|
||||
// Used for creating a resource.
|
||||
string post = 4;
|
||||
|
||||
// Used for deleting a resource.
|
||||
string delete = 5;
|
||||
|
||||
// Used for updating a resource.
|
||||
string patch = 6;
|
||||
|
||||
// The custom pattern is used for specifying an HTTP method that is not
|
||||
// included in the `pattern` field, such as HEAD, or "*" to leave the
|
||||
// HTTP method unspecified for this rule. The wild-card rule is useful
|
||||
// for services that provide content to Web (HTML) clients.
|
||||
CustomHttpPattern custom = 8;
|
||||
}
|
||||
|
||||
// The name of the request field whose value is mapped to the HTTP body, or
|
||||
// `*` for mapping all fields not captured by the path pattern to the HTTP
|
||||
// body. NOTE: the referred field must not be a repeated field and must be
|
||||
// present at the top-level of request message type.
|
||||
string body = 7;
|
||||
|
||||
// Optional. The name of the response field whose value is mapped to the HTTP
|
||||
// body of response. Other response fields are ignored. When
|
||||
// not set, the response message will be used as HTTP body of response.
|
||||
string response_body = 12;
|
||||
|
||||
// Additional HTTP bindings for the selector. Nested bindings must
|
||||
// not contain an `additional_bindings` field themselves (that is,
|
||||
// the nesting may only be one level deep).
|
||||
repeated HttpRule additional_bindings = 11;
|
||||
}
|
||||
|
||||
// A custom pattern is used for defining custom HTTP verb.
|
||||
message CustomHttpPattern {
|
||||
// The name of this custom HTTP verb.
|
||||
string kind = 1;
|
||||
|
||||
// The path matched by this custom verb.
|
||||
string path = 2;
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
// Copyright 2018 Google LLC.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
import "google/protobuf/any.proto";
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "HttpBodyProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
// Message that represents an arbitrary HTTP body. It should only be used for
|
||||
// payload formats that can't be represented as JSON, such as raw binary or
|
||||
// an HTML page.
|
||||
//
|
||||
//
|
||||
// This message can be used both in streaming and non-streaming API methods in
|
||||
// the request as well as the response.
|
||||
//
|
||||
// It can be used as a top-level request field, which is convenient if one
|
||||
// wants to extract parameters from either the URL or HTTP template into the
|
||||
// request fields and also want access to the raw HTTP body.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// message GetResourceRequest {
|
||||
// // A unique request id.
|
||||
// string request_id = 1;
|
||||
//
|
||||
// // The raw HTTP body is bound to this field.
|
||||
// google.api.HttpBody http_body = 2;
|
||||
// }
|
||||
//
|
||||
// service ResourceService {
|
||||
// rpc GetResource(GetResourceRequest) returns (google.api.HttpBody);
|
||||
// rpc UpdateResource(google.api.HttpBody) returns
|
||||
// (google.protobuf.Empty);
|
||||
// }
|
||||
//
|
||||
// Example with streaming methods:
|
||||
//
|
||||
// service CaldavService {
|
||||
// rpc GetCalendar(stream google.api.HttpBody)
|
||||
// returns (stream google.api.HttpBody);
|
||||
// rpc UpdateCalendar(stream google.api.HttpBody)
|
||||
// returns (stream google.api.HttpBody);
|
||||
// }
|
||||
//
|
||||
// Use of this type only changes how the request and response bodies are
|
||||
// handled, all other features will continue to work unchanged.
|
||||
message HttpBody {
|
||||
// The HTTP Content-Type header value specifying the content type of the body.
|
||||
string content_type = 1;
|
||||
|
||||
// The HTTP request/response body as raw binary.
|
||||
bytes data = 2;
|
||||
|
||||
// Application specific response metadata. Must be set in the first response
|
||||
// for streaming APIs.
|
||||
repeated google.protobuf.Any extensions = 3;
|
||||
}
|
@ -1,161 +0,0 @@
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.protobuf;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||
option go_package = "types";
|
||||
option java_package = "com.google.protobuf";
|
||||
option java_outer_classname = "AnyProto";
|
||||
option java_multiple_files = true;
|
||||
option objc_class_prefix = "GPB";
|
||||
|
||||
// `Any` contains an arbitrary serialized protocol buffer message along with a
|
||||
// URL that describes the type of the serialized message.
|
||||
//
|
||||
// Protobuf library provides support to pack/unpack Any values in the form
|
||||
// of utility functions or additional generated methods of the Any type.
|
||||
//
|
||||
// Example 1: Pack and unpack a message in C++.
|
||||
//
|
||||
// Foo foo = ...;
|
||||
// Any any;
|
||||
// any.PackFrom(foo);
|
||||
// ...
|
||||
// if (any.UnpackTo(&foo)) {
|
||||
// ...
|
||||
// }
|
||||
//
|
||||
// Example 2: Pack and unpack a message in Java.
|
||||
//
|
||||
// Foo foo = ...;
|
||||
// Any any = Any.pack(foo);
|
||||
// ...
|
||||
// if (any.is(Foo.class)) {
|
||||
// foo = any.unpack(Foo.class);
|
||||
// }
|
||||
//
|
||||
// Example 3: Pack and unpack a message in Python.
|
||||
//
|
||||
// foo = Foo(...)
|
||||
// any = Any()
|
||||
// any.Pack(foo)
|
||||
// ...
|
||||
// if any.Is(Foo.DESCRIPTOR):
|
||||
// any.Unpack(foo)
|
||||
// ...
|
||||
//
|
||||
// Example 4: Pack and unpack a message in Go
|
||||
//
|
||||
// foo := &pb.Foo{...}
|
||||
// any, err := ptypes.MarshalAny(foo)
|
||||
// ...
|
||||
// foo := &pb.Foo{}
|
||||
// if err := ptypes.UnmarshalAny(any, foo); err != nil {
|
||||
// ...
|
||||
// }
|
||||
//
|
||||
// The pack methods provided by protobuf library will by default use
|
||||
// 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
||||
// methods only use the fully qualified type name after the last '/'
|
||||
// in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
||||
// name "y.z".
|
||||
//
|
||||
//
|
||||
// JSON
|
||||
// ====
|
||||
// The JSON representation of an `Any` value uses the regular
|
||||
// representation of the deserialized, embedded message, with an
|
||||
// additional field `@type` which contains the type URL. Example:
|
||||
//
|
||||
// package google.profile;
|
||||
// message Person {
|
||||
// string first_name = 1;
|
||||
// string last_name = 2;
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// "@type": "type.googleapis.com/google.profile.Person",
|
||||
// "firstName": <string>,
|
||||
// "lastName": <string>
|
||||
// }
|
||||
//
|
||||
// If the embedded message type is well-known and has a custom JSON
|
||||
// representation, that representation will be embedded adding a field
|
||||
// `value` which holds the custom JSON in addition to the `@type`
|
||||
// field. Example (for message [google.protobuf.Duration][]):
|
||||
//
|
||||
// {
|
||||
// "@type": "type.googleapis.com/google.protobuf.Duration",
|
||||
// "value": "1.212s"
|
||||
// }
|
||||
//
|
||||
message Any {
|
||||
// A URL/resource name that uniquely identifies the type of the serialized
|
||||
// protocol buffer message. This string must contain at least
|
||||
// one "/" character. The last segment of the URL's path must represent
|
||||
// the fully qualified name of the type (as in
|
||||
// `path/google.protobuf.Duration`). The name should be in a canonical form
|
||||
// (e.g., leading "." is not accepted).
|
||||
//
|
||||
// In practice, teams usually precompile into the binary all types that they
|
||||
// expect it to use in the context of Any. However, for URLs which use the
|
||||
// scheme `http`, `https`, or no scheme, one can optionally set up a type
|
||||
// server that maps type URLs to message definitions as follows:
|
||||
//
|
||||
// * If no scheme is provided, `https` is assumed.
|
||||
// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
||||
// value in binary format, or produce an error.
|
||||
// * Applications are allowed to cache lookup results based on the
|
||||
// URL, or have them precompiled into a binary to avoid any
|
||||
// lookup. Therefore, binary compatibility needs to be preserved
|
||||
// on changes to types. (Use versioned type names to manage
|
||||
// breaking changes.)
|
||||
//
|
||||
// Note: this functionality is not currently available in the official
|
||||
// protobuf release, and it is not used for type URLs beginning with
|
||||
// type.googleapis.com.
|
||||
//
|
||||
// Schemes other than `http`, `https` (or the empty scheme) might be
|
||||
// used with implementation specific semantics.
|
||||
//
|
||||
string type_url = 1;
|
||||
|
||||
// Must be a valid serialized protocol buffer of the above specified type.
|
||||
bytes value = 2;
|
||||
|
||||
option (gogoproto.typedecl) = false;
|
||||
}
|
||||
|
||||
option (gogoproto.goproto_registration) = false;
|
@ -1,895 +0,0 @@
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Author: kenton@google.com (Kenton Varda)
|
||||
// Based on original Protocol Buffers design by
|
||||
// Sanjay Ghemawat, Jeff Dean, and others.
|
||||
//
|
||||
// The messages in this file describe the definitions found in .proto files.
|
||||
// A valid .proto file can be translated directly to a FileDescriptorProto
|
||||
// without any other information (e.g. without reading its imports).
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package google.protobuf;
|
||||
|
||||
option go_package = "google.golang.org/protobuf/types/descriptorpb";
|
||||
option java_package = "com.google.protobuf";
|
||||
option java_outer_classname = "DescriptorProtos";
|
||||
option csharp_namespace = "Google.Protobuf.Reflection";
|
||||
option objc_class_prefix = "GPB";
|
||||
option cc_enable_arenas = true;
|
||||
|
||||
// descriptor.proto must be optimized for speed because reflection-based
|
||||
// algorithms don't work during bootstrapping.
|
||||
option optimize_for = SPEED;
|
||||
|
||||
// The protocol compiler can output a FileDescriptorSet containing the .proto
|
||||
// files it parses.
|
||||
message FileDescriptorSet {
|
||||
repeated FileDescriptorProto file = 1;
|
||||
}
|
||||
|
||||
// Describes a complete .proto file.
|
||||
message FileDescriptorProto {
|
||||
optional string name = 1; // file name, relative to root of source tree
|
||||
optional string package = 2; // e.g. "foo", "foo.bar", etc.
|
||||
|
||||
// Names of files imported by this file.
|
||||
repeated string dependency = 3;
|
||||
// Indexes of the public imported files in the dependency list above.
|
||||
repeated int32 public_dependency = 10;
|
||||
// Indexes of the weak imported files in the dependency list.
|
||||
// For Google-internal migration only. Do not use.
|
||||
repeated int32 weak_dependency = 11;
|
||||
|
||||
// All top-level definitions in this file.
|
||||
repeated DescriptorProto message_type = 4;
|
||||
repeated EnumDescriptorProto enum_type = 5;
|
||||
repeated ServiceDescriptorProto service = 6;
|
||||
repeated FieldDescriptorProto extension = 7;
|
||||
|
||||
optional FileOptions options = 8;
|
||||
|
||||
// This field contains optional information about the original source code.
|
||||
// You may safely remove this entire field without harming runtime
|
||||
// functionality of the descriptors -- the information is needed only by
|
||||
// development tools.
|
||||
optional SourceCodeInfo source_code_info = 9;
|
||||
|
||||
// The syntax of the proto file.
|
||||
// The supported values are "proto2" and "proto3".
|
||||
optional string syntax = 12;
|
||||
}
|
||||
|
||||
// Describes a message type.
|
||||
message DescriptorProto {
|
||||
optional string name = 1;
|
||||
|
||||
repeated FieldDescriptorProto field = 2;
|
||||
repeated FieldDescriptorProto extension = 6;
|
||||
|
||||
repeated DescriptorProto nested_type = 3;
|
||||
repeated EnumDescriptorProto enum_type = 4;
|
||||
|
||||
message ExtensionRange {
|
||||
optional int32 start = 1; // Inclusive.
|
||||
optional int32 end = 2; // Exclusive.
|
||||
|
||||
optional ExtensionRangeOptions options = 3;
|
||||
}
|
||||
repeated ExtensionRange extension_range = 5;
|
||||
|
||||
repeated OneofDescriptorProto oneof_decl = 8;
|
||||
|
||||
optional MessageOptions options = 7;
|
||||
|
||||
// Range of reserved tag numbers. Reserved tag numbers may not be used by
|
||||
// fields or extension ranges in the same message. Reserved ranges may
|
||||
// not overlap.
|
||||
message ReservedRange {
|
||||
optional int32 start = 1; // Inclusive.
|
||||
optional int32 end = 2; // Exclusive.
|
||||
}
|
||||
repeated ReservedRange reserved_range = 9;
|
||||
// Reserved field names, which may not be used by fields in the same message.
|
||||
// A given name may only be reserved once.
|
||||
repeated string reserved_name = 10;
|
||||
}
|
||||
|
||||
message ExtensionRangeOptions {
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
// Describes a field within a message.
|
||||
message FieldDescriptorProto {
|
||||
enum Type {
|
||||
// 0 is reserved for errors.
|
||||
// Order is weird for historical reasons.
|
||||
TYPE_DOUBLE = 1;
|
||||
TYPE_FLOAT = 2;
|
||||
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
|
||||
// negative values are likely.
|
||||
TYPE_INT64 = 3;
|
||||
TYPE_UINT64 = 4;
|
||||
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
|
||||
// negative values are likely.
|
||||
TYPE_INT32 = 5;
|
||||
TYPE_FIXED64 = 6;
|
||||
TYPE_FIXED32 = 7;
|
||||
TYPE_BOOL = 8;
|
||||
TYPE_STRING = 9;
|
||||
// Tag-delimited aggregate.
|
||||
// Group type is deprecated and not supported in proto3. However, Proto3
|
||||
// implementations should still be able to parse the group wire format and
|
||||
// treat group fields as unknown fields.
|
||||
TYPE_GROUP = 10;
|
||||
TYPE_MESSAGE = 11; // Length-delimited aggregate.
|
||||
|
||||
// New in version 2.
|
||||
TYPE_BYTES = 12;
|
||||
TYPE_UINT32 = 13;
|
||||
TYPE_ENUM = 14;
|
||||
TYPE_SFIXED32 = 15;
|
||||
TYPE_SFIXED64 = 16;
|
||||
TYPE_SINT32 = 17; // Uses ZigZag encoding.
|
||||
TYPE_SINT64 = 18; // Uses ZigZag encoding.
|
||||
}
|
||||
|
||||
enum Label {
|
||||
// 0 is reserved for errors
|
||||
LABEL_OPTIONAL = 1;
|
||||
LABEL_REQUIRED = 2;
|
||||
LABEL_REPEATED = 3;
|
||||
}
|
||||
|
||||
optional string name = 1;
|
||||
optional int32 number = 3;
|
||||
optional Label label = 4;
|
||||
|
||||
// If type_name is set, this need not be set. If both this and type_name
|
||||
// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
|
||||
optional Type type = 5;
|
||||
|
||||
// For message and enum types, this is the name of the type. If the name
|
||||
// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
|
||||
// rules are used to find the type (i.e. first the nested types within this
|
||||
// message are searched, then within the parent, on up to the root
|
||||
// namespace).
|
||||
optional string type_name = 6;
|
||||
|
||||
// For extensions, this is the name of the type being extended. It is
|
||||
// resolved in the same manner as type_name.
|
||||
optional string extendee = 2;
|
||||
|
||||
// For numeric types, contains the original text representation of the value.
|
||||
// For booleans, "true" or "false".
|
||||
// For strings, contains the default text contents (not escaped in any way).
|
||||
// For bytes, contains the C escaped value. All bytes >= 128 are escaped.
|
||||
// TODO(kenton): Base-64 encode?
|
||||
optional string default_value = 7;
|
||||
|
||||
// If set, gives the index of a oneof in the containing type's oneof_decl
|
||||
// list. This field is a member of that oneof.
|
||||
optional int32 oneof_index = 9;
|
||||
|
||||
// JSON name of this field. The value is set by protocol compiler. If the
|
||||
// user has set a "json_name" option on this field, that option's value
|
||||
// will be used. Otherwise, it's deduced from the field's name by converting
|
||||
// it to camelCase.
|
||||
optional string json_name = 10;
|
||||
|
||||
optional FieldOptions options = 8;
|
||||
|
||||
// If true, this is a proto3 "optional". When a proto3 field is optional, it
|
||||
// tracks presence regardless of field type.
|
||||
//
|
||||
// When proto3_optional is true, this field must be belong to a oneof to
|
||||
// signal to old proto3 clients that presence is tracked for this field. This
|
||||
// oneof is known as a "synthetic" oneof, and this field must be its sole
|
||||
// member (each proto3 optional field gets its own synthetic oneof). Synthetic
|
||||
// oneofs exist in the descriptor only, and do not generate any API. Synthetic
|
||||
// oneofs must be ordered after all "real" oneofs.
|
||||
//
|
||||
// For message fields, proto3_optional doesn't create any semantic change,
|
||||
// since non-repeated message fields always track presence. However it still
|
||||
// indicates the semantic detail of whether the user wrote "optional" or not.
|
||||
// This can be useful for round-tripping the .proto file. For consistency we
|
||||
// give message fields a synthetic oneof also, even though it is not required
|
||||
// to track presence. This is especially important because the parser can't
|
||||
// tell if a field is a message or an enum, so it must always create a
|
||||
// synthetic oneof.
|
||||
//
|
||||
// Proto2 optional fields do not set this flag, because they already indicate
|
||||
// optional with `LABEL_OPTIONAL`.
|
||||
optional bool proto3_optional = 17;
|
||||
}
|
||||
|
||||
// Describes a oneof.
|
||||
message OneofDescriptorProto {
|
||||
optional string name = 1;
|
||||
optional OneofOptions options = 2;
|
||||
}
|
||||
|
||||
// Describes an enum type.
|
||||
message EnumDescriptorProto {
|
||||
optional string name = 1;
|
||||
|
||||
repeated EnumValueDescriptorProto value = 2;
|
||||
|
||||
optional EnumOptions options = 3;
|
||||
|
||||
// Range of reserved numeric values. Reserved values may not be used by
|
||||
// entries in the same enum. Reserved ranges may not overlap.
|
||||
//
|
||||
// Note that this is distinct from DescriptorProto.ReservedRange in that it
|
||||
// is inclusive such that it can appropriately represent the entire int32
|
||||
// domain.
|
||||
message EnumReservedRange {
|
||||
optional int32 start = 1; // Inclusive.
|
||||
optional int32 end = 2; // Inclusive.
|
||||
}
|
||||
|
||||
// Range of reserved numeric values. Reserved numeric values may not be used
|
||||
// by enum values in the same enum declaration. Reserved ranges may not
|
||||
// overlap.
|
||||
repeated EnumReservedRange reserved_range = 4;
|
||||
|
||||
// Reserved enum value names, which may not be reused. A given name may only
|
||||
// be reserved once.
|
||||
repeated string reserved_name = 5;
|
||||
}
|
||||
|
||||
// Describes a value within an enum.
|
||||
message EnumValueDescriptorProto {
|
||||
optional string name = 1;
|
||||
optional int32 number = 2;
|
||||
|
||||
optional EnumValueOptions options = 3;
|
||||
}
|
||||
|
||||
// Describes a service.
|
||||
message ServiceDescriptorProto {
|
||||
optional string name = 1;
|
||||
repeated MethodDescriptorProto method = 2;
|
||||
|
||||
optional ServiceOptions options = 3;
|
||||
}
|
||||
|
||||
// Describes a method of a service.
|
||||
message MethodDescriptorProto {
|
||||
optional string name = 1;
|
||||
|
||||
// Input and output type names. These are resolved in the same way as
|
||||
// FieldDescriptorProto.type_name, but must refer to a message type.
|
||||
optional string input_type = 2;
|
||||
optional string output_type = 3;
|
||||
|
||||
optional MethodOptions options = 4;
|
||||
|
||||
// Identifies if client streams multiple client messages
|
||||
optional bool client_streaming = 5 [default = false];
|
||||
// Identifies if server streams multiple server messages
|
||||
optional bool server_streaming = 6 [default = false];
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
// Options
|
||||
|
||||
// Each of the definitions above may have "options" attached. These are
|
||||
// just annotations which may cause code to be generated slightly differently
|
||||
// or may contain hints for code that manipulates protocol messages.
|
||||
//
|
||||
// Clients may define custom options as extensions of the *Options messages.
|
||||
// These extensions may not yet be known at parsing time, so the parser cannot
|
||||
// store the values in them. Instead it stores them in a field in the *Options
|
||||
// message called uninterpreted_option. This field must have the same name
|
||||
// across all *Options messages. We then use this field to populate the
|
||||
// extensions when we build a descriptor, at which point all protos have been
|
||||
// parsed and so all extensions are known.
|
||||
//
|
||||
// Extension numbers for custom options may be chosen as follows:
|
||||
// * For options which will only be used within a single application or
|
||||
// organization, or for experimental options, use field numbers 50000
|
||||
// through 99999. It is up to you to ensure that you do not use the
|
||||
// same number for multiple options.
|
||||
// * For options which will be published and used publicly by multiple
|
||||
// independent entities, e-mail protobuf-global-extension-registry@google.com
|
||||
// to reserve extension numbers. Simply provide your project name (e.g.
|
||||
// Objective-C plugin) and your project website (if available) -- there's no
|
||||
// need to explain how you intend to use them. Usually you only need one
|
||||
// extension number. You can declare multiple options with only one extension
|
||||
// number by putting them in a sub-message. See the Custom Options section of
|
||||
// the docs for examples:
|
||||
// https://developers.google.com/protocol-buffers/docs/proto#options
|
||||
// If this turns out to be popular, a web service will be set up
|
||||
// to automatically assign option numbers.
|
||||
|
||||
message FileOptions {
|
||||
|
||||
// Sets the Java package where classes generated from this .proto will be
|
||||
// placed. By default, the proto package is used, but this is often
|
||||
// inappropriate because proto packages do not normally start with backwards
|
||||
// domain names.
|
||||
optional string java_package = 1;
|
||||
|
||||
// If set, all the classes from the .proto file are wrapped in a single
|
||||
// outer class with the given name. This applies to both Proto1
|
||||
// (equivalent to the old "--one_java_file" option) and Proto2 (where
|
||||
// a .proto always translates to a single class, but you may want to
|
||||
// explicitly choose the class name).
|
||||
optional string java_outer_classname = 8;
|
||||
|
||||
// If set true, then the Java code generator will generate a separate .java
|
||||
// file for each top-level message, enum, and service defined in the .proto
|
||||
// file. Thus, these types will *not* be nested inside the outer class
|
||||
// named by java_outer_classname. However, the outer class will still be
|
||||
// generated to contain the file's getDescriptor() method as well as any
|
||||
// top-level extensions defined in the file.
|
||||
optional bool java_multiple_files = 10 [default = false];
|
||||
|
||||
// This option does nothing.
|
||||
optional bool java_generate_equals_and_hash = 20 [deprecated = true];
|
||||
|
||||
// If set true, then the Java2 code generator will generate code that
|
||||
// throws an exception whenever an attempt is made to assign a non-UTF-8
|
||||
// byte sequence to a string field.
|
||||
// Message reflection will do the same.
|
||||
// However, an extension field still accepts non-UTF-8 byte sequences.
|
||||
// This option has no effect on when used with the lite runtime.
|
||||
optional bool java_string_check_utf8 = 27 [default = false];
|
||||
|
||||
// Generated classes can be optimized for speed or code size.
|
||||
enum OptimizeMode {
|
||||
SPEED = 1; // Generate complete code for parsing, serialization,
|
||||
// etc.
|
||||
CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
|
||||
LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
|
||||
}
|
||||
optional OptimizeMode optimize_for = 9 [default = SPEED];
|
||||
|
||||
// Sets the Go package where structs generated from this .proto will be
|
||||
// placed. If omitted, the Go package will be derived from the following:
|
||||
// - The basename of the package import path, if provided.
|
||||
// - Otherwise, the package statement in the .proto file, if present.
|
||||
// - Otherwise, the basename of the .proto file, without extension.
|
||||
optional string go_package = 11;
|
||||
|
||||
// Should generic services be generated in each language? "Generic" services
|
||||
// are not specific to any particular RPC system. They are generated by the
|
||||
// main code generators in each language (without additional plugins).
|
||||
// Generic services were the only kind of service generation supported by
|
||||
// early versions of google.protobuf.
|
||||
//
|
||||
// Generic services are now considered deprecated in favor of using plugins
|
||||
// that generate code specific to your particular RPC system. Therefore,
|
||||
// these default to false. Old code which depends on generic services should
|
||||
// explicitly set them to true.
|
||||
optional bool cc_generic_services = 16 [default = false];
|
||||
optional bool java_generic_services = 17 [default = false];
|
||||
optional bool py_generic_services = 18 [default = false];
|
||||
optional bool php_generic_services = 42 [default = false];
|
||||
|
||||
// Is this file deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for everything in the file, or it will be completely ignored; in the very
|
||||
// least, this is a formalization for deprecating files.
|
||||
optional bool deprecated = 23 [default = false];
|
||||
|
||||
// Enables the use of arenas for the proto messages in this file. This applies
|
||||
// only to generated classes for C++.
|
||||
optional bool cc_enable_arenas = 31 [default = true];
|
||||
|
||||
// Sets the objective c class prefix which is prepended to all objective c
|
||||
// generated classes from this .proto. There is no default.
|
||||
optional string objc_class_prefix = 36;
|
||||
|
||||
// Namespace for generated classes; defaults to the package.
|
||||
optional string csharp_namespace = 37;
|
||||
|
||||
// By default Swift generators will take the proto package and CamelCase it
|
||||
// replacing '.' with underscore and use that to prefix the types/symbols
|
||||
// defined. When this options is provided, they will use this value instead
|
||||
// to prefix the types/symbols defined.
|
||||
optional string swift_prefix = 39;
|
||||
|
||||
// Sets the php class prefix which is prepended to all php generated classes
|
||||
// from this .proto. Default is empty.
|
||||
optional string php_class_prefix = 40;
|
||||
|
||||
// Use this option to change the namespace of php generated classes. Default
|
||||
// is empty. When this option is empty, the package name will be used for
|
||||
// determining the namespace.
|
||||
optional string php_namespace = 41;
|
||||
|
||||
// Use this option to change the namespace of php generated metadata classes.
|
||||
// Default is empty. When this option is empty, the proto file name will be
|
||||
// used for determining the namespace.
|
||||
optional string php_metadata_namespace = 44;
|
||||
|
||||
// Use this option to change the package of ruby generated classes. Default
|
||||
// is empty. When this option is not set, the package name will be used for
|
||||
// determining the ruby package.
|
||||
optional string ruby_package = 45;
|
||||
|
||||
// The parser stores options it doesn't recognize here.
|
||||
// See the documentation for the "Options" section above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message.
|
||||
// See the documentation for the "Options" section above.
|
||||
extensions 1000 to max;
|
||||
|
||||
reserved 38;
|
||||
}
|
||||
|
||||
message MessageOptions {
|
||||
// Set true to use the old proto1 MessageSet wire format for extensions.
|
||||
// This is provided for backwards-compatibility with the MessageSet wire
|
||||
// format. You should not use this for any other reason: It's less
|
||||
// efficient, has fewer features, and is more complicated.
|
||||
//
|
||||
// The message must be defined exactly as follows:
|
||||
// message Foo {
|
||||
// option message_set_wire_format = true;
|
||||
// extensions 4 to max;
|
||||
// }
|
||||
// Note that the message cannot have any defined fields; MessageSets only
|
||||
// have extensions.
|
||||
//
|
||||
// All extensions of your type must be singular messages; e.g. they cannot
|
||||
// be int32s, enums, or repeated messages.
|
||||
//
|
||||
// Because this is an option, the above two restrictions are not enforced by
|
||||
// the protocol compiler.
|
||||
optional bool message_set_wire_format = 1 [default = false];
|
||||
|
||||
// Disables the generation of the standard "descriptor()" accessor, which can
|
||||
// conflict with a field of the same name. This is meant to make migration
|
||||
// from proto1 easier; new code should avoid fields named "descriptor".
|
||||
optional bool no_standard_descriptor_accessor = 2 [default = false];
|
||||
|
||||
// Is this message deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the message, or it will be completely ignored; in the very least,
|
||||
// this is a formalization for deprecating messages.
|
||||
optional bool deprecated = 3 [default = false];
|
||||
|
||||
// Whether the message is an automatically generated map entry type for the
|
||||
// maps field.
|
||||
//
|
||||
// For maps fields:
|
||||
// map<KeyType, ValueType> map_field = 1;
|
||||
// The parsed descriptor looks like:
|
||||
// message MapFieldEntry {
|
||||
// option map_entry = true;
|
||||
// optional KeyType key = 1;
|
||||
// optional ValueType value = 2;
|
||||
// }
|
||||
// repeated MapFieldEntry map_field = 1;
|
||||
//
|
||||
// Implementations may choose not to generate the map_entry=true message, but
|
||||
// use a native map in the target language to hold the keys and values.
|
||||
// The reflection APIs in such implementations still need to work as
|
||||
// if the field is a repeated message field.
|
||||
//
|
||||
// NOTE: Do not set the option in .proto files. Always use the maps syntax
|
||||
// instead. The option should only be implicitly set by the proto compiler
|
||||
// parser.
|
||||
optional bool map_entry = 7;
|
||||
|
||||
reserved 8; // javalite_serializable
|
||||
reserved 9; // javanano_as_lite
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
message FieldOptions {
|
||||
// The ctype option instructs the C++ code generator to use a different
|
||||
// representation of the field than it normally would. See the specific
|
||||
// options below. This option is not yet implemented in the open source
|
||||
// release -- sorry, we'll try to include it in a future version!
|
||||
optional CType ctype = 1 [default = STRING];
|
||||
enum CType {
|
||||
// Default mode.
|
||||
STRING = 0;
|
||||
|
||||
CORD = 1;
|
||||
|
||||
STRING_PIECE = 2;
|
||||
}
|
||||
// The packed option can be enabled for repeated primitive fields to enable
|
||||
// a more efficient representation on the wire. Rather than repeatedly
|
||||
// writing the tag and type for each element, the entire array is encoded as
|
||||
// a single length-delimited blob. In proto3, only explicit setting it to
|
||||
// false will avoid using packed encoding.
|
||||
optional bool packed = 2;
|
||||
|
||||
// The jstype option determines the JavaScript type used for values of the
|
||||
// field. The option is permitted only for 64 bit integral and fixed types
|
||||
// (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
|
||||
// is represented as JavaScript string, which avoids loss of precision that
|
||||
// can happen when a large value is converted to a floating point JavaScript.
|
||||
// Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
|
||||
// use the JavaScript "number" type. The behavior of the default option
|
||||
// JS_NORMAL is implementation dependent.
|
||||
//
|
||||
// This option is an enum to permit additional types to be added, e.g.
|
||||
// goog.math.Integer.
|
||||
optional JSType jstype = 6 [default = JS_NORMAL];
|
||||
enum JSType {
|
||||
// Use the default type.
|
||||
JS_NORMAL = 0;
|
||||
|
||||
// Use JavaScript strings.
|
||||
JS_STRING = 1;
|
||||
|
||||
// Use JavaScript numbers.
|
||||
JS_NUMBER = 2;
|
||||
}
|
||||
|
||||
// Should this field be parsed lazily? Lazy applies only to message-type
|
||||
// fields. It means that when the outer message is initially parsed, the
|
||||
// inner message's contents will not be parsed but instead stored in encoded
|
||||
// form. The inner message will actually be parsed when it is first accessed.
|
||||
//
|
||||
// This is only a hint. Implementations are free to choose whether to use
|
||||
// eager or lazy parsing regardless of the value of this option. However,
|
||||
// setting this option true suggests that the protocol author believes that
|
||||
// using lazy parsing on this field is worth the additional bookkeeping
|
||||
// overhead typically needed to implement it.
|
||||
//
|
||||
// This option does not affect the public interface of any generated code;
|
||||
// all method signatures remain the same. Furthermore, thread-safety of the
|
||||
// interface is not affected by this option; const methods remain safe to
|
||||
// call from multiple threads concurrently, while non-const methods continue
|
||||
// to require exclusive access.
|
||||
//
|
||||
//
|
||||
// Note that implementations may choose not to check required fields within
|
||||
// a lazy sub-message. That is, calling IsInitialized() on the outer message
|
||||
// may return true even if the inner message has missing required fields.
|
||||
// This is necessary because otherwise the inner message would have to be
|
||||
// parsed in order to perform the check, defeating the purpose of lazy
|
||||
// parsing. An implementation which chooses not to check required fields
|
||||
// must be consistent about it. That is, for any particular sub-message, the
|
||||
// implementation must either *always* check its required fields, or *never*
|
||||
// check its required fields, regardless of whether or not the message has
|
||||
// been parsed.
|
||||
optional bool lazy = 5 [default = false];
|
||||
|
||||
// Is this field deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for accessors, or it will be completely ignored; in the very least, this
|
||||
// is a formalization for deprecating fields.
|
||||
optional bool deprecated = 3 [default = false];
|
||||
|
||||
// For Google-internal migration only. Do not use.
|
||||
optional bool weak = 10 [default = false];
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
|
||||
reserved 4; // removed jtype
|
||||
}
|
||||
|
||||
message OneofOptions {
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
message EnumOptions {
|
||||
|
||||
// Set this option to true to allow mapping different tag names to the same
|
||||
// value.
|
||||
optional bool allow_alias = 2;
|
||||
|
||||
// Is this enum deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the enum, or it will be completely ignored; in the very least, this
|
||||
// is a formalization for deprecating enums.
|
||||
optional bool deprecated = 3 [default = false];
|
||||
|
||||
reserved 5; // javanano_as_lite
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
message EnumValueOptions {
|
||||
// Is this enum value deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the enum value, or it will be completely ignored; in the very least,
|
||||
// this is a formalization for deprecating enum values.
|
||||
optional bool deprecated = 1 [default = false];
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
message ServiceOptions {
|
||||
|
||||
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC
|
||||
// framework. We apologize for hoarding these numbers to ourselves, but
|
||||
// we were already using them long before we decided to release Protocol
|
||||
// Buffers.
|
||||
|
||||
// Is this service deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the service, or it will be completely ignored; in the very least,
|
||||
// this is a formalization for deprecating services.
|
||||
optional bool deprecated = 33 [default = false];
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
message MethodOptions {
|
||||
|
||||
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC
|
||||
// framework. We apologize for hoarding these numbers to ourselves, but
|
||||
// we were already using them long before we decided to release Protocol
|
||||
// Buffers.
|
||||
|
||||
// Is this method deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the method, or it will be completely ignored; in the very least,
|
||||
// this is a formalization for deprecating methods.
|
||||
optional bool deprecated = 33 [default = false];
|
||||
|
||||
// Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
|
||||
// or neither? HTTP based RPC implementation may choose GET verb for safe
|
||||
// methods, and PUT verb for idempotent methods instead of the default POST.
|
||||
enum IdempotencyLevel {
|
||||
IDEMPOTENCY_UNKNOWN = 0;
|
||||
NO_SIDE_EFFECTS = 1; // implies idempotent
|
||||
IDEMPOTENT = 2; // idempotent, but may have side effects
|
||||
}
|
||||
optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
// A message representing a option the parser does not recognize. This only
|
||||
// appears in options protos created by the compiler::Parser class.
|
||||
// DescriptorPool resolves these when building Descriptor objects. Therefore,
|
||||
// options protos in descriptor objects (e.g. returned by Descriptor::options(),
|
||||
// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
|
||||
// in them.
|
||||
message UninterpretedOption {
|
||||
// The name of the uninterpreted option. Each string represents a segment in
|
||||
// a dot-separated name. is_extension is true iff a segment represents an
|
||||
// extension (denoted with parentheses in options specs in .proto files).
|
||||
// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
|
||||
// "foo.(bar.baz).qux".
|
||||
message NamePart {
|
||||
required string name_part = 1;
|
||||
required bool is_extension = 2;
|
||||
}
|
||||
repeated NamePart name = 2;
|
||||
|
||||
// The value of the uninterpreted option, in whatever type the tokenizer
|
||||
// identified it as during parsing. Exactly one of these should be set.
|
||||
optional string identifier_value = 3;
|
||||
optional uint64 positive_int_value = 4;
|
||||
optional int64 negative_int_value = 5;
|
||||
optional double double_value = 6;
|
||||
optional bytes string_value = 7;
|
||||
optional string aggregate_value = 8;
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
// Optional source code info
|
||||
|
||||
// Encapsulates information about the original source file from which a
|
||||
// FileDescriptorProto was generated.
|
||||
message SourceCodeInfo {
|
||||
// A Location identifies a piece of source code in a .proto file which
|
||||
// corresponds to a particular definition. This information is intended
|
||||
// to be useful to IDEs, code indexers, documentation generators, and similar
|
||||
// tools.
|
||||
//
|
||||
// For example, say we have a file like:
|
||||
// message Foo {
|
||||
// optional string foo = 1;
|
||||
// }
|
||||
// Let's look at just the field definition:
|
||||
// optional string foo = 1;
|
||||
// ^ ^^ ^^ ^ ^^^
|
||||
// a bc de f ghi
|
||||
// We have the following locations:
|
||||
// span path represents
|
||||
// [a,i) [ 4, 0, 2, 0 ] The whole field definition.
|
||||
// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
|
||||
// [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
|
||||
// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
|
||||
// [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
|
||||
//
|
||||
// Notes:
|
||||
// - A location may refer to a repeated field itself (i.e. not to any
|
||||
// particular index within it). This is used whenever a set of elements are
|
||||
// logically enclosed in a single code segment. For example, an entire
|
||||
// extend block (possibly containing multiple extension definitions) will
|
||||
// have an outer location whose path refers to the "extensions" repeated
|
||||
// field without an index.
|
||||
// - Multiple locations may have the same path. This happens when a single
|
||||
// logical declaration is spread out across multiple places. The most
|
||||
// obvious example is the "extend" block again -- there may be multiple
|
||||
// extend blocks in the same scope, each of which will have the same path.
|
||||
// - A location's span is not always a subset of its parent's span. For
|
||||
// example, the "extendee" of an extension declaration appears at the
|
||||
// beginning of the "extend" block and is shared by all extensions within
|
||||
// the block.
|
||||
// - Just because a location's span is a subset of some other location's span
|
||||
// does not mean that it is a descendant. For example, a "group" defines
|
||||
// both a type and a field in a single declaration. Thus, the locations
|
||||
// corresponding to the type and field and their components will overlap.
|
||||
// - Code which tries to interpret locations should probably be designed to
|
||||
// ignore those that it doesn't understand, as more types of locations could
|
||||
// be recorded in the future.
|
||||
repeated Location location = 1;
|
||||
message Location {
|
||||
// Identifies which part of the FileDescriptorProto was defined at this
|
||||
// location.
|
||||
//
|
||||
// Each element is a field number or an index. They form a path from
|
||||
// the root FileDescriptorProto to the place where the definition. For
|
||||
// example, this path:
|
||||
// [ 4, 3, 2, 7, 1 ]
|
||||
// refers to:
|
||||
// file.message_type(3) // 4, 3
|
||||
// .field(7) // 2, 7
|
||||
// .name() // 1
|
||||
// This is because FileDescriptorProto.message_type has field number 4:
|
||||
// repeated DescriptorProto message_type = 4;
|
||||
// and DescriptorProto.field has field number 2:
|
||||
// repeated FieldDescriptorProto field = 2;
|
||||
// and FieldDescriptorProto.name has field number 1:
|
||||
// optional string name = 1;
|
||||
//
|
||||
// Thus, the above path gives the location of a field name. If we removed
|
||||
// the last element:
|
||||
// [ 4, 3, 2, 7 ]
|
||||
// this path refers to the whole field declaration (from the beginning
|
||||
// of the label to the terminating semicolon).
|
||||
repeated int32 path = 1 [packed = true];
|
||||
|
||||
// Always has exactly three or four elements: start line, start column,
|
||||
// end line (optional, otherwise assumed same as start line), end column.
|
||||
// These are packed into a single field for efficiency. Note that line
|
||||
// and column numbers are zero-based -- typically you will want to add
|
||||
// 1 to each before displaying to a user.
|
||||
repeated int32 span = 2 [packed = true];
|
||||
|
||||
// If this SourceCodeInfo represents a complete declaration, these are any
|
||||
// comments appearing before and after the declaration which appear to be
|
||||
// attached to the declaration.
|
||||
//
|
||||
// A series of line comments appearing on consecutive lines, with no other
|
||||
// tokens appearing on those lines, will be treated as a single comment.
|
||||
//
|
||||
// leading_detached_comments will keep paragraphs of comments that appear
|
||||
// before (but not connected to) the current element. Each paragraph,
|
||||
// separated by empty lines, will be one comment element in the repeated
|
||||
// field.
|
||||
//
|
||||
// Only the comment content is provided; comment markers (e.g. //) are
|
||||
// stripped out. For block comments, leading whitespace and an asterisk
|
||||
// will be stripped from the beginning of each line other than the first.
|
||||
// Newlines are included in the output.
|
||||
//
|
||||
// Examples:
|
||||
//
|
||||
// optional int32 foo = 1; // Comment attached to foo.
|
||||
// // Comment attached to bar.
|
||||
// optional int32 bar = 2;
|
||||
//
|
||||
// optional string baz = 3;
|
||||
// // Comment attached to baz.
|
||||
// // Another line attached to baz.
|
||||
//
|
||||
// // Comment attached to qux.
|
||||
// //
|
||||
// // Another line attached to qux.
|
||||
// optional double qux = 4;
|
||||
//
|
||||
// // Detached comment for corge. This is not leading or trailing comments
|
||||
// // to qux or corge because there are blank lines separating it from
|
||||
// // both.
|
||||
//
|
||||
// // Detached comment for corge paragraph 2.
|
||||
//
|
||||
// optional string corge = 5;
|
||||
// /* Block comment attached
|
||||
// * to corge. Leading asterisks
|
||||
// * will be removed. */
|
||||
// /* Block comment attached to
|
||||
// * grault. */
|
||||
// optional int32 grault = 6;
|
||||
//
|
||||
// // ignored detached comments.
|
||||
optional string leading_comments = 3;
|
||||
optional string trailing_comments = 4;
|
||||
repeated string leading_detached_comments = 6;
|
||||
}
|
||||
}
|
||||
|
||||
// Describes the relationship between generated code and its original source
|
||||
// file. A GeneratedCodeInfo message is associated with only one generated
|
||||
// source file, but may contain references to different source .proto files.
|
||||
message GeneratedCodeInfo {
|
||||
// An Annotation connects some span of text in generated code to an element
|
||||
// of its generating .proto file.
|
||||
repeated Annotation annotation = 1;
|
||||
message Annotation {
|
||||
// Identifies the element in the original source .proto file. This field
|
||||
// is formatted the same as SourceCodeInfo.Location.path.
|
||||
repeated int32 path = 1 [packed = true];
|
||||
|
||||
// Identifies the filesystem path to the original source .proto.
|
||||
optional string source_file = 2;
|
||||
|
||||
// Identifies the starting offset in bytes in the generated code
|
||||
// that relates to the identified object.
|
||||
optional int32 begin = 3;
|
||||
|
||||
// Identifies the ending offset in bytes in the generated code that
|
||||
// relates to the identified offset. The end offset should be one past
|
||||
// the last relevant byte (so the length of the text = end - begin).
|
||||
optional int32 end = 4;
|
||||
}
|
||||
}
|
@ -1,115 +0,0 @@
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.protobuf;
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option go_package = "google.golang.org/protobuf/types/known/durationpb";
|
||||
option java_package = "com.google.protobuf";
|
||||
option java_outer_classname = "DurationProto";
|
||||
option java_multiple_files = true;
|
||||
option objc_class_prefix = "GPB";
|
||||
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||
|
||||
// A Duration represents a signed, fixed-length span of time represented
|
||||
// as a count of seconds and fractions of seconds at nanosecond
|
||||
// resolution. It is independent of any calendar and concepts like "day"
|
||||
// or "month". It is related to Timestamp in that the difference between
|
||||
// two Timestamp values is a Duration and it can be added or subtracted
|
||||
// from a Timestamp. Range is approximately +-10,000 years.
|
||||
//
|
||||
// # Examples
|
||||
//
|
||||
// Example 1: Compute Duration from two Timestamps in pseudo code.
|
||||
//
|
||||
// Timestamp start = ...;
|
||||
// Timestamp end = ...;
|
||||
// Duration duration = ...;
|
||||
//
|
||||
// duration.seconds = end.seconds - start.seconds;
|
||||
// duration.nanos = end.nanos - start.nanos;
|
||||
//
|
||||
// if (duration.seconds < 0 && duration.nanos > 0) {
|
||||
// duration.seconds += 1;
|
||||
// duration.nanos -= 1000000000;
|
||||
// } else if (duration.seconds > 0 && duration.nanos < 0) {
|
||||
// duration.seconds -= 1;
|
||||
// duration.nanos += 1000000000;
|
||||
// }
|
||||
//
|
||||
// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
||||
//
|
||||
// Timestamp start = ...;
|
||||
// Duration duration = ...;
|
||||
// Timestamp end = ...;
|
||||
//
|
||||
// end.seconds = start.seconds + duration.seconds;
|
||||
// end.nanos = start.nanos + duration.nanos;
|
||||
//
|
||||
// if (end.nanos < 0) {
|
||||
// end.seconds -= 1;
|
||||
// end.nanos += 1000000000;
|
||||
// } else if (end.nanos >= 1000000000) {
|
||||
// end.seconds += 1;
|
||||
// end.nanos -= 1000000000;
|
||||
// }
|
||||
//
|
||||
// Example 3: Compute Duration from datetime.timedelta in Python.
|
||||
//
|
||||
// td = datetime.timedelta(days=3, minutes=10)
|
||||
// duration = Duration()
|
||||
// duration.FromTimedelta(td)
|
||||
//
|
||||
// # JSON Mapping
|
||||
//
|
||||
// In JSON format, the Duration type is encoded as a string rather than an
|
||||
// object, where the string ends in the suffix "s" (indicating seconds) and
|
||||
// is preceded by the number of seconds, with nanoseconds expressed as
|
||||
// fractional seconds. For example, 3 seconds with 0 nanoseconds should be
|
||||
// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
|
||||
// be expressed in JSON format as "3.000000001s", and 3 seconds and 1
|
||||
// microsecond should be expressed in JSON format as "3.000001s".
|
||||
//
|
||||
message Duration {
|
||||
// Signed seconds of the span of time. Must be from -315,576,000,000
|
||||
// to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
||||
// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
||||
int64 seconds = 1;
|
||||
|
||||
// Signed fractions of a second at nanosecond resolution of the span
|
||||
// of time. Durations less than one second are represented with a 0
|
||||
// `seconds` field and a positive or negative `nanos` field. For durations
|
||||
// of one second or more, a non-zero value for the `nanos` field must be
|
||||
// of the same sign as the `seconds` field. Must be from -999,999,999
|
||||
// to +999,999,999 inclusive.
|
||||
int32 nanos = 2;
|
||||
}
|
@ -1,144 +0,0 @@
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.protobuf;
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option go_package = "google.golang.org/protobuf/types/known/timestamppb";
|
||||
option java_package = "com.google.protobuf";
|
||||
option java_outer_classname = "TimestampProto";
|
||||
option java_multiple_files = true;
|
||||
option objc_class_prefix = "GPB";
|
||||
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||
|
||||
// A Timestamp represents a point in time independent of any time zone or local
|
||||
// calendar, encoded as a count of seconds and fractions of seconds at
|
||||
// nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
||||
// January 1, 1970, in the proleptic Gregorian calendar which extends the
|
||||
// Gregorian calendar backwards to year one.
|
||||
//
|
||||
// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
||||
// second table is needed for interpretation, using a [24-hour linear
|
||||
// smear](https://developers.google.com/time/smear).
|
||||
//
|
||||
// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
||||
// restricting to that range, we ensure that we can convert to and from [RFC
|
||||
// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
||||
//
|
||||
// # Examples
|
||||
//
|
||||
// Example 1: Compute Timestamp from POSIX `time()`.
|
||||
//
|
||||
// Timestamp timestamp;
|
||||
// timestamp.set_seconds(time(NULL));
|
||||
// timestamp.set_nanos(0);
|
||||
//
|
||||
// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
||||
//
|
||||
// struct timeval tv;
|
||||
// gettimeofday(&tv, NULL);
|
||||
//
|
||||
// Timestamp timestamp;
|
||||
// timestamp.set_seconds(tv.tv_sec);
|
||||
// timestamp.set_nanos(tv.tv_usec * 1000);
|
||||
//
|
||||
// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
||||
//
|
||||
// FILETIME ft;
|
||||
// GetSystemTimeAsFileTime(&ft);
|
||||
// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
||||
//
|
||||
// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
||||
// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
||||
// Timestamp timestamp;
|
||||
// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
||||
// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
||||
//
|
||||
// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
||||
//
|
||||
// long millis = System.currentTimeMillis();
|
||||
//
|
||||
// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
||||
// .setNanos((int) ((millis % 1000) * 1000000)).build();
|
||||
//
|
||||
// Example 5: Compute Timestamp from Java `Instant.now()`.
|
||||
//
|
||||
// Instant now = Instant.now();
|
||||
//
|
||||
// Timestamp timestamp =
|
||||
// Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
||||
// .setNanos(now.getNano()).build();
|
||||
//
|
||||
// Example 6: Compute Timestamp from current time in Python.
|
||||
//
|
||||
// timestamp = Timestamp()
|
||||
// timestamp.GetCurrentTime()
|
||||
//
|
||||
// # JSON Mapping
|
||||
//
|
||||
// In JSON format, the Timestamp type is encoded as a string in the
|
||||
// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
||||
// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
||||
// where {year} is always expressed using four digits while {month}, {day},
|
||||
// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
||||
// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
||||
// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
||||
// is required. A proto3 JSON serializer should always use UTC (as indicated by
|
||||
// "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
||||
// able to accept both UTC and other timezones (as indicated by an offset).
|
||||
//
|
||||
// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
||||
// 01:30 UTC on January 15, 2017.
|
||||
//
|
||||
// In JavaScript, one can convert a Date object to this format using the
|
||||
// standard
|
||||
// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
||||
// method. In Python, a standard `datetime.datetime` object can be converted
|
||||
// to this format using
|
||||
// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
||||
// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
||||
// the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
||||
// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
|
||||
// ) to obtain a formatter capable of generating timestamps in this format.
|
||||
//
|
||||
message Timestamp {
|
||||
// Represents seconds of UTC time since Unix epoch
|
||||
// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
||||
// 9999-12-31T23:59:59Z inclusive.
|
||||
int64 seconds = 1;
|
||||
|
||||
// Non-negative fractions of a second at nanosecond resolution. Negative
|
||||
// second values with fractions must still have non-negative nanos values
|
||||
// that count forward in time. Must be from 0 to 999,999,999
|
||||
// inclusive.
|
||||
int32 nanos = 2;
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package vulcanize.auction.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "vulcanize/auction/v1beta1/types.proto";
|
||||
|
||||
option go_package = "github.com/tharsis/ethermint/x/auction/types";
|
||||
|
||||
// GenesisState defines the genesis state of the auction module
|
||||
message GenesisState {
|
||||
Params params = 1 [(gogoproto.nullable) = false];
|
||||
repeated Auction auctions = 2 [
|
||||
(gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\""
|
||||
];
|
||||
}
|
@ -1,149 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package vulcanize.auction.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "cosmos/base/query/v1beta1/pagination.proto";
|
||||
import "cosmos/base/v1beta1/coin.proto";
|
||||
import "vulcanize/auction/v1beta1/types.proto";
|
||||
|
||||
option go_package = "github.com/tharsis/ethermint/x/auction/types";
|
||||
|
||||
// AuctionsRequest is the format for querying all the auctions
|
||||
message AuctionsRequest {
|
||||
// pagination defines an optional pagination info for the next request
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 1;
|
||||
}
|
||||
|
||||
// AuctionsResponse returns the list of all auctions
|
||||
message AuctionsResponse {
|
||||
// List of auctions
|
||||
Auctions auctions = 1;
|
||||
// pagination defines an optional pagination info for the next request
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 2;
|
||||
}
|
||||
|
||||
// AuctionRequest is the format for querying a specific auction
|
||||
message AuctionRequest {
|
||||
// Auction ID
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
// AuctionResponse returns the details of the queried auction
|
||||
message AuctionResponse {
|
||||
// Auction details
|
||||
Auction auction = 1;
|
||||
}
|
||||
|
||||
// BidRequest is the format for querying a specific bid in an auction
|
||||
message BidRequest {
|
||||
// Auction ID
|
||||
string auction_id = 1;
|
||||
// Bidder address
|
||||
string bidder = 2;
|
||||
}
|
||||
|
||||
// BidResponse returns the details of the queried bid
|
||||
message BidResponse {
|
||||
// Bid details
|
||||
Bid bid = 1;
|
||||
}
|
||||
|
||||
// BidsRequest is the format for querying all bids in an auction
|
||||
message BidsRequest {
|
||||
// Auction ID
|
||||
string auction_id = 1;
|
||||
}
|
||||
|
||||
// BidsResponse returns details of all bids in an auction
|
||||
message BidsResponse {
|
||||
// List of bids in the auction
|
||||
repeated Bid bids = 1;
|
||||
}
|
||||
|
||||
// AuctionsByBidderRequest is the format for querying all auctions containing a bidder address
|
||||
message AuctionsByBidderRequest {
|
||||
// Address of the bidder
|
||||
string bidder_address = 1;
|
||||
}
|
||||
|
||||
// AuctionsByBidderResponse returns all auctions containing a bidder
|
||||
message AuctionsByBidderResponse {
|
||||
// List of auctions
|
||||
Auctions auctions = 1;
|
||||
}
|
||||
|
||||
// AuctionsByOwnerRequest is the format for querying all auctions created by an owner
|
||||
message AuctionsByOwnerRequest {
|
||||
// Address of the owner
|
||||
string owner_address = 1;
|
||||
}
|
||||
|
||||
// AuctionsByOwnerResponse returns all auctions created by an owner
|
||||
message AuctionsByOwnerResponse {
|
||||
// List of auctions
|
||||
Auctions auctions = 1;
|
||||
}
|
||||
|
||||
// QueryParamsRequest is the format to query the parameters of the auction module
|
||||
message QueryParamsRequest {
|
||||
}
|
||||
|
||||
// QueryParamsResponse returns parameters of the auction module
|
||||
message QueryParamsResponse {
|
||||
Params params = 1;
|
||||
}
|
||||
|
||||
// BalanceRequest is the format to fetch all balances
|
||||
message BalanceRequest {
|
||||
}
|
||||
|
||||
message BalanceResponse {
|
||||
// Set of all balances within the auction
|
||||
repeated cosmos.base.v1beta1.Coin balance = 1 [
|
||||
(gogoproto.nullable) = false
|
||||
];
|
||||
}
|
||||
|
||||
// Query defines the gRPC querier interface for the auction module
|
||||
service Query {
|
||||
// Auctions queries all auctions
|
||||
rpc Auctions(AuctionsRequest) returns (AuctionsResponse) {
|
||||
option (google.api.http).get = "/vulcanize/auction/v1beta1/auctions";
|
||||
}
|
||||
|
||||
// GetAuction queries an auction
|
||||
rpc GetAuction(AuctionRequest) returns (AuctionResponse) {
|
||||
option (google.api.http).get = "/vulcanize/auction/v1beta1/auctions/{id}";
|
||||
}
|
||||
|
||||
// GetBid queries an auction bid
|
||||
rpc GetBid(BidRequest) returns (BidResponse) {
|
||||
option (google.api.http).get = "/vulcanize/auction/v1beta1/bids/{auction_id}/{bidder}";
|
||||
}
|
||||
|
||||
// GetBids queries all auction bids
|
||||
rpc GetBids(BidsRequest) returns (BidsResponse) {
|
||||
option (google.api.http).get = "/vulcanize/auction/v1beta1/bids/{auction_id}";
|
||||
}
|
||||
|
||||
// AuctionsByBidder queries auctions by bidder
|
||||
rpc AuctionsByBidder(AuctionsByBidderRequest) returns (AuctionsByBidderResponse) {
|
||||
option (google.api.http).get = "/vulcanize/auction/v1beta1/by-bidder/{bidder_address}";
|
||||
}
|
||||
|
||||
// AuctionsByOwner queries auctions by owner
|
||||
rpc AuctionsByOwner(AuctionsByOwnerRequest) returns (AuctionsByOwnerResponse) {
|
||||
option (google.api.http).get = "/vulcanize/auction/v1beta1/by-owner/{owner_address}";
|
||||
}
|
||||
|
||||
// QueryParams implements the params query command
|
||||
rpc QueryParams(QueryParamsRequest) returns (QueryParamsResponse) {
|
||||
option (google.api.http).get = "/vulcanize/auction/v1beta1/params";
|
||||
}
|
||||
|
||||
// Balance queries the auction module account balance
|
||||
rpc Balance(BalanceRequest) returns (BalanceResponse) {
|
||||
option (google.api.http).get = "/vulcanize/auction/v1beta1/balance";
|
||||
}
|
||||
}
|
@ -1,122 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package vulcanize.auction.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
import "cosmos/base/v1beta1/coin.proto";
|
||||
import "vulcanize/auction/v1beta1/types.proto";
|
||||
|
||||
option go_package = "github.com/tharsis/ethermint/x/auction/types";
|
||||
|
||||
// MsgCreateAuction defines a create auction message
|
||||
message MsgCreateAuction {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
// Duration of the commits phase in seconds
|
||||
google.protobuf.Duration commits_duration = 1 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.stdduration) = true,
|
||||
(gogoproto.moretags) = "json:\"commits_duration\" yaml:\"commits_duration\""
|
||||
];
|
||||
// Duration of the reveals phase in seconds
|
||||
google.protobuf.Duration reveals_duration = 2 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.stdduration) = true,
|
||||
(gogoproto.moretags) = "json:\"reveals_duration\" yaml:\"reveals_duration\""
|
||||
];
|
||||
// Commit fees
|
||||
cosmos.base.v1beta1.Coin commit_fee = 3 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\""
|
||||
];
|
||||
// Reveal fees
|
||||
cosmos.base.v1beta1.Coin reveal_fee = 4 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
|
||||
];
|
||||
// Minimum acceptable bid amount
|
||||
cosmos.base.v1beta1.Coin minimum_bid = 5 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
|
||||
];
|
||||
// Address of the signer
|
||||
string signer = 6 [
|
||||
(gogoproto.moretags) = "json:\"signer\" yaml:\"signer\""
|
||||
];
|
||||
}
|
||||
|
||||
// MsgCreateAuctionResponse returns the details of the created auction
|
||||
message MsgCreateAuctionResponse {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
// Auction details
|
||||
Auction auction = 1 [
|
||||
(gogoproto.moretags) = "json:\"auction\" yaml:\"auction\""
|
||||
];
|
||||
}
|
||||
|
||||
// CommitBid defines the message to commit a bid
|
||||
message MsgCommitBid {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
// Auction ID
|
||||
string auction_id = 1 [
|
||||
(gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\""
|
||||
];
|
||||
// Commit Hash
|
||||
string commit_hash = 2 [
|
||||
(gogoproto.moretags) = "json:\"commit_hash\" yaml:\"commit_hash\""
|
||||
];
|
||||
// Address of the signer
|
||||
string signer = 3 [
|
||||
(gogoproto.moretags) = "json:\"signer\" yaml:\"signer\""
|
||||
];
|
||||
}
|
||||
|
||||
// RevealBid defines the message to reveal a bid
|
||||
message MsgRevealBid {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
// Auction ID
|
||||
string auction_id = 1 [
|
||||
(gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\""
|
||||
];
|
||||
// Commit Hash
|
||||
string reveal = 2 [
|
||||
(gogoproto.moretags) = "json:\"reveal\" yaml:\"reveal\""
|
||||
];
|
||||
// Address of the signer
|
||||
string signer = 3 [
|
||||
(gogoproto.moretags) = "json:\"signer\" yaml:\"signer\""
|
||||
];
|
||||
}
|
||||
|
||||
// MsgCommitBidResponse returns the state of the auction after the bid creation
|
||||
message MsgCommitBidResponse {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
// Auction details
|
||||
Bid bid = 1 [
|
||||
(gogoproto.moretags) = "json:\"bid\" yaml:\"bid\""
|
||||
];
|
||||
}
|
||||
|
||||
// MsgRevealBidResponse returns the state of the auction after the bid reveal
|
||||
message MsgRevealBidResponse {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
// Auction details
|
||||
Auction auction = 1 [
|
||||
(gogoproto.moretags) = "json:\"auction\" yaml:\"auction\""
|
||||
];
|
||||
}
|
||||
|
||||
// Tx defines the gRPC tx interface
|
||||
service Msg {
|
||||
// CreateAuction is the command for creating an auction
|
||||
rpc CreateAuction(MsgCreateAuction) returns (MsgCreateAuctionResponse);
|
||||
|
||||
// CommitBid is the command for committing a bid
|
||||
rpc CommitBid(MsgCommitBid) returns (MsgCommitBidResponse);
|
||||
|
||||
//RevealBid is the command for revealing a bid
|
||||
rpc RevealBid(MsgRevealBid) returns (MsgRevealBidResponse);
|
||||
}
|
||||
|
@ -1,135 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package vulcanize.auction.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "cosmos/base/v1beta1/coin.proto";
|
||||
|
||||
option go_package = "github.com/tharsis/ethermint/x/auction/types";
|
||||
|
||||
// Params defines the auction module parameters
|
||||
message Params {
|
||||
option (gogoproto.goproto_stringer) = false;
|
||||
|
||||
// Duration of the commits phase in seconds
|
||||
google.protobuf.Duration commits_duration = 1 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.stdduration) = true,
|
||||
(gogoproto.moretags) = "json:\"commits_duration\" yaml:\"commits_duration\""
|
||||
];
|
||||
// Duration of the reveals phase in seconds
|
||||
google.protobuf.Duration reveals_duration = 2 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.stdduration) = true,
|
||||
(gogoproto.moretags) = "json:\"reveals_duration\" yaml:\"reveals_duration\""
|
||||
];
|
||||
// Commit fees
|
||||
cosmos.base.v1beta1.Coin commit_fee = 3 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\""
|
||||
];
|
||||
// Reveal fees
|
||||
cosmos.base.v1beta1.Coin reveal_fee = 4 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
|
||||
];
|
||||
// Minimum acceptable bid amount
|
||||
cosmos.base.v1beta1.Coin minimum_bid = 5 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
|
||||
];
|
||||
}
|
||||
|
||||
// Auction represents a sealed-bid on-chain auction
|
||||
message Auction {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
string id = 1;
|
||||
string status = 2;
|
||||
// Address of the creator of the auction
|
||||
string owner_address = 3;
|
||||
// Timestamp at which the auction was created
|
||||
google.protobuf.Timestamp create_time = 4 [
|
||||
(gogoproto.stdtime) = true,
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"create_time\" yaml:\"create_time\""
|
||||
];
|
||||
// Timestamp at which the commits phase concluded
|
||||
google.protobuf.Timestamp commits_end_time = 5 [
|
||||
(gogoproto.stdtime) = true,
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"commits_end_time\" yaml:\"commits_end_time\""
|
||||
];
|
||||
// Timestamp at which the reveals phase concluded
|
||||
google.protobuf.Timestamp reveals_end_time = 6 [
|
||||
(gogoproto.stdtime) = true,
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"reveals_end_time\" yaml:\"reveals_end_time\""
|
||||
];
|
||||
// Commit and reveal fees must both be paid when committing a bid
|
||||
// Reveal fee is returned only if the bid is revealed
|
||||
cosmos.base.v1beta1.Coin commit_fee = 7 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\""
|
||||
];
|
||||
cosmos.base.v1beta1.Coin reveal_fee = 8 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
|
||||
];
|
||||
// Minimum acceptable bid amount for a valid commit
|
||||
cosmos.base.v1beta1.Coin minimum_bid = 9 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
|
||||
];
|
||||
// Address of the winner
|
||||
string winner_address = 10;
|
||||
// Winning bid, i.e., the highest bid
|
||||
cosmos.base.v1beta1.Coin winning_bid = 11 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"winning_bid\" yaml:\"winning_bid\""
|
||||
];
|
||||
// Amount the winner pays, i.e. the second highest auction
|
||||
cosmos.base.v1beta1.Coin winning_price = 12 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"winning_price\" yaml:\"winning_price\""
|
||||
];
|
||||
}
|
||||
|
||||
message Auctions {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
repeated Auction auctions = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// Bid represents a sealed bid (commit) made during the auction
|
||||
message Bid {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
string auction_id = 1;
|
||||
string bidder_address = 2;
|
||||
string status = 3;
|
||||
string commit_hash = 4;
|
||||
google.protobuf.Timestamp commit_time = 5 [
|
||||
(gogoproto.stdtime) = true,
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"commit_time\" yaml:\"commit_time\""
|
||||
];
|
||||
cosmos.base.v1beta1.Coin commit_fee = 6 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\""
|
||||
];
|
||||
google.protobuf.Timestamp reveal_time = 7 [
|
||||
(gogoproto.stdtime) = true,
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"reveal_time\" yaml:\"reveal_time\""
|
||||
];
|
||||
cosmos.base.v1beta1.Coin reveal_fee = 8 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
|
||||
];
|
||||
cosmos.base.v1beta1.Coin bid_amount = 9 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"bid_amount\" yaml:\"bid_amount\""
|
||||
];;
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package vulcanize.bond.v1beta1;
|
||||
|
||||
option go_package = "github.com/tharsis/ethermint/x/bond/types";
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "cosmos/base/v1beta1/coin.proto";
|
||||
|
||||
// Params defines the bond module parameters
|
||||
message Params {
|
||||
// max_bond_amount is maximum amount to bond
|
||||
cosmos.base.v1beta1.Coin max_bond_amount = 1 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"max_bond_amount\" yaml:\"max_bond_amount\""
|
||||
];
|
||||
}
|
||||
|
||||
// Bond represents funds deposited by an account for record rent payments.
|
||||
message Bond {
|
||||
// id is unique identifier of the bond
|
||||
string id = 1;
|
||||
// owner of the bond
|
||||
string owner = 2;
|
||||
// balance of the bond
|
||||
repeated cosmos.base.v1beta1.Coin balance = 3 [
|
||||
(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
|
||||
(gogoproto.moretags) = "json:\"balance\" yaml:\"balance\""
|
||||
];
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package vulcanize.bond.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "vulcanize/bond/v1beta1/bond.proto";
|
||||
|
||||
option go_package = "github.com/tharsis/ethermint/x/bond/types";
|
||||
|
||||
// GenesisState defines the bond module's genesis state.
|
||||
message GenesisState {
|
||||
// params defines all the parameters of the module.
|
||||
Params params = 1 [(gogoproto.nullable) = false];
|
||||
|
||||
// bonds defines all the bonds
|
||||
repeated Bond bonds = 2 [
|
||||
(gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\""
|
||||
];
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package vulcanize.bond.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "vulcanize/bond/v1beta1/bond.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "cosmos/base/query/v1beta1/pagination.proto";
|
||||
import "cosmos/base/v1beta1/coin.proto";
|
||||
|
||||
option go_package = "github.com/tharsis/ethermint/x/bond/types";
|
||||
|
||||
// Query defines the gRPC querier service for bond module
|
||||
service Query {
|
||||
// Params queries bonds module params.
|
||||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
|
||||
option (google.api.http).get = "/vulcanize/bond/v1beta1/params";
|
||||
}
|
||||
|
||||
// Bonds queries bonds list.
|
||||
rpc Bonds(QueryGetBondsRequest) returns (QueryGetBondsResponse) {
|
||||
option (google.api.http).get = "/vulcanize/bond/v1beta1/bonds";
|
||||
}
|
||||
|
||||
// GetBondById
|
||||
rpc GetBondById(QueryGetBondByIdRequest) returns (QueryGetBondByIdResponse){
|
||||
option (google.api.http).get = "/vulcanize/bond/v1beta1/bonds/{id}";
|
||||
}
|
||||
|
||||
// Get Bonds List by Owner
|
||||
rpc GetBondsByOwner(QueryGetBondsByOwnerRequest) returns (QueryGetBondsByOwnerResponse){
|
||||
option (google.api.http).get = "/vulcanize/bond/v1beta1/by-owner/{owner}";
|
||||
}
|
||||
|
||||
// Get Bonds module balance
|
||||
rpc GetBondsModuleBalance(QueryGetBondModuleBalanceRequest) returns (QueryGetBondModuleBalanceResponse){
|
||||
option (google.api.http).get = "/vulcanize/bond/v1beta1/balance";
|
||||
}
|
||||
}
|
||||
|
||||
// QueryParamsRequest is request for query the bond module params
|
||||
message QueryParamsRequest{
|
||||
}
|
||||
|
||||
// QueryParamsResponse returns response type of bond module params
|
||||
message QueryParamsResponse{
|
||||
Params params = 1 [
|
||||
(gogoproto.moretags) = "json:\"params\" yaml:\"params\""
|
||||
];
|
||||
}
|
||||
|
||||
// QueryGetBondById queries a bond by bond-id.
|
||||
message QueryGetBondsRequest{
|
||||
// pagination defines an optional pagination for the request.
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 1;
|
||||
}
|
||||
|
||||
// QueryGetBondsResponse is response type for get the bonds by bond-id
|
||||
message QueryGetBondsResponse{
|
||||
repeated Bond bonds = 1 [
|
||||
(gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\""
|
||||
];
|
||||
// pagination defines the pagination in the response.
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
||||
|
||||
// QueryGetBondById
|
||||
message QueryGetBondByIdRequest{
|
||||
string id = 1 [
|
||||
(gogoproto.moretags) = "json:\"id\" yaml:\"id\""
|
||||
];
|
||||
}
|
||||
|
||||
// QueryGetBondByIdResponse returns QueryGetBondById query response
|
||||
message QueryGetBondByIdResponse{
|
||||
Bond bond = 1 [
|
||||
(gogoproto.moretags) = "json:\"bond\" yaml:\"bond\""
|
||||
];
|
||||
}
|
||||
|
||||
// QueryGetBondsByOwnerRequest is request type for Query/GetBondsByOwner RPC Method
|
||||
message QueryGetBondsByOwnerRequest{
|
||||
string owner = 1;
|
||||
// pagination defines the pagination in the response.
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
||||
|
||||
// QueryGetBondsByOwnerResponse is response type for Query/GetBondsByOwner RPC Method
|
||||
message QueryGetBondsByOwnerResponse {
|
||||
repeated Bond bonds = 1 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\""
|
||||
];
|
||||
// pagination defines the pagination in the response.
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
||||
|
||||
// QueryGetBondModuleBalanceRequest is request type for bond module balance rpc method
|
||||
message QueryGetBondModuleBalanceRequest{
|
||||
|
||||
}
|
||||
|
||||
// QueryGetBondModuleBalanceResponse is the response type for bond module balance rpc method
|
||||
message QueryGetBondModuleBalanceResponse{
|
||||
repeated cosmos.base.v1beta1.Coin balance = 2 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
|
||||
(gogoproto.moretags) = "json:\"coins\" yaml:\"coins\""
|
||||
];
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package vulcanize.bond.v1beta1;
|
||||
|
||||
option go_package = "github.com/tharsis/ethermint/x/bond/types";
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "cosmos/base/v1beta1/coin.proto";
|
||||
|
||||
// Msg defines the bond Msg service.
|
||||
service Msg {
|
||||
// CreateBond defines a method for creating a new bond.
|
||||
rpc CreateBond(MsgCreateBond) returns (MsgCreateBondResponse);
|
||||
|
||||
// RefillBond defines a method for refilling amount for bond.
|
||||
rpc RefillBond(MsgRefillBond) returns (MsgRefillBondResponse);
|
||||
|
||||
// WithdrawBond defines a method for withdrawing amount from bond.
|
||||
rpc WithdrawBond(MsgWithdrawBond) returns (MsgWithdrawBondResponse);
|
||||
|
||||
// CancelBond defines a method for cancelling a bond.
|
||||
rpc CancelBond(MsgCancelBond) returns (MsgCancelBondResponse);
|
||||
}
|
||||
|
||||
// MsgCreateBond defines a SDK message for creating a new bond.
|
||||
message MsgCreateBond{
|
||||
string signer = 1;
|
||||
repeated cosmos.base.v1beta1.Coin coins = 2 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
|
||||
(gogoproto.moretags) = "json:\"coins\" yaml:\"coins\""
|
||||
];
|
||||
}
|
||||
|
||||
// MsgCreateBondResponse defines the Msg/CreateBond response type.
|
||||
message MsgCreateBondResponse{
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
// MsgRefillBond defines a SDK message for refill the amount for bond.
|
||||
message MsgRefillBond{
|
||||
string id = 1;
|
||||
string signer = 2;
|
||||
repeated cosmos.base.v1beta1.Coin coins = 3 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
|
||||
(gogoproto.moretags) = "json:\"coins\" yaml:\"coins\""
|
||||
];
|
||||
}
|
||||
|
||||
// MsgRefillBondResponse defines the Msg/RefillBond response type.
|
||||
message MsgRefillBondResponse{
|
||||
}
|
||||
|
||||
// MsgWithdrawBond defines a SDK message for withdrawing amount from bond.
|
||||
message MsgWithdrawBond {
|
||||
string id = 1;
|
||||
string signer = 2;
|
||||
repeated cosmos.base.v1beta1.Coin coins = 3 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
|
||||
(gogoproto.moretags) = "json:\"coins\" yaml:\"coins\""
|
||||
];
|
||||
}
|
||||
|
||||
// MsgWithdrawBondResponse defines the Msg/WithdrawBond response type.
|
||||
message MsgWithdrawBondResponse{
|
||||
}
|
||||
|
||||
// MsgCancelBond defines a SDK message for the cancel the bond.
|
||||
message MsgCancelBond{
|
||||
string id = 1;
|
||||
string signer = 2;
|
||||
}
|
||||
|
||||
// MsgCancelBondResponse defines the Msg/CancelBond response type.
|
||||
message MsgCancelBondResponse{
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package vulcanize.registry.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "vulcanize/registry/v1beta1/registry.proto";
|
||||
|
||||
option go_package = "github.com/cerc-io/laconicd/x/registry/types";
|
||||
|
||||
// GenesisState defines the registry module's genesis state.
|
||||
message GenesisState {
|
||||
// params defines all the params of registry module.
|
||||
Params params = 1 [(gogoproto.nullable) = false];
|
||||
// records
|
||||
repeated Record records = 2
|
||||
[(gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"records\" yaml:\"records\""];
|
||||
// authorities
|
||||
repeated AuthorityEntry authorities = 3
|
||||
[(gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"authorities\" yaml:\"authorities\""];
|
||||
// names
|
||||
repeated NameEntry names = 4 [(gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"names\" yaml:\"names\""];
|
||||
}
|
@ -1,225 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package vulcanize.registry.v1beta1;
|
||||
|
||||
import "vulcanize/registry/v1beta1/registry.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "cosmos/base/query/v1beta1/pagination.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
import "cosmos/base/v1beta1/coin.proto";
|
||||
|
||||
option go_package = "github.com/cerc-io/laconicd/x/registry/types";
|
||||
|
||||
// Query defines the gRPC querier service for registry module
|
||||
service Query {
|
||||
// Params queries the registry module params.
|
||||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
|
||||
option (google.api.http).get = "/vulcanize/registry/v1beta1/params";
|
||||
}
|
||||
// List records
|
||||
rpc ListRecords(QueryListRecordsRequest) returns (QueryListRecordsResponse) {
|
||||
option (google.api.http).get = "/vulcanize/registry/v1beta1/records";
|
||||
}
|
||||
// Get record by id
|
||||
rpc GetRecord(QueryRecordByIDRequest) returns (QueryRecordByIDResponse) {
|
||||
option (google.api.http).get = "/vulcanize/registry/v1beta1/records/{id}";
|
||||
}
|
||||
// Get records by bond id
|
||||
rpc GetRecordByBondID(QueryRecordByBondIDRequest) returns (QueryRecordByBondIDResponse) {
|
||||
option (google.api.http).get = "/vulcanize/registry/v1beta1/records-by-bond-id/{id}";
|
||||
}
|
||||
// Get registry module balance
|
||||
rpc GetRegistryModuleBalance(GetRegistryModuleBalanceRequest) returns (GetRegistryModuleBalanceResponse) {
|
||||
option (google.api.http).get = "/vulcanize/registry/v1beta1/balance";
|
||||
}
|
||||
// List name records
|
||||
rpc ListNameRecords(QueryListNameRecordsRequest) returns (QueryListNameRecordsResponse) {
|
||||
option (google.api.http).get = "/vulcanize/registry/v1beta1/names";
|
||||
}
|
||||
// Whois method retrieve the name authority info
|
||||
rpc Whois(QueryWhoisRequest) returns (QueryWhoisResponse) {
|
||||
option (google.api.http).get = "/vulcanize/registry/v1beta1/whois/{name}";
|
||||
}
|
||||
// LookupCrn
|
||||
rpc LookupCrn(QueryLookupCrn) returns (QueryLookupCrnResponse) {
|
||||
option (google.api.http).get = "/vulcanize/registry/v1beta1/lookup";
|
||||
}
|
||||
// ResolveCrn
|
||||
rpc ResolveCrn(QueryResolveCrn) returns (QueryResolveCrnResponse) {
|
||||
option (google.api.http).get = "/vulcanize/registry/v1beta1/resolve";
|
||||
}
|
||||
// GetRecordExpiryQueue
|
||||
rpc GetRecordExpiryQueue(QueryGetRecordExpiryQueue) returns (QueryGetRecordExpiryQueueResponse) {
|
||||
option (google.api.http).get = "/vulcanize/registry/v1beta1/record-expiry";
|
||||
}
|
||||
// GetAuthorityExpiryQueue
|
||||
rpc GetAuthorityExpiryQueue(QueryGetAuthorityExpiryQueue) returns (QueryGetAuthorityExpiryQueueResponse) {
|
||||
option (google.api.http).get = "/vulcanize/registry/v1beta1/authority-expiry";
|
||||
}
|
||||
}
|
||||
|
||||
// QueryParamsRequest is request type for registry params
|
||||
message QueryParamsRequest {}
|
||||
|
||||
// QueryParamsResponse is response type for registry params
|
||||
message QueryParamsResponse {
|
||||
Params params = 1;
|
||||
}
|
||||
|
||||
// QueryListRecordsRequest is request type for registry records list
|
||||
message QueryListRecordsRequest {
|
||||
message LinkInput {
|
||||
string id = 1;
|
||||
}
|
||||
message ArrayInput {
|
||||
repeated ValueInput values = 1;
|
||||
}
|
||||
message MapInput {
|
||||
map<string, ValueInput> values = 1;
|
||||
}
|
||||
message ValueInput {
|
||||
oneof value {
|
||||
string string = 1;
|
||||
int64 int = 2;
|
||||
double float = 3;
|
||||
bool boolean = 4;
|
||||
string link = 5;
|
||||
ArrayInput array = 6;
|
||||
MapInput map = 7;
|
||||
}
|
||||
}
|
||||
message KeyValueInput {
|
||||
string key = 1;
|
||||
ValueInput value = 2;
|
||||
}
|
||||
repeated KeyValueInput attributes = 1;
|
||||
|
||||
bool all = 2;
|
||||
|
||||
// pagination defines an optional pagination for the request.
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 3;
|
||||
}
|
||||
|
||||
// QueryListRecordsResponse is response type for registry records list
|
||||
message QueryListRecordsResponse {
|
||||
repeated Record records = 1 [(gogoproto.nullable) = false];
|
||||
// pagination defines the pagination in the response.
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
||||
|
||||
// QueryRecordByIDRequest is request type for registry records by id
|
||||
message QueryRecordByIDRequest {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
// QueryRecordByIDResponse is response type for registry records by id
|
||||
message QueryRecordByIDResponse {
|
||||
Record record = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// QueryRecordByBondIdRequest is request type for get the records by bond-id
|
||||
message QueryRecordByBondIDRequest {
|
||||
string id = 1;
|
||||
// pagination defines an optional pagination for the request.
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 2;
|
||||
}
|
||||
|
||||
// QueryRecordByBondIdResponse is response type for records list by bond-id
|
||||
message QueryRecordByBondIDResponse {
|
||||
repeated Record records = 1 [(gogoproto.nullable) = false];
|
||||
// pagination defines the pagination in the response.
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
||||
|
||||
// GetRegistryModuleBalanceRequest is request type for registry module accounts balance
|
||||
message GetRegistryModuleBalanceRequest {}
|
||||
|
||||
// GetRegistryModuleBalanceResponse is response type for registry module accounts balance
|
||||
message GetRegistryModuleBalanceResponse {
|
||||
repeated AccountBalance balances = 1;
|
||||
}
|
||||
|
||||
// AccountBalance is registry module account balance
|
||||
message AccountBalance {
|
||||
string account_name = 1 [(gogoproto.moretags) = "json:\"accountName\" yaml:\"accountName\""];
|
||||
repeated cosmos.base.v1beta1.Coin balance = 3 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
|
||||
(gogoproto.moretags) = "json:\"balance\" yaml:\"balance\""
|
||||
];
|
||||
}
|
||||
|
||||
// QueryListNameRecordsRequest is request type for registry names records
|
||||
message QueryListNameRecordsRequest {
|
||||
// pagination defines an optional pagination for the request.
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 1;
|
||||
}
|
||||
|
||||
// QueryListNameRecordsResponse is response type for registry names records
|
||||
message QueryListNameRecordsResponse {
|
||||
repeated NameEntry names = 1 [(gogoproto.nullable) = false];
|
||||
// pagination defines the pagination in the response.
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
||||
|
||||
// QueryWhoisRequest is request type for Get NameAuthority
|
||||
message QueryWhoisRequest {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
// QueryWhoisResponse is response type for whois request
|
||||
message QueryWhoisResponse {
|
||||
NameAuthority name_authority = 1
|
||||
[(gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"nameAuthority\" yaml:\"nameAuthority\""];
|
||||
}
|
||||
|
||||
// QueryLookupCrn is request type for LookupCrn
|
||||
message QueryLookupCrn {
|
||||
string crn = 1;
|
||||
}
|
||||
|
||||
// QueryLookupCrnResponse is response type for QueryLookupCrn
|
||||
message QueryLookupCrnResponse {
|
||||
NameRecord name = 1;
|
||||
}
|
||||
|
||||
// QueryResolveCrn is request type for ResolveCrn
|
||||
message QueryResolveCrn {
|
||||
string crn = 1;
|
||||
}
|
||||
|
||||
// QueryResolveCrnResponse is response type for QueryResolveCrn
|
||||
message QueryResolveCrnResponse {
|
||||
Record record = 1;
|
||||
}
|
||||
|
||||
// QueryGetRecordExpiryQueue
|
||||
message QueryGetRecordExpiryQueue {
|
||||
// pagination defines an optional pagination for the request.
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 1;
|
||||
}
|
||||
|
||||
// QueryGetRecordExpiryQueueResponse
|
||||
message QueryGetRecordExpiryQueueResponse {
|
||||
repeated ExpiryQueueRecord records = 1;
|
||||
// pagination defines the pagination in the response.
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
||||
|
||||
// ExpiryQueueRecord
|
||||
message ExpiryQueueRecord {
|
||||
string id = 1;
|
||||
repeated string value = 2;
|
||||
}
|
||||
|
||||
// QueryGetAuthorityExpiryQueue
|
||||
message QueryGetAuthorityExpiryQueue {
|
||||
// pagination defines an optional pagination for the request.
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 1;
|
||||
}
|
||||
|
||||
// QueryGetAuthorityExpiryQueueResponse
|
||||
message QueryGetAuthorityExpiryQueueResponse {
|
||||
repeated ExpiryQueueRecord authorities = 1;
|
||||
// pagination defines the pagination in the response.
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package vulcanize.registry.v1beta1;
|
||||
|
||||
import "google/protobuf/duration.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
import "cosmos/base/v1beta1/coin.proto";
|
||||
|
||||
option go_package = "github.com/cerc-io/laconicd/x/registry/types";
|
||||
|
||||
// Params defines the registry module parameters
|
||||
message Params {
|
||||
cosmos.base.v1beta1.Coin record_rent = 1
|
||||
[(gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"record_rent\" yaml:\"record_rent\""];
|
||||
google.protobuf.Duration record_rent_duration = 2 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.stdduration) = true,
|
||||
(gogoproto.moretags) = "json:\"record_rent_duration\" yaml:\"record_rent_duration\""
|
||||
];
|
||||
cosmos.base.v1beta1.Coin authority_rent = 3
|
||||
[(gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"authority_rent\" yaml:\"authority_rent\""];
|
||||
google.protobuf.Duration authority_rent_duration = 4 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.stdduration) = true,
|
||||
(gogoproto.moretags) = "json:\"authority_rent_duration\" yaml:\"authority_rent_duration\""
|
||||
];
|
||||
google.protobuf.Duration authority_grace_period = 5 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.stdduration) = true,
|
||||
(gogoproto.moretags) = "json:\"authority_grace_period\" yaml:\"authority_grace_period\""
|
||||
];
|
||||
bool authority_auction_enabled = 6
|
||||
[(gogoproto.moretags) = "json:\"authority_auction_enabled\" yaml:\"authority_auction_enabled\""];
|
||||
google.protobuf.Duration authority_auction_commits_duration = 7 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.stdduration) = true,
|
||||
(gogoproto.moretags) = "json:\"authority_auction_commits_duration\" yaml:\"authority_auction_commits_duration\""
|
||||
];
|
||||
google.protobuf.Duration authority_auction_reveals_duration = 8 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.stdduration) = true,
|
||||
(gogoproto.moretags) = "json:\"authority_auction_reveals_duration\" yaml:\"authority_auction_reveals_duration\""
|
||||
];
|
||||
cosmos.base.v1beta1.Coin authority_auction_commit_fee = 9 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"authority_auction_commit_fee\" yaml:\"authority_auction_commit_fee\""
|
||||
];
|
||||
cosmos.base.v1beta1.Coin authority_auction_reveal_fee = 10 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"authority_auction_reveal_fee\" yaml:\"authority_auction_reveal_fee\""
|
||||
];
|
||||
cosmos.base.v1beta1.Coin authority_auction_minimum_bid = 11 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"authority_auction_minimum_bid\" yaml:\"authority_auction_minimum_bid\""
|
||||
];
|
||||
}
|
||||
|
||||
// Params defines the registry module records
|
||||
message Record {
|
||||
string id = 1 [(gogoproto.moretags) = "json:\"id\" yaml:\"id\""];
|
||||
string bond_id = 2 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""];
|
||||
string create_time = 3 [(gogoproto.moretags) = "json:\"createTime\" yaml:\"createTime\""];
|
||||
string expiry_time = 4 [(gogoproto.moretags) = "json:\"expiryTime\" yaml:\"expiryTime\""];
|
||||
bool deleted = 5;
|
||||
repeated string owners = 6 [(gogoproto.moretags) = "json:\"owners\" yaml:\"owners\""];
|
||||
bytes attributes = 7 [(gogoproto.moretags) = "json:\"attributes\" yaml:\"attributes\""];
|
||||
repeated string names = 8 [(gogoproto.moretags) = "json:\"names\" yaml:\"names\""];
|
||||
string type = 9 [(gogoproto.moretags) = "json:\"types\" yaml:\"types\""];
|
||||
}
|
||||
|
||||
// AuthorityEntry defines the registry module AuthorityEntries
|
||||
message AuthorityEntry {
|
||||
string name = 1;
|
||||
NameAuthority entry = 2;
|
||||
}
|
||||
|
||||
// NameAuthority
|
||||
message NameAuthority {
|
||||
// Owner public key.
|
||||
string owner_public_key = 1 [(gogoproto.moretags) = "json:\"ownerPublicKey\" yaml:\"ownerPublicKey\""];
|
||||
// Owner address.
|
||||
string owner_address = 2 [(gogoproto.moretags) = "json:\"ownerAddress\" yaml:\"ownerAddress\""];
|
||||
// height at which name/authority was created.
|
||||
uint64 height = 3;
|
||||
string status = 4;
|
||||
string auction_id = 5 [(gogoproto.moretags) = "json:\"auctionID\" yaml:\"auctionID\""];
|
||||
string bond_id = 6 [(gogoproto.moretags) = "json:\"bondID\" yaml:\"bondID\""];
|
||||
google.protobuf.Timestamp expiry_time = 7 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.stdtime) = true,
|
||||
(gogoproto.moretags) = "json:\"expiryTime\" yaml:\"expiryTime\""
|
||||
];
|
||||
}
|
||||
|
||||
// NameEntry
|
||||
message NameEntry {
|
||||
string name = 1;
|
||||
NameRecord entry = 2;
|
||||
}
|
||||
|
||||
// NameRecord
|
||||
message NameRecord {
|
||||
NameRecordEntry latest = 1;
|
||||
repeated NameRecordEntry history = 2;
|
||||
}
|
||||
|
||||
// NameRecordEntry
|
||||
message NameRecordEntry {
|
||||
string id = 1;
|
||||
uint64 height = 2;
|
||||
}
|
||||
|
||||
// Signature
|
||||
message Signature {
|
||||
string sig = 1 [(gogoproto.moretags) = "json:\"sig\" yaml:\"sig\""];
|
||||
string pub_key = 2 [(gogoproto.moretags) = "json:\"pubKey\" yaml:\"pubKey\""];
|
||||
}
|
||||
|
||||
// BlockChangeSet
|
||||
message BlockChangeSet {
|
||||
int64 height = 1;
|
||||
repeated string records = 2;
|
||||
repeated string auctions = 3;
|
||||
repeated AuctionBidInfo auction_bids = 4 [(gogoproto.moretags) = "json:\"auctionBids\" yaml:\"auctionBids\""];
|
||||
repeated string authorities = 5;
|
||||
repeated string names = 6;
|
||||
}
|
||||
|
||||
// AuctionBidInfo
|
||||
message AuctionBidInfo {
|
||||
string auction_id = 1 [(gogoproto.moretags) = "json:\"auctionID\" yaml:\"auctionID\""];
|
||||
string bidder_address = 2 [(gogoproto.moretags) = "json:\"bidderAddress\" yaml:\"bidderAddress\""];
|
||||
}
|
@ -1,137 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package vulcanize.registry.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "vulcanize/registry/v1beta1/registry.proto";
|
||||
|
||||
option go_package = "github.com/cerc-io/laconicd/x/registry/types";
|
||||
|
||||
// Msg
|
||||
service Msg {
|
||||
// SetRecord will records a new record with given payload and bond id
|
||||
rpc SetRecord(MsgSetRecord) returns (MsgSetRecordResponse) {}
|
||||
// Renew Record will renew the expire record
|
||||
rpc RenewRecord(MsgRenewRecord) returns (MsgRenewRecordResponse) {}
|
||||
// AssociateBond
|
||||
rpc AssociateBond(MsgAssociateBond) returns (MsgAssociateBondResponse) {}
|
||||
// DissociateBond
|
||||
rpc DissociateBond(MsgDissociateBond) returns (MsgDissociateBondResponse) {}
|
||||
// DissociateRecords
|
||||
rpc DissociateRecords(MsgDissociateRecords) returns (MsgDissociateRecordsResponse) {}
|
||||
// ReAssociateRecords
|
||||
rpc ReAssociateRecords(MsgReAssociateRecords) returns (MsgReAssociateRecordsResponse) {}
|
||||
// SetName will store the name with given crn and name
|
||||
rpc SetName(MsgSetName) returns (MsgSetNameResponse) {}
|
||||
// Reserve name
|
||||
rpc ReserveName(MsgReserveAuthority) returns (MsgReserveAuthorityResponse) {}
|
||||
// Delete Name method will remove authority name
|
||||
rpc DeleteName(MsgDeleteNameAuthority) returns (MsgDeleteNameAuthorityResponse) {}
|
||||
// SetAuthorityBond
|
||||
rpc SetAuthorityBond(MsgSetAuthorityBond) returns (MsgSetAuthorityBondResponse) {}
|
||||
}
|
||||
|
||||
// MsgSetRecord
|
||||
message MsgSetRecord {
|
||||
string bond_id = 1 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""];
|
||||
string signer = 2;
|
||||
Payload payload = 3 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// MsgSetRecordResponse
|
||||
message MsgSetRecordResponse {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
// Payload
|
||||
message Payload {
|
||||
Record record = 1;
|
||||
repeated Signature signatures = 2
|
||||
[(gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"signatures\" yaml:\"signatures\""];
|
||||
}
|
||||
|
||||
// MsgSetName
|
||||
message MsgSetName {
|
||||
string crn = 1;
|
||||
string cid = 2;
|
||||
string signer = 3;
|
||||
}
|
||||
|
||||
// MsgSetNameResponse
|
||||
message MsgSetNameResponse {}
|
||||
|
||||
// MsgReserveName
|
||||
message MsgReserveAuthority {
|
||||
string name = 1;
|
||||
string signer = 2;
|
||||
// if creating a sub-authority.
|
||||
string owner = 3;
|
||||
}
|
||||
|
||||
// MsgReserveNameResponse
|
||||
message MsgReserveAuthorityResponse {}
|
||||
|
||||
// MsgSetAuthorityBond is SDK message for SetAuthorityBond
|
||||
message MsgSetAuthorityBond {
|
||||
string name = 1;
|
||||
string bond_id = 2 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""];
|
||||
string signer = 3;
|
||||
}
|
||||
|
||||
// MsgSetAuthorityBondResponse
|
||||
message MsgSetAuthorityBondResponse {}
|
||||
|
||||
// MsgDeleteNameAuthority is SDK message for DeleteNameAuthority
|
||||
message MsgDeleteNameAuthority {
|
||||
string crn = 1;
|
||||
string signer = 2;
|
||||
}
|
||||
|
||||
// MsgDeleteNameAuthorityResponse
|
||||
message MsgDeleteNameAuthorityResponse {}
|
||||
|
||||
// MsgRenewRecord is SDK message for Renew a record
|
||||
message MsgRenewRecord {
|
||||
string record_id = 1 [(gogoproto.moretags) = "json:\"recordId\" yaml:\"recordId\""];
|
||||
string signer = 2;
|
||||
}
|
||||
|
||||
// MsgRenewRecordResponse
|
||||
message MsgRenewRecordResponse {}
|
||||
|
||||
// MsgAssociateBond
|
||||
message MsgAssociateBond {
|
||||
string record_id = 1 [(gogoproto.moretags) = "json:\"recordId\" yaml:\"recordId\""];
|
||||
string bond_id = 2 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""];
|
||||
string signer = 3;
|
||||
}
|
||||
|
||||
// MsgAssociateBondResponse
|
||||
message MsgAssociateBondResponse {}
|
||||
|
||||
// MsgDissociateBond is SDK message for Msg/DissociateBond
|
||||
message MsgDissociateBond {
|
||||
string record_id = 1 [(gogoproto.moretags) = "json:\"recordId\" yaml:\"recordId\""];
|
||||
string signer = 2;
|
||||
}
|
||||
|
||||
// MsgDissociateBondResponse is response type for MsgDissociateBond
|
||||
message MsgDissociateBondResponse {}
|
||||
|
||||
// MsgDissociateRecords is SDK message for Msg/DissociateRecords
|
||||
message MsgDissociateRecords {
|
||||
string bond_id = 1 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""];
|
||||
string signer = 2;
|
||||
}
|
||||
|
||||
// MsgDissociateRecordsResponse is response type for MsgDissociateRecords
|
||||
message MsgDissociateRecordsResponse {}
|
||||
|
||||
// MsgReAssociateRecords is SDK message for Msg/ReAssociateRecords
|
||||
message MsgReAssociateRecords {
|
||||
string new_bond_id = 1 [(gogoproto.moretags) = "json:\"newBondId\" yaml:\"newBondId\""];
|
||||
string old_bond_id = 2 [(gogoproto.moretags) = "json:\"oldBondId\" yaml:\"oldBondId\""];
|
||||
string signer = 3;
|
||||
}
|
||||
|
||||
// MsgReAssociateRecordsResponse is response type for MsgReAssociateRecords
|
||||
message MsgReAssociateRecordsResponse {}
|
@ -1,2 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
docker build -t cerc/laconic-sdk-tester:local -f Dockerfile .
|
@ -1,40 +0,0 @@
|
||||
#!/bin/bash
|
||||
# NOTE: protoc is required
|
||||
|
||||
set -e
|
||||
|
||||
REPO_ROOT=$(pwd)
|
||||
I=$REPO_ROOT/proto
|
||||
DEST_TS=$REPO_ROOT/src/proto/
|
||||
|
||||
echo "Generating protobuf files"
|
||||
|
||||
mkdir -p $DEST_TS
|
||||
|
||||
protoc \
|
||||
--plugin=protoc-gen-ts=$REPO_ROOT/node_modules/.bin/protoc-gen-ts \
|
||||
--ts_out=$DEST_TS \
|
||||
--proto_path=$I \
|
||||
$(find $REPO_ROOT/proto/vulcanize -iname "*.proto")
|
||||
|
||||
SED='sed -i'
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
SED='sed -i ""'
|
||||
fi
|
||||
|
||||
echo "Removing gRPC references..."
|
||||
# https://github.com/tharsis/evmosjs/tree/main/packages/proto#note
|
||||
|
||||
for file in $(find $REPO_ROOT/src/proto -type f)
|
||||
do
|
||||
line=$(grep -n '@grpc/grpc-js' $file | cut -f1 -d':')
|
||||
if [[ -n "$line" ]] && [[ "$line" -gt 0 ]]; then
|
||||
echo "Processing file: $file"
|
||||
$SED "${line}d" ${file}
|
||||
functions=$(grep -n 'interface GrpcUnaryServiceInterface' $file | cut -f1 -d':')
|
||||
$SED "${functions},\$d" ${file}
|
||||
echo '}' >> $file
|
||||
fi
|
||||
$SED '1s#^#/* eslint-disable */\n#' $file
|
||||
$SED '1s#^#// @ts-nocheck\n#' $file
|
||||
done
|
182
src/account.ts
182
src/account.ts
@ -1,182 +0,0 @@
|
||||
import assert from 'assert';
|
||||
import BIP32Factory from 'bip32';
|
||||
import * as ecc from 'tiny-secp256k1';
|
||||
import * as bip39 from 'bip39';
|
||||
import canonicalStringify from 'canonical-json';
|
||||
import secp256k1 from 'secp256k1';
|
||||
import { utils } from 'ethers';
|
||||
import { sha256 } from 'js-sha256';
|
||||
import { MessageTypes, signTypedData, SignTypedDataVersion } from '@metamask/eth-sig-util';
|
||||
import { Ripemd160 } from "@cosmjs/crypto";
|
||||
import { fromHex, toHex } from '@cosmjs/encoding';
|
||||
import { ethToEthermint } from "@tharsis/address-converter"
|
||||
import { encodeSecp256k1Pubkey } from '@cosmjs/amino';
|
||||
|
||||
import { Payload, Signature } from './types';
|
||||
|
||||
const AMINO_PREFIX = 'EB5AE98721';
|
||||
const HDPATH = "m/44'/60'/0'/0";
|
||||
|
||||
const bip32 = BIP32Factory(ecc);
|
||||
|
||||
interface TypedMessageDomain {
|
||||
name?: string;
|
||||
version?: string;
|
||||
chainId?: number;
|
||||
verifyingContract?: string;
|
||||
salt?: ArrayBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registry account.
|
||||
*/
|
||||
export class Account {
|
||||
_privateKey: Buffer
|
||||
_publicKey!: Uint8Array
|
||||
_encodedPubkey!: string
|
||||
_formattedCosmosAddress!: string
|
||||
_registryPublicKey!: string
|
||||
_registryAddress!: string
|
||||
_ethAddress!: string
|
||||
|
||||
/**
|
||||
* Generate bip39 mnemonic.
|
||||
*/
|
||||
static generateMnemonic() {
|
||||
return bip39.generateMnemonic();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate private key from mnemonic.
|
||||
*/
|
||||
static async generateFromMnemonic(mnemonic: string) {
|
||||
assert(mnemonic);
|
||||
|
||||
const seed = await bip39.mnemonicToSeed(mnemonic);
|
||||
const wallet = bip32.fromSeed(seed);
|
||||
const account = wallet.derivePath(HDPATH);
|
||||
const { privateKey } = account;
|
||||
assert(privateKey);
|
||||
|
||||
return new Account(privateKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* New Account.
|
||||
*/
|
||||
constructor(privateKey: Buffer) {
|
||||
assert(privateKey);
|
||||
|
||||
this._privateKey = privateKey;
|
||||
this.init()
|
||||
}
|
||||
|
||||
get privateKey() {
|
||||
return this._privateKey;
|
||||
}
|
||||
|
||||
get encodedPubkey() {
|
||||
return this._encodedPubkey;
|
||||
}
|
||||
|
||||
get formattedCosmosAddress() {
|
||||
return this._formattedCosmosAddress;
|
||||
}
|
||||
|
||||
get registryPublicKey() {
|
||||
return this._registryPublicKey;
|
||||
}
|
||||
|
||||
get registryAddress() {
|
||||
return this._registryAddress;
|
||||
}
|
||||
|
||||
init () {
|
||||
// Generate public key.
|
||||
this._publicKey = secp256k1.publicKeyCreate(this._privateKey)
|
||||
this._encodedPubkey = encodeSecp256k1Pubkey(this._publicKey).value
|
||||
|
||||
// 2. Generate eth address.
|
||||
this._ethAddress = utils.computeAddress(this._publicKey)
|
||||
|
||||
// 3. Generate cosmos-sdk formatted address.
|
||||
this._formattedCosmosAddress = ethToEthermint(this._ethAddress);
|
||||
|
||||
// 4. Generate registry formatted public key.
|
||||
const publicKeyInHex = AMINO_PREFIX + toHex(this._publicKey);
|
||||
this._registryPublicKey = Buffer.from(publicKeyInHex, 'hex').toString('base64');
|
||||
|
||||
// 5. Generate registry formatted address.
|
||||
let publicKeySha256 = sha256(Buffer.from(publicKeyInHex, 'hex'));
|
||||
this._registryAddress = new Ripemd160().update(fromHex(publicKeySha256)).digest().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get private key.
|
||||
*/
|
||||
getPrivateKey() {
|
||||
return this._privateKey.toString('hex');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cosmos address.
|
||||
*/
|
||||
getCosmosAddress() {
|
||||
return this._formattedCosmosAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get record signature.
|
||||
*/
|
||||
async signRecord(record: any) {
|
||||
assert(record);
|
||||
|
||||
const recordAsJson = canonicalStringify(record);
|
||||
// Double sha256.
|
||||
const recordBytesToSign = Buffer.from(sha256(Buffer.from(sha256(Buffer.from(recordAsJson)), 'hex')), 'hex');
|
||||
|
||||
// Sign message
|
||||
assert(recordBytesToSign);
|
||||
|
||||
const messageToSignSha256 = sha256(recordBytesToSign);
|
||||
const messageToSignSha256InBytes = Buffer.from(messageToSignSha256, 'hex');
|
||||
const sigObj = secp256k1.ecdsaSign(messageToSignSha256InBytes, this.privateKey);
|
||||
|
||||
return Buffer.from(sigObj.signature);
|
||||
}
|
||||
|
||||
async signPayload(payload: Payload) {
|
||||
assert(payload);
|
||||
|
||||
const { record } = payload;
|
||||
const messageToSign = record.getMessageToSign();
|
||||
|
||||
const sig = await this.signRecord(messageToSign);
|
||||
assert(this.registryPublicKey)
|
||||
const signature = new Signature(this.registryPublicKey, sig.toString('base64'));
|
||||
payload.addSignature(signature);
|
||||
|
||||
return signature;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sign message.
|
||||
*/
|
||||
sign(message: any) {
|
||||
assert(message);
|
||||
const eipMessageDomain: any = message.eipToSign.domain;
|
||||
|
||||
const signature = signTypedData({
|
||||
data: {
|
||||
types: message.eipToSign.types as MessageTypes,
|
||||
primaryType: message.eipToSign.primaryType,
|
||||
domain: eipMessageDomain as TypedMessageDomain,
|
||||
message: message.eipToSign.message as Record<string, unknown>
|
||||
},
|
||||
privateKey: this._privateKey,
|
||||
version: SignTypedDataVersion.V4
|
||||
})
|
||||
|
||||
return signature;
|
||||
}
|
||||
}
|
@ -1,130 +0,0 @@
|
||||
import { Registry, Account, createBid } from './index';
|
||||
import { getConfig } from './testing/helper';
|
||||
|
||||
jest.setTimeout(30 * 60 * 1000);
|
||||
|
||||
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
|
||||
|
||||
const auctionTests = (numBidders = 3) => {
|
||||
let registry: Registry;
|
||||
|
||||
const accounts: { address: string, privateKey: string, bid?: any }[] = [];
|
||||
|
||||
let auctionId: string;
|
||||
let authorityName: string;
|
||||
|
||||
beforeAll(async () => {
|
||||
console.log('Running auction tests with num bidders', numBidders);
|
||||
|
||||
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
});
|
||||
|
||||
test('Setup bidder accounts', async () => {
|
||||
for (let i = 0; i < numBidders; i++) {
|
||||
const mnenonic = Account.generateMnemonic();
|
||||
const account = await Account.generateFromMnemonic(mnenonic);
|
||||
const bidderAddress = account.formattedCosmosAddress;
|
||||
await registry.sendCoins({ denom: 'aphoton', amount: '1000000000', destinationAddress: bidderAddress }, privateKey, fee);
|
||||
accounts.push({ address: bidderAddress, privateKey: account.privateKey.toString('hex') });
|
||||
}
|
||||
});
|
||||
|
||||
test('Reserve authority.', async () => {
|
||||
authorityName = `laconic-${Date.now()}`;
|
||||
await registry.reserveAuthority({ name: authorityName }, accounts[0].privateKey, fee);
|
||||
});
|
||||
|
||||
test('Authority should be under auction.', async () => {
|
||||
const [record] = await registry.lookupAuthorities([authorityName], true);
|
||||
expect(record.ownerAddress).toEqual('');
|
||||
expect(record.height).toBeDefined();
|
||||
expect(record.status).toEqual('auction');
|
||||
|
||||
expect(record.auction.id).toBeDefined();
|
||||
expect(record.auction.status).toEqual('commit');
|
||||
|
||||
auctionId = record.auction.id;
|
||||
});
|
||||
|
||||
test('Commit bids.', async () => {
|
||||
for (let i = 0; i < numBidders; i++) {
|
||||
accounts[i].bid = await createBid(chainId, auctionId, accounts[i].address, `${10000000 + (i * 500)}aphoton`);
|
||||
await registry.commitBid({ auctionId, commitHash: accounts[i].bid.commitHash }, accounts[i].privateKey, fee);
|
||||
}
|
||||
});
|
||||
|
||||
test('Check bids are committed', async () => {
|
||||
const [record] = await registry.lookupAuthorities([authorityName], true);
|
||||
expect(record.auction.id).toBeDefined();
|
||||
expect(record.auction.status).toEqual('commit');
|
||||
expect(record.auction.bids).toHaveLength(accounts.length);
|
||||
|
||||
record.auction.bids.forEach((bid: any) => {
|
||||
expect(bid.status).toEqual('commit');
|
||||
});
|
||||
});
|
||||
|
||||
test('Wait for reveal phase.', (done) => {
|
||||
setTimeout(done, 60 * 1000);
|
||||
});
|
||||
|
||||
test('Reveal bids.', async () => {
|
||||
const [auction] = await registry.getAuctionsByIds([auctionId]);
|
||||
expect(auction.status).toEqual('reveal');
|
||||
|
||||
for (let i = 0; i < numBidders; i++) {
|
||||
await registry.revealBid({ auctionId, reveal: accounts[i].bid.revealString }, accounts[i].privateKey, fee);
|
||||
}
|
||||
});
|
||||
|
||||
test('Check bids are revealed', async () => {
|
||||
const [auction] = await registry.getAuctionsByIds([auctionId]);
|
||||
expect(auction.status).toEqual('reveal');
|
||||
|
||||
auction.bids.forEach((bid: any) => {
|
||||
expect(bid.status).toEqual('reveal');
|
||||
});
|
||||
});
|
||||
|
||||
test('Wait for auction completion.', (done) => {
|
||||
setTimeout(done, 60 * 1000);
|
||||
});
|
||||
|
||||
test('Check auction winner, authority owner and status.', async () => {
|
||||
const [auction] = await registry.getAuctionsByIds([auctionId]);
|
||||
expect(auction.status).toEqual('completed');
|
||||
|
||||
const highestBidder = accounts[accounts.length - 1];
|
||||
const secondHighestBidder = (accounts.length > 1 ? accounts[accounts.length - 2] : highestBidder);
|
||||
|
||||
expect(auction.winnerAddress).toEqual(highestBidder.address);
|
||||
expect(highestBidder.bid.reveal.bidAmount).toEqual(`${auction.winnerBid.quantity}${auction.winnerBid.type}`);
|
||||
expect(secondHighestBidder.bid.reveal.bidAmount).toEqual(`${auction.winnerPrice.quantity}${auction.winnerPrice.type}`);
|
||||
|
||||
const [record] = await registry.lookupAuthorities([authorityName], true);
|
||||
expect(record.ownerAddress).toEqual(highestBidder.address);
|
||||
expect(record.height).toBeDefined();
|
||||
expect(record.status).toEqual('active');
|
||||
});
|
||||
};
|
||||
|
||||
const withNumBidders = (numBidders: number) => () => auctionTests(numBidders);
|
||||
|
||||
if (!process.env.TEST_AUCTIONS_ENABLED) {
|
||||
// Required as jest complains if file has no tests.
|
||||
test('skipping auction tests', () => {});
|
||||
} else {
|
||||
/**
|
||||
Running these tests requires name auctions enabled. In laconicd repo run:
|
||||
|
||||
TEST_AUCTION_ENABLED=true ./init.sh
|
||||
|
||||
|
||||
Run tests:
|
||||
|
||||
yarn test:auctions
|
||||
*/
|
||||
describe('Auction (1 bidder)', withNumBidders(1));
|
||||
describe('Auction (2 bidders)', withNumBidders(2));
|
||||
describe('Auction (4 bidders)', withNumBidders(4));
|
||||
}
|
164
src/bond.test.ts
164
src/bond.test.ts
@ -1,164 +0,0 @@
|
||||
import path from 'path';
|
||||
|
||||
import { Registry } from './index';
|
||||
import { ensureUpdatedConfig, getConfig } from './testing/helper';
|
||||
|
||||
const WATCHER_YML_PATH = path.join(__dirname, './testing/data/watcher.yml');
|
||||
|
||||
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
|
||||
|
||||
jest.setTimeout(90 * 1000);
|
||||
|
||||
const bondTests = () => {
|
||||
let registry: Registry;
|
||||
|
||||
const publishNewWatcherVersion = async (bondId: string) => {
|
||||
let watcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
|
||||
await registry.setRecord({ privateKey, record: watcher.record, bondId }, privateKey, fee);
|
||||
return watcher;
|
||||
};
|
||||
|
||||
beforeAll(async () => {
|
||||
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
});
|
||||
|
||||
test('Create bond.', async () => {
|
||||
let bondId = await registry.getNextBondId(privateKey);
|
||||
expect(bondId).toBeDefined();
|
||||
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||
});
|
||||
|
||||
describe('With bond created', () => {
|
||||
let bond1: any
|
||||
|
||||
beforeAll(async () => {
|
||||
let bondId1 = await registry.getNextBondId(privateKey);
|
||||
expect(bondId1).toBeDefined();
|
||||
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||
|
||||
[bond1] = await registry.getBondsByIds([bondId1]);
|
||||
expect(bond1).toBeDefined();
|
||||
expect(bond1.id).toEqual(bondId1);
|
||||
});
|
||||
|
||||
test('Get bond by ID.', async () => {
|
||||
const [bond] = await registry.getBondsByIds([bond1.id]);
|
||||
expect(bond).toBeDefined();
|
||||
expect(bond.id).toBe(bond1.id);
|
||||
expect(bond.balance).toHaveLength(1);
|
||||
expect(bond.balance[0]).toEqual({ type: 'aphoton', quantity: '1000000000' });
|
||||
});
|
||||
|
||||
test('Query bonds.', async () => {
|
||||
const bonds = await registry.queryBonds();
|
||||
expect(bonds).toBeDefined();
|
||||
const bond = bonds.filter((bond: any) => bond.id === bond1.id);
|
||||
expect(bond).toBeDefined();
|
||||
});
|
||||
|
||||
test('Query bonds by owner.', async () => {
|
||||
const bonds = await registry.queryBonds({ owner: bond1.owner });
|
||||
expect(bonds).toBeDefined();
|
||||
const bond = bonds.filter((bond: any) => bond.id === bond1.id);
|
||||
expect(bond).toBeDefined();
|
||||
});
|
||||
|
||||
test('Refill bond.', async () => {
|
||||
await registry.refillBond({ id: bond1.id, denom: 'aphoton', amount: '500' }, privateKey, fee);
|
||||
|
||||
const [bond] = await registry.getBondsByIds([bond1.id]);
|
||||
expect(bond).toBeDefined();
|
||||
expect(bond.id).toBe(bond1.id);
|
||||
expect(bond.balance).toHaveLength(1);
|
||||
expect(bond.balance[0]).toEqual({ type: 'aphoton', quantity: '1000000500' });
|
||||
});
|
||||
|
||||
test('Withdraw bond.', async () => {
|
||||
await registry.withdrawBond({ id: bond1.id, denom: 'aphoton', amount: '500' }, privateKey, fee);
|
||||
|
||||
const [bond] = await registry.getBondsByIds([bond1.id]);
|
||||
expect(bond).toBeDefined();
|
||||
expect(bond.id).toBe(bond1.id);
|
||||
expect(bond.balance).toHaveLength(1);
|
||||
expect(bond.balance[0]).toEqual({ type: 'aphoton', quantity: '1000000000' });
|
||||
});
|
||||
|
||||
test('Cancel bond.', async () => {
|
||||
await registry.cancelBond({ id: bond1.id }, privateKey, fee);
|
||||
|
||||
const [bond] = await registry.getBondsByIds([bond1.id]);
|
||||
expect(bond.id).toBe("");
|
||||
expect(bond.owner).toBe("");
|
||||
expect(bond.balance).toHaveLength(0);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
test('Associate/Dissociate bond.', async () => {
|
||||
let bondId1: string;
|
||||
|
||||
bondId1 = await registry.getNextBondId(privateKey);
|
||||
expect(bondId1).toBeDefined();
|
||||
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||
|
||||
// Create a new record.
|
||||
let watcher = await publishNewWatcherVersion(bondId1);
|
||||
let query = { type: watcher.record.type, url: watcher.record.url, version: watcher.record.version };
|
||||
let [record1] = await registry.queryRecords(query, true);
|
||||
expect(record1.bondId).toBe(bondId1);
|
||||
|
||||
// Dissociate record, query and confirm.
|
||||
await registry.dissociateBond({ recordId: record1.id }, privateKey, fee);
|
||||
[record1] = await registry.queryRecords(query, true);
|
||||
expect(record1.bondId).toBe('');
|
||||
|
||||
// Associate record with bond, query and confirm.
|
||||
await registry.associateBond({ recordId: record1.id, bondId: bondId1 }, privateKey, fee);
|
||||
[record1] = await registry.queryRecords(query, true);
|
||||
expect(record1.bondId).toBe(bondId1);
|
||||
});
|
||||
|
||||
test('Reassociate/Dissociate records.', async () => {
|
||||
let bondId1: string;
|
||||
let bondId2: string;
|
||||
|
||||
bondId1 = await registry.getNextBondId(privateKey);
|
||||
expect(bondId1).toBeDefined();
|
||||
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||
|
||||
// Create a new record version.
|
||||
let watcher = await publishNewWatcherVersion(bondId1);
|
||||
let queryv1 = { type: watcher.record.type, url: watcher.record.url, version: watcher.record.version };
|
||||
let queryv2 = { type: watcher.record.type, url: watcher.record.url, version: watcher.record.version };
|
||||
|
||||
// Check version1, version2 as associated with bondId1.
|
||||
let records;
|
||||
records = await registry.queryRecords(queryv1, true);
|
||||
expect(records[0].bondId).toBe(bondId1);
|
||||
records = await registry.queryRecords(queryv2, true);
|
||||
expect(records[0].bondId).toBe(bondId1);
|
||||
|
||||
// Create another bond.
|
||||
bondId2 = await registry.getNextBondId(privateKey);
|
||||
expect(bondId2).toBeDefined();
|
||||
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||
const [bond] = await registry.getBondsByIds([bondId2]);
|
||||
expect(bond.id).toBe(bondId2);
|
||||
|
||||
// Reassociate records from bondId1 to bondId2, verify change.
|
||||
await registry.reassociateRecords({ oldBondId: bondId1, newBondId: bondId2 }, privateKey, fee);
|
||||
records = await registry.queryRecords(queryv1, true);
|
||||
expect(records[0].bondId).toBe(bondId2);
|
||||
records = await registry.queryRecords(queryv2, true);
|
||||
expect(records[0].bondId).toBe(bondId2);
|
||||
|
||||
// Dissociate all records from bond, verify change.
|
||||
await registry.dissociateRecords({ bondId: bondId2 }, privateKey, fee);
|
||||
records = await registry.queryRecords(queryv1, true);
|
||||
expect(records[0].bondId).toBe('');
|
||||
records = await registry.queryRecords(queryv2, true);
|
||||
expect(records[0].bondId).toBe('');
|
||||
});
|
||||
};
|
||||
|
||||
describe('Bonds', bondTests);
|
3
src/decs.d.ts
vendored
3
src/decs.d.ts
vendored
@ -1,3 +0,0 @@
|
||||
declare module 'graphql.js'
|
||||
declare module 'node-yaml'
|
||||
declare module 'canonical-json'
|
@ -1,46 +1,32 @@
|
||||
import { Account } from './account';
|
||||
import { Registry } from './index';
|
||||
import { getConfig } from './testing/helper';
|
||||
import { DirectSecp256k1HdWallet, DirectSecp256k1Wallet } from '@cosmjs/proto-signing';
|
||||
import { stringToPath } from '@cosmjs/crypto';
|
||||
import { fromHex } from '@cosmjs/encoding';
|
||||
|
||||
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
|
||||
import { sendTokens } from './index'
|
||||
|
||||
jest.setTimeout(90 * 1000);
|
||||
const MNEMONIC = "talent dismiss teach girl mutual arctic burger matrix outdoor rude vapor rose boost drastic glimpse govern illness rhythm avoid fetch derive increase harvest oak";
|
||||
|
||||
const registryTests = () => {
|
||||
let registry: Registry;
|
||||
const PRIVATE_KEY = "1c6dc846552186ef241489c4e4d10b01086d58b8c2ba06de5dfa589bd52cf23e"
|
||||
|
||||
beforeAll(async () => {
|
||||
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
describe('Send tokens', () => {
|
||||
test('Create wallet using mnemonic', async () => {
|
||||
const path = stringToPath("m/44'/60'/0'/0");
|
||||
|
||||
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(
|
||||
MNEMONIC,
|
||||
{
|
||||
prefix: 'ethm',
|
||||
hdPaths: [path]
|
||||
}
|
||||
);
|
||||
|
||||
await sendTokens(wallet)
|
||||
});
|
||||
|
||||
test('Get account info.', async() => {
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const accounts = await registry.getAccounts([account.formattedCosmosAddress]);
|
||||
expect(accounts).toHaveLength(1)
|
||||
const [accountObj] = accounts;
|
||||
expect(accountObj.address).toBe(account.formattedCosmosAddress);
|
||||
expect(accountObj.pubKey).toBe(account.encodedPubkey);
|
||||
expect(accountObj.number).toBe('0');
|
||||
expect(accountObj.sequence).toBeDefined();
|
||||
expect(accountObj.balance).toHaveLength(1);
|
||||
const [{ type, quantity }] = accountObj.balance
|
||||
expect(type).toBe('aphoton');
|
||||
expect(quantity).toBeDefined();
|
||||
})
|
||||
test('Create wallet using private key', async () => {
|
||||
const privateKey = fromHex(PRIVATE_KEY);
|
||||
const wallet = await DirectSecp256k1Wallet.fromKey(privateKey, 'ethm')
|
||||
|
||||
test('Get account balance.', async() => {
|
||||
const mnenonic1 = Account.generateMnemonic();
|
||||
const otherAccount = await Account.generateFromMnemonic(mnenonic1);
|
||||
await registry.sendCoins({ denom: 'aphoton', amount: '100000000', destinationAddress: otherAccount.formattedCosmosAddress }, privateKey, fee);
|
||||
|
||||
const [accountObj] = await registry.getAccounts([otherAccount.formattedCosmosAddress]);
|
||||
expect(accountObj).toBeDefined();
|
||||
expect(accountObj.address).toBe(otherAccount.formattedCosmosAddress);
|
||||
const [{ type, quantity }] = accountObj.balance
|
||||
expect(type).toBe('aphoton');
|
||||
expect(quantity).toBe('100000000');
|
||||
})
|
||||
}
|
||||
|
||||
describe('Registry', registryTests);
|
||||
await sendTokens(wallet)
|
||||
});
|
||||
})
|
||||
|
584
src/index.ts
584
src/index.ts
@ -1,570 +1,36 @@
|
||||
import { sha256 } from 'js-sha256';
|
||||
import { generatePostBodyBroadcast, BroadcastMode } from '@tharsis/provider';
|
||||
import {
|
||||
Chain,
|
||||
Sender,
|
||||
Fee,
|
||||
createMessageSend,
|
||||
MessageSendParams
|
||||
} from '@tharsis/transactions'
|
||||
import { OfflineDirectSigner } from "@cosmjs/proto-signing";
|
||||
import { assertIsDeliverTxSuccess, SigningStargateClient } from "@cosmjs/stargate";
|
||||
|
||||
import { RegistryClient } from "./registry-client";
|
||||
import { Account } from "./account";
|
||||
import { createTransaction } from "./txbuilder";
|
||||
import { Payload, Record } from './types';
|
||||
import { Util } from './util';
|
||||
import {
|
||||
createTxMsgAssociateBond,
|
||||
createTxMsgCancelBond,
|
||||
createTxMsgCreateBond,
|
||||
createTxMsgDissociateBond,
|
||||
createTxMsgDissociateRecords,
|
||||
createTxMsgReAssociateRecords,
|
||||
createTxMsgRefillBond,
|
||||
createTxMsgWithdrawBond,
|
||||
MessageMsgAssociateBond,
|
||||
MessageMsgCancelBond,
|
||||
MessageMsgCreateBond,
|
||||
MessageMsgDissociateBond,
|
||||
MessageMsgDissociateRecords,
|
||||
MessageMsgReAssociateRecords,
|
||||
MessageMsgRefillBond,
|
||||
MessageMsgWithdrawBond
|
||||
} from "./messages/bond";
|
||||
import {
|
||||
createTxMsgDeleteName,
|
||||
createTxMsgReserveAuthority,
|
||||
createTxMsgSetAuthorityBond,
|
||||
createTxMsgSetName,
|
||||
createTxMsgSetRecord,
|
||||
MessageMsgDeleteName,
|
||||
MessageMsgReserveAuthority,
|
||||
MessageMsgSetAuthorityBond,
|
||||
MessageMsgSetName,
|
||||
MessageMsgSetRecord,
|
||||
NAMESERVICE_ERRORS,
|
||||
parseMsgSetRecordResponse
|
||||
} from './messages/registry';
|
||||
import {
|
||||
createTxMsgCommitBid,
|
||||
createTxMsgRevealBid,
|
||||
MessageMsgCommitBid,
|
||||
MessageMsgRevealBid
|
||||
} from './messages/auction';
|
||||
const RPC_ENDPOINT = "http://127.0.0.1:26657"
|
||||
|
||||
export const DEFAULT_CHAIN_ID = 'laconic_9000-1';
|
||||
export const sendTokens = async (wallet: OfflineDirectSigner) => {
|
||||
const [firstAccount] = await wallet.getAccounts();
|
||||
console.log("account", firstAccount)
|
||||
|
||||
const DEFAULT_WRITE_ERROR = 'Unable to write to laconicd';
|
||||
const client = await SigningStargateClient.connectWithSigner(RPC_ENDPOINT, wallet, { prefix: 'ethm' });
|
||||
|
||||
// Parse Tx response from cosmos-sdk.
|
||||
export const parseTxResponse = (result: any, parseResponse?: (data: string) => any) => {
|
||||
const { txhash: hash, height, ...txResponse } = result;
|
||||
const senderAddress = firstAccount.address
|
||||
const recipient = "ethm1xv9tklw7d82sezh9haa573wufgy59vmwe6xxe5";
|
||||
|
||||
if (parseResponse) {
|
||||
txResponse.data = parseResponse(txResponse.data)
|
||||
}
|
||||
|
||||
txResponse.events.forEach((event:any) => {
|
||||
event.attributes = event.attributes.map(({ key, value }: { key: string, value: string }) => ({
|
||||
key: Buffer.from(key, 'base64').toString('utf8'),
|
||||
value: Buffer.from(value, 'base64').toString('utf8')
|
||||
}));
|
||||
});
|
||||
|
||||
return { hash, height, ...txResponse };
|
||||
};
|
||||
|
||||
/**
|
||||
* Create an auction bid.
|
||||
*/
|
||||
export const createBid = async (chainId: string, auctionId: string, bidderAddress: string, bidAmount: string, noise?: string) => {
|
||||
if (!noise) {
|
||||
noise = Account.generateMnemonic();
|
||||
}
|
||||
|
||||
const reveal = {
|
||||
chainId,
|
||||
auctionId,
|
||||
bidderAddress,
|
||||
bidAmount,
|
||||
noise
|
||||
const amount = {
|
||||
denom: "ethm",
|
||||
amount: "12345",
|
||||
};
|
||||
|
||||
const commitHash = await Util.getContentId(reveal);
|
||||
const revealString = Buffer.from(JSON.stringify(reveal)).toString('hex');
|
||||
|
||||
return {
|
||||
commitHash,
|
||||
reveal,
|
||||
revealString
|
||||
const sendMsg = {
|
||||
typeUrl: "/ethm.bank.v1beta1.MsgSend",
|
||||
value: {
|
||||
fromAddress: senderAddress,
|
||||
toAddress: recipient,
|
||||
amount: [amount],
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const isKeyValid = (key: string) => key && key.match(/^[0-9a-fA-F]{64}$/);
|
||||
const defaultFee = {
|
||||
amount: [],
|
||||
gas: "200000",
|
||||
};
|
||||
|
||||
export class Registry {
|
||||
_endpoints: {[key: string]: string}
|
||||
_chainID: string
|
||||
_chain: Chain
|
||||
_client: RegistryClient
|
||||
|
||||
static processWriteError(error: string) {
|
||||
// error string a stacktrace containing the message.
|
||||
// https://gist.github.com/nikugogoi/de55d390574ded3466abad8bffd81952#file-txresponse-js-L7
|
||||
const errorMessage = NAMESERVICE_ERRORS.find(message => error.includes(message))
|
||||
|
||||
if (!errorMessage) {
|
||||
console.error(error)
|
||||
}
|
||||
|
||||
const [lastErrorLine] = error.split("\n").slice(-1);
|
||||
return `${errorMessage || DEFAULT_WRITE_ERROR}: ${lastErrorLine}`;
|
||||
}
|
||||
|
||||
constructor(gqlUrl: string, restUrl: string = "", chainId: string = DEFAULT_CHAIN_ID) {
|
||||
|
||||
this._endpoints = {
|
||||
rest: restUrl,
|
||||
gql: gqlUrl
|
||||
};
|
||||
|
||||
this._client = new RegistryClient(gqlUrl, restUrl);
|
||||
this._chainID = chainId;
|
||||
|
||||
this._chain = {
|
||||
cosmosChainId: chainId,
|
||||
chainId: this._parseEthChainId(chainId)
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get accounts by addresses.
|
||||
*/
|
||||
async getAccounts(addresses: string[]) {
|
||||
return this._client.getAccounts(addresses);
|
||||
}
|
||||
|
||||
get endpoints() {
|
||||
return this._endpoints;
|
||||
}
|
||||
|
||||
get chainID() {
|
||||
return this._chainID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get server status.
|
||||
*/
|
||||
async getStatus() {
|
||||
return this._client.getStatus();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get records by ids.
|
||||
*/
|
||||
async getRecordsByIds(ids: string[], refs = false) {
|
||||
return this._client.getRecordsByIds(ids, refs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get records by attributes.
|
||||
*/
|
||||
async queryRecords(attributes: {[key: string]: any}, all = false, refs = false) {
|
||||
return this._client.queryRecords(attributes, all, refs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve names to records.
|
||||
*/
|
||||
async resolveNames(names: string[], refs = false) {
|
||||
return this._client.resolveNames(names, refs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish record.
|
||||
* @param transactionPrivateKey - private key in HEX to sign transaction.
|
||||
*/
|
||||
async setRecord(
|
||||
params: { privateKey: string, record: any, bondId: string },
|
||||
transactionPrivateKey: string,
|
||||
fee: Fee
|
||||
) {
|
||||
let result;
|
||||
result = await this._submitRecordTx(params, transactionPrivateKey, fee);
|
||||
|
||||
return parseTxResponse(result, parseMsgSetRecordResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send coins.
|
||||
*/
|
||||
async sendCoins(params: MessageSendParams, privateKey: string, fee: Fee) {
|
||||
let result;
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const sender = await this._getSender(account);
|
||||
|
||||
const msg = createMessageSend(this._chain, sender, fee, '', params)
|
||||
result = await this._submitTx(msg, privateKey, sender);
|
||||
|
||||
return parseTxResponse(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the next bondId for the given account private key.
|
||||
*/
|
||||
async getNextBondId(privateKey: string) {
|
||||
let result;
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const accounts = await this.getAccounts([account.formattedCosmosAddress]);
|
||||
if (!accounts.length) {
|
||||
throw new Error('Account does not exist.');
|
||||
}
|
||||
|
||||
const [accountObj] = accounts;
|
||||
const nextSeq = parseInt(accountObj.sequence, 10) + 1;
|
||||
result = sha256(`${accountObj.address}:${accountObj.number}:${nextSeq}`);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bonds by ids.
|
||||
*/
|
||||
async getBondsByIds(ids: string[]) {
|
||||
return this._client.getBondsByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query bonds by attributes.
|
||||
*/
|
||||
async queryBonds(attributes = {}) {
|
||||
return this._client.queryBonds(attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create bond.
|
||||
*/
|
||||
async createBond(params: MessageMsgCreateBond, privateKey: string, fee: Fee) {
|
||||
let result;
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const sender = await this._getSender(account);
|
||||
|
||||
const msg = createTxMsgCreateBond(this._chain, sender, fee, '', params)
|
||||
result = await this._submitTx(msg, privateKey, sender);
|
||||
|
||||
return parseTxResponse(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refill bond.
|
||||
*/
|
||||
async refillBond(params: MessageMsgRefillBond, privateKey: string, fee: Fee) {
|
||||
let result;
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const sender = await this._getSender(account);
|
||||
|
||||
const msg = createTxMsgRefillBond(this._chain, sender, fee, '', params)
|
||||
result = await this._submitTx(msg, privateKey, sender);
|
||||
|
||||
return parseTxResponse(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Withdraw (from) bond.
|
||||
*/
|
||||
async withdrawBond(params: MessageMsgWithdrawBond, privateKey: string, fee: Fee) {
|
||||
let result;
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const sender = await this._getSender(account);
|
||||
|
||||
const msg = createTxMsgWithdrawBond(this._chain, sender, fee, '', params)
|
||||
result = await this._submitTx(msg, privateKey, sender);
|
||||
|
||||
return parseTxResponse(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel bond.
|
||||
*/
|
||||
async cancelBond(params: MessageMsgCancelBond, privateKey: string, fee: Fee) {
|
||||
let result;
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const sender = await this._getSender(account);
|
||||
|
||||
const msg = createTxMsgCancelBond(this._chain, sender, fee, '', params)
|
||||
result = await this._submitTx(msg, privateKey, sender);
|
||||
|
||||
return parseTxResponse(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate record with bond.
|
||||
*/
|
||||
async associateBond(params: MessageMsgAssociateBond, privateKey: string, fee: Fee) {
|
||||
let result;
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const sender = await this._getSender(account);
|
||||
|
||||
const msg = createTxMsgAssociateBond(this._chain, sender, fee, '', params)
|
||||
result = await this._submitTx(msg, privateKey, sender);
|
||||
|
||||
return parseTxResponse(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dissociate record from bond.
|
||||
*/
|
||||
async dissociateBond(params: MessageMsgDissociateBond, privateKey: string, fee: Fee) {
|
||||
let result;
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const sender = await this._getSender(account);
|
||||
|
||||
const msg = createTxMsgDissociateBond(this._chain, sender, fee, '', params)
|
||||
result = await this._submitTx(msg, privateKey, sender);
|
||||
|
||||
return parseTxResponse(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dissociate all records from bond.
|
||||
*/
|
||||
async dissociateRecords(params: MessageMsgDissociateRecords, privateKey: string, fee: Fee) {
|
||||
let result;
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const sender = await this._getSender(account);
|
||||
|
||||
const msg = createTxMsgDissociateRecords(this._chain, sender, fee, '', params)
|
||||
result = await this._submitTx(msg, privateKey, sender);
|
||||
|
||||
return parseTxResponse(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reassociate records (switch bond).
|
||||
*/
|
||||
async reassociateRecords(params: MessageMsgReAssociateRecords, privateKey: string, fee: Fee) {
|
||||
let result;
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const sender = await this._getSender(account);
|
||||
|
||||
const msg = createTxMsgReAssociateRecords(this._chain, sender, fee, '', params)
|
||||
result = await this._submitTx(msg, privateKey, sender);
|
||||
|
||||
return parseTxResponse(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reserve authority.
|
||||
*/
|
||||
async reserveAuthority(params: { name: string, owner?: string }, privateKey: string, fee: Fee) {
|
||||
let result;
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const sender = await this._getSender(account);
|
||||
|
||||
const msgParams = {
|
||||
name: params.name,
|
||||
owner: params.owner || sender.accountAddress
|
||||
}
|
||||
|
||||
const msg = createTxMsgReserveAuthority(this._chain, sender, fee, '', msgParams)
|
||||
result = await this._submitTx(msg, privateKey, sender);
|
||||
|
||||
return parseTxResponse(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set authority bond.
|
||||
*/
|
||||
async setAuthorityBond(params: MessageMsgSetAuthorityBond, privateKey: string, fee: Fee) {
|
||||
let result;
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const sender = await this._getSender(account);
|
||||
|
||||
const msg = createTxMsgSetAuthorityBond(this._chain, sender, fee, '', params)
|
||||
result = await this._submitTx(msg, privateKey, sender);
|
||||
|
||||
return parseTxResponse(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Commit auction bid.
|
||||
*/
|
||||
async commitBid(params: MessageMsgCommitBid, privateKey: string, fee: Fee) {
|
||||
let result;
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const sender = await this._getSender(account);
|
||||
|
||||
const msg = createTxMsgCommitBid(this._chain, sender, fee, '', params)
|
||||
result = await this._submitTx(msg, privateKey, sender);
|
||||
|
||||
return parseTxResponse(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reveal auction bid.
|
||||
*/
|
||||
async revealBid(params: MessageMsgRevealBid, privateKey: string, fee: Fee) {
|
||||
let result;
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const sender = await this._getSender(account);
|
||||
|
||||
const msg = createTxMsgRevealBid(this._chain, sender, fee, '', params)
|
||||
result = await this._submitTx(msg, privateKey, sender);
|
||||
|
||||
return parseTxResponse(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get records by ids.
|
||||
*/
|
||||
async getAuctionsByIds(ids: string[]) {
|
||||
return this._client.getAuctionsByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup authorities by names.
|
||||
*/
|
||||
async lookupAuthorities(names: string[], auction = false) {
|
||||
return this._client.lookupAuthorities(names, auction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name (CRN) to record ID (CID).
|
||||
*/
|
||||
async setName(params: MessageMsgSetName, privateKey: string, fee: Fee) {
|
||||
let result;
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const sender = await this._getSender(account);
|
||||
|
||||
const msg = createTxMsgSetName(this._chain, sender, fee, '', params)
|
||||
result = await this._submitTx(msg, privateKey, sender);
|
||||
|
||||
return parseTxResponse(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup naming information.
|
||||
*/
|
||||
async lookupNames(names: string[], history = false) {
|
||||
return this._client.lookupNames(names, history);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete name (CRN) mapping.
|
||||
*/
|
||||
async deleteName(params: MessageMsgDeleteName, privateKey: string, fee: Fee) {
|
||||
let result;
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const sender = await this._getSender(account);
|
||||
|
||||
const msg = createTxMsgDeleteName(this._chain, sender, fee, '', params)
|
||||
result = await this._submitTx(msg, privateKey, sender);
|
||||
|
||||
return parseTxResponse(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit record transaction.
|
||||
* @param privateKey - private key in HEX to sign message.
|
||||
* @param txPrivateKey - private key in HEX to sign transaction.
|
||||
*/
|
||||
async _submitRecordTx(
|
||||
{ privateKey, record, bondId }: { privateKey: string, record: any, bondId: string },
|
||||
txPrivateKey: string,
|
||||
fee: Fee
|
||||
) {
|
||||
if (!isKeyValid(privateKey)) {
|
||||
throw new Error('Registry privateKey should be a hex string.');
|
||||
}
|
||||
|
||||
if (!isKeyValid(bondId)) {
|
||||
throw new Error(`Invalid bondId: ${bondId}.`);
|
||||
}
|
||||
|
||||
// Sign record.
|
||||
const recordSignerAccount = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const registryRecord = new Record(record);
|
||||
const payload = new Payload(registryRecord);
|
||||
await recordSignerAccount.signPayload(payload);
|
||||
|
||||
// Send record payload Tx.
|
||||
txPrivateKey = txPrivateKey || recordSignerAccount.getPrivateKey();
|
||||
return this._submitRecordPayloadTx({ payload, bondId }, txPrivateKey, fee);
|
||||
}
|
||||
|
||||
async _submitRecordPayloadTx(params: MessageMsgSetRecord, privateKey: string, fee: Fee) {
|
||||
if (!isKeyValid(privateKey)) {
|
||||
throw new Error('Registry privateKey should be a hex string.');
|
||||
}
|
||||
|
||||
if (!isKeyValid(params.bondId)) {
|
||||
throw new Error(`Invalid bondId: ${params.bondId}.`);
|
||||
}
|
||||
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
const sender = await this._getSender(account);
|
||||
|
||||
const msg = createTxMsgSetRecord(this._chain, sender, fee, '', params)
|
||||
return this._submitTx(msg, privateKey, sender);
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit a generic Tx to the chain.
|
||||
*/
|
||||
async _submitTx(message: any, privateKey: string, sender: Sender) {
|
||||
// Check private key.
|
||||
if (!isKeyValid(privateKey)) {
|
||||
throw new Error('Registry privateKey should be a hex string.');
|
||||
}
|
||||
|
||||
// Check that the account exists on-chain.
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
|
||||
// Generate signed Tx.
|
||||
const transaction = createTransaction(message, account, sender, this._chain);
|
||||
|
||||
const tx = generatePostBodyBroadcast(transaction, BroadcastMode.Block)
|
||||
|
||||
// Submit Tx to chain.
|
||||
const { tx_response: response } = await this._client.submit(tx);
|
||||
|
||||
if (response.code !== 0) {
|
||||
// Throw error when transaction is not successful.
|
||||
// https://docs.starport.com/guide/nameservice/05-play.html#buy-name-transaction-details
|
||||
throw new Error(Registry.processWriteError(response.raw_log))
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://evmos.dev/basics/chain_id.html
|
||||
*/
|
||||
_parseEthChainId (chainId: string) {
|
||||
const [ idWithChainNumber ] = chainId.split('-')
|
||||
const [ _, ethChainId ] = idWithChainNumber.split('_')
|
||||
|
||||
return Number(ethChainId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sender used for creating message.
|
||||
*/
|
||||
async _getSender (account: Account) {
|
||||
const accounts = await this.getAccounts([account.formattedCosmosAddress]);
|
||||
if (!accounts.length) {
|
||||
throw new Error('Account does not exist.');
|
||||
}
|
||||
|
||||
const [{ number, sequence }] = accounts;
|
||||
|
||||
return {
|
||||
accountAddress: account.formattedCosmosAddress,
|
||||
sequence: sequence,
|
||||
accountNumber: number,
|
||||
pubkey: account.encodedPubkey,
|
||||
}
|
||||
}
|
||||
const result = await client.signAndBroadcast(senderAddress, [sendMsg], defaultFee);
|
||||
assertIsDeliverTxSuccess(result);
|
||||
}
|
||||
|
||||
export { Account }
|
||||
|
@ -1,149 +0,0 @@
|
||||
import {
|
||||
generateTypes,
|
||||
} from '@tharsis/eip712'
|
||||
import {
|
||||
Chain,
|
||||
Sender,
|
||||
Fee,
|
||||
} from '@tharsis/transactions'
|
||||
|
||||
import * as auctionTx from '../proto/vulcanize/auction/v1beta1/tx'
|
||||
import { createTx } from './util'
|
||||
|
||||
const MSG_COMMIT_BID_TYPES = {
|
||||
MsgValue: [
|
||||
{ name: 'auction_id', type: 'string' },
|
||||
{ name: 'commit_hash', type: 'string' },
|
||||
{ name: 'signer', type: 'string' },
|
||||
]
|
||||
}
|
||||
|
||||
export interface MessageMsgCommitBid {
|
||||
auctionId: string,
|
||||
commitHash: string,
|
||||
}
|
||||
|
||||
const MSG_REVEAL_BID_TYPES = {
|
||||
MsgValue: [
|
||||
{ name: 'auction_id', type: 'string' },
|
||||
{ name: 'reveal', type: 'string' },
|
||||
{ name: 'signer', type: 'string' },
|
||||
]
|
||||
}
|
||||
|
||||
export interface MessageMsgRevealBid {
|
||||
auctionId: string,
|
||||
reveal: string,
|
||||
}
|
||||
|
||||
export function createTxMsgCommitBid(
|
||||
chain: Chain,
|
||||
sender: Sender,
|
||||
fee: Fee,
|
||||
memo: string,
|
||||
params: MessageMsgCommitBid,
|
||||
) {
|
||||
const types = generateTypes(MSG_COMMIT_BID_TYPES)
|
||||
|
||||
const msg = createMsgCommitBid(
|
||||
params.auctionId,
|
||||
params.commitHash,
|
||||
sender.accountAddress,
|
||||
)
|
||||
|
||||
const msgCosmos = protoCreateMsgCommitBid(
|
||||
params.auctionId,
|
||||
params.commitHash,
|
||||
sender.accountAddress,
|
||||
)
|
||||
|
||||
return createTx(chain, sender, fee, memo, types, msg, msgCosmos)
|
||||
}
|
||||
|
||||
export function createTxMsgRevealBid(
|
||||
chain: Chain,
|
||||
sender: Sender,
|
||||
fee: Fee,
|
||||
memo: string,
|
||||
params: MessageMsgRevealBid,
|
||||
) {
|
||||
const types = generateTypes(MSG_REVEAL_BID_TYPES)
|
||||
|
||||
const msg = createMsgRevealBid(
|
||||
params.auctionId,
|
||||
params.reveal,
|
||||
sender.accountAddress,
|
||||
)
|
||||
|
||||
const msgCosmos = protoCreateMsgRevealBid(
|
||||
params.auctionId,
|
||||
params.reveal,
|
||||
sender.accountAddress,
|
||||
)
|
||||
|
||||
return createTx(chain, sender, fee, memo, types, msg, msgCosmos)
|
||||
}
|
||||
|
||||
function createMsgCommitBid(
|
||||
auctionId: string,
|
||||
commitHash: string,
|
||||
signer: string
|
||||
) {
|
||||
return {
|
||||
type: 'auction/MsgCommitBid',
|
||||
value: {
|
||||
auction_id: auctionId,
|
||||
commit_hash: commitHash,
|
||||
signer,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const protoCreateMsgCommitBid = (
|
||||
auctionId: string,
|
||||
commitHash: string,
|
||||
signer: string
|
||||
) => {
|
||||
const commitBidMessage = new auctionTx.vulcanize.auction.v1beta1.MsgCommitBid({
|
||||
auction_id: auctionId,
|
||||
commit_hash: commitHash,
|
||||
signer,
|
||||
})
|
||||
|
||||
return {
|
||||
message: commitBidMessage,
|
||||
path: 'vulcanize.auction.v1beta1.MsgCommitBid',
|
||||
}
|
||||
}
|
||||
|
||||
function createMsgRevealBid(
|
||||
auctionId: string,
|
||||
reveal: string,
|
||||
signer: string
|
||||
) {
|
||||
return {
|
||||
type: 'auction/MsgRevealBid',
|
||||
value: {
|
||||
auction_id: auctionId,
|
||||
reveal,
|
||||
signer,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const protoCreateMsgRevealBid = (
|
||||
auctionId: string,
|
||||
reveal: string,
|
||||
signer: string
|
||||
) => {
|
||||
const revealBidMessage = new auctionTx.vulcanize.auction.v1beta1.MsgRevealBid({
|
||||
auction_id: auctionId,
|
||||
reveal,
|
||||
signer,
|
||||
})
|
||||
|
||||
return {
|
||||
message: revealBidMessage,
|
||||
path: 'vulcanize.auction.v1beta1.MsgRevealBid',
|
||||
}
|
||||
}
|
@ -1,590 +0,0 @@
|
||||
import {
|
||||
generateTypes,
|
||||
} from '@tharsis/eip712'
|
||||
import {
|
||||
Chain,
|
||||
Sender,
|
||||
Fee,
|
||||
} from '@tharsis/transactions'
|
||||
|
||||
import * as bondTx from '../proto/vulcanize/bond/v1beta1/tx'
|
||||
import * as registryTx from '../proto/vulcanize/registry/v1beta1/tx'
|
||||
import * as coin from '../proto/cosmos/base/v1beta1/coin'
|
||||
import { createTx } from './util'
|
||||
|
||||
const MSG_CREATE_BOND_TYPES = {
|
||||
MsgValue: [
|
||||
{ name: 'signer', type: 'string' },
|
||||
{ name: 'coins', type: 'TypeCoins[]' },
|
||||
],
|
||||
TypeCoins: [
|
||||
{ name: 'denom', type: 'string' },
|
||||
{ name: 'amount', type: 'string' },
|
||||
],
|
||||
}
|
||||
|
||||
const MSG_REFILL_BOND_TYPES = {
|
||||
MsgValue: [
|
||||
{ name: 'id', type: 'string' },
|
||||
{ name: 'signer', type: 'string' },
|
||||
{ name: 'coins', type: 'TypeCoins[]' },
|
||||
],
|
||||
TypeCoins: [
|
||||
{ name: 'denom', type: 'string' },
|
||||
{ name: 'amount', type: 'string' },
|
||||
],
|
||||
}
|
||||
|
||||
const MSG_WITHDRAW_BOND_TYPES = {
|
||||
MsgValue: [
|
||||
{ name: 'id', type: 'string' },
|
||||
{ name: 'signer', type: 'string' },
|
||||
{ name: 'coins', type: 'TypeCoins[]' },
|
||||
],
|
||||
TypeCoins: [
|
||||
{ name: 'denom', type: 'string' },
|
||||
{ name: 'amount', type: 'string' },
|
||||
],
|
||||
}
|
||||
|
||||
const MSG_CANCEL_BOND_TYPES = {
|
||||
MsgValue: [
|
||||
{ name: 'id', type: 'string' },
|
||||
{ name: 'signer', type: 'string' },
|
||||
]
|
||||
}
|
||||
|
||||
const MSG_ASSOCIATE_BOND_TYPES = {
|
||||
MsgValue: [
|
||||
{ name: 'record_id', type: 'string' },
|
||||
{ name: 'bond_id', type: 'string' },
|
||||
{ name: 'signer', type: 'string' },
|
||||
]
|
||||
}
|
||||
|
||||
const MSG_DISSOCIATE_BOND_TYPES = {
|
||||
MsgValue: [
|
||||
{ name: 'record_id', type: 'string' },
|
||||
{ name: 'signer', type: 'string' },
|
||||
]
|
||||
}
|
||||
|
||||
const MSG_DISSOCIATE_RECORDS_TYPES = {
|
||||
MsgValue: [
|
||||
{ name: 'bond_id', type: 'string' },
|
||||
{ name: 'signer', type: 'string' },
|
||||
]
|
||||
}
|
||||
|
||||
const MSG_REASSOCIATE_RECORDS_TYPES = {
|
||||
MsgValue: [
|
||||
{ name: 'new_bond_id', type: 'string' },
|
||||
{ name: 'old_bond_id', type: 'string' },
|
||||
{ name: 'signer', type: 'string' },
|
||||
]
|
||||
}
|
||||
|
||||
export interface MessageMsgCreateBond {
|
||||
amount: string
|
||||
denom: string
|
||||
}
|
||||
|
||||
export interface MessageMsgRefillBond {
|
||||
id: string,
|
||||
amount: string
|
||||
denom: string
|
||||
}
|
||||
|
||||
export interface MessageMsgWithdrawBond {
|
||||
id: string
|
||||
amount: string
|
||||
denom: string
|
||||
}
|
||||
|
||||
export interface MessageMsgCancelBond {
|
||||
id: string
|
||||
}
|
||||
|
||||
export interface MessageMsgAssociateBond {
|
||||
bondId: string,
|
||||
recordId: string
|
||||
}
|
||||
|
||||
export interface MessageMsgDissociateBond {
|
||||
recordId: string
|
||||
}
|
||||
|
||||
export interface MessageMsgDissociateRecords {
|
||||
bondId: string
|
||||
}
|
||||
|
||||
export interface MessageMsgReAssociateRecords {
|
||||
newBondId: string
|
||||
oldBondId: string
|
||||
}
|
||||
|
||||
export function createTxMsgCreateBond(
|
||||
chain: Chain,
|
||||
sender: Sender,
|
||||
fee: Fee,
|
||||
memo: string,
|
||||
params: MessageMsgCreateBond,
|
||||
) {
|
||||
const types = generateTypes(MSG_CREATE_BOND_TYPES)
|
||||
|
||||
const msg = createMsgCreateBond(
|
||||
sender.accountAddress,
|
||||
params.amount,
|
||||
params.denom
|
||||
)
|
||||
|
||||
const msgCosmos = protoCreateMsgCreateBond(
|
||||
sender.accountAddress,
|
||||
params.amount,
|
||||
params.denom
|
||||
)
|
||||
|
||||
return createTx(chain, sender, fee, memo, types, msg, msgCosmos)
|
||||
}
|
||||
|
||||
export function createTxMsgRefillBond(
|
||||
chain: Chain,
|
||||
sender: Sender,
|
||||
fee: Fee,
|
||||
memo: string,
|
||||
params: MessageMsgRefillBond,
|
||||
) {
|
||||
const types = generateTypes(MSG_REFILL_BOND_TYPES)
|
||||
|
||||
const msg = createMsgRefillBond(
|
||||
params.id,
|
||||
sender.accountAddress,
|
||||
params.amount,
|
||||
params.denom
|
||||
)
|
||||
|
||||
const msgCosmos = protoCreateMsgRefillBond(
|
||||
params.id,
|
||||
sender.accountAddress,
|
||||
params.amount,
|
||||
params.denom
|
||||
)
|
||||
|
||||
return createTx(chain, sender, fee, memo, types, msg, msgCosmos)
|
||||
}
|
||||
|
||||
export function createTxMsgWithdrawBond(
|
||||
chain: Chain,
|
||||
sender: Sender,
|
||||
fee: Fee,
|
||||
memo: string,
|
||||
params: MessageMsgWithdrawBond,
|
||||
) {
|
||||
const types = generateTypes(MSG_WITHDRAW_BOND_TYPES)
|
||||
|
||||
const msg = createMsgWithdrawBond(
|
||||
params.id,
|
||||
sender.accountAddress,
|
||||
params.amount,
|
||||
params.denom
|
||||
)
|
||||
|
||||
const msgCosmos = protoCreateMsgWithdrawBond(
|
||||
params.id,
|
||||
sender.accountAddress,
|
||||
params.amount,
|
||||
params.denom
|
||||
)
|
||||
|
||||
return createTx(chain, sender, fee, memo, types, msg, msgCosmos)
|
||||
}
|
||||
|
||||
export function createTxMsgCancelBond(
|
||||
chain: Chain,
|
||||
sender: Sender,
|
||||
fee: Fee,
|
||||
memo: string,
|
||||
params: MessageMsgCancelBond,
|
||||
) {
|
||||
const types = generateTypes(MSG_CANCEL_BOND_TYPES)
|
||||
|
||||
const msg = createMsgCancelBond(
|
||||
params.id,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
const msgCosmos = protoCreateMsgCancelBond(
|
||||
params.id,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
return createTx(chain, sender, fee, memo, types, msg, msgCosmos)
|
||||
}
|
||||
|
||||
export function createTxMsgAssociateBond(
|
||||
chain: Chain,
|
||||
sender: Sender,
|
||||
fee: Fee,
|
||||
memo: string,
|
||||
params: MessageMsgAssociateBond,
|
||||
) {
|
||||
const types = generateTypes(MSG_ASSOCIATE_BOND_TYPES)
|
||||
|
||||
const msg = createMsgAssociateBond(
|
||||
params.recordId,
|
||||
params.bondId,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
const msgCosmos = protoCreateMsgAssociateBond(
|
||||
params.recordId,
|
||||
params.bondId,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
return createTx(chain, sender, fee, memo, types, msg, msgCosmos)
|
||||
}
|
||||
|
||||
export function createTxMsgDissociateBond(
|
||||
chain: Chain,
|
||||
sender: Sender,
|
||||
fee: Fee,
|
||||
memo: string,
|
||||
params: MessageMsgDissociateBond,
|
||||
) {
|
||||
const types = generateTypes(MSG_DISSOCIATE_BOND_TYPES)
|
||||
|
||||
const msg = createMsgDissociateBond(
|
||||
params.recordId,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
const msgCosmos = protoCreateMsgDissociateBond(
|
||||
params.recordId,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
return createTx(chain, sender, fee, memo, types, msg, msgCosmos)
|
||||
}
|
||||
|
||||
export function createTxMsgDissociateRecords(
|
||||
chain: Chain,
|
||||
sender: Sender,
|
||||
fee: Fee,
|
||||
memo: string,
|
||||
params: MessageMsgDissociateRecords,
|
||||
) {
|
||||
const types = generateTypes(MSG_DISSOCIATE_RECORDS_TYPES)
|
||||
|
||||
const msg = createMsgDissociateRecords(
|
||||
params.bondId,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
const msgCosmos = protoCreateMsgDissociateRecords(
|
||||
params.bondId,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
return createTx(chain, sender, fee, memo, types, msg, msgCosmos)
|
||||
}
|
||||
|
||||
export function createTxMsgReAssociateRecords(
|
||||
chain: Chain,
|
||||
sender: Sender,
|
||||
fee: Fee,
|
||||
memo: string,
|
||||
params: MessageMsgReAssociateRecords,
|
||||
) {
|
||||
const types = generateTypes(MSG_REASSOCIATE_RECORDS_TYPES)
|
||||
|
||||
const msg = createMsgReAssociateRecords(
|
||||
params.newBondId,
|
||||
params.oldBondId,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
const msgCosmos = protoCreateMsgReAssociateRecords(
|
||||
params.newBondId,
|
||||
params.oldBondId,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
return createTx(chain, sender, fee, memo, types, msg, msgCosmos)
|
||||
}
|
||||
|
||||
function createMsgCreateBond(
|
||||
signer: string,
|
||||
amount: string,
|
||||
denom: string,
|
||||
) {
|
||||
return {
|
||||
type: 'bond/MsgCreateBond',
|
||||
value: {
|
||||
coins: [
|
||||
{
|
||||
amount,
|
||||
denom,
|
||||
},
|
||||
],
|
||||
signer
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const protoCreateMsgCreateBond = (
|
||||
signer: string,
|
||||
amount: string,
|
||||
denom: string,
|
||||
) => {
|
||||
const value = new coin.cosmos.base.v1beta1.Coin({
|
||||
denom,
|
||||
amount,
|
||||
})
|
||||
|
||||
const createBondMessage = new bondTx.vulcanize.bond.v1beta1.MsgCreateBond({
|
||||
signer,
|
||||
coins: [value]
|
||||
})
|
||||
|
||||
return {
|
||||
message: createBondMessage,
|
||||
path: 'vulcanize.bond.v1beta1.MsgCreateBond',
|
||||
}
|
||||
}
|
||||
|
||||
function createMsgRefillBond(
|
||||
id: string,
|
||||
signer: string,
|
||||
amount: string,
|
||||
denom: string,
|
||||
) {
|
||||
return {
|
||||
type: 'bond/MsgRefillBond',
|
||||
value: {
|
||||
coins: [
|
||||
{
|
||||
amount,
|
||||
denom,
|
||||
},
|
||||
],
|
||||
id,
|
||||
signer
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const protoCreateMsgRefillBond = (
|
||||
id: string,
|
||||
signer: string,
|
||||
amount: string,
|
||||
denom: string,
|
||||
) => {
|
||||
const value = new coin.cosmos.base.v1beta1.Coin({
|
||||
denom,
|
||||
amount,
|
||||
})
|
||||
|
||||
const refillBondMessage = new bondTx.vulcanize.bond.v1beta1.MsgRefillBond({
|
||||
id,
|
||||
signer,
|
||||
coins: [value]
|
||||
})
|
||||
|
||||
return {
|
||||
message: refillBondMessage,
|
||||
path: 'vulcanize.bond.v1beta1.MsgRefillBond',
|
||||
}
|
||||
}
|
||||
|
||||
function createMsgWithdrawBond(
|
||||
id: string,
|
||||
signer: string,
|
||||
amount: string,
|
||||
denom: string,
|
||||
) {
|
||||
return {
|
||||
type: 'bond/MsgWithdrawBond',
|
||||
value: {
|
||||
id,
|
||||
coins: [
|
||||
{
|
||||
amount,
|
||||
denom,
|
||||
},
|
||||
],
|
||||
signer
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const protoCreateMsgWithdrawBond = (
|
||||
id: string,
|
||||
signer: string,
|
||||
amount: string,
|
||||
denom: string,
|
||||
) => {
|
||||
const value = new coin.cosmos.base.v1beta1.Coin({
|
||||
denom,
|
||||
amount,
|
||||
})
|
||||
|
||||
const withdrawBondMessage = new bondTx.vulcanize.bond.v1beta1.MsgWithdrawBond({
|
||||
id,
|
||||
signer,
|
||||
coins: [value]
|
||||
})
|
||||
|
||||
return {
|
||||
message: withdrawBondMessage,
|
||||
path: 'vulcanize.bond.v1beta1.MsgWithdrawBond',
|
||||
}
|
||||
}
|
||||
|
||||
function createMsgCancelBond(
|
||||
id: string,
|
||||
signer: string
|
||||
) {
|
||||
return {
|
||||
type: 'bond/MsgCancelBond',
|
||||
value: {
|
||||
id,
|
||||
signer
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const protoCreateMsgCancelBond = (
|
||||
id: string,
|
||||
signer: string
|
||||
) => {
|
||||
const cancelBondMessage = new bondTx.vulcanize.bond.v1beta1.MsgCancelBond({
|
||||
id,
|
||||
signer
|
||||
})
|
||||
|
||||
return {
|
||||
message: cancelBondMessage,
|
||||
path: 'vulcanize.bond.v1beta1.MsgCancelBond',
|
||||
}
|
||||
}
|
||||
|
||||
function createMsgAssociateBond(
|
||||
recordId: string,
|
||||
bondId: string,
|
||||
signer: string
|
||||
) {
|
||||
return {
|
||||
type: 'registry/AssociateBond',
|
||||
value: {
|
||||
record_id: recordId,
|
||||
bond_id: bondId,
|
||||
signer
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const protoCreateMsgAssociateBond = (
|
||||
recordId: string,
|
||||
bondId: string,
|
||||
signer: string
|
||||
) => {
|
||||
const associateBondMessage = new registryTx.vulcanize.registry.v1beta1.MsgAssociateBond({
|
||||
record_id: recordId,
|
||||
bond_id: bondId,
|
||||
signer
|
||||
})
|
||||
|
||||
return {
|
||||
message: associateBondMessage,
|
||||
path: 'vulcanize.registry.v1beta1.MsgAssociateBond',
|
||||
}
|
||||
}
|
||||
|
||||
function createMsgDissociateBond(
|
||||
recordId: string,
|
||||
signer: string
|
||||
) {
|
||||
return {
|
||||
type: 'registry/DissociateBond',
|
||||
value: {
|
||||
record_id: recordId,
|
||||
signer
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const protoCreateMsgDissociateBond = (
|
||||
recordId: string,
|
||||
signer: string
|
||||
) => {
|
||||
const dissociateBondMessage = new registryTx.vulcanize.registry.v1beta1.MsgDissociateBond({
|
||||
record_id: recordId,
|
||||
signer
|
||||
})
|
||||
|
||||
return {
|
||||
message: dissociateBondMessage,
|
||||
path: 'vulcanize.registry.v1beta1.MsgDissociateBond',
|
||||
}
|
||||
}
|
||||
|
||||
function createMsgDissociateRecords(
|
||||
bondId: string,
|
||||
signer: string
|
||||
) {
|
||||
return {
|
||||
type: 'registry/DissociateRecords',
|
||||
value: {
|
||||
bond_id: bondId,
|
||||
signer
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const protoCreateMsgDissociateRecords = (
|
||||
bondId: string,
|
||||
signer: string
|
||||
) => {
|
||||
const dissociateRecordsMessage = new registryTx.vulcanize.registry.v1beta1.MsgDissociateRecords({
|
||||
bond_id: bondId,
|
||||
signer
|
||||
})
|
||||
|
||||
return {
|
||||
message: dissociateRecordsMessage,
|
||||
path: 'vulcanize.registry.v1beta1.MsgDissociateRecords',
|
||||
}
|
||||
}
|
||||
|
||||
function createMsgReAssociateRecords(
|
||||
newBondId: string,
|
||||
oldBondId: string,
|
||||
signer: string
|
||||
) {
|
||||
return {
|
||||
type: 'registry/ReassociateRecords',
|
||||
value: {
|
||||
new_bond_id: newBondId,
|
||||
old_bond_id: oldBondId,
|
||||
signer
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const protoCreateMsgReAssociateRecords = (
|
||||
newBondId: string,
|
||||
oldBondId: string,
|
||||
signer: string
|
||||
) => {
|
||||
const reAssociateRecordsMessage = new registryTx.vulcanize.registry.v1beta1.MsgReAssociateRecords({
|
||||
new_bond_id: newBondId,
|
||||
old_bond_id: oldBondId,
|
||||
signer
|
||||
})
|
||||
|
||||
return {
|
||||
message: reAssociateRecordsMessage,
|
||||
path: 'vulcanize.registry.v1beta1.MsgReAssociateRecords',
|
||||
}
|
||||
}
|
@ -1,399 +0,0 @@
|
||||
import {
|
||||
generateTypes,
|
||||
} from '@tharsis/eip712'
|
||||
import {
|
||||
Chain,
|
||||
Sender,
|
||||
Fee,
|
||||
} from '@tharsis/transactions'
|
||||
|
||||
import * as registryTx from '../proto/vulcanize/registry/v1beta1/tx'
|
||||
import * as registry from '../proto/vulcanize/registry/v1beta1/registry'
|
||||
import { createTx } from './util'
|
||||
import { Payload } from '../types'
|
||||
|
||||
const MSG_RESERVE_AUTHORITY_TYPES = {
|
||||
MsgValue: [
|
||||
{ name: 'name', type: 'string' },
|
||||
{ name: 'signer', type: 'string' },
|
||||
{ name: 'owner', type: 'string' },
|
||||
],
|
||||
}
|
||||
|
||||
const MSG_SET_NAME_TYPES = {
|
||||
MsgValue: [
|
||||
{ name: 'crn', type: 'string' },
|
||||
{ name: 'cid', type: 'string' },
|
||||
{ name: 'signer', type: 'string' },
|
||||
],
|
||||
}
|
||||
|
||||
const MSG_SET_RECORD_TYPES = {
|
||||
MsgValue: [
|
||||
{ name: 'bond_id', type: 'string' },
|
||||
{ name: 'signer', type: 'string' },
|
||||
{ name: 'payload', type: 'TypePayload' },
|
||||
],
|
||||
TypePayload: [
|
||||
{ name: 'record', type: 'TypePayloadRecord' },
|
||||
{ name: 'signatures', type: 'TypePayloadSignatures[]' },
|
||||
],
|
||||
TypePayloadRecord: [
|
||||
{ name: 'id', type: 'string' },
|
||||
{ name: 'bond_id', type: 'string' },
|
||||
{ name: 'create_time', type: 'string' },
|
||||
{ name: 'expiry_time', type: 'string' },
|
||||
{ name: 'deleted', type: 'bool' },
|
||||
{ name: 'attributes', type: 'bytes' },
|
||||
],
|
||||
TypePayloadSignatures: [
|
||||
{ name: 'sig', type: 'string' },
|
||||
{ name: 'pub_key', type: 'string' }
|
||||
],
|
||||
}
|
||||
|
||||
const MSG_SET_AUTHORITY_BOND_TYPES = {
|
||||
MsgValue: [
|
||||
{ name: 'name', type: 'string' },
|
||||
{ name: 'bond_id', type: 'string' },
|
||||
{ name: 'signer', type: 'string' },
|
||||
],
|
||||
}
|
||||
|
||||
const MSG_DELETE_NAME_TYPES = {
|
||||
MsgValue: [
|
||||
{ name: 'crn', type: 'string' },
|
||||
{ name: 'signer', type: 'string' },
|
||||
],
|
||||
}
|
||||
|
||||
export const parseMsgSetRecordResponse = (data: string) => {
|
||||
const responseBytes = Buffer.from(data, 'hex')
|
||||
|
||||
// TODO: Decode response using protobuf.
|
||||
// const msgSetRecordResponse = nameserviceTx.vulcanize.nameservice.v1beta1.MsgSetRecordResponse.deserialize(responseBytes);
|
||||
// return msgSetRecordResponse.toObject();
|
||||
|
||||
// Workaround as proto based decoding is not working.
|
||||
const [_, id] = responseBytes.toString().split(';')
|
||||
|
||||
return { id }
|
||||
}
|
||||
|
||||
export const NAMESERVICE_ERRORS = [
|
||||
'Name already reserved',
|
||||
'Authority bond not found',
|
||||
'Name authority not found',
|
||||
'Access denied',
|
||||
]
|
||||
|
||||
export interface MessageMsgReserveAuthority {
|
||||
name: string
|
||||
owner: string
|
||||
}
|
||||
|
||||
export interface MessageMsgSetName {
|
||||
crn: string
|
||||
cid: string
|
||||
}
|
||||
|
||||
export interface MessageMsgSetRecord {
|
||||
bondId: string
|
||||
payload: Payload
|
||||
}
|
||||
|
||||
export interface MessageMsgSetAuthorityBond {
|
||||
name: string
|
||||
bondId: string
|
||||
}
|
||||
|
||||
export interface MessageMsgDeleteName {
|
||||
crn: string
|
||||
}
|
||||
|
||||
export function createTxMsgReserveAuthority(
|
||||
chain: Chain,
|
||||
sender: Sender,
|
||||
fee: Fee,
|
||||
memo: string,
|
||||
params: MessageMsgReserveAuthority,
|
||||
) {
|
||||
const types = generateTypes(MSG_RESERVE_AUTHORITY_TYPES)
|
||||
|
||||
const msg = createMsgReserveAuthority(
|
||||
params.name,
|
||||
sender.accountAddress,
|
||||
params.owner
|
||||
)
|
||||
|
||||
const msgCosmos = protoCreateMsgReserveAuthority(
|
||||
params.name,
|
||||
sender.accountAddress,
|
||||
params.owner
|
||||
)
|
||||
|
||||
return createTx(chain, sender, fee, memo, types, msg, msgCosmos)
|
||||
}
|
||||
|
||||
export function createTxMsgSetName(
|
||||
chain: Chain,
|
||||
sender: Sender,
|
||||
fee: Fee,
|
||||
memo: string,
|
||||
params: MessageMsgSetName,
|
||||
) {
|
||||
const types = generateTypes(MSG_SET_NAME_TYPES)
|
||||
|
||||
const msg = createMsgSetName(
|
||||
params.crn,
|
||||
params.cid,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
const msgCosmos = protoCreateMsgSetName(
|
||||
params.crn,
|
||||
params.cid,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
return createTx(chain, sender, fee, memo, types, msg, msgCosmos)
|
||||
}
|
||||
|
||||
export function createTxMsgSetRecord(
|
||||
chain: Chain,
|
||||
sender: Sender,
|
||||
fee: Fee,
|
||||
memo: string,
|
||||
params: MessageMsgSetRecord,
|
||||
) {
|
||||
const types = generateTypes(MSG_SET_RECORD_TYPES)
|
||||
|
||||
const msg = createMsgSetRecord(
|
||||
params.bondId,
|
||||
params.payload,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
const msgCosmos = protoCreateMsgSetRecord(
|
||||
params.bondId,
|
||||
params.payload,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
return createTx(chain, sender, fee, memo, types, msg, msgCosmos)
|
||||
}
|
||||
|
||||
export function createTxMsgSetAuthorityBond(
|
||||
chain: Chain,
|
||||
sender: Sender,
|
||||
fee: Fee,
|
||||
memo: string,
|
||||
params: MessageMsgSetAuthorityBond,
|
||||
) {
|
||||
const types = generateTypes(MSG_SET_AUTHORITY_BOND_TYPES)
|
||||
|
||||
const msg = createMsgSetAuthorityBond(
|
||||
params.name,
|
||||
params.bondId,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
const msgCosmos = protoCreateMsgSetAuthorityBond(
|
||||
params.name,
|
||||
params.bondId,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
return createTx(chain, sender, fee, memo, types, msg, msgCosmos)
|
||||
}
|
||||
|
||||
export function createTxMsgDeleteName(
|
||||
chain: Chain,
|
||||
sender: Sender,
|
||||
fee: Fee,
|
||||
memo: string,
|
||||
params: MessageMsgDeleteName,
|
||||
) {
|
||||
const types = generateTypes(MSG_DELETE_NAME_TYPES)
|
||||
|
||||
const msg = createMsgDeleteName(
|
||||
params.crn,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
const msgCosmos = protoCreateMsgDeleteName(
|
||||
params.crn,
|
||||
sender.accountAddress
|
||||
)
|
||||
|
||||
return createTx(chain, sender, fee, memo, types, msg, msgCosmos)
|
||||
}
|
||||
|
||||
function createMsgReserveAuthority(
|
||||
name: string,
|
||||
signer: string,
|
||||
owner: string
|
||||
) {
|
||||
return {
|
||||
type: 'registry/ReserveAuthority',
|
||||
value: {
|
||||
name,
|
||||
signer,
|
||||
owner
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const protoCreateMsgReserveAuthority = (
|
||||
name: string,
|
||||
signer: string,
|
||||
owner: string,
|
||||
) => {
|
||||
const reserveAuthorityMessage = new registryTx.vulcanize.registry.v1beta1.MsgReserveAuthority({
|
||||
name,
|
||||
signer,
|
||||
owner
|
||||
})
|
||||
|
||||
return {
|
||||
message: reserveAuthorityMessage,
|
||||
path: 'vulcanize.registry.v1beta1.MsgReserveAuthority',
|
||||
}
|
||||
}
|
||||
|
||||
function createMsgSetName(
|
||||
crn: string,
|
||||
cid: string,
|
||||
signer: string
|
||||
) {
|
||||
return {
|
||||
type: 'registry/SetName',
|
||||
value: {
|
||||
crn,
|
||||
cid,
|
||||
signer
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const protoCreateMsgSetName = (
|
||||
crn: string,
|
||||
cid: string,
|
||||
signer: string
|
||||
) => {
|
||||
const setNameMessage = new registryTx.vulcanize.registry.v1beta1.MsgSetName({
|
||||
crn,
|
||||
cid,
|
||||
signer,
|
||||
})
|
||||
|
||||
return {
|
||||
message: setNameMessage,
|
||||
path: 'vulcanize.registry.v1beta1.MsgSetName',
|
||||
}
|
||||
}
|
||||
|
||||
function createMsgSetRecord(
|
||||
bondId: string,
|
||||
payload: Payload,
|
||||
signer: string
|
||||
) {
|
||||
return {
|
||||
type: 'registry/SetRecord',
|
||||
value: {
|
||||
bond_id: bondId,
|
||||
signer,
|
||||
payload: payload.serialize()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const protoCreateMsgSetRecord = (
|
||||
bondId: string,
|
||||
payloadData: Payload,
|
||||
signer: string
|
||||
) => {
|
||||
const record = new registry.vulcanize.registry.v1beta1.Record(payloadData.record.serialize())
|
||||
|
||||
const signatures = payloadData.signatures.map(
|
||||
signature => new registry.vulcanize.registry.v1beta1.Signature(
|
||||
signature.serialize()
|
||||
)
|
||||
)
|
||||
|
||||
const payload = new registryTx.vulcanize.registry.v1beta1.Payload({
|
||||
record,
|
||||
signatures
|
||||
})
|
||||
|
||||
const setNameMessage = new registryTx.vulcanize.registry.v1beta1.MsgSetRecord({
|
||||
bond_id: bondId,
|
||||
signer,
|
||||
payload
|
||||
})
|
||||
|
||||
return {
|
||||
message: setNameMessage,
|
||||
path: 'vulcanize.registry.v1beta1.MsgSetRecord',
|
||||
}
|
||||
}
|
||||
|
||||
function createMsgSetAuthorityBond(
|
||||
name: string,
|
||||
bondId: string,
|
||||
signer: string
|
||||
) {
|
||||
return {
|
||||
type: 'registry/SetAuthorityBond',
|
||||
value: {
|
||||
name,
|
||||
bond_id: bondId,
|
||||
signer
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const protoCreateMsgSetAuthorityBond = (
|
||||
name: string,
|
||||
bondId: string,
|
||||
signer: string
|
||||
) => {
|
||||
const setAuthorityBondMessage = new registryTx.vulcanize.registry.v1beta1.MsgSetAuthorityBond({
|
||||
name,
|
||||
bond_id: bondId,
|
||||
signer,
|
||||
})
|
||||
|
||||
return {
|
||||
message: setAuthorityBondMessage,
|
||||
path: 'vulcanize.registry.v1beta1.MsgSetAuthorityBond',
|
||||
}
|
||||
}
|
||||
|
||||
function createMsgDeleteName(
|
||||
crn: string,
|
||||
signer: string
|
||||
) {
|
||||
return {
|
||||
type: 'registry/DeleteAuthority',
|
||||
value: {
|
||||
crn,
|
||||
signer
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const protoCreateMsgDeleteName = (
|
||||
crn: string,
|
||||
signer: string
|
||||
) => {
|
||||
const deleteNameAutorityMessage = new registryTx.vulcanize.registry.v1beta1.MsgDeleteNameAuthority({
|
||||
crn,
|
||||
signer,
|
||||
})
|
||||
|
||||
return {
|
||||
message: deleteNameAutorityMessage,
|
||||
path: 'vulcanize.registry.v1beta1.MsgDeleteNameAuthority',
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
import { Message } from "google-protobuf";
|
||||
import {
|
||||
createEIP712,
|
||||
generateFee,
|
||||
generateMessage,
|
||||
generateTypes,
|
||||
} from '@tharsis/eip712'
|
||||
import {
|
||||
Chain,
|
||||
Sender,
|
||||
Fee,
|
||||
} from '@tharsis/transactions'
|
||||
import { createTransaction } from '@tharsis/proto'
|
||||
|
||||
interface Msg {
|
||||
type: string
|
||||
value: any
|
||||
}
|
||||
|
||||
interface MsgCosmos {
|
||||
message: Message
|
||||
path: string
|
||||
}
|
||||
|
||||
interface Types {
|
||||
[key: string]: Array<{
|
||||
name: string
|
||||
type: string
|
||||
}>
|
||||
}
|
||||
|
||||
export const createTx = (
|
||||
chain: Chain,
|
||||
sender: Sender,
|
||||
fee: Fee,
|
||||
memo: string,
|
||||
messageTypes: Types,
|
||||
msg: Msg,
|
||||
msgCosmos: MsgCosmos,
|
||||
) => {
|
||||
// EIP712
|
||||
const feeObject = generateFee(
|
||||
fee.amount,
|
||||
fee.denom,
|
||||
fee.gas,
|
||||
sender.accountAddress,
|
||||
)
|
||||
const types = generateTypes(messageTypes)
|
||||
|
||||
const messages = generateMessage(
|
||||
sender.accountNumber.toString(),
|
||||
sender.sequence.toString(),
|
||||
chain.cosmosChainId,
|
||||
memo,
|
||||
feeObject,
|
||||
msg,
|
||||
)
|
||||
const eipToSign = createEIP712(types, chain.chainId, messages)
|
||||
|
||||
// Cosmos
|
||||
const tx = createTransaction(
|
||||
msgCosmos,
|
||||
memo,
|
||||
fee.amount,
|
||||
fee.denom,
|
||||
parseInt(fee.gas, 10),
|
||||
'ethsecp256',
|
||||
sender.pubkey,
|
||||
sender.sequence,
|
||||
sender.accountNumber,
|
||||
chain.cosmosChainId,
|
||||
)
|
||||
|
||||
return {
|
||||
signDirect: tx.signDirect,
|
||||
legacyAmino: tx.legacyAmino,
|
||||
eipToSign,
|
||||
}
|
||||
}
|
@ -1,117 +0,0 @@
|
||||
import path from 'path';
|
||||
|
||||
import { Registry } from './index';
|
||||
import { ensureUpdatedConfig, getConfig } from './testing/helper';
|
||||
|
||||
const WATCHER_YML_PATH = path.join(__dirname, './testing/data/watcher.yml');
|
||||
|
||||
jest.setTimeout(120 * 1000);
|
||||
|
||||
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
|
||||
|
||||
const nameserviceExpiryTests = () => {
|
||||
let registry: Registry;
|
||||
|
||||
let bondId: string;
|
||||
let watcher: any;
|
||||
|
||||
let authorityName: string;
|
||||
let authorityExpiryTime: Date;
|
||||
let recordExpiryTime: Date;
|
||||
|
||||
beforeAll(async () => {
|
||||
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
|
||||
// Create bond.
|
||||
bondId = await registry.getNextBondId(privateKey);
|
||||
await registry.createBond({ denom: 'aphoton', amount: '3000000' }, privateKey, fee);
|
||||
});
|
||||
|
||||
test('Set record and check bond balance', async () => {
|
||||
// Create watcher.
|
||||
watcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
|
||||
const result = await registry.setRecord(
|
||||
{
|
||||
privateKey,
|
||||
bondId,
|
||||
record: watcher.record
|
||||
},
|
||||
privateKey,
|
||||
fee
|
||||
)
|
||||
console.log("SetRecordResult: " + result.data.id)
|
||||
const [record] = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version }, true);
|
||||
recordExpiryTime = new Date(record.expiryTime);
|
||||
|
||||
const [bond] = await registry.getBondsByIds([bondId]);
|
||||
expect(bond).toBeDefined();
|
||||
expect(bond.balance).toHaveLength(1);
|
||||
expect(bond.balance[0].quantity).toBe('2000000');
|
||||
})
|
||||
|
||||
test('Reserve authority and set bond', async () => {
|
||||
authorityName = `laconic-${Date.now()}`;
|
||||
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
||||
await registry.setAuthorityBond({ name: authorityName, bondId }, privateKey, fee);
|
||||
const [authority] = await registry.lookupAuthorities([authorityName]);
|
||||
expect(authority.status).toBe('active');
|
||||
authorityExpiryTime = new Date(authority.expiryTime);
|
||||
});
|
||||
|
||||
test('Wait for expiry duration', (done) => {
|
||||
setTimeout(done, 60 * 1000);
|
||||
});
|
||||
|
||||
test('Check record expiry time', async() => {
|
||||
const [record] = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version }, true);
|
||||
const updatedExpiryTime = new Date();
|
||||
expect(updatedExpiryTime.getTime()).toBeGreaterThan(recordExpiryTime.getTime());
|
||||
recordExpiryTime = updatedExpiryTime;
|
||||
})
|
||||
|
||||
test('Check authority expiry time', async() => {
|
||||
const [authority] = await registry.lookupAuthorities([authorityName]);
|
||||
const updatedExpiryTime = new Date();
|
||||
expect(updatedExpiryTime.getTime()).toBeGreaterThan(authorityExpiryTime.getTime());
|
||||
authorityExpiryTime = updatedExpiryTime;
|
||||
})
|
||||
|
||||
test('Check bond balance', async () => {
|
||||
const [bond] = await registry.getBondsByIds([bondId]);
|
||||
console.log(bond)
|
||||
expect(bond).toBeDefined();
|
||||
expect(bond.balance).toHaveLength(0);
|
||||
})
|
||||
|
||||
test('Wait for expiry duration', (done) => {
|
||||
setTimeout(done, 60 * 1000);
|
||||
});
|
||||
|
||||
test('Check record deleted without bond balance', async() => {
|
||||
const records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version }, true);
|
||||
expect(records).toHaveLength(0);
|
||||
})
|
||||
|
||||
test('Check authority expired without bond balance', async() => {
|
||||
const [authority] = await registry.lookupAuthorities([authorityName]);
|
||||
expect(authority.status).toBe('expired');
|
||||
})
|
||||
}
|
||||
|
||||
if (!process.env.TEST_NAMESERVICE_EXPIRY) {
|
||||
// Required as jest complains if file has no tests.
|
||||
test('skipping nameservice expiry tests', () => {});
|
||||
} else {
|
||||
/**
|
||||
Running these tests requires timers to be set. In laconicd repo run:
|
||||
|
||||
TEST_REGISTRY_EXPIRY=true ./init.sh
|
||||
|
||||
|
||||
Run tests:
|
||||
|
||||
yarn test:nameservice-expiry
|
||||
*/
|
||||
|
||||
describe('Nameservice Expiry', nameserviceExpiryTests)
|
||||
}
|
@ -1,317 +0,0 @@
|
||||
import assert from 'assert';
|
||||
import path from 'path';
|
||||
|
||||
import { Account } from './account';
|
||||
import { Registry } from './index';
|
||||
import { ensureUpdatedConfig, getConfig } from './testing/helper';
|
||||
|
||||
const WATCHER_YML_PATH = path.join(__dirname, './testing/data/watcher.yml');
|
||||
|
||||
jest.setTimeout(5 * 60 * 1000);
|
||||
|
||||
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
|
||||
|
||||
const namingTests = () => {
|
||||
let registry: Registry;
|
||||
|
||||
let bondId: string;
|
||||
let watcher: any;
|
||||
let watcherId: string;
|
||||
|
||||
beforeAll(async () => {
|
||||
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
|
||||
// Create bond.
|
||||
bondId = await registry.getNextBondId(privateKey);
|
||||
await registry.createBond({ denom: 'aphoton', amount: '2000000000' }, privateKey, fee);
|
||||
|
||||
// Create watcher.
|
||||
watcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
|
||||
const result = await registry.setRecord(
|
||||
{
|
||||
privateKey,
|
||||
bondId,
|
||||
record: watcher.record
|
||||
},
|
||||
privateKey,
|
||||
fee
|
||||
)
|
||||
|
||||
watcherId = result.data.id;
|
||||
});
|
||||
|
||||
describe('Authority tests', () => {
|
||||
test('Reserve authority.', async () => {
|
||||
const authorityName = `laconic-${Date.now()}`;
|
||||
|
||||
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
||||
});
|
||||
|
||||
describe('With authority reserved', () => {
|
||||
let authorityName: string;
|
||||
let crn: string;
|
||||
|
||||
beforeAll(async () => {
|
||||
|
||||
authorityName = `laconic-${Date.now()}`;
|
||||
crn = `crn://${authorityName}/app/test`;
|
||||
|
||||
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
||||
})
|
||||
|
||||
test('Lookup authority.', async () => {
|
||||
const [record] = await registry.lookupAuthorities([authorityName]);
|
||||
|
||||
expect(record).toBeDefined();
|
||||
expect(record.ownerAddress).not.toBe('');
|
||||
expect(record.ownerPublicKey).not.toBe('');
|
||||
expect(Number(record.height)).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test('Lookup non existing authority', async () => {
|
||||
const [record] = await registry.lookupAuthorities(['does-not-exist']);
|
||||
|
||||
expect(record.ownerAddress).toBe('');
|
||||
expect(record.ownerPublicKey).toBe('');
|
||||
expect(Number(record.height)).toBe(0);
|
||||
});
|
||||
|
||||
test('Reserve already reserved authority', async () => {
|
||||
await expect(registry.reserveAuthority({ name: authorityName }, privateKey, fee)).
|
||||
rejects.toThrow('Name already reserved.');
|
||||
});
|
||||
|
||||
test('Reserve sub-authority.', async () => {
|
||||
const subAuthority = `echo.${authorityName}`;
|
||||
await registry.reserveAuthority({ name: subAuthority }, privateKey, fee);
|
||||
|
||||
const [record] = await registry.lookupAuthorities([subAuthority]);
|
||||
expect(record).toBeDefined();
|
||||
expect(record.ownerAddress).not.toBe('');
|
||||
expect(record.ownerPublicKey).not.toBe('');
|
||||
expect(Number(record.height)).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test('Reserve sub-authority with different owner.', async () => {
|
||||
// Create another account, send tx to set public key on the account.
|
||||
const mnenonic1 = Account.generateMnemonic();
|
||||
const otherAccount1 = await Account.generateFromMnemonic(mnenonic1);
|
||||
await registry.sendCoins({ denom: 'aphoton', amount: '1000000000', destinationAddress: otherAccount1.formattedCosmosAddress }, privateKey, fee);
|
||||
|
||||
const mnenonic2 = Account.generateMnemonic();
|
||||
const otherAccount2 = await Account.generateFromMnemonic(mnenonic2);
|
||||
await registry.sendCoins({ denom: 'aphoton', amount: '10', destinationAddress: otherAccount2.formattedCosmosAddress }, otherAccount1.getPrivateKey(), fee);
|
||||
|
||||
const subAuthority = `halo.${authorityName}`;
|
||||
await registry.reserveAuthority({ name: subAuthority, owner: otherAccount1.formattedCosmosAddress }, privateKey, fee);
|
||||
|
||||
const [record] = await registry.lookupAuthorities([subAuthority]);
|
||||
expect(record).toBeDefined();
|
||||
expect(record.ownerAddress).toBeDefined();
|
||||
expect(record.ownerAddress).toBe(otherAccount1.getCosmosAddress());
|
||||
expect(record.ownerPublicKey).toBeDefined();
|
||||
expect(Number(record.height)).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test('Set name for unbonded authority', async () => {
|
||||
assert(watcherId)
|
||||
await expect(registry.setName({ crn, cid: watcherId }, privateKey, fee)).
|
||||
rejects.toThrow('Authority bond not found.');
|
||||
});
|
||||
|
||||
test('Set authority bond', async () => {
|
||||
await registry.setAuthorityBond({ name: authorityName, bondId }, privateKey, fee);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Naming tests', () => {
|
||||
let authorityName: string;
|
||||
let otherAuthorityName: string;
|
||||
let otherPrivateKey: string;
|
||||
let otherAccount: Account;
|
||||
|
||||
beforeAll(async () => {
|
||||
authorityName = `laconic-${Date.now()}`;
|
||||
|
||||
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
||||
await registry.setAuthorityBond({ name: authorityName, bondId }, privateKey, fee);
|
||||
|
||||
// Create another account.
|
||||
const mnenonic = Account.generateMnemonic();
|
||||
otherAccount = await Account.generateFromMnemonic(mnenonic);
|
||||
await registry.sendCoins({ denom: 'aphoton', amount: '1000000000', destinationAddress: otherAccount.formattedCosmosAddress }, privateKey, fee);
|
||||
|
||||
otherAuthorityName = `other-${Date.now()}`;
|
||||
otherPrivateKey = otherAccount.privateKey.toString('hex');
|
||||
});
|
||||
|
||||
test('Set name', async () => {
|
||||
const crn = `crn://${authorityName}/app/test1`;
|
||||
|
||||
await registry.setName({ crn, cid: watcherId }, privateKey, fee);
|
||||
|
||||
// Query records should return it (some CRN points to it).
|
||||
const [record] = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version });
|
||||
expect(record).toBeDefined();
|
||||
expect(record.names).toHaveLength(1);
|
||||
|
||||
await registry.deleteName({ crn }, privateKey, fee);
|
||||
});
|
||||
|
||||
describe('With name set', () => {
|
||||
let crn: string;
|
||||
|
||||
beforeAll(async () => {
|
||||
crn = `crn://${authorityName}/app/test2`;
|
||||
await registry.setName({ crn, cid: watcherId }, privateKey, fee);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await registry.deleteName({ crn }, privateKey, fee);
|
||||
});
|
||||
|
||||
test('Lookup name', async () => {
|
||||
const records = await registry.lookupNames([crn]);
|
||||
expect(records).toBeDefined();
|
||||
expect(records).toHaveLength(1);
|
||||
|
||||
const [{ latest, history }] = records;
|
||||
expect(latest).toBeDefined();
|
||||
expect(latest.id).toBeDefined();
|
||||
expect(latest.id).toBe(watcherId);
|
||||
expect(latest.height).toBeDefined();
|
||||
expect(history).toBeUndefined();
|
||||
});
|
||||
|
||||
test('Resolve name', async () => {
|
||||
const records = await registry.resolveNames([crn]);
|
||||
expect(records).toBeDefined();
|
||||
expect(records).toHaveLength(1);
|
||||
|
||||
const [{ attributes }] = records;
|
||||
expect(attributes).toEqual(watcher.record);
|
||||
});
|
||||
|
||||
test('Lookup name with history', async () => {
|
||||
const updatedWatcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
|
||||
const result = await registry.setRecord(
|
||||
{
|
||||
privateKey,
|
||||
bondId,
|
||||
record: updatedWatcher.record
|
||||
},
|
||||
privateKey,
|
||||
fee
|
||||
)
|
||||
|
||||
const updatedWatcherId = result.data.id;
|
||||
await registry.setName({ crn, cid: updatedWatcherId }, privateKey, fee);
|
||||
|
||||
const records = await registry.lookupNames([crn], true);
|
||||
expect(records).toHaveLength(1);
|
||||
|
||||
const [{ latest, history }] = records;
|
||||
expect(latest).toBeDefined();
|
||||
expect(latest.id).toBeDefined();
|
||||
expect(latest.id).toBe(updatedWatcherId);
|
||||
expect(latest.height).toBeDefined();
|
||||
expect(history).toBeDefined();
|
||||
expect(history).toHaveLength(1);
|
||||
|
||||
const [oldRecord] = history;
|
||||
expect(oldRecord).toBeDefined();
|
||||
expect(oldRecord.id).toBeDefined();
|
||||
expect(oldRecord.id).toBe(watcherId);
|
||||
expect(oldRecord.height).toBeDefined();
|
||||
});
|
||||
|
||||
test('Delete name', async () => {
|
||||
await registry.deleteName({ crn }, privateKey, fee);
|
||||
|
||||
let records = await registry.lookupNames([crn], true);
|
||||
expect(records).toBeDefined();
|
||||
expect(records).toHaveLength(1);
|
||||
|
||||
const [{ latest }] = records;
|
||||
expect(latest).toBeDefined();
|
||||
expect(latest.id).toBeDefined();
|
||||
expect(latest.id).toBe('');
|
||||
expect(latest.height).toBeDefined();
|
||||
|
||||
// Query records should NOT return it (no CRN points to it).
|
||||
records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version });
|
||||
expect(records).toBeDefined();
|
||||
expect(records).toHaveLength(0);
|
||||
|
||||
// Query all records should return it (all: true).
|
||||
records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version }, true);
|
||||
expect(records).toBeDefined();
|
||||
expect(records).toHaveLength(1);
|
||||
});
|
||||
|
||||
test('Delete already deleted name', async () => {
|
||||
await registry.deleteName({ crn }, privateKey, fee);
|
||||
await registry.deleteName({ crn }, privateKey, fee);
|
||||
|
||||
const records = await registry.lookupNames([crn], true);
|
||||
expect(records).toBeDefined();
|
||||
expect(records).toHaveLength(1);
|
||||
|
||||
const [{ latest }] = records;
|
||||
expect(latest).toBeDefined();
|
||||
expect(latest.id).toBeDefined();
|
||||
expect(latest.id).toBe('');
|
||||
expect(latest.height).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
test('Set name without reserving authority', async () => {
|
||||
await expect(registry.setName({ crn: 'crn://not-reserved/app/test', cid: watcherId }, privateKey, fee))
|
||||
.rejects.toThrow('Name authority not found.');
|
||||
});
|
||||
|
||||
test('Set name for non-owned authority', async () => {
|
||||
await registry.sendCoins({ denom: 'aphoton', amount: '1000000000', destinationAddress: otherAccount.formattedCosmosAddress }, privateKey, fee);
|
||||
|
||||
// Other account reserves an authority.
|
||||
await registry.reserveAuthority({ name: otherAuthorityName }, otherPrivateKey, fee);
|
||||
|
||||
// Try setting name under other authority.
|
||||
await expect(registry.setName({ crn: `crn://${otherAuthorityName}/app/test`, cid: watcherId }, privateKey, fee)).rejects.toThrow('Access denied.');
|
||||
});
|
||||
|
||||
test('Delete name for non-owned authority.', async () => {
|
||||
const otherBondId = await registry.getNextBondId(otherPrivateKey);
|
||||
await registry.createBond({ denom: 'aphoton', amount: '10000' }, otherPrivateKey, fee);
|
||||
await registry.setAuthorityBond({ name: otherAuthorityName, bondId: otherBondId }, otherPrivateKey, fee);
|
||||
await registry.setName({ crn: `crn://${otherAuthorityName}/app/test`, cid: watcherId }, otherPrivateKey, fee);
|
||||
|
||||
// Try deleting name under other authority.
|
||||
await expect(registry.deleteName({ crn: `crn://${otherAuthorityName}/app/test` }, privateKey, fee)).rejects.toThrow('Access denied.');
|
||||
});
|
||||
|
||||
test('Lookup non existing name', async () => {
|
||||
const records = await registry.lookupNames(['crn://not-reserved/app/test']);
|
||||
expect(records).toBeDefined();
|
||||
expect(records).toHaveLength(1);
|
||||
const [record] = records;
|
||||
expect(record).toBeNull();
|
||||
});
|
||||
|
||||
test('Resolve non existing name', async () => {
|
||||
const records = await registry.resolveNames(['crn://not-reserved/app/test']);
|
||||
expect(records).toBeDefined();
|
||||
expect(records).toHaveLength(1);
|
||||
const [record] = records;
|
||||
expect(record).toBeNull();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
if (process.env.TEST_AUCTIONS_ENABLED) {
|
||||
// Required as jest complains if file has no tests.
|
||||
test('skipping naming tests', () => {});
|
||||
} else {
|
||||
describe('Naming', namingTests);
|
||||
}
|
@ -1,259 +0,0 @@
|
||||
// @ts-nocheck
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* source: cosmos/base/query/v1beta1/pagination.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as pb_1 from "google-protobuf";
|
||||
export namespace cosmos.base.query.v1beta1 {
|
||||
export class PageRequest extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
key?: Uint8Array;
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
count_total?: boolean;
|
||||
reverse?: boolean;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("key" in data && data.key != undefined) {
|
||||
this.key = data.key;
|
||||
}
|
||||
if ("offset" in data && data.offset != undefined) {
|
||||
this.offset = data.offset;
|
||||
}
|
||||
if ("limit" in data && data.limit != undefined) {
|
||||
this.limit = data.limit;
|
||||
}
|
||||
if ("count_total" in data && data.count_total != undefined) {
|
||||
this.count_total = data.count_total;
|
||||
}
|
||||
if ("reverse" in data && data.reverse != undefined) {
|
||||
this.reverse = data.reverse;
|
||||
}
|
||||
}
|
||||
}
|
||||
get key() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array;
|
||||
}
|
||||
set key(value: Uint8Array) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get offset() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
|
||||
}
|
||||
set offset(value: number) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get limit() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
|
||||
}
|
||||
set limit(value: number) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
get count_total() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean;
|
||||
}
|
||||
set count_total(value: boolean) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get reverse() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 5, false) as boolean;
|
||||
}
|
||||
set reverse(value: boolean) {
|
||||
pb_1.Message.setField(this, 5, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
key?: Uint8Array;
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
count_total?: boolean;
|
||||
reverse?: boolean;
|
||||
}): PageRequest {
|
||||
const message = new PageRequest({});
|
||||
if (data.key != null) {
|
||||
message.key = data.key;
|
||||
}
|
||||
if (data.offset != null) {
|
||||
message.offset = data.offset;
|
||||
}
|
||||
if (data.limit != null) {
|
||||
message.limit = data.limit;
|
||||
}
|
||||
if (data.count_total != null) {
|
||||
message.count_total = data.count_total;
|
||||
}
|
||||
if (data.reverse != null) {
|
||||
message.reverse = data.reverse;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
key?: Uint8Array;
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
count_total?: boolean;
|
||||
reverse?: boolean;
|
||||
} = {};
|
||||
if (this.key != null) {
|
||||
data.key = this.key;
|
||||
}
|
||||
if (this.offset != null) {
|
||||
data.offset = this.offset;
|
||||
}
|
||||
if (this.limit != null) {
|
||||
data.limit = this.limit;
|
||||
}
|
||||
if (this.count_total != null) {
|
||||
data.count_total = this.count_total;
|
||||
}
|
||||
if (this.reverse != null) {
|
||||
data.reverse = this.reverse;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.key.length)
|
||||
writer.writeBytes(1, this.key);
|
||||
if (this.offset != 0)
|
||||
writer.writeUint64(2, this.offset);
|
||||
if (this.limit != 0)
|
||||
writer.writeUint64(3, this.limit);
|
||||
if (this.count_total != false)
|
||||
writer.writeBool(4, this.count_total);
|
||||
if (this.reverse != false)
|
||||
writer.writeBool(5, this.reverse);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): PageRequest {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new PageRequest();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.key = reader.readBytes();
|
||||
break;
|
||||
case 2:
|
||||
message.offset = reader.readUint64();
|
||||
break;
|
||||
case 3:
|
||||
message.limit = reader.readUint64();
|
||||
break;
|
||||
case 4:
|
||||
message.count_total = reader.readBool();
|
||||
break;
|
||||
case 5:
|
||||
message.reverse = reader.readBool();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): PageRequest {
|
||||
return PageRequest.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class PageResponse extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
next_key?: Uint8Array;
|
||||
total?: number;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("next_key" in data && data.next_key != undefined) {
|
||||
this.next_key = data.next_key;
|
||||
}
|
||||
if ("total" in data && data.total != undefined) {
|
||||
this.total = data.total;
|
||||
}
|
||||
}
|
||||
}
|
||||
get next_key() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array;
|
||||
}
|
||||
set next_key(value: Uint8Array) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get total() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
|
||||
}
|
||||
set total(value: number) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
next_key?: Uint8Array;
|
||||
total?: number;
|
||||
}): PageResponse {
|
||||
const message = new PageResponse({});
|
||||
if (data.next_key != null) {
|
||||
message.next_key = data.next_key;
|
||||
}
|
||||
if (data.total != null) {
|
||||
message.total = data.total;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
next_key?: Uint8Array;
|
||||
total?: number;
|
||||
} = {};
|
||||
if (this.next_key != null) {
|
||||
data.next_key = this.next_key;
|
||||
}
|
||||
if (this.total != null) {
|
||||
data.total = this.total;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.next_key.length)
|
||||
writer.writeBytes(1, this.next_key);
|
||||
if (this.total != 0)
|
||||
writer.writeUint64(2, this.total);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): PageResponse {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new PageResponse();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.next_key = reader.readBytes();
|
||||
break;
|
||||
case 2:
|
||||
message.total = reader.readUint64();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): PageResponse {
|
||||
return PageResponse.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,325 +0,0 @@
|
||||
// @ts-nocheck
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* source: cosmos/base/v1beta1/coin.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
import * as pb_1 from "google-protobuf";
|
||||
export namespace cosmos.base.v1beta1 {
|
||||
export class Coin extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
denom?: string;
|
||||
amount?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("denom" in data && data.denom != undefined) {
|
||||
this.denom = data.denom;
|
||||
}
|
||||
if ("amount" in data && data.amount != undefined) {
|
||||
this.amount = data.amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
get denom() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set denom(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get amount() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
||||
}
|
||||
set amount(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
denom?: string;
|
||||
amount?: string;
|
||||
}): Coin {
|
||||
const message = new Coin({});
|
||||
if (data.denom != null) {
|
||||
message.denom = data.denom;
|
||||
}
|
||||
if (data.amount != null) {
|
||||
message.amount = data.amount;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
denom?: string;
|
||||
amount?: string;
|
||||
} = {};
|
||||
if (this.denom != null) {
|
||||
data.denom = this.denom;
|
||||
}
|
||||
if (this.amount != null) {
|
||||
data.amount = this.amount;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.denom.length)
|
||||
writer.writeString(1, this.denom);
|
||||
if (this.amount.length)
|
||||
writer.writeString(2, this.amount);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Coin {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Coin();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.denom = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.amount = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Coin {
|
||||
return Coin.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class DecCoin extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
denom?: string;
|
||||
amount?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("denom" in data && data.denom != undefined) {
|
||||
this.denom = data.denom;
|
||||
}
|
||||
if ("amount" in data && data.amount != undefined) {
|
||||
this.amount = data.amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
get denom() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set denom(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get amount() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
||||
}
|
||||
set amount(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
denom?: string;
|
||||
amount?: string;
|
||||
}): DecCoin {
|
||||
const message = new DecCoin({});
|
||||
if (data.denom != null) {
|
||||
message.denom = data.denom;
|
||||
}
|
||||
if (data.amount != null) {
|
||||
message.amount = data.amount;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
denom?: string;
|
||||
amount?: string;
|
||||
} = {};
|
||||
if (this.denom != null) {
|
||||
data.denom = this.denom;
|
||||
}
|
||||
if (this.amount != null) {
|
||||
data.amount = this.amount;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.denom.length)
|
||||
writer.writeString(1, this.denom);
|
||||
if (this.amount.length)
|
||||
writer.writeString(2, this.amount);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DecCoin {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DecCoin();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.denom = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.amount = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): DecCoin {
|
||||
return DecCoin.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class IntProto extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
int?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("int" in data && data.int != undefined) {
|
||||
this.int = data.int;
|
||||
}
|
||||
}
|
||||
}
|
||||
get int() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set int(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
int?: string;
|
||||
}): IntProto {
|
||||
const message = new IntProto({});
|
||||
if (data.int != null) {
|
||||
message.int = data.int;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
int?: string;
|
||||
} = {};
|
||||
if (this.int != null) {
|
||||
data.int = this.int;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.int.length)
|
||||
writer.writeString(1, this.int);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): IntProto {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new IntProto();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.int = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): IntProto {
|
||||
return IntProto.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class DecProto extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
dec?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("dec" in data && data.dec != undefined) {
|
||||
this.dec = data.dec;
|
||||
}
|
||||
}
|
||||
}
|
||||
get dec() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set dec(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
dec?: string;
|
||||
}): DecProto {
|
||||
const message = new DecProto({});
|
||||
if (data.dec != null) {
|
||||
message.dec = data.dec;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
dec?: string;
|
||||
} = {};
|
||||
if (this.dec != null) {
|
||||
data.dec = this.dec;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.dec.length)
|
||||
writer.writeString(1, this.dec);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DecProto {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DecProto();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.dec = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): DecProto {
|
||||
return DecProto.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
// @ts-nocheck
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* source: gogoproto/gogo.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../google/protobuf/descriptor";
|
||||
export namespace gogoproto { }
|
@ -1,10 +0,0 @@
|
||||
// @ts-nocheck
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* source: google/api/annotations.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./http";
|
||||
import * as dependency_2 from "./../protobuf/descriptor";
|
||||
export namespace google.api { }
|
@ -1,532 +0,0 @@
|
||||
// @ts-nocheck
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* source: google/api/http.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as pb_1 from "google-protobuf";
|
||||
export namespace google.api {
|
||||
export class Http extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
rules?: HttpRule[];
|
||||
fully_decode_reserved_expansion?: boolean;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("rules" in data && data.rules != undefined) {
|
||||
this.rules = data.rules;
|
||||
}
|
||||
if ("fully_decode_reserved_expansion" in data && data.fully_decode_reserved_expansion != undefined) {
|
||||
this.fully_decode_reserved_expansion = data.fully_decode_reserved_expansion;
|
||||
}
|
||||
}
|
||||
}
|
||||
get rules() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, HttpRule, 1) as HttpRule[];
|
||||
}
|
||||
set rules(value: HttpRule[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 1, value);
|
||||
}
|
||||
get fully_decode_reserved_expansion() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, false) as boolean;
|
||||
}
|
||||
set fully_decode_reserved_expansion(value: boolean) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
rules?: ReturnType<typeof HttpRule.prototype.toObject>[];
|
||||
fully_decode_reserved_expansion?: boolean;
|
||||
}): Http {
|
||||
const message = new Http({});
|
||||
if (data.rules != null) {
|
||||
message.rules = data.rules.map(item => HttpRule.fromObject(item));
|
||||
}
|
||||
if (data.fully_decode_reserved_expansion != null) {
|
||||
message.fully_decode_reserved_expansion = data.fully_decode_reserved_expansion;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
rules?: ReturnType<typeof HttpRule.prototype.toObject>[];
|
||||
fully_decode_reserved_expansion?: boolean;
|
||||
} = {};
|
||||
if (this.rules != null) {
|
||||
data.rules = this.rules.map((item: HttpRule) => item.toObject());
|
||||
}
|
||||
if (this.fully_decode_reserved_expansion != null) {
|
||||
data.fully_decode_reserved_expansion = this.fully_decode_reserved_expansion;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.rules.length)
|
||||
writer.writeRepeatedMessage(1, this.rules, (item: HttpRule) => item.serialize(writer));
|
||||
if (this.fully_decode_reserved_expansion != false)
|
||||
writer.writeBool(2, this.fully_decode_reserved_expansion);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Http {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Http();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.rules, () => pb_1.Message.addToRepeatedWrapperField(message, 1, HttpRule.deserialize(reader), HttpRule));
|
||||
break;
|
||||
case 2:
|
||||
message.fully_decode_reserved_expansion = reader.readBool();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Http {
|
||||
return Http.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class HttpRule extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [[2, 3, 4, 5, 6, 8]];
|
||||
constructor(data?: any[] | ({
|
||||
selector?: string;
|
||||
body?: string;
|
||||
response_body?: string;
|
||||
additional_bindings?: HttpRule[];
|
||||
} & (({
|
||||
get?: string;
|
||||
put?: never;
|
||||
post?: never;
|
||||
delete?: never;
|
||||
patch?: never;
|
||||
custom?: never;
|
||||
} | {
|
||||
get?: never;
|
||||
put?: string;
|
||||
post?: never;
|
||||
delete?: never;
|
||||
patch?: never;
|
||||
custom?: never;
|
||||
} | {
|
||||
get?: never;
|
||||
put?: never;
|
||||
post?: string;
|
||||
delete?: never;
|
||||
patch?: never;
|
||||
custom?: never;
|
||||
} | {
|
||||
get?: never;
|
||||
put?: never;
|
||||
post?: never;
|
||||
delete?: string;
|
||||
patch?: never;
|
||||
custom?: never;
|
||||
} | {
|
||||
get?: never;
|
||||
put?: never;
|
||||
post?: never;
|
||||
delete?: never;
|
||||
patch?: string;
|
||||
custom?: never;
|
||||
} | {
|
||||
get?: never;
|
||||
put?: never;
|
||||
post?: never;
|
||||
delete?: never;
|
||||
patch?: never;
|
||||
custom?: CustomHttpPattern;
|
||||
})))) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [11], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("selector" in data && data.selector != undefined) {
|
||||
this.selector = data.selector;
|
||||
}
|
||||
if ("get" in data && data.get != undefined) {
|
||||
this.get = data.get;
|
||||
}
|
||||
if ("put" in data && data.put != undefined) {
|
||||
this.put = data.put;
|
||||
}
|
||||
if ("post" in data && data.post != undefined) {
|
||||
this.post = data.post;
|
||||
}
|
||||
if ("delete" in data && data.delete != undefined) {
|
||||
this.delete = data.delete;
|
||||
}
|
||||
if ("patch" in data && data.patch != undefined) {
|
||||
this.patch = data.patch;
|
||||
}
|
||||
if ("custom" in data && data.custom != undefined) {
|
||||
this.custom = data.custom;
|
||||
}
|
||||
if ("body" in data && data.body != undefined) {
|
||||
this.body = data.body;
|
||||
}
|
||||
if ("response_body" in data && data.response_body != undefined) {
|
||||
this.response_body = data.response_body;
|
||||
}
|
||||
if ("additional_bindings" in data && data.additional_bindings != undefined) {
|
||||
this.additional_bindings = data.additional_bindings;
|
||||
}
|
||||
}
|
||||
}
|
||||
get selector() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set selector(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get get() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
||||
}
|
||||
set get(value: string) {
|
||||
pb_1.Message.setOneofField(this, 2, this.#one_of_decls[0], value);
|
||||
}
|
||||
get has_get() {
|
||||
return pb_1.Message.getField(this, 2) != null;
|
||||
}
|
||||
get put() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
|
||||
}
|
||||
set put(value: string) {
|
||||
pb_1.Message.setOneofField(this, 3, this.#one_of_decls[0], value);
|
||||
}
|
||||
get has_put() {
|
||||
return pb_1.Message.getField(this, 3) != null;
|
||||
}
|
||||
get post() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
|
||||
}
|
||||
set post(value: string) {
|
||||
pb_1.Message.setOneofField(this, 4, this.#one_of_decls[0], value);
|
||||
}
|
||||
get has_post() {
|
||||
return pb_1.Message.getField(this, 4) != null;
|
||||
}
|
||||
get delete() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 5, "") as string;
|
||||
}
|
||||
set delete(value: string) {
|
||||
pb_1.Message.setOneofField(this, 5, this.#one_of_decls[0], value);
|
||||
}
|
||||
get has_delete() {
|
||||
return pb_1.Message.getField(this, 5) != null;
|
||||
}
|
||||
get patch() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 6, "") as string;
|
||||
}
|
||||
set patch(value: string) {
|
||||
pb_1.Message.setOneofField(this, 6, this.#one_of_decls[0], value);
|
||||
}
|
||||
get has_patch() {
|
||||
return pb_1.Message.getField(this, 6) != null;
|
||||
}
|
||||
get custom() {
|
||||
return pb_1.Message.getWrapperField(this, CustomHttpPattern, 8) as CustomHttpPattern;
|
||||
}
|
||||
set custom(value: CustomHttpPattern) {
|
||||
pb_1.Message.setOneofWrapperField(this, 8, this.#one_of_decls[0], value);
|
||||
}
|
||||
get has_custom() {
|
||||
return pb_1.Message.getField(this, 8) != null;
|
||||
}
|
||||
get body() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 7, "") as string;
|
||||
}
|
||||
set body(value: string) {
|
||||
pb_1.Message.setField(this, 7, value);
|
||||
}
|
||||
get response_body() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 12, "") as string;
|
||||
}
|
||||
set response_body(value: string) {
|
||||
pb_1.Message.setField(this, 12, value);
|
||||
}
|
||||
get additional_bindings() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, HttpRule, 11) as HttpRule[];
|
||||
}
|
||||
set additional_bindings(value: HttpRule[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 11, value);
|
||||
}
|
||||
get pattern() {
|
||||
const cases: {
|
||||
[index: number]: "none" | "get" | "put" | "post" | "delete" | "patch" | "custom";
|
||||
} = {
|
||||
0: "none",
|
||||
2: "get",
|
||||
3: "put",
|
||||
4: "post",
|
||||
5: "delete",
|
||||
6: "patch",
|
||||
8: "custom"
|
||||
};
|
||||
return cases[pb_1.Message.computeOneofCase(this, [2, 3, 4, 5, 6, 8])];
|
||||
}
|
||||
static fromObject(data: {
|
||||
selector?: string;
|
||||
get?: string;
|
||||
put?: string;
|
||||
post?: string;
|
||||
delete?: string;
|
||||
patch?: string;
|
||||
custom?: ReturnType<typeof CustomHttpPattern.prototype.toObject>;
|
||||
body?: string;
|
||||
response_body?: string;
|
||||
additional_bindings?: ReturnType<typeof HttpRule.prototype.toObject>[];
|
||||
}): HttpRule {
|
||||
const message = new HttpRule({});
|
||||
if (data.selector != null) {
|
||||
message.selector = data.selector;
|
||||
}
|
||||
if (data.get != null) {
|
||||
message.get = data.get;
|
||||
}
|
||||
if (data.put != null) {
|
||||
message.put = data.put;
|
||||
}
|
||||
if (data.post != null) {
|
||||
message.post = data.post;
|
||||
}
|
||||
if (data.delete != null) {
|
||||
message.delete = data.delete;
|
||||
}
|
||||
if (data.patch != null) {
|
||||
message.patch = data.patch;
|
||||
}
|
||||
if (data.custom != null) {
|
||||
message.custom = CustomHttpPattern.fromObject(data.custom);
|
||||
}
|
||||
if (data.body != null) {
|
||||
message.body = data.body;
|
||||
}
|
||||
if (data.response_body != null) {
|
||||
message.response_body = data.response_body;
|
||||
}
|
||||
if (data.additional_bindings != null) {
|
||||
message.additional_bindings = data.additional_bindings.map(item => HttpRule.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
selector?: string;
|
||||
get?: string;
|
||||
put?: string;
|
||||
post?: string;
|
||||
delete?: string;
|
||||
patch?: string;
|
||||
custom?: ReturnType<typeof CustomHttpPattern.prototype.toObject>;
|
||||
body?: string;
|
||||
response_body?: string;
|
||||
additional_bindings?: ReturnType<typeof HttpRule.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.selector != null) {
|
||||
data.selector = this.selector;
|
||||
}
|
||||
if (this.get != null) {
|
||||
data.get = this.get;
|
||||
}
|
||||
if (this.put != null) {
|
||||
data.put = this.put;
|
||||
}
|
||||
if (this.post != null) {
|
||||
data.post = this.post;
|
||||
}
|
||||
if (this.delete != null) {
|
||||
data.delete = this.delete;
|
||||
}
|
||||
if (this.patch != null) {
|
||||
data.patch = this.patch;
|
||||
}
|
||||
if (this.custom != null) {
|
||||
data.custom = this.custom.toObject();
|
||||
}
|
||||
if (this.body != null) {
|
||||
data.body = this.body;
|
||||
}
|
||||
if (this.response_body != null) {
|
||||
data.response_body = this.response_body;
|
||||
}
|
||||
if (this.additional_bindings != null) {
|
||||
data.additional_bindings = this.additional_bindings.map((item: HttpRule) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.selector.length)
|
||||
writer.writeString(1, this.selector);
|
||||
if (this.has_get)
|
||||
writer.writeString(2, this.get);
|
||||
if (this.has_put)
|
||||
writer.writeString(3, this.put);
|
||||
if (this.has_post)
|
||||
writer.writeString(4, this.post);
|
||||
if (this.has_delete)
|
||||
writer.writeString(5, this.delete);
|
||||
if (this.has_patch)
|
||||
writer.writeString(6, this.patch);
|
||||
if (this.has_custom)
|
||||
writer.writeMessage(8, this.custom, () => this.custom.serialize(writer));
|
||||
if (this.body.length)
|
||||
writer.writeString(7, this.body);
|
||||
if (this.response_body.length)
|
||||
writer.writeString(12, this.response_body);
|
||||
if (this.additional_bindings.length)
|
||||
writer.writeRepeatedMessage(11, this.additional_bindings, (item: HttpRule) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): HttpRule {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new HttpRule();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.selector = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.get = reader.readString();
|
||||
break;
|
||||
case 3:
|
||||
message.put = reader.readString();
|
||||
break;
|
||||
case 4:
|
||||
message.post = reader.readString();
|
||||
break;
|
||||
case 5:
|
||||
message.delete = reader.readString();
|
||||
break;
|
||||
case 6:
|
||||
message.patch = reader.readString();
|
||||
break;
|
||||
case 8:
|
||||
reader.readMessage(message.custom, () => message.custom = CustomHttpPattern.deserialize(reader));
|
||||
break;
|
||||
case 7:
|
||||
message.body = reader.readString();
|
||||
break;
|
||||
case 12:
|
||||
message.response_body = reader.readString();
|
||||
break;
|
||||
case 11:
|
||||
reader.readMessage(message.additional_bindings, () => pb_1.Message.addToRepeatedWrapperField(message, 11, HttpRule.deserialize(reader), HttpRule));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): HttpRule {
|
||||
return HttpRule.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class CustomHttpPattern extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
kind?: string;
|
||||
path?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("kind" in data && data.kind != undefined) {
|
||||
this.kind = data.kind;
|
||||
}
|
||||
if ("path" in data && data.path != undefined) {
|
||||
this.path = data.path;
|
||||
}
|
||||
}
|
||||
}
|
||||
get kind() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set kind(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get path() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
||||
}
|
||||
set path(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
kind?: string;
|
||||
path?: string;
|
||||
}): CustomHttpPattern {
|
||||
const message = new CustomHttpPattern({});
|
||||
if (data.kind != null) {
|
||||
message.kind = data.kind;
|
||||
}
|
||||
if (data.path != null) {
|
||||
message.path = data.path;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
kind?: string;
|
||||
path?: string;
|
||||
} = {};
|
||||
if (this.kind != null) {
|
||||
data.kind = this.kind;
|
||||
}
|
||||
if (this.path != null) {
|
||||
data.path = this.path;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.kind.length)
|
||||
writer.writeString(1, this.kind);
|
||||
if (this.path.length)
|
||||
writer.writeString(2, this.path);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CustomHttpPattern {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new CustomHttpPattern();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.kind = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.path = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): CustomHttpPattern {
|
||||
return CustomHttpPattern.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,100 +0,0 @@
|
||||
// @ts-nocheck
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* source: google/protobuf/duration.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as pb_1 from "google-protobuf";
|
||||
export namespace google.protobuf {
|
||||
export class Duration extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
seconds?: number;
|
||||
nanos?: number;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("seconds" in data && data.seconds != undefined) {
|
||||
this.seconds = data.seconds;
|
||||
}
|
||||
if ("nanos" in data && data.nanos != undefined) {
|
||||
this.nanos = data.nanos;
|
||||
}
|
||||
}
|
||||
}
|
||||
get seconds() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
|
||||
}
|
||||
set seconds(value: number) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get nanos() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
|
||||
}
|
||||
set nanos(value: number) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
seconds?: number;
|
||||
nanos?: number;
|
||||
}): Duration {
|
||||
const message = new Duration({});
|
||||
if (data.seconds != null) {
|
||||
message.seconds = data.seconds;
|
||||
}
|
||||
if (data.nanos != null) {
|
||||
message.nanos = data.nanos;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
seconds?: number;
|
||||
nanos?: number;
|
||||
} = {};
|
||||
if (this.seconds != null) {
|
||||
data.seconds = this.seconds;
|
||||
}
|
||||
if (this.nanos != null) {
|
||||
data.nanos = this.nanos;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.seconds != 0)
|
||||
writer.writeInt64(1, this.seconds);
|
||||
if (this.nanos != 0)
|
||||
writer.writeInt32(2, this.nanos);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Duration {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Duration();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.seconds = reader.readInt64();
|
||||
break;
|
||||
case 2:
|
||||
message.nanos = reader.readInt32();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Duration {
|
||||
return Duration.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
// @ts-nocheck
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* source: google/protobuf/timestamp.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as pb_1 from "google-protobuf";
|
||||
export namespace google.protobuf {
|
||||
export class Timestamp extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
seconds?: number;
|
||||
nanos?: number;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("seconds" in data && data.seconds != undefined) {
|
||||
this.seconds = data.seconds;
|
||||
}
|
||||
if ("nanos" in data && data.nanos != undefined) {
|
||||
this.nanos = data.nanos;
|
||||
}
|
||||
}
|
||||
}
|
||||
get seconds() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
|
||||
}
|
||||
set seconds(value: number) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get nanos() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
|
||||
}
|
||||
set nanos(value: number) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
seconds?: number;
|
||||
nanos?: number;
|
||||
}): Timestamp {
|
||||
const message = new Timestamp({});
|
||||
if (data.seconds != null) {
|
||||
message.seconds = data.seconds;
|
||||
}
|
||||
if (data.nanos != null) {
|
||||
message.nanos = data.nanos;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
seconds?: number;
|
||||
nanos?: number;
|
||||
} = {};
|
||||
if (this.seconds != null) {
|
||||
data.seconds = this.seconds;
|
||||
}
|
||||
if (this.nanos != null) {
|
||||
data.nanos = this.nanos;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.seconds != 0)
|
||||
writer.writeInt64(1, this.seconds);
|
||||
if (this.nanos != 0)
|
||||
writer.writeInt32(2, this.nanos);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Timestamp {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Timestamp();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.seconds = reader.readInt64();
|
||||
break;
|
||||
case 2:
|
||||
message.nanos = reader.readInt32();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Timestamp {
|
||||
return Timestamp.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
// @ts-nocheck
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* source: vulcanize/auction/v1beta1/genesis.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
import * as dependency_2 from "./types";
|
||||
import * as pb_1 from "google-protobuf";
|
||||
export namespace vulcanize.auction.v1beta1 {
|
||||
export class GenesisState extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
params?: dependency_2.vulcanize.auction.v1beta1.Params;
|
||||
auctions?: dependency_2.vulcanize.auction.v1beta1.Auction[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("params" in data && data.params != undefined) {
|
||||
this.params = data.params;
|
||||
}
|
||||
if ("auctions" in data && data.auctions != undefined) {
|
||||
this.auctions = data.auctions;
|
||||
}
|
||||
}
|
||||
}
|
||||
get params() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_2.vulcanize.auction.v1beta1.Params, 1) as dependency_2.vulcanize.auction.v1beta1.Params;
|
||||
}
|
||||
set params(value: dependency_2.vulcanize.auction.v1beta1.Params) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get has_params() {
|
||||
return pb_1.Message.getField(this, 1) != null;
|
||||
}
|
||||
get auctions() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, dependency_2.vulcanize.auction.v1beta1.Auction, 2) as dependency_2.vulcanize.auction.v1beta1.Auction[];
|
||||
}
|
||||
set auctions(value: dependency_2.vulcanize.auction.v1beta1.Auction[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 2, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
params?: ReturnType<typeof dependency_2.vulcanize.auction.v1beta1.Params.prototype.toObject>;
|
||||
auctions?: ReturnType<typeof dependency_2.vulcanize.auction.v1beta1.Auction.prototype.toObject>[];
|
||||
}): GenesisState {
|
||||
const message = new GenesisState({});
|
||||
if (data.params != null) {
|
||||
message.params = dependency_2.vulcanize.auction.v1beta1.Params.fromObject(data.params);
|
||||
}
|
||||
if (data.auctions != null) {
|
||||
message.auctions = data.auctions.map(item => dependency_2.vulcanize.auction.v1beta1.Auction.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
params?: ReturnType<typeof dependency_2.vulcanize.auction.v1beta1.Params.prototype.toObject>;
|
||||
auctions?: ReturnType<typeof dependency_2.vulcanize.auction.v1beta1.Auction.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.params != null) {
|
||||
data.params = this.params.toObject();
|
||||
}
|
||||
if (this.auctions != null) {
|
||||
data.auctions = this.auctions.map((item: dependency_2.vulcanize.auction.v1beta1.Auction) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.has_params)
|
||||
writer.writeMessage(1, this.params, () => this.params.serialize(writer));
|
||||
if (this.auctions.length)
|
||||
writer.writeRepeatedMessage(2, this.auctions, (item: dependency_2.vulcanize.auction.v1beta1.Auction) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): GenesisState {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new GenesisState();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.params, () => message.params = dependency_2.vulcanize.auction.v1beta1.Params.deserialize(reader));
|
||||
break;
|
||||
case 2:
|
||||
reader.readMessage(message.auctions, () => pb_1.Message.addToRepeatedWrapperField(message, 2, dependency_2.vulcanize.auction.v1beta1.Auction.deserialize(reader), dependency_2.vulcanize.auction.v1beta1.Auction));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): GenesisState {
|
||||
return GenesisState.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,647 +0,0 @@
|
||||
// @ts-nocheck
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* source: vulcanize/auction/v1beta1/tx.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
import * as dependency_2 from "./../../../google/protobuf/duration";
|
||||
import * as dependency_3 from "./../../../cosmos/base/v1beta1/coin";
|
||||
import * as dependency_4 from "./types";
|
||||
import * as pb_1 from "google-protobuf";
|
||||
export namespace vulcanize.auction.v1beta1 {
|
||||
export class MsgCreateAuction extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
commits_duration?: dependency_2.google.protobuf.Duration;
|
||||
reveals_duration?: dependency_2.google.protobuf.Duration;
|
||||
commit_fee?: dependency_3.cosmos.base.v1beta1.Coin;
|
||||
reveal_fee?: dependency_3.cosmos.base.v1beta1.Coin;
|
||||
minimum_bid?: dependency_3.cosmos.base.v1beta1.Coin;
|
||||
signer?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("commits_duration" in data && data.commits_duration != undefined) {
|
||||
this.commits_duration = data.commits_duration;
|
||||
}
|
||||
if ("reveals_duration" in data && data.reveals_duration != undefined) {
|
||||
this.reveals_duration = data.reveals_duration;
|
||||
}
|
||||
if ("commit_fee" in data && data.commit_fee != undefined) {
|
||||
this.commit_fee = data.commit_fee;
|
||||
}
|
||||
if ("reveal_fee" in data && data.reveal_fee != undefined) {
|
||||
this.reveal_fee = data.reveal_fee;
|
||||
}
|
||||
if ("minimum_bid" in data && data.minimum_bid != undefined) {
|
||||
this.minimum_bid = data.minimum_bid;
|
||||
}
|
||||
if ("signer" in data && data.signer != undefined) {
|
||||
this.signer = data.signer;
|
||||
}
|
||||
}
|
||||
}
|
||||
get commits_duration() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_2.google.protobuf.Duration, 1) as dependency_2.google.protobuf.Duration;
|
||||
}
|
||||
set commits_duration(value: dependency_2.google.protobuf.Duration) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get has_commits_duration() {
|
||||
return pb_1.Message.getField(this, 1) != null;
|
||||
}
|
||||
get reveals_duration() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_2.google.protobuf.Duration, 2) as dependency_2.google.protobuf.Duration;
|
||||
}
|
||||
set reveals_duration(value: dependency_2.google.protobuf.Duration) {
|
||||
pb_1.Message.setWrapperField(this, 2, value);
|
||||
}
|
||||
get has_reveals_duration() {
|
||||
return pb_1.Message.getField(this, 2) != null;
|
||||
}
|
||||
get commit_fee() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_3.cosmos.base.v1beta1.Coin, 3) as dependency_3.cosmos.base.v1beta1.Coin;
|
||||
}
|
||||
set commit_fee(value: dependency_3.cosmos.base.v1beta1.Coin) {
|
||||
pb_1.Message.setWrapperField(this, 3, value);
|
||||
}
|
||||
get has_commit_fee() {
|
||||
return pb_1.Message.getField(this, 3) != null;
|
||||
}
|
||||
get reveal_fee() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_3.cosmos.base.v1beta1.Coin, 4) as dependency_3.cosmos.base.v1beta1.Coin;
|
||||
}
|
||||
set reveal_fee(value: dependency_3.cosmos.base.v1beta1.Coin) {
|
||||
pb_1.Message.setWrapperField(this, 4, value);
|
||||
}
|
||||
get has_reveal_fee() {
|
||||
return pb_1.Message.getField(this, 4) != null;
|
||||
}
|
||||
get minimum_bid() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_3.cosmos.base.v1beta1.Coin, 5) as dependency_3.cosmos.base.v1beta1.Coin;
|
||||
}
|
||||
set minimum_bid(value: dependency_3.cosmos.base.v1beta1.Coin) {
|
||||
pb_1.Message.setWrapperField(this, 5, value);
|
||||
}
|
||||
get has_minimum_bid() {
|
||||
return pb_1.Message.getField(this, 5) != null;
|
||||
}
|
||||
get signer() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 6, "") as string;
|
||||
}
|
||||
set signer(value: string) {
|
||||
pb_1.Message.setField(this, 6, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
commits_duration?: ReturnType<typeof dependency_2.google.protobuf.Duration.prototype.toObject>;
|
||||
reveals_duration?: ReturnType<typeof dependency_2.google.protobuf.Duration.prototype.toObject>;
|
||||
commit_fee?: ReturnType<typeof dependency_3.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
reveal_fee?: ReturnType<typeof dependency_3.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
minimum_bid?: ReturnType<typeof dependency_3.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
signer?: string;
|
||||
}): MsgCreateAuction {
|
||||
const message = new MsgCreateAuction({});
|
||||
if (data.commits_duration != null) {
|
||||
message.commits_duration = dependency_2.google.protobuf.Duration.fromObject(data.commits_duration);
|
||||
}
|
||||
if (data.reveals_duration != null) {
|
||||
message.reveals_duration = dependency_2.google.protobuf.Duration.fromObject(data.reveals_duration);
|
||||
}
|
||||
if (data.commit_fee != null) {
|
||||
message.commit_fee = dependency_3.cosmos.base.v1beta1.Coin.fromObject(data.commit_fee);
|
||||
}
|
||||
if (data.reveal_fee != null) {
|
||||
message.reveal_fee = dependency_3.cosmos.base.v1beta1.Coin.fromObject(data.reveal_fee);
|
||||
}
|
||||
if (data.minimum_bid != null) {
|
||||
message.minimum_bid = dependency_3.cosmos.base.v1beta1.Coin.fromObject(data.minimum_bid);
|
||||
}
|
||||
if (data.signer != null) {
|
||||
message.signer = data.signer;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
commits_duration?: ReturnType<typeof dependency_2.google.protobuf.Duration.prototype.toObject>;
|
||||
reveals_duration?: ReturnType<typeof dependency_2.google.protobuf.Duration.prototype.toObject>;
|
||||
commit_fee?: ReturnType<typeof dependency_3.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
reveal_fee?: ReturnType<typeof dependency_3.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
minimum_bid?: ReturnType<typeof dependency_3.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
signer?: string;
|
||||
} = {};
|
||||
if (this.commits_duration != null) {
|
||||
data.commits_duration = this.commits_duration.toObject();
|
||||
}
|
||||
if (this.reveals_duration != null) {
|
||||
data.reveals_duration = this.reveals_duration.toObject();
|
||||
}
|
||||
if (this.commit_fee != null) {
|
||||
data.commit_fee = this.commit_fee.toObject();
|
||||
}
|
||||
if (this.reveal_fee != null) {
|
||||
data.reveal_fee = this.reveal_fee.toObject();
|
||||
}
|
||||
if (this.minimum_bid != null) {
|
||||
data.minimum_bid = this.minimum_bid.toObject();
|
||||
}
|
||||
if (this.signer != null) {
|
||||
data.signer = this.signer;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.has_commits_duration)
|
||||
writer.writeMessage(1, this.commits_duration, () => this.commits_duration.serialize(writer));
|
||||
if (this.has_reveals_duration)
|
||||
writer.writeMessage(2, this.reveals_duration, () => this.reveals_duration.serialize(writer));
|
||||
if (this.has_commit_fee)
|
||||
writer.writeMessage(3, this.commit_fee, () => this.commit_fee.serialize(writer));
|
||||
if (this.has_reveal_fee)
|
||||
writer.writeMessage(4, this.reveal_fee, () => this.reveal_fee.serialize(writer));
|
||||
if (this.has_minimum_bid)
|
||||
writer.writeMessage(5, this.minimum_bid, () => this.minimum_bid.serialize(writer));
|
||||
if (this.signer.length)
|
||||
writer.writeString(6, this.signer);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MsgCreateAuction {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new MsgCreateAuction();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.commits_duration, () => message.commits_duration = dependency_2.google.protobuf.Duration.deserialize(reader));
|
||||
break;
|
||||
case 2:
|
||||
reader.readMessage(message.reveals_duration, () => message.reveals_duration = dependency_2.google.protobuf.Duration.deserialize(reader));
|
||||
break;
|
||||
case 3:
|
||||
reader.readMessage(message.commit_fee, () => message.commit_fee = dependency_3.cosmos.base.v1beta1.Coin.deserialize(reader));
|
||||
break;
|
||||
case 4:
|
||||
reader.readMessage(message.reveal_fee, () => message.reveal_fee = dependency_3.cosmos.base.v1beta1.Coin.deserialize(reader));
|
||||
break;
|
||||
case 5:
|
||||
reader.readMessage(message.minimum_bid, () => message.minimum_bid = dependency_3.cosmos.base.v1beta1.Coin.deserialize(reader));
|
||||
break;
|
||||
case 6:
|
||||
message.signer = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): MsgCreateAuction {
|
||||
return MsgCreateAuction.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class MsgCreateAuctionResponse extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
auction?: dependency_4.vulcanize.auction.v1beta1.Auction;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("auction" in data && data.auction != undefined) {
|
||||
this.auction = data.auction;
|
||||
}
|
||||
}
|
||||
}
|
||||
get auction() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.vulcanize.auction.v1beta1.Auction, 1) as dependency_4.vulcanize.auction.v1beta1.Auction;
|
||||
}
|
||||
set auction(value: dependency_4.vulcanize.auction.v1beta1.Auction) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get has_auction() {
|
||||
return pb_1.Message.getField(this, 1) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
auction?: ReturnType<typeof dependency_4.vulcanize.auction.v1beta1.Auction.prototype.toObject>;
|
||||
}): MsgCreateAuctionResponse {
|
||||
const message = new MsgCreateAuctionResponse({});
|
||||
if (data.auction != null) {
|
||||
message.auction = dependency_4.vulcanize.auction.v1beta1.Auction.fromObject(data.auction);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
auction?: ReturnType<typeof dependency_4.vulcanize.auction.v1beta1.Auction.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.auction != null) {
|
||||
data.auction = this.auction.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.has_auction)
|
||||
writer.writeMessage(1, this.auction, () => this.auction.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MsgCreateAuctionResponse {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new MsgCreateAuctionResponse();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.auction, () => message.auction = dependency_4.vulcanize.auction.v1beta1.Auction.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): MsgCreateAuctionResponse {
|
||||
return MsgCreateAuctionResponse.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class MsgCommitBid extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
auction_id?: string;
|
||||
commit_hash?: string;
|
||||
signer?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("auction_id" in data && data.auction_id != undefined) {
|
||||
this.auction_id = data.auction_id;
|
||||
}
|
||||
if ("commit_hash" in data && data.commit_hash != undefined) {
|
||||
this.commit_hash = data.commit_hash;
|
||||
}
|
||||
if ("signer" in data && data.signer != undefined) {
|
||||
this.signer = data.signer;
|
||||
}
|
||||
}
|
||||
}
|
||||
get auction_id() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set auction_id(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get commit_hash() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
||||
}
|
||||
set commit_hash(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get signer() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
|
||||
}
|
||||
set signer(value: string) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
auction_id?: string;
|
||||
commit_hash?: string;
|
||||
signer?: string;
|
||||
}): MsgCommitBid {
|
||||
const message = new MsgCommitBid({});
|
||||
if (data.auction_id != null) {
|
||||
message.auction_id = data.auction_id;
|
||||
}
|
||||
if (data.commit_hash != null) {
|
||||
message.commit_hash = data.commit_hash;
|
||||
}
|
||||
if (data.signer != null) {
|
||||
message.signer = data.signer;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
auction_id?: string;
|
||||
commit_hash?: string;
|
||||
signer?: string;
|
||||
} = {};
|
||||
if (this.auction_id != null) {
|
||||
data.auction_id = this.auction_id;
|
||||
}
|
||||
if (this.commit_hash != null) {
|
||||
data.commit_hash = this.commit_hash;
|
||||
}
|
||||
if (this.signer != null) {
|
||||
data.signer = this.signer;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.auction_id.length)
|
||||
writer.writeString(1, this.auction_id);
|
||||
if (this.commit_hash.length)
|
||||
writer.writeString(2, this.commit_hash);
|
||||
if (this.signer.length)
|
||||
writer.writeString(3, this.signer);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MsgCommitBid {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new MsgCommitBid();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.auction_id = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.commit_hash = reader.readString();
|
||||
break;
|
||||
case 3:
|
||||
message.signer = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): MsgCommitBid {
|
||||
return MsgCommitBid.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class MsgRevealBid extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
auction_id?: string;
|
||||
reveal?: string;
|
||||
signer?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("auction_id" in data && data.auction_id != undefined) {
|
||||
this.auction_id = data.auction_id;
|
||||
}
|
||||
if ("reveal" in data && data.reveal != undefined) {
|
||||
this.reveal = data.reveal;
|
||||
}
|
||||
if ("signer" in data && data.signer != undefined) {
|
||||
this.signer = data.signer;
|
||||
}
|
||||
}
|
||||
}
|
||||
get auction_id() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set auction_id(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get reveal() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
||||
}
|
||||
set reveal(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get signer() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
|
||||
}
|
||||
set signer(value: string) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
auction_id?: string;
|
||||
reveal?: string;
|
||||
signer?: string;
|
||||
}): MsgRevealBid {
|
||||
const message = new MsgRevealBid({});
|
||||
if (data.auction_id != null) {
|
||||
message.auction_id = data.auction_id;
|
||||
}
|
||||
if (data.reveal != null) {
|
||||
message.reveal = data.reveal;
|
||||
}
|
||||
if (data.signer != null) {
|
||||
message.signer = data.signer;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
auction_id?: string;
|
||||
reveal?: string;
|
||||
signer?: string;
|
||||
} = {};
|
||||
if (this.auction_id != null) {
|
||||
data.auction_id = this.auction_id;
|
||||
}
|
||||
if (this.reveal != null) {
|
||||
data.reveal = this.reveal;
|
||||
}
|
||||
if (this.signer != null) {
|
||||
data.signer = this.signer;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.auction_id.length)
|
||||
writer.writeString(1, this.auction_id);
|
||||
if (this.reveal.length)
|
||||
writer.writeString(2, this.reveal);
|
||||
if (this.signer.length)
|
||||
writer.writeString(3, this.signer);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MsgRevealBid {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new MsgRevealBid();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.auction_id = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.reveal = reader.readString();
|
||||
break;
|
||||
case 3:
|
||||
message.signer = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): MsgRevealBid {
|
||||
return MsgRevealBid.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class MsgCommitBidResponse extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
bid?: dependency_4.vulcanize.auction.v1beta1.Bid;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("bid" in data && data.bid != undefined) {
|
||||
this.bid = data.bid;
|
||||
}
|
||||
}
|
||||
}
|
||||
get bid() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.vulcanize.auction.v1beta1.Bid, 1) as dependency_4.vulcanize.auction.v1beta1.Bid;
|
||||
}
|
||||
set bid(value: dependency_4.vulcanize.auction.v1beta1.Bid) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get has_bid() {
|
||||
return pb_1.Message.getField(this, 1) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
bid?: ReturnType<typeof dependency_4.vulcanize.auction.v1beta1.Bid.prototype.toObject>;
|
||||
}): MsgCommitBidResponse {
|
||||
const message = new MsgCommitBidResponse({});
|
||||
if (data.bid != null) {
|
||||
message.bid = dependency_4.vulcanize.auction.v1beta1.Bid.fromObject(data.bid);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
bid?: ReturnType<typeof dependency_4.vulcanize.auction.v1beta1.Bid.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.bid != null) {
|
||||
data.bid = this.bid.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.has_bid)
|
||||
writer.writeMessage(1, this.bid, () => this.bid.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MsgCommitBidResponse {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new MsgCommitBidResponse();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.bid, () => message.bid = dependency_4.vulcanize.auction.v1beta1.Bid.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): MsgCommitBidResponse {
|
||||
return MsgCommitBidResponse.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class MsgRevealBidResponse extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
auction?: dependency_4.vulcanize.auction.v1beta1.Auction;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("auction" in data && data.auction != undefined) {
|
||||
this.auction = data.auction;
|
||||
}
|
||||
}
|
||||
}
|
||||
get auction() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.vulcanize.auction.v1beta1.Auction, 1) as dependency_4.vulcanize.auction.v1beta1.Auction;
|
||||
}
|
||||
set auction(value: dependency_4.vulcanize.auction.v1beta1.Auction) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get has_auction() {
|
||||
return pb_1.Message.getField(this, 1) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
auction?: ReturnType<typeof dependency_4.vulcanize.auction.v1beta1.Auction.prototype.toObject>;
|
||||
}): MsgRevealBidResponse {
|
||||
const message = new MsgRevealBidResponse({});
|
||||
if (data.auction != null) {
|
||||
message.auction = dependency_4.vulcanize.auction.v1beta1.Auction.fromObject(data.auction);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
auction?: ReturnType<typeof dependency_4.vulcanize.auction.v1beta1.Auction.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.auction != null) {
|
||||
data.auction = this.auction.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.has_auction)
|
||||
writer.writeMessage(1, this.auction, () => this.auction.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MsgRevealBidResponse {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new MsgRevealBidResponse();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.auction, () => message.auction = dependency_4.vulcanize.auction.v1beta1.Auction.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): MsgRevealBidResponse {
|
||||
return MsgRevealBidResponse.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,865 +0,0 @@
|
||||
// @ts-nocheck
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* source: vulcanize/auction/v1beta1/types.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
import * as dependency_2 from "./../../../google/protobuf/duration";
|
||||
import * as dependency_3 from "./../../../google/protobuf/timestamp";
|
||||
import * as dependency_4 from "./../../../cosmos/base/v1beta1/coin";
|
||||
import * as pb_1 from "google-protobuf";
|
||||
export namespace vulcanize.auction.v1beta1 {
|
||||
export class Params extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
commits_duration?: dependency_2.google.protobuf.Duration;
|
||||
reveals_duration?: dependency_2.google.protobuf.Duration;
|
||||
commit_fee?: dependency_4.cosmos.base.v1beta1.Coin;
|
||||
reveal_fee?: dependency_4.cosmos.base.v1beta1.Coin;
|
||||
minimum_bid?: dependency_4.cosmos.base.v1beta1.Coin;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("commits_duration" in data && data.commits_duration != undefined) {
|
||||
this.commits_duration = data.commits_duration;
|
||||
}
|
||||
if ("reveals_duration" in data && data.reveals_duration != undefined) {
|
||||
this.reveals_duration = data.reveals_duration;
|
||||
}
|
||||
if ("commit_fee" in data && data.commit_fee != undefined) {
|
||||
this.commit_fee = data.commit_fee;
|
||||
}
|
||||
if ("reveal_fee" in data && data.reveal_fee != undefined) {
|
||||
this.reveal_fee = data.reveal_fee;
|
||||
}
|
||||
if ("minimum_bid" in data && data.minimum_bid != undefined) {
|
||||
this.minimum_bid = data.minimum_bid;
|
||||
}
|
||||
}
|
||||
}
|
||||
get commits_duration() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_2.google.protobuf.Duration, 1) as dependency_2.google.protobuf.Duration;
|
||||
}
|
||||
set commits_duration(value: dependency_2.google.protobuf.Duration) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get has_commits_duration() {
|
||||
return pb_1.Message.getField(this, 1) != null;
|
||||
}
|
||||
get reveals_duration() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_2.google.protobuf.Duration, 2) as dependency_2.google.protobuf.Duration;
|
||||
}
|
||||
set reveals_duration(value: dependency_2.google.protobuf.Duration) {
|
||||
pb_1.Message.setWrapperField(this, 2, value);
|
||||
}
|
||||
get has_reveals_duration() {
|
||||
return pb_1.Message.getField(this, 2) != null;
|
||||
}
|
||||
get commit_fee() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.cosmos.base.v1beta1.Coin, 3) as dependency_4.cosmos.base.v1beta1.Coin;
|
||||
}
|
||||
set commit_fee(value: dependency_4.cosmos.base.v1beta1.Coin) {
|
||||
pb_1.Message.setWrapperField(this, 3, value);
|
||||
}
|
||||
get has_commit_fee() {
|
||||
return pb_1.Message.getField(this, 3) != null;
|
||||
}
|
||||
get reveal_fee() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.cosmos.base.v1beta1.Coin, 4) as dependency_4.cosmos.base.v1beta1.Coin;
|
||||
}
|
||||
set reveal_fee(value: dependency_4.cosmos.base.v1beta1.Coin) {
|
||||
pb_1.Message.setWrapperField(this, 4, value);
|
||||
}
|
||||
get has_reveal_fee() {
|
||||
return pb_1.Message.getField(this, 4) != null;
|
||||
}
|
||||
get minimum_bid() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.cosmos.base.v1beta1.Coin, 5) as dependency_4.cosmos.base.v1beta1.Coin;
|
||||
}
|
||||
set minimum_bid(value: dependency_4.cosmos.base.v1beta1.Coin) {
|
||||
pb_1.Message.setWrapperField(this, 5, value);
|
||||
}
|
||||
get has_minimum_bid() {
|
||||
return pb_1.Message.getField(this, 5) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
commits_duration?: ReturnType<typeof dependency_2.google.protobuf.Duration.prototype.toObject>;
|
||||
reveals_duration?: ReturnType<typeof dependency_2.google.protobuf.Duration.prototype.toObject>;
|
||||
commit_fee?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
reveal_fee?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
minimum_bid?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
}): Params {
|
||||
const message = new Params({});
|
||||
if (data.commits_duration != null) {
|
||||
message.commits_duration = dependency_2.google.protobuf.Duration.fromObject(data.commits_duration);
|
||||
}
|
||||
if (data.reveals_duration != null) {
|
||||
message.reveals_duration = dependency_2.google.protobuf.Duration.fromObject(data.reveals_duration);
|
||||
}
|
||||
if (data.commit_fee != null) {
|
||||
message.commit_fee = dependency_4.cosmos.base.v1beta1.Coin.fromObject(data.commit_fee);
|
||||
}
|
||||
if (data.reveal_fee != null) {
|
||||
message.reveal_fee = dependency_4.cosmos.base.v1beta1.Coin.fromObject(data.reveal_fee);
|
||||
}
|
||||
if (data.minimum_bid != null) {
|
||||
message.minimum_bid = dependency_4.cosmos.base.v1beta1.Coin.fromObject(data.minimum_bid);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
commits_duration?: ReturnType<typeof dependency_2.google.protobuf.Duration.prototype.toObject>;
|
||||
reveals_duration?: ReturnType<typeof dependency_2.google.protobuf.Duration.prototype.toObject>;
|
||||
commit_fee?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
reveal_fee?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
minimum_bid?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.commits_duration != null) {
|
||||
data.commits_duration = this.commits_duration.toObject();
|
||||
}
|
||||
if (this.reveals_duration != null) {
|
||||
data.reveals_duration = this.reveals_duration.toObject();
|
||||
}
|
||||
if (this.commit_fee != null) {
|
||||
data.commit_fee = this.commit_fee.toObject();
|
||||
}
|
||||
if (this.reveal_fee != null) {
|
||||
data.reveal_fee = this.reveal_fee.toObject();
|
||||
}
|
||||
if (this.minimum_bid != null) {
|
||||
data.minimum_bid = this.minimum_bid.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.has_commits_duration)
|
||||
writer.writeMessage(1, this.commits_duration, () => this.commits_duration.serialize(writer));
|
||||
if (this.has_reveals_duration)
|
||||
writer.writeMessage(2, this.reveals_duration, () => this.reveals_duration.serialize(writer));
|
||||
if (this.has_commit_fee)
|
||||
writer.writeMessage(3, this.commit_fee, () => this.commit_fee.serialize(writer));
|
||||
if (this.has_reveal_fee)
|
||||
writer.writeMessage(4, this.reveal_fee, () => this.reveal_fee.serialize(writer));
|
||||
if (this.has_minimum_bid)
|
||||
writer.writeMessage(5, this.minimum_bid, () => this.minimum_bid.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Params {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Params();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.commits_duration, () => message.commits_duration = dependency_2.google.protobuf.Duration.deserialize(reader));
|
||||
break;
|
||||
case 2:
|
||||
reader.readMessage(message.reveals_duration, () => message.reveals_duration = dependency_2.google.protobuf.Duration.deserialize(reader));
|
||||
break;
|
||||
case 3:
|
||||
reader.readMessage(message.commit_fee, () => message.commit_fee = dependency_4.cosmos.base.v1beta1.Coin.deserialize(reader));
|
||||
break;
|
||||
case 4:
|
||||
reader.readMessage(message.reveal_fee, () => message.reveal_fee = dependency_4.cosmos.base.v1beta1.Coin.deserialize(reader));
|
||||
break;
|
||||
case 5:
|
||||
reader.readMessage(message.minimum_bid, () => message.minimum_bid = dependency_4.cosmos.base.v1beta1.Coin.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Params {
|
||||
return Params.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class Auction extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
id?: string;
|
||||
status?: string;
|
||||
owner_address?: string;
|
||||
create_time?: dependency_3.google.protobuf.Timestamp;
|
||||
commits_end_time?: dependency_3.google.protobuf.Timestamp;
|
||||
reveals_end_time?: dependency_3.google.protobuf.Timestamp;
|
||||
commit_fee?: dependency_4.cosmos.base.v1beta1.Coin;
|
||||
reveal_fee?: dependency_4.cosmos.base.v1beta1.Coin;
|
||||
minimum_bid?: dependency_4.cosmos.base.v1beta1.Coin;
|
||||
winner_address?: string;
|
||||
winning_bid?: dependency_4.cosmos.base.v1beta1.Coin;
|
||||
winning_price?: dependency_4.cosmos.base.v1beta1.Coin;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("id" in data && data.id != undefined) {
|
||||
this.id = data.id;
|
||||
}
|
||||
if ("status" in data && data.status != undefined) {
|
||||
this.status = data.status;
|
||||
}
|
||||
if ("owner_address" in data && data.owner_address != undefined) {
|
||||
this.owner_address = data.owner_address;
|
||||
}
|
||||
if ("create_time" in data && data.create_time != undefined) {
|
||||
this.create_time = data.create_time;
|
||||
}
|
||||
if ("commits_end_time" in data && data.commits_end_time != undefined) {
|
||||
this.commits_end_time = data.commits_end_time;
|
||||
}
|
||||
if ("reveals_end_time" in data && data.reveals_end_time != undefined) {
|
||||
this.reveals_end_time = data.reveals_end_time;
|
||||
}
|
||||
if ("commit_fee" in data && data.commit_fee != undefined) {
|
||||
this.commit_fee = data.commit_fee;
|
||||
}
|
||||
if ("reveal_fee" in data && data.reveal_fee != undefined) {
|
||||
this.reveal_fee = data.reveal_fee;
|
||||
}
|
||||
if ("minimum_bid" in data && data.minimum_bid != undefined) {
|
||||
this.minimum_bid = data.minimum_bid;
|
||||
}
|
||||
if ("winner_address" in data && data.winner_address != undefined) {
|
||||
this.winner_address = data.winner_address;
|
||||
}
|
||||
if ("winning_bid" in data && data.winning_bid != undefined) {
|
||||
this.winning_bid = data.winning_bid;
|
||||
}
|
||||
if ("winning_price" in data && data.winning_price != undefined) {
|
||||
this.winning_price = data.winning_price;
|
||||
}
|
||||
}
|
||||
}
|
||||
get id() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set id(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get status() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
||||
}
|
||||
set status(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get owner_address() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
|
||||
}
|
||||
set owner_address(value: string) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
get create_time() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_3.google.protobuf.Timestamp, 4) as dependency_3.google.protobuf.Timestamp;
|
||||
}
|
||||
set create_time(value: dependency_3.google.protobuf.Timestamp) {
|
||||
pb_1.Message.setWrapperField(this, 4, value);
|
||||
}
|
||||
get has_create_time() {
|
||||
return pb_1.Message.getField(this, 4) != null;
|
||||
}
|
||||
get commits_end_time() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_3.google.protobuf.Timestamp, 5) as dependency_3.google.protobuf.Timestamp;
|
||||
}
|
||||
set commits_end_time(value: dependency_3.google.protobuf.Timestamp) {
|
||||
pb_1.Message.setWrapperField(this, 5, value);
|
||||
}
|
||||
get has_commits_end_time() {
|
||||
return pb_1.Message.getField(this, 5) != null;
|
||||
}
|
||||
get reveals_end_time() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_3.google.protobuf.Timestamp, 6) as dependency_3.google.protobuf.Timestamp;
|
||||
}
|
||||
set reveals_end_time(value: dependency_3.google.protobuf.Timestamp) {
|
||||
pb_1.Message.setWrapperField(this, 6, value);
|
||||
}
|
||||
get has_reveals_end_time() {
|
||||
return pb_1.Message.getField(this, 6) != null;
|
||||
}
|
||||
get commit_fee() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.cosmos.base.v1beta1.Coin, 7) as dependency_4.cosmos.base.v1beta1.Coin;
|
||||
}
|
||||
set commit_fee(value: dependency_4.cosmos.base.v1beta1.Coin) {
|
||||
pb_1.Message.setWrapperField(this, 7, value);
|
||||
}
|
||||
get has_commit_fee() {
|
||||
return pb_1.Message.getField(this, 7) != null;
|
||||
}
|
||||
get reveal_fee() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.cosmos.base.v1beta1.Coin, 8) as dependency_4.cosmos.base.v1beta1.Coin;
|
||||
}
|
||||
set reveal_fee(value: dependency_4.cosmos.base.v1beta1.Coin) {
|
||||
pb_1.Message.setWrapperField(this, 8, value);
|
||||
}
|
||||
get has_reveal_fee() {
|
||||
return pb_1.Message.getField(this, 8) != null;
|
||||
}
|
||||
get minimum_bid() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.cosmos.base.v1beta1.Coin, 9) as dependency_4.cosmos.base.v1beta1.Coin;
|
||||
}
|
||||
set minimum_bid(value: dependency_4.cosmos.base.v1beta1.Coin) {
|
||||
pb_1.Message.setWrapperField(this, 9, value);
|
||||
}
|
||||
get has_minimum_bid() {
|
||||
return pb_1.Message.getField(this, 9) != null;
|
||||
}
|
||||
get winner_address() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 10, "") as string;
|
||||
}
|
||||
set winner_address(value: string) {
|
||||
pb_1.Message.setField(this, 10, value);
|
||||
}
|
||||
get winning_bid() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.cosmos.base.v1beta1.Coin, 11) as dependency_4.cosmos.base.v1beta1.Coin;
|
||||
}
|
||||
set winning_bid(value: dependency_4.cosmos.base.v1beta1.Coin) {
|
||||
pb_1.Message.setWrapperField(this, 11, value);
|
||||
}
|
||||
get has_winning_bid() {
|
||||
return pb_1.Message.getField(this, 11) != null;
|
||||
}
|
||||
get winning_price() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.cosmos.base.v1beta1.Coin, 12) as dependency_4.cosmos.base.v1beta1.Coin;
|
||||
}
|
||||
set winning_price(value: dependency_4.cosmos.base.v1beta1.Coin) {
|
||||
pb_1.Message.setWrapperField(this, 12, value);
|
||||
}
|
||||
get has_winning_price() {
|
||||
return pb_1.Message.getField(this, 12) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
id?: string;
|
||||
status?: string;
|
||||
owner_address?: string;
|
||||
create_time?: ReturnType<typeof dependency_3.google.protobuf.Timestamp.prototype.toObject>;
|
||||
commits_end_time?: ReturnType<typeof dependency_3.google.protobuf.Timestamp.prototype.toObject>;
|
||||
reveals_end_time?: ReturnType<typeof dependency_3.google.protobuf.Timestamp.prototype.toObject>;
|
||||
commit_fee?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
reveal_fee?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
minimum_bid?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
winner_address?: string;
|
||||
winning_bid?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
winning_price?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
}): Auction {
|
||||
const message = new Auction({});
|
||||
if (data.id != null) {
|
||||
message.id = data.id;
|
||||
}
|
||||
if (data.status != null) {
|
||||
message.status = data.status;
|
||||
}
|
||||
if (data.owner_address != null) {
|
||||
message.owner_address = data.owner_address;
|
||||
}
|
||||
if (data.create_time != null) {
|
||||
message.create_time = dependency_3.google.protobuf.Timestamp.fromObject(data.create_time);
|
||||
}
|
||||
if (data.commits_end_time != null) {
|
||||
message.commits_end_time = dependency_3.google.protobuf.Timestamp.fromObject(data.commits_end_time);
|
||||
}
|
||||
if (data.reveals_end_time != null) {
|
||||
message.reveals_end_time = dependency_3.google.protobuf.Timestamp.fromObject(data.reveals_end_time);
|
||||
}
|
||||
if (data.commit_fee != null) {
|
||||
message.commit_fee = dependency_4.cosmos.base.v1beta1.Coin.fromObject(data.commit_fee);
|
||||
}
|
||||
if (data.reveal_fee != null) {
|
||||
message.reveal_fee = dependency_4.cosmos.base.v1beta1.Coin.fromObject(data.reveal_fee);
|
||||
}
|
||||
if (data.minimum_bid != null) {
|
||||
message.minimum_bid = dependency_4.cosmos.base.v1beta1.Coin.fromObject(data.minimum_bid);
|
||||
}
|
||||
if (data.winner_address != null) {
|
||||
message.winner_address = data.winner_address;
|
||||
}
|
||||
if (data.winning_bid != null) {
|
||||
message.winning_bid = dependency_4.cosmos.base.v1beta1.Coin.fromObject(data.winning_bid);
|
||||
}
|
||||
if (data.winning_price != null) {
|
||||
message.winning_price = dependency_4.cosmos.base.v1beta1.Coin.fromObject(data.winning_price);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
id?: string;
|
||||
status?: string;
|
||||
owner_address?: string;
|
||||
create_time?: ReturnType<typeof dependency_3.google.protobuf.Timestamp.prototype.toObject>;
|
||||
commits_end_time?: ReturnType<typeof dependency_3.google.protobuf.Timestamp.prototype.toObject>;
|
||||
reveals_end_time?: ReturnType<typeof dependency_3.google.protobuf.Timestamp.prototype.toObject>;
|
||||
commit_fee?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
reveal_fee?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
minimum_bid?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
winner_address?: string;
|
||||
winning_bid?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
winning_price?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.id != null) {
|
||||
data.id = this.id;
|
||||
}
|
||||
if (this.status != null) {
|
||||
data.status = this.status;
|
||||
}
|
||||
if (this.owner_address != null) {
|
||||
data.owner_address = this.owner_address;
|
||||
}
|
||||
if (this.create_time != null) {
|
||||
data.create_time = this.create_time.toObject();
|
||||
}
|
||||
if (this.commits_end_time != null) {
|
||||
data.commits_end_time = this.commits_end_time.toObject();
|
||||
}
|
||||
if (this.reveals_end_time != null) {
|
||||
data.reveals_end_time = this.reveals_end_time.toObject();
|
||||
}
|
||||
if (this.commit_fee != null) {
|
||||
data.commit_fee = this.commit_fee.toObject();
|
||||
}
|
||||
if (this.reveal_fee != null) {
|
||||
data.reveal_fee = this.reveal_fee.toObject();
|
||||
}
|
||||
if (this.minimum_bid != null) {
|
||||
data.minimum_bid = this.minimum_bid.toObject();
|
||||
}
|
||||
if (this.winner_address != null) {
|
||||
data.winner_address = this.winner_address;
|
||||
}
|
||||
if (this.winning_bid != null) {
|
||||
data.winning_bid = this.winning_bid.toObject();
|
||||
}
|
||||
if (this.winning_price != null) {
|
||||
data.winning_price = this.winning_price.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.id.length)
|
||||
writer.writeString(1, this.id);
|
||||
if (this.status.length)
|
||||
writer.writeString(2, this.status);
|
||||
if (this.owner_address.length)
|
||||
writer.writeString(3, this.owner_address);
|
||||
if (this.has_create_time)
|
||||
writer.writeMessage(4, this.create_time, () => this.create_time.serialize(writer));
|
||||
if (this.has_commits_end_time)
|
||||
writer.writeMessage(5, this.commits_end_time, () => this.commits_end_time.serialize(writer));
|
||||
if (this.has_reveals_end_time)
|
||||
writer.writeMessage(6, this.reveals_end_time, () => this.reveals_end_time.serialize(writer));
|
||||
if (this.has_commit_fee)
|
||||
writer.writeMessage(7, this.commit_fee, () => this.commit_fee.serialize(writer));
|
||||
if (this.has_reveal_fee)
|
||||
writer.writeMessage(8, this.reveal_fee, () => this.reveal_fee.serialize(writer));
|
||||
if (this.has_minimum_bid)
|
||||
writer.writeMessage(9, this.minimum_bid, () => this.minimum_bid.serialize(writer));
|
||||
if (this.winner_address.length)
|
||||
writer.writeString(10, this.winner_address);
|
||||
if (this.has_winning_bid)
|
||||
writer.writeMessage(11, this.winning_bid, () => this.winning_bid.serialize(writer));
|
||||
if (this.has_winning_price)
|
||||
writer.writeMessage(12, this.winning_price, () => this.winning_price.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Auction {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Auction();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.id = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.status = reader.readString();
|
||||
break;
|
||||
case 3:
|
||||
message.owner_address = reader.readString();
|
||||
break;
|
||||
case 4:
|
||||
reader.readMessage(message.create_time, () => message.create_time = dependency_3.google.protobuf.Timestamp.deserialize(reader));
|
||||
break;
|
||||
case 5:
|
||||
reader.readMessage(message.commits_end_time, () => message.commits_end_time = dependency_3.google.protobuf.Timestamp.deserialize(reader));
|
||||
break;
|
||||
case 6:
|
||||
reader.readMessage(message.reveals_end_time, () => message.reveals_end_time = dependency_3.google.protobuf.Timestamp.deserialize(reader));
|
||||
break;
|
||||
case 7:
|
||||
reader.readMessage(message.commit_fee, () => message.commit_fee = dependency_4.cosmos.base.v1beta1.Coin.deserialize(reader));
|
||||
break;
|
||||
case 8:
|
||||
reader.readMessage(message.reveal_fee, () => message.reveal_fee = dependency_4.cosmos.base.v1beta1.Coin.deserialize(reader));
|
||||
break;
|
||||
case 9:
|
||||
reader.readMessage(message.minimum_bid, () => message.minimum_bid = dependency_4.cosmos.base.v1beta1.Coin.deserialize(reader));
|
||||
break;
|
||||
case 10:
|
||||
message.winner_address = reader.readString();
|
||||
break;
|
||||
case 11:
|
||||
reader.readMessage(message.winning_bid, () => message.winning_bid = dependency_4.cosmos.base.v1beta1.Coin.deserialize(reader));
|
||||
break;
|
||||
case 12:
|
||||
reader.readMessage(message.winning_price, () => message.winning_price = dependency_4.cosmos.base.v1beta1.Coin.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Auction {
|
||||
return Auction.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class Auctions extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
auctions?: Auction[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("auctions" in data && data.auctions != undefined) {
|
||||
this.auctions = data.auctions;
|
||||
}
|
||||
}
|
||||
}
|
||||
get auctions() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, Auction, 1) as Auction[];
|
||||
}
|
||||
set auctions(value: Auction[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 1, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
auctions?: ReturnType<typeof Auction.prototype.toObject>[];
|
||||
}): Auctions {
|
||||
const message = new Auctions({});
|
||||
if (data.auctions != null) {
|
||||
message.auctions = data.auctions.map(item => Auction.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
auctions?: ReturnType<typeof Auction.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.auctions != null) {
|
||||
data.auctions = this.auctions.map((item: Auction) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.auctions.length)
|
||||
writer.writeRepeatedMessage(1, this.auctions, (item: Auction) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Auctions {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Auctions();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.auctions, () => pb_1.Message.addToRepeatedWrapperField(message, 1, Auction.deserialize(reader), Auction));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Auctions {
|
||||
return Auctions.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class Bid extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
auction_id?: string;
|
||||
bidder_address?: string;
|
||||
status?: string;
|
||||
commit_hash?: string;
|
||||
commit_time?: dependency_3.google.protobuf.Timestamp;
|
||||
commit_fee?: dependency_4.cosmos.base.v1beta1.Coin;
|
||||
reveal_time?: dependency_3.google.protobuf.Timestamp;
|
||||
reveal_fee?: dependency_4.cosmos.base.v1beta1.Coin;
|
||||
bid_amount?: dependency_4.cosmos.base.v1beta1.Coin;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("auction_id" in data && data.auction_id != undefined) {
|
||||
this.auction_id = data.auction_id;
|
||||
}
|
||||
if ("bidder_address" in data && data.bidder_address != undefined) {
|
||||
this.bidder_address = data.bidder_address;
|
||||
}
|
||||
if ("status" in data && data.status != undefined) {
|
||||
this.status = data.status;
|
||||
}
|
||||
if ("commit_hash" in data && data.commit_hash != undefined) {
|
||||
this.commit_hash = data.commit_hash;
|
||||
}
|
||||
if ("commit_time" in data && data.commit_time != undefined) {
|
||||
this.commit_time = data.commit_time;
|
||||
}
|
||||
if ("commit_fee" in data && data.commit_fee != undefined) {
|
||||
this.commit_fee = data.commit_fee;
|
||||
}
|
||||
if ("reveal_time" in data && data.reveal_time != undefined) {
|
||||
this.reveal_time = data.reveal_time;
|
||||
}
|
||||
if ("reveal_fee" in data && data.reveal_fee != undefined) {
|
||||
this.reveal_fee = data.reveal_fee;
|
||||
}
|
||||
if ("bid_amount" in data && data.bid_amount != undefined) {
|
||||
this.bid_amount = data.bid_amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
get auction_id() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set auction_id(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get bidder_address() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
||||
}
|
||||
set bidder_address(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get status() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
|
||||
}
|
||||
set status(value: string) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
get commit_hash() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
|
||||
}
|
||||
set commit_hash(value: string) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get commit_time() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_3.google.protobuf.Timestamp, 5) as dependency_3.google.protobuf.Timestamp;
|
||||
}
|
||||
set commit_time(value: dependency_3.google.protobuf.Timestamp) {
|
||||
pb_1.Message.setWrapperField(this, 5, value);
|
||||
}
|
||||
get has_commit_time() {
|
||||
return pb_1.Message.getField(this, 5) != null;
|
||||
}
|
||||
get commit_fee() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.cosmos.base.v1beta1.Coin, 6) as dependency_4.cosmos.base.v1beta1.Coin;
|
||||
}
|
||||
set commit_fee(value: dependency_4.cosmos.base.v1beta1.Coin) {
|
||||
pb_1.Message.setWrapperField(this, 6, value);
|
||||
}
|
||||
get has_commit_fee() {
|
||||
return pb_1.Message.getField(this, 6) != null;
|
||||
}
|
||||
get reveal_time() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_3.google.protobuf.Timestamp, 7) as dependency_3.google.protobuf.Timestamp;
|
||||
}
|
||||
set reveal_time(value: dependency_3.google.protobuf.Timestamp) {
|
||||
pb_1.Message.setWrapperField(this, 7, value);
|
||||
}
|
||||
get has_reveal_time() {
|
||||
return pb_1.Message.getField(this, 7) != null;
|
||||
}
|
||||
get reveal_fee() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.cosmos.base.v1beta1.Coin, 8) as dependency_4.cosmos.base.v1beta1.Coin;
|
||||
}
|
||||
set reveal_fee(value: dependency_4.cosmos.base.v1beta1.Coin) {
|
||||
pb_1.Message.setWrapperField(this, 8, value);
|
||||
}
|
||||
get has_reveal_fee() {
|
||||
return pb_1.Message.getField(this, 8) != null;
|
||||
}
|
||||
get bid_amount() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.cosmos.base.v1beta1.Coin, 9) as dependency_4.cosmos.base.v1beta1.Coin;
|
||||
}
|
||||
set bid_amount(value: dependency_4.cosmos.base.v1beta1.Coin) {
|
||||
pb_1.Message.setWrapperField(this, 9, value);
|
||||
}
|
||||
get has_bid_amount() {
|
||||
return pb_1.Message.getField(this, 9) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
auction_id?: string;
|
||||
bidder_address?: string;
|
||||
status?: string;
|
||||
commit_hash?: string;
|
||||
commit_time?: ReturnType<typeof dependency_3.google.protobuf.Timestamp.prototype.toObject>;
|
||||
commit_fee?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
reveal_time?: ReturnType<typeof dependency_3.google.protobuf.Timestamp.prototype.toObject>;
|
||||
reveal_fee?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
bid_amount?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
}): Bid {
|
||||
const message = new Bid({});
|
||||
if (data.auction_id != null) {
|
||||
message.auction_id = data.auction_id;
|
||||
}
|
||||
if (data.bidder_address != null) {
|
||||
message.bidder_address = data.bidder_address;
|
||||
}
|
||||
if (data.status != null) {
|
||||
message.status = data.status;
|
||||
}
|
||||
if (data.commit_hash != null) {
|
||||
message.commit_hash = data.commit_hash;
|
||||
}
|
||||
if (data.commit_time != null) {
|
||||
message.commit_time = dependency_3.google.protobuf.Timestamp.fromObject(data.commit_time);
|
||||
}
|
||||
if (data.commit_fee != null) {
|
||||
message.commit_fee = dependency_4.cosmos.base.v1beta1.Coin.fromObject(data.commit_fee);
|
||||
}
|
||||
if (data.reveal_time != null) {
|
||||
message.reveal_time = dependency_3.google.protobuf.Timestamp.fromObject(data.reveal_time);
|
||||
}
|
||||
if (data.reveal_fee != null) {
|
||||
message.reveal_fee = dependency_4.cosmos.base.v1beta1.Coin.fromObject(data.reveal_fee);
|
||||
}
|
||||
if (data.bid_amount != null) {
|
||||
message.bid_amount = dependency_4.cosmos.base.v1beta1.Coin.fromObject(data.bid_amount);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
auction_id?: string;
|
||||
bidder_address?: string;
|
||||
status?: string;
|
||||
commit_hash?: string;
|
||||
commit_time?: ReturnType<typeof dependency_3.google.protobuf.Timestamp.prototype.toObject>;
|
||||
commit_fee?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
reveal_time?: ReturnType<typeof dependency_3.google.protobuf.Timestamp.prototype.toObject>;
|
||||
reveal_fee?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
bid_amount?: ReturnType<typeof dependency_4.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.auction_id != null) {
|
||||
data.auction_id = this.auction_id;
|
||||
}
|
||||
if (this.bidder_address != null) {
|
||||
data.bidder_address = this.bidder_address;
|
||||
}
|
||||
if (this.status != null) {
|
||||
data.status = this.status;
|
||||
}
|
||||
if (this.commit_hash != null) {
|
||||
data.commit_hash = this.commit_hash;
|
||||
}
|
||||
if (this.commit_time != null) {
|
||||
data.commit_time = this.commit_time.toObject();
|
||||
}
|
||||
if (this.commit_fee != null) {
|
||||
data.commit_fee = this.commit_fee.toObject();
|
||||
}
|
||||
if (this.reveal_time != null) {
|
||||
data.reveal_time = this.reveal_time.toObject();
|
||||
}
|
||||
if (this.reveal_fee != null) {
|
||||
data.reveal_fee = this.reveal_fee.toObject();
|
||||
}
|
||||
if (this.bid_amount != null) {
|
||||
data.bid_amount = this.bid_amount.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.auction_id.length)
|
||||
writer.writeString(1, this.auction_id);
|
||||
if (this.bidder_address.length)
|
||||
writer.writeString(2, this.bidder_address);
|
||||
if (this.status.length)
|
||||
writer.writeString(3, this.status);
|
||||
if (this.commit_hash.length)
|
||||
writer.writeString(4, this.commit_hash);
|
||||
if (this.has_commit_time)
|
||||
writer.writeMessage(5, this.commit_time, () => this.commit_time.serialize(writer));
|
||||
if (this.has_commit_fee)
|
||||
writer.writeMessage(6, this.commit_fee, () => this.commit_fee.serialize(writer));
|
||||
if (this.has_reveal_time)
|
||||
writer.writeMessage(7, this.reveal_time, () => this.reveal_time.serialize(writer));
|
||||
if (this.has_reveal_fee)
|
||||
writer.writeMessage(8, this.reveal_fee, () => this.reveal_fee.serialize(writer));
|
||||
if (this.has_bid_amount)
|
||||
writer.writeMessage(9, this.bid_amount, () => this.bid_amount.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Bid {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Bid();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.auction_id = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.bidder_address = reader.readString();
|
||||
break;
|
||||
case 3:
|
||||
message.status = reader.readString();
|
||||
break;
|
||||
case 4:
|
||||
message.commit_hash = reader.readString();
|
||||
break;
|
||||
case 5:
|
||||
reader.readMessage(message.commit_time, () => message.commit_time = dependency_3.google.protobuf.Timestamp.deserialize(reader));
|
||||
break;
|
||||
case 6:
|
||||
reader.readMessage(message.commit_fee, () => message.commit_fee = dependency_4.cosmos.base.v1beta1.Coin.deserialize(reader));
|
||||
break;
|
||||
case 7:
|
||||
reader.readMessage(message.reveal_time, () => message.reveal_time = dependency_3.google.protobuf.Timestamp.deserialize(reader));
|
||||
break;
|
||||
case 8:
|
||||
reader.readMessage(message.reveal_fee, () => message.reveal_fee = dependency_4.cosmos.base.v1beta1.Coin.deserialize(reader));
|
||||
break;
|
||||
case 9:
|
||||
reader.readMessage(message.bid_amount, () => message.bid_amount = dependency_4.cosmos.base.v1beta1.Coin.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Bid {
|
||||
return Bid.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,195 +0,0 @@
|
||||
// @ts-nocheck
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* source: vulcanize/bond/v1beta1/bond.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
import * as dependency_2 from "./../../../cosmos/base/v1beta1/coin";
|
||||
import * as pb_1 from "google-protobuf";
|
||||
export namespace vulcanize.bond.v1beta1 {
|
||||
export class Params extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
max_bond_amount?: dependency_2.cosmos.base.v1beta1.Coin;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("max_bond_amount" in data && data.max_bond_amount != undefined) {
|
||||
this.max_bond_amount = data.max_bond_amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
get max_bond_amount() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_2.cosmos.base.v1beta1.Coin, 1) as dependency_2.cosmos.base.v1beta1.Coin;
|
||||
}
|
||||
set max_bond_amount(value: dependency_2.cosmos.base.v1beta1.Coin) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get has_max_bond_amount() {
|
||||
return pb_1.Message.getField(this, 1) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
max_bond_amount?: ReturnType<typeof dependency_2.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
}): Params {
|
||||
const message = new Params({});
|
||||
if (data.max_bond_amount != null) {
|
||||
message.max_bond_amount = dependency_2.cosmos.base.v1beta1.Coin.fromObject(data.max_bond_amount);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
max_bond_amount?: ReturnType<typeof dependency_2.cosmos.base.v1beta1.Coin.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.max_bond_amount != null) {
|
||||
data.max_bond_amount = this.max_bond_amount.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.has_max_bond_amount)
|
||||
writer.writeMessage(1, this.max_bond_amount, () => this.max_bond_amount.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Params {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Params();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.max_bond_amount, () => message.max_bond_amount = dependency_2.cosmos.base.v1beta1.Coin.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Params {
|
||||
return Params.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class Bond extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
id?: string;
|
||||
owner?: string;
|
||||
balance?: dependency_2.cosmos.base.v1beta1.Coin[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("id" in data && data.id != undefined) {
|
||||
this.id = data.id;
|
||||
}
|
||||
if ("owner" in data && data.owner != undefined) {
|
||||
this.owner = data.owner;
|
||||
}
|
||||
if ("balance" in data && data.balance != undefined) {
|
||||
this.balance = data.balance;
|
||||
}
|
||||
}
|
||||
}
|
||||
get id() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set id(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get owner() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
||||
}
|
||||
set owner(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get balance() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, dependency_2.cosmos.base.v1beta1.Coin, 3) as dependency_2.cosmos.base.v1beta1.Coin[];
|
||||
}
|
||||
set balance(value: dependency_2.cosmos.base.v1beta1.Coin[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 3, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
id?: string;
|
||||
owner?: string;
|
||||
balance?: ReturnType<typeof dependency_2.cosmos.base.v1beta1.Coin.prototype.toObject>[];
|
||||
}): Bond {
|
||||
const message = new Bond({});
|
||||
if (data.id != null) {
|
||||
message.id = data.id;
|
||||
}
|
||||
if (data.owner != null) {
|
||||
message.owner = data.owner;
|
||||
}
|
||||
if (data.balance != null) {
|
||||
message.balance = data.balance.map(item => dependency_2.cosmos.base.v1beta1.Coin.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
id?: string;
|
||||
owner?: string;
|
||||
balance?: ReturnType<typeof dependency_2.cosmos.base.v1beta1.Coin.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.id != null) {
|
||||
data.id = this.id;
|
||||
}
|
||||
if (this.owner != null) {
|
||||
data.owner = this.owner;
|
||||
}
|
||||
if (this.balance != null) {
|
||||
data.balance = this.balance.map((item: dependency_2.cosmos.base.v1beta1.Coin) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.id.length)
|
||||
writer.writeString(1, this.id);
|
||||
if (this.owner.length)
|
||||
writer.writeString(2, this.owner);
|
||||
if (this.balance.length)
|
||||
writer.writeRepeatedMessage(3, this.balance, (item: dependency_2.cosmos.base.v1beta1.Coin) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Bond {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Bond();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.id = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.owner = reader.readString();
|
||||
break;
|
||||
case 3:
|
||||
reader.readMessage(message.balance, () => pb_1.Message.addToRepeatedWrapperField(message, 3, dependency_2.cosmos.base.v1beta1.Coin.deserialize(reader), dependency_2.cosmos.base.v1beta1.Coin));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Bond {
|
||||
return Bond.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
// @ts-nocheck
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* source: vulcanize/bond/v1beta1/genesis.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
import * as dependency_2 from "./bond";
|
||||
import * as pb_1 from "google-protobuf";
|
||||
export namespace vulcanize.bond.v1beta1 {
|
||||
export class GenesisState extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
params?: dependency_2.vulcanize.bond.v1beta1.Params;
|
||||
bonds?: dependency_2.vulcanize.bond.v1beta1.Bond[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("params" in data && data.params != undefined) {
|
||||
this.params = data.params;
|
||||
}
|
||||
if ("bonds" in data && data.bonds != undefined) {
|
||||
this.bonds = data.bonds;
|
||||
}
|
||||
}
|
||||
}
|
||||
get params() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_2.vulcanize.bond.v1beta1.Params, 1) as dependency_2.vulcanize.bond.v1beta1.Params;
|
||||
}
|
||||
set params(value: dependency_2.vulcanize.bond.v1beta1.Params) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get has_params() {
|
||||
return pb_1.Message.getField(this, 1) != null;
|
||||
}
|
||||
get bonds() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, dependency_2.vulcanize.bond.v1beta1.Bond, 2) as dependency_2.vulcanize.bond.v1beta1.Bond[];
|
||||
}
|
||||
set bonds(value: dependency_2.vulcanize.bond.v1beta1.Bond[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 2, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
params?: ReturnType<typeof dependency_2.vulcanize.bond.v1beta1.Params.prototype.toObject>;
|
||||
bonds?: ReturnType<typeof dependency_2.vulcanize.bond.v1beta1.Bond.prototype.toObject>[];
|
||||
}): GenesisState {
|
||||
const message = new GenesisState({});
|
||||
if (data.params != null) {
|
||||
message.params = dependency_2.vulcanize.bond.v1beta1.Params.fromObject(data.params);
|
||||
}
|
||||
if (data.bonds != null) {
|
||||
message.bonds = data.bonds.map(item => dependency_2.vulcanize.bond.v1beta1.Bond.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
params?: ReturnType<typeof dependency_2.vulcanize.bond.v1beta1.Params.prototype.toObject>;
|
||||
bonds?: ReturnType<typeof dependency_2.vulcanize.bond.v1beta1.Bond.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.params != null) {
|
||||
data.params = this.params.toObject();
|
||||
}
|
||||
if (this.bonds != null) {
|
||||
data.bonds = this.bonds.map((item: dependency_2.vulcanize.bond.v1beta1.Bond) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.has_params)
|
||||
writer.writeMessage(1, this.params, () => this.params.serialize(writer));
|
||||
if (this.bonds.length)
|
||||
writer.writeRepeatedMessage(2, this.bonds, (item: dependency_2.vulcanize.bond.v1beta1.Bond) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): GenesisState {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new GenesisState();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.params, () => message.params = dependency_2.vulcanize.bond.v1beta1.Params.deserialize(reader));
|
||||
break;
|
||||
case 2:
|
||||
reader.readMessage(message.bonds, () => pb_1.Message.addToRepeatedWrapperField(message, 2, dependency_2.vulcanize.bond.v1beta1.Bond.deserialize(reader), dependency_2.vulcanize.bond.v1beta1.Bond));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): GenesisState {
|
||||
return GenesisState.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,718 +0,0 @@
|
||||
// @ts-nocheck
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* source: vulcanize/bond/v1beta1/query.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
import * as dependency_2 from "./bond";
|
||||
import * as dependency_3 from "./../../../google/api/annotations";
|
||||
import * as dependency_4 from "./../../../cosmos/base/query/v1beta1/pagination";
|
||||
import * as dependency_5 from "./../../../cosmos/base/v1beta1/coin";
|
||||
import * as pb_1 from "google-protobuf";
|
||||
export namespace vulcanize.bond.v1beta1 {
|
||||
export class QueryParamsRequest extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") { }
|
||||
}
|
||||
static fromObject(data: {}): QueryParamsRequest {
|
||||
const message = new QueryParamsRequest({});
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {} = {};
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryParamsRequest {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryParamsRequest();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): QueryParamsRequest {
|
||||
return QueryParamsRequest.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class QueryParamsResponse extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
params?: dependency_2.vulcanize.bond.v1beta1.Params;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("params" in data && data.params != undefined) {
|
||||
this.params = data.params;
|
||||
}
|
||||
}
|
||||
}
|
||||
get params() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_2.vulcanize.bond.v1beta1.Params, 1) as dependency_2.vulcanize.bond.v1beta1.Params;
|
||||
}
|
||||
set params(value: dependency_2.vulcanize.bond.v1beta1.Params) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get has_params() {
|
||||
return pb_1.Message.getField(this, 1) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
params?: ReturnType<typeof dependency_2.vulcanize.bond.v1beta1.Params.prototype.toObject>;
|
||||
}): QueryParamsResponse {
|
||||
const message = new QueryParamsResponse({});
|
||||
if (data.params != null) {
|
||||
message.params = dependency_2.vulcanize.bond.v1beta1.Params.fromObject(data.params);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
params?: ReturnType<typeof dependency_2.vulcanize.bond.v1beta1.Params.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.params != null) {
|
||||
data.params = this.params.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.has_params)
|
||||
writer.writeMessage(1, this.params, () => this.params.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryParamsResponse {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryParamsResponse();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.params, () => message.params = dependency_2.vulcanize.bond.v1beta1.Params.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): QueryParamsResponse {
|
||||
return QueryParamsResponse.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class QueryGetBondsRequest extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
pagination?: dependency_4.cosmos.base.query.v1beta1.PageRequest;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("pagination" in data && data.pagination != undefined) {
|
||||
this.pagination = data.pagination;
|
||||
}
|
||||
}
|
||||
}
|
||||
get pagination() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.cosmos.base.query.v1beta1.PageRequest, 1) as dependency_4.cosmos.base.query.v1beta1.PageRequest;
|
||||
}
|
||||
set pagination(value: dependency_4.cosmos.base.query.v1beta1.PageRequest) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get has_pagination() {
|
||||
return pb_1.Message.getField(this, 1) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
pagination?: ReturnType<typeof dependency_4.cosmos.base.query.v1beta1.PageRequest.prototype.toObject>;
|
||||
}): QueryGetBondsRequest {
|
||||
const message = new QueryGetBondsRequest({});
|
||||
if (data.pagination != null) {
|
||||
message.pagination = dependency_4.cosmos.base.query.v1beta1.PageRequest.fromObject(data.pagination);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
pagination?: ReturnType<typeof dependency_4.cosmos.base.query.v1beta1.PageRequest.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.pagination != null) {
|
||||
data.pagination = this.pagination.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.has_pagination)
|
||||
writer.writeMessage(1, this.pagination, () => this.pagination.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryGetBondsRequest {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryGetBondsRequest();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.pagination, () => message.pagination = dependency_4.cosmos.base.query.v1beta1.PageRequest.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): QueryGetBondsRequest {
|
||||
return QueryGetBondsRequest.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class QueryGetBondsResponse extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
bonds?: dependency_2.vulcanize.bond.v1beta1.Bond[];
|
||||
pagination?: dependency_4.cosmos.base.query.v1beta1.PageResponse;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("bonds" in data && data.bonds != undefined) {
|
||||
this.bonds = data.bonds;
|
||||
}
|
||||
if ("pagination" in data && data.pagination != undefined) {
|
||||
this.pagination = data.pagination;
|
||||
}
|
||||
}
|
||||
}
|
||||
get bonds() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, dependency_2.vulcanize.bond.v1beta1.Bond, 1) as dependency_2.vulcanize.bond.v1beta1.Bond[];
|
||||
}
|
||||
set bonds(value: dependency_2.vulcanize.bond.v1beta1.Bond[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 1, value);
|
||||
}
|
||||
get pagination() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.cosmos.base.query.v1beta1.PageResponse, 2) as dependency_4.cosmos.base.query.v1beta1.PageResponse;
|
||||
}
|
||||
set pagination(value: dependency_4.cosmos.base.query.v1beta1.PageResponse) {
|
||||
pb_1.Message.setWrapperField(this, 2, value);
|
||||
}
|
||||
get has_pagination() {
|
||||
return pb_1.Message.getField(this, 2) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
bonds?: ReturnType<typeof dependency_2.vulcanize.bond.v1beta1.Bond.prototype.toObject>[];
|
||||
pagination?: ReturnType<typeof dependency_4.cosmos.base.query.v1beta1.PageResponse.prototype.toObject>;
|
||||
}): QueryGetBondsResponse {
|
||||
const message = new QueryGetBondsResponse({});
|
||||
if (data.bonds != null) {
|
||||
message.bonds = data.bonds.map(item => dependency_2.vulcanize.bond.v1beta1.Bond.fromObject(item));
|
||||
}
|
||||
if (data.pagination != null) {
|
||||
message.pagination = dependency_4.cosmos.base.query.v1beta1.PageResponse.fromObject(data.pagination);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
bonds?: ReturnType<typeof dependency_2.vulcanize.bond.v1beta1.Bond.prototype.toObject>[];
|
||||
pagination?: ReturnType<typeof dependency_4.cosmos.base.query.v1beta1.PageResponse.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.bonds != null) {
|
||||
data.bonds = this.bonds.map((item: dependency_2.vulcanize.bond.v1beta1.Bond) => item.toObject());
|
||||
}
|
||||
if (this.pagination != null) {
|
||||
data.pagination = this.pagination.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.bonds.length)
|
||||
writer.writeRepeatedMessage(1, this.bonds, (item: dependency_2.vulcanize.bond.v1beta1.Bond) => item.serialize(writer));
|
||||
if (this.has_pagination)
|
||||
writer.writeMessage(2, this.pagination, () => this.pagination.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryGetBondsResponse {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryGetBondsResponse();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.bonds, () => pb_1.Message.addToRepeatedWrapperField(message, 1, dependency_2.vulcanize.bond.v1beta1.Bond.deserialize(reader), dependency_2.vulcanize.bond.v1beta1.Bond));
|
||||
break;
|
||||
case 2:
|
||||
reader.readMessage(message.pagination, () => message.pagination = dependency_4.cosmos.base.query.v1beta1.PageResponse.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): QueryGetBondsResponse {
|
||||
return QueryGetBondsResponse.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class QueryGetBondByIdRequest extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
id?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("id" in data && data.id != undefined) {
|
||||
this.id = data.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
get id() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set id(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
id?: string;
|
||||
}): QueryGetBondByIdRequest {
|
||||
const message = new QueryGetBondByIdRequest({});
|
||||
if (data.id != null) {
|
||||
message.id = data.id;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
id?: string;
|
||||
} = {};
|
||||
if (this.id != null) {
|
||||
data.id = this.id;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.id.length)
|
||||
writer.writeString(1, this.id);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryGetBondByIdRequest {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryGetBondByIdRequest();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.id = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): QueryGetBondByIdRequest {
|
||||
return QueryGetBondByIdRequest.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class QueryGetBondByIdResponse extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
bond?: dependency_2.vulcanize.bond.v1beta1.Bond;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("bond" in data && data.bond != undefined) {
|
||||
this.bond = data.bond;
|
||||
}
|
||||
}
|
||||
}
|
||||
get bond() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_2.vulcanize.bond.v1beta1.Bond, 1) as dependency_2.vulcanize.bond.v1beta1.Bond;
|
||||
}
|
||||
set bond(value: dependency_2.vulcanize.bond.v1beta1.Bond) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get has_bond() {
|
||||
return pb_1.Message.getField(this, 1) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
bond?: ReturnType<typeof dependency_2.vulcanize.bond.v1beta1.Bond.prototype.toObject>;
|
||||
}): QueryGetBondByIdResponse {
|
||||
const message = new QueryGetBondByIdResponse({});
|
||||
if (data.bond != null) {
|
||||
message.bond = dependency_2.vulcanize.bond.v1beta1.Bond.fromObject(data.bond);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
bond?: ReturnType<typeof dependency_2.vulcanize.bond.v1beta1.Bond.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.bond != null) {
|
||||
data.bond = this.bond.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.has_bond)
|
||||
writer.writeMessage(1, this.bond, () => this.bond.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryGetBondByIdResponse {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryGetBondByIdResponse();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.bond, () => message.bond = dependency_2.vulcanize.bond.v1beta1.Bond.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): QueryGetBondByIdResponse {
|
||||
return QueryGetBondByIdResponse.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class QueryGetBondsByOwnerRequest extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
owner?: string;
|
||||
pagination?: dependency_4.cosmos.base.query.v1beta1.PageResponse;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("owner" in data && data.owner != undefined) {
|
||||
this.owner = data.owner;
|
||||
}
|
||||
if ("pagination" in data && data.pagination != undefined) {
|
||||
this.pagination = data.pagination;
|
||||
}
|
||||
}
|
||||
}
|
||||
get owner() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set owner(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get pagination() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.cosmos.base.query.v1beta1.PageResponse, 2) as dependency_4.cosmos.base.query.v1beta1.PageResponse;
|
||||
}
|
||||
set pagination(value: dependency_4.cosmos.base.query.v1beta1.PageResponse) {
|
||||
pb_1.Message.setWrapperField(this, 2, value);
|
||||
}
|
||||
get has_pagination() {
|
||||
return pb_1.Message.getField(this, 2) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
owner?: string;
|
||||
pagination?: ReturnType<typeof dependency_4.cosmos.base.query.v1beta1.PageResponse.prototype.toObject>;
|
||||
}): QueryGetBondsByOwnerRequest {
|
||||
const message = new QueryGetBondsByOwnerRequest({});
|
||||
if (data.owner != null) {
|
||||
message.owner = data.owner;
|
||||
}
|
||||
if (data.pagination != null) {
|
||||
message.pagination = dependency_4.cosmos.base.query.v1beta1.PageResponse.fromObject(data.pagination);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
owner?: string;
|
||||
pagination?: ReturnType<typeof dependency_4.cosmos.base.query.v1beta1.PageResponse.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.owner != null) {
|
||||
data.owner = this.owner;
|
||||
}
|
||||
if (this.pagination != null) {
|
||||
data.pagination = this.pagination.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.owner.length)
|
||||
writer.writeString(1, this.owner);
|
||||
if (this.has_pagination)
|
||||
writer.writeMessage(2, this.pagination, () => this.pagination.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryGetBondsByOwnerRequest {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryGetBondsByOwnerRequest();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.owner = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
reader.readMessage(message.pagination, () => message.pagination = dependency_4.cosmos.base.query.v1beta1.PageResponse.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): QueryGetBondsByOwnerRequest {
|
||||
return QueryGetBondsByOwnerRequest.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class QueryGetBondsByOwnerResponse extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
bonds?: dependency_2.vulcanize.bond.v1beta1.Bond[];
|
||||
pagination?: dependency_4.cosmos.base.query.v1beta1.PageResponse;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("bonds" in data && data.bonds != undefined) {
|
||||
this.bonds = data.bonds;
|
||||
}
|
||||
if ("pagination" in data && data.pagination != undefined) {
|
||||
this.pagination = data.pagination;
|
||||
}
|
||||
}
|
||||
}
|
||||
get bonds() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, dependency_2.vulcanize.bond.v1beta1.Bond, 1) as dependency_2.vulcanize.bond.v1beta1.Bond[];
|
||||
}
|
||||
set bonds(value: dependency_2.vulcanize.bond.v1beta1.Bond[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 1, value);
|
||||
}
|
||||
get pagination() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_4.cosmos.base.query.v1beta1.PageResponse, 2) as dependency_4.cosmos.base.query.v1beta1.PageResponse;
|
||||
}
|
||||
set pagination(value: dependency_4.cosmos.base.query.v1beta1.PageResponse) {
|
||||
pb_1.Message.setWrapperField(this, 2, value);
|
||||
}
|
||||
get has_pagination() {
|
||||
return pb_1.Message.getField(this, 2) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
bonds?: ReturnType<typeof dependency_2.vulcanize.bond.v1beta1.Bond.prototype.toObject>[];
|
||||
pagination?: ReturnType<typeof dependency_4.cosmos.base.query.v1beta1.PageResponse.prototype.toObject>;
|
||||
}): QueryGetBondsByOwnerResponse {
|
||||
const message = new QueryGetBondsByOwnerResponse({});
|
||||
if (data.bonds != null) {
|
||||
message.bonds = data.bonds.map(item => dependency_2.vulcanize.bond.v1beta1.Bond.fromObject(item));
|
||||
}
|
||||
if (data.pagination != null) {
|
||||
message.pagination = dependency_4.cosmos.base.query.v1beta1.PageResponse.fromObject(data.pagination);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
bonds?: ReturnType<typeof dependency_2.vulcanize.bond.v1beta1.Bond.prototype.toObject>[];
|
||||
pagination?: ReturnType<typeof dependency_4.cosmos.base.query.v1beta1.PageResponse.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.bonds != null) {
|
||||
data.bonds = this.bonds.map((item: dependency_2.vulcanize.bond.v1beta1.Bond) => item.toObject());
|
||||
}
|
||||
if (this.pagination != null) {
|
||||
data.pagination = this.pagination.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.bonds.length)
|
||||
writer.writeRepeatedMessage(1, this.bonds, (item: dependency_2.vulcanize.bond.v1beta1.Bond) => item.serialize(writer));
|
||||
if (this.has_pagination)
|
||||
writer.writeMessage(2, this.pagination, () => this.pagination.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryGetBondsByOwnerResponse {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryGetBondsByOwnerResponse();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.bonds, () => pb_1.Message.addToRepeatedWrapperField(message, 1, dependency_2.vulcanize.bond.v1beta1.Bond.deserialize(reader), dependency_2.vulcanize.bond.v1beta1.Bond));
|
||||
break;
|
||||
case 2:
|
||||
reader.readMessage(message.pagination, () => message.pagination = dependency_4.cosmos.base.query.v1beta1.PageResponse.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): QueryGetBondsByOwnerResponse {
|
||||
return QueryGetBondsByOwnerResponse.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class QueryGetBondModuleBalanceRequest extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") { }
|
||||
}
|
||||
static fromObject(data: {}): QueryGetBondModuleBalanceRequest {
|
||||
const message = new QueryGetBondModuleBalanceRequest({});
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {} = {};
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryGetBondModuleBalanceRequest {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryGetBondModuleBalanceRequest();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): QueryGetBondModuleBalanceRequest {
|
||||
return QueryGetBondModuleBalanceRequest.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class QueryGetBondModuleBalanceResponse extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
balance?: dependency_5.cosmos.base.v1beta1.Coin[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("balance" in data && data.balance != undefined) {
|
||||
this.balance = data.balance;
|
||||
}
|
||||
}
|
||||
}
|
||||
get balance() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, dependency_5.cosmos.base.v1beta1.Coin, 2) as dependency_5.cosmos.base.v1beta1.Coin[];
|
||||
}
|
||||
set balance(value: dependency_5.cosmos.base.v1beta1.Coin[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 2, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
balance?: ReturnType<typeof dependency_5.cosmos.base.v1beta1.Coin.prototype.toObject>[];
|
||||
}): QueryGetBondModuleBalanceResponse {
|
||||
const message = new QueryGetBondModuleBalanceResponse({});
|
||||
if (data.balance != null) {
|
||||
message.balance = data.balance.map(item => dependency_5.cosmos.base.v1beta1.Coin.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
balance?: ReturnType<typeof dependency_5.cosmos.base.v1beta1.Coin.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.balance != null) {
|
||||
data.balance = this.balance.map((item: dependency_5.cosmos.base.v1beta1.Coin) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.balance.length)
|
||||
writer.writeRepeatedMessage(2, this.balance, (item: dependency_5.cosmos.base.v1beta1.Coin) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryGetBondModuleBalanceResponse {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryGetBondModuleBalanceResponse();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 2:
|
||||
reader.readMessage(message.balance, () => pb_1.Message.addToRepeatedWrapperField(message, 2, dependency_5.cosmos.base.v1beta1.Coin.deserialize(reader), dependency_5.cosmos.base.v1beta1.Coin));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): QueryGetBondModuleBalanceResponse {
|
||||
return QueryGetBondModuleBalanceResponse.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,605 +0,0 @@
|
||||
// @ts-nocheck
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* source: vulcanize/bond/v1beta1/tx.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
import * as dependency_2 from "./../../../cosmos/base/v1beta1/coin";
|
||||
import * as pb_1 from "google-protobuf";
|
||||
export namespace vulcanize.bond.v1beta1 {
|
||||
export class MsgCreateBond extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
signer?: string;
|
||||
coins?: dependency_2.cosmos.base.v1beta1.Coin[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("signer" in data && data.signer != undefined) {
|
||||
this.signer = data.signer;
|
||||
}
|
||||
if ("coins" in data && data.coins != undefined) {
|
||||
this.coins = data.coins;
|
||||
}
|
||||
}
|
||||
}
|
||||
get signer() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set signer(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get coins() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, dependency_2.cosmos.base.v1beta1.Coin, 2) as dependency_2.cosmos.base.v1beta1.Coin[];
|
||||
}
|
||||
set coins(value: dependency_2.cosmos.base.v1beta1.Coin[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 2, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
signer?: string;
|
||||
coins?: ReturnType<typeof dependency_2.cosmos.base.v1beta1.Coin.prototype.toObject>[];
|
||||
}): MsgCreateBond {
|
||||
const message = new MsgCreateBond({});
|
||||
if (data.signer != null) {
|
||||
message.signer = data.signer;
|
||||
}
|
||||
if (data.coins != null) {
|
||||
message.coins = data.coins.map(item => dependency_2.cosmos.base.v1beta1.Coin.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
signer?: string;
|
||||
coins?: ReturnType<typeof dependency_2.cosmos.base.v1beta1.Coin.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.signer != null) {
|
||||
data.signer = this.signer;
|
||||
}
|
||||
if (this.coins != null) {
|
||||
data.coins = this.coins.map((item: dependency_2.cosmos.base.v1beta1.Coin) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.signer.length)
|
||||
writer.writeString(1, this.signer);
|
||||
if (this.coins.length)
|
||||
writer.writeRepeatedMessage(2, this.coins, (item: dependency_2.cosmos.base.v1beta1.Coin) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MsgCreateBond {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new MsgCreateBond();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.signer = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
reader.readMessage(message.coins, () => pb_1.Message.addToRepeatedWrapperField(message, 2, dependency_2.cosmos.base.v1beta1.Coin.deserialize(reader), dependency_2.cosmos.base.v1beta1.Coin));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): MsgCreateBond {
|
||||
return MsgCreateBond.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class MsgCreateBondResponse extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
id?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("id" in data && data.id != undefined) {
|
||||
this.id = data.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
get id() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set id(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
id?: string;
|
||||
}): MsgCreateBondResponse {
|
||||
const message = new MsgCreateBondResponse({});
|
||||
if (data.id != null) {
|
||||
message.id = data.id;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
id?: string;
|
||||
} = {};
|
||||
if (this.id != null) {
|
||||
data.id = this.id;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.id.length)
|
||||
writer.writeString(1, this.id);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MsgCreateBondResponse {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new MsgCreateBondResponse();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.id = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): MsgCreateBondResponse {
|
||||
return MsgCreateBondResponse.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class MsgRefillBond extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
id?: string;
|
||||
signer?: string;
|
||||
coins?: dependency_2.cosmos.base.v1beta1.Coin[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("id" in data && data.id != undefined) {
|
||||
this.id = data.id;
|
||||
}
|
||||
if ("signer" in data && data.signer != undefined) {
|
||||
this.signer = data.signer;
|
||||
}
|
||||
if ("coins" in data && data.coins != undefined) {
|
||||
this.coins = data.coins;
|
||||
}
|
||||
}
|
||||
}
|
||||
get id() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set id(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get signer() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
||||
}
|
||||
set signer(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get coins() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, dependency_2.cosmos.base.v1beta1.Coin, 3) as dependency_2.cosmos.base.v1beta1.Coin[];
|
||||
}
|
||||
set coins(value: dependency_2.cosmos.base.v1beta1.Coin[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 3, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
id?: string;
|
||||
signer?: string;
|
||||
coins?: ReturnType<typeof dependency_2.cosmos.base.v1beta1.Coin.prototype.toObject>[];
|
||||
}): MsgRefillBond {
|
||||
const message = new MsgRefillBond({});
|
||||
if (data.id != null) {
|
||||
message.id = data.id;
|
||||
}
|
||||
if (data.signer != null) {
|
||||
message.signer = data.signer;
|
||||
}
|
||||
if (data.coins != null) {
|
||||
message.coins = data.coins.map(item => dependency_2.cosmos.base.v1beta1.Coin.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
id?: string;
|
||||
signer?: string;
|
||||
coins?: ReturnType<typeof dependency_2.cosmos.base.v1beta1.Coin.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.id != null) {
|
||||
data.id = this.id;
|
||||
}
|
||||
if (this.signer != null) {
|
||||
data.signer = this.signer;
|
||||
}
|
||||
if (this.coins != null) {
|
||||
data.coins = this.coins.map((item: dependency_2.cosmos.base.v1beta1.Coin) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.id.length)
|
||||
writer.writeString(1, this.id);
|
||||
if (this.signer.length)
|
||||
writer.writeString(2, this.signer);
|
||||
if (this.coins.length)
|
||||
writer.writeRepeatedMessage(3, this.coins, (item: dependency_2.cosmos.base.v1beta1.Coin) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MsgRefillBond {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new MsgRefillBond();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.id = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.signer = reader.readString();
|
||||
break;
|
||||
case 3:
|
||||
reader.readMessage(message.coins, () => pb_1.Message.addToRepeatedWrapperField(message, 3, dependency_2.cosmos.base.v1beta1.Coin.deserialize(reader), dependency_2.cosmos.base.v1beta1.Coin));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): MsgRefillBond {
|
||||
return MsgRefillBond.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class MsgRefillBondResponse extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") { }
|
||||
}
|
||||
static fromObject(data: {}): MsgRefillBondResponse {
|
||||
const message = new MsgRefillBondResponse({});
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {} = {};
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MsgRefillBondResponse {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new MsgRefillBondResponse();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): MsgRefillBondResponse {
|
||||
return MsgRefillBondResponse.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class MsgWithdrawBond extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
id?: string;
|
||||
signer?: string;
|
||||
coins?: dependency_2.cosmos.base.v1beta1.Coin[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("id" in data && data.id != undefined) {
|
||||
this.id = data.id;
|
||||
}
|
||||
if ("signer" in data && data.signer != undefined) {
|
||||
this.signer = data.signer;
|
||||
}
|
||||
if ("coins" in data && data.coins != undefined) {
|
||||
this.coins = data.coins;
|
||||
}
|
||||
}
|
||||
}
|
||||
get id() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set id(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get signer() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
||||
}
|
||||
set signer(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get coins() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, dependency_2.cosmos.base.v1beta1.Coin, 3) as dependency_2.cosmos.base.v1beta1.Coin[];
|
||||
}
|
||||
set coins(value: dependency_2.cosmos.base.v1beta1.Coin[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 3, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
id?: string;
|
||||
signer?: string;
|
||||
coins?: ReturnType<typeof dependency_2.cosmos.base.v1beta1.Coin.prototype.toObject>[];
|
||||
}): MsgWithdrawBond {
|
||||
const message = new MsgWithdrawBond({});
|
||||
if (data.id != null) {
|
||||
message.id = data.id;
|
||||
}
|
||||
if (data.signer != null) {
|
||||
message.signer = data.signer;
|
||||
}
|
||||
if (data.coins != null) {
|
||||
message.coins = data.coins.map(item => dependency_2.cosmos.base.v1beta1.Coin.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
id?: string;
|
||||
signer?: string;
|
||||
coins?: ReturnType<typeof dependency_2.cosmos.base.v1beta1.Coin.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.id != null) {
|
||||
data.id = this.id;
|
||||
}
|
||||
if (this.signer != null) {
|
||||
data.signer = this.signer;
|
||||
}
|
||||
if (this.coins != null) {
|
||||
data.coins = this.coins.map((item: dependency_2.cosmos.base.v1beta1.Coin) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.id.length)
|
||||
writer.writeString(1, this.id);
|
||||
if (this.signer.length)
|
||||
writer.writeString(2, this.signer);
|
||||
if (this.coins.length)
|
||||
writer.writeRepeatedMessage(3, this.coins, (item: dependency_2.cosmos.base.v1beta1.Coin) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MsgWithdrawBond {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new MsgWithdrawBond();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.id = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.signer = reader.readString();
|
||||
break;
|
||||
case 3:
|
||||
reader.readMessage(message.coins, () => pb_1.Message.addToRepeatedWrapperField(message, 3, dependency_2.cosmos.base.v1beta1.Coin.deserialize(reader), dependency_2.cosmos.base.v1beta1.Coin));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): MsgWithdrawBond {
|
||||
return MsgWithdrawBond.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class MsgWithdrawBondResponse extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") { }
|
||||
}
|
||||
static fromObject(data: {}): MsgWithdrawBondResponse {
|
||||
const message = new MsgWithdrawBondResponse({});
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {} = {};
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MsgWithdrawBondResponse {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new MsgWithdrawBondResponse();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): MsgWithdrawBondResponse {
|
||||
return MsgWithdrawBondResponse.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class MsgCancelBond extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
id?: string;
|
||||
signer?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("id" in data && data.id != undefined) {
|
||||
this.id = data.id;
|
||||
}
|
||||
if ("signer" in data && data.signer != undefined) {
|
||||
this.signer = data.signer;
|
||||
}
|
||||
}
|
||||
}
|
||||
get id() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set id(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get signer() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
||||
}
|
||||
set signer(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
id?: string;
|
||||
signer?: string;
|
||||
}): MsgCancelBond {
|
||||
const message = new MsgCancelBond({});
|
||||
if (data.id != null) {
|
||||
message.id = data.id;
|
||||
}
|
||||
if (data.signer != null) {
|
||||
message.signer = data.signer;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
id?: string;
|
||||
signer?: string;
|
||||
} = {};
|
||||
if (this.id != null) {
|
||||
data.id = this.id;
|
||||
}
|
||||
if (this.signer != null) {
|
||||
data.signer = this.signer;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.id.length)
|
||||
writer.writeString(1, this.id);
|
||||
if (this.signer.length)
|
||||
writer.writeString(2, this.signer);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MsgCancelBond {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new MsgCancelBond();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.id = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.signer = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): MsgCancelBond {
|
||||
return MsgCancelBond.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class MsgCancelBondResponse extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") { }
|
||||
}
|
||||
static fromObject(data: {}): MsgCancelBondResponse {
|
||||
const message = new MsgCancelBondResponse({});
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {} = {};
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MsgCancelBondResponse {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new MsgCancelBondResponse();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): MsgCancelBondResponse {
|
||||
return MsgCancelBondResponse.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,151 +0,0 @@
|
||||
// @ts-nocheck
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* source: vulcanize/registry/v1beta1/genesis.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
import * as dependency_2 from "./registry";
|
||||
import * as pb_1 from "google-protobuf";
|
||||
export namespace vulcanize.registry.v1beta1 {
|
||||
export class GenesisState extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
params?: dependency_2.vulcanize.registry.v1beta1.Params;
|
||||
records?: dependency_2.vulcanize.registry.v1beta1.Record[];
|
||||
authorities?: dependency_2.vulcanize.registry.v1beta1.AuthorityEntry[];
|
||||
names?: dependency_2.vulcanize.registry.v1beta1.NameEntry[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("params" in data && data.params != undefined) {
|
||||
this.params = data.params;
|
||||
}
|
||||
if ("records" in data && data.records != undefined) {
|
||||
this.records = data.records;
|
||||
}
|
||||
if ("authorities" in data && data.authorities != undefined) {
|
||||
this.authorities = data.authorities;
|
||||
}
|
||||
if ("names" in data && data.names != undefined) {
|
||||
this.names = data.names;
|
||||
}
|
||||
}
|
||||
}
|
||||
get params() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_2.vulcanize.registry.v1beta1.Params, 1) as dependency_2.vulcanize.registry.v1beta1.Params;
|
||||
}
|
||||
set params(value: dependency_2.vulcanize.registry.v1beta1.Params) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get has_params() {
|
||||
return pb_1.Message.getField(this, 1) != null;
|
||||
}
|
||||
get records() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, dependency_2.vulcanize.registry.v1beta1.Record, 2) as dependency_2.vulcanize.registry.v1beta1.Record[];
|
||||
}
|
||||
set records(value: dependency_2.vulcanize.registry.v1beta1.Record[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 2, value);
|
||||
}
|
||||
get authorities() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, dependency_2.vulcanize.registry.v1beta1.AuthorityEntry, 3) as dependency_2.vulcanize.registry.v1beta1.AuthorityEntry[];
|
||||
}
|
||||
set authorities(value: dependency_2.vulcanize.registry.v1beta1.AuthorityEntry[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 3, value);
|
||||
}
|
||||
get names() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, dependency_2.vulcanize.registry.v1beta1.NameEntry, 4) as dependency_2.vulcanize.registry.v1beta1.NameEntry[];
|
||||
}
|
||||
set names(value: dependency_2.vulcanize.registry.v1beta1.NameEntry[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 4, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
params?: ReturnType<typeof dependency_2.vulcanize.registry.v1beta1.Params.prototype.toObject>;
|
||||
records?: ReturnType<typeof dependency_2.vulcanize.registry.v1beta1.Record.prototype.toObject>[];
|
||||
authorities?: ReturnType<typeof dependency_2.vulcanize.registry.v1beta1.AuthorityEntry.prototype.toObject>[];
|
||||
names?: ReturnType<typeof dependency_2.vulcanize.registry.v1beta1.NameEntry.prototype.toObject>[];
|
||||
}): GenesisState {
|
||||
const message = new GenesisState({});
|
||||
if (data.params != null) {
|
||||
message.params = dependency_2.vulcanize.registry.v1beta1.Params.fromObject(data.params);
|
||||
}
|
||||
if (data.records != null) {
|
||||
message.records = data.records.map(item => dependency_2.vulcanize.registry.v1beta1.Record.fromObject(item));
|
||||
}
|
||||
if (data.authorities != null) {
|
||||
message.authorities = data.authorities.map(item => dependency_2.vulcanize.registry.v1beta1.AuthorityEntry.fromObject(item));
|
||||
}
|
||||
if (data.names != null) {
|
||||
message.names = data.names.map(item => dependency_2.vulcanize.registry.v1beta1.NameEntry.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
params?: ReturnType<typeof dependency_2.vulcanize.registry.v1beta1.Params.prototype.toObject>;
|
||||
records?: ReturnType<typeof dependency_2.vulcanize.registry.v1beta1.Record.prototype.toObject>[];
|
||||
authorities?: ReturnType<typeof dependency_2.vulcanize.registry.v1beta1.AuthorityEntry.prototype.toObject>[];
|
||||
names?: ReturnType<typeof dependency_2.vulcanize.registry.v1beta1.NameEntry.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.params != null) {
|
||||
data.params = this.params.toObject();
|
||||
}
|
||||
if (this.records != null) {
|
||||
data.records = this.records.map((item: dependency_2.vulcanize.registry.v1beta1.Record) => item.toObject());
|
||||
}
|
||||
if (this.authorities != null) {
|
||||
data.authorities = this.authorities.map((item: dependency_2.vulcanize.registry.v1beta1.AuthorityEntry) => item.toObject());
|
||||
}
|
||||
if (this.names != null) {
|
||||
data.names = this.names.map((item: dependency_2.vulcanize.registry.v1beta1.NameEntry) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.has_params)
|
||||
writer.writeMessage(1, this.params, () => this.params.serialize(writer));
|
||||
if (this.records.length)
|
||||
writer.writeRepeatedMessage(2, this.records, (item: dependency_2.vulcanize.registry.v1beta1.Record) => item.serialize(writer));
|
||||
if (this.authorities.length)
|
||||
writer.writeRepeatedMessage(3, this.authorities, (item: dependency_2.vulcanize.registry.v1beta1.AuthorityEntry) => item.serialize(writer));
|
||||
if (this.names.length)
|
||||
writer.writeRepeatedMessage(4, this.names, (item: dependency_2.vulcanize.registry.v1beta1.NameEntry) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): GenesisState {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new GenesisState();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.params, () => message.params = dependency_2.vulcanize.registry.v1beta1.Params.deserialize(reader));
|
||||
break;
|
||||
case 2:
|
||||
reader.readMessage(message.records, () => pb_1.Message.addToRepeatedWrapperField(message, 2, dependency_2.vulcanize.registry.v1beta1.Record.deserialize(reader), dependency_2.vulcanize.registry.v1beta1.Record));
|
||||
break;
|
||||
case 3:
|
||||
reader.readMessage(message.authorities, () => pb_1.Message.addToRepeatedWrapperField(message, 3, dependency_2.vulcanize.registry.v1beta1.AuthorityEntry.deserialize(reader), dependency_2.vulcanize.registry.v1beta1.AuthorityEntry));
|
||||
break;
|
||||
case 4:
|
||||
reader.readMessage(message.names, () => pb_1.Message.addToRepeatedWrapperField(message, 4, dependency_2.vulcanize.registry.v1beta1.NameEntry.deserialize(reader), dependency_2.vulcanize.registry.v1beta1.NameEntry));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): GenesisState {
|
||||
return GenesisState.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,437 +0,0 @@
|
||||
import assert from 'assert';
|
||||
import axios from 'axios';
|
||||
import graphqlClient from 'graphql.js'
|
||||
import { get, set } from 'lodash'
|
||||
import { generateEndpointAccount, generateEndpointBroadcast } from '@tharsis/provider';
|
||||
|
||||
import { Util } from './util';
|
||||
|
||||
const attributeField = `
|
||||
attributes {
|
||||
key
|
||||
value {
|
||||
... on BooleanValue { bool: value }
|
||||
... on IntValue { int: value }
|
||||
... on FloatValue { float: value }
|
||||
... on StringValue { string: value }
|
||||
... on BytesValue { bytes: value }
|
||||
... on LinkValue { link: value }
|
||||
... on ArrayValue {
|
||||
array: value {
|
||||
... on BooleanValue { bool: value }
|
||||
... on IntValue { int: value }
|
||||
... on FloatValue { float: value }
|
||||
... on StringValue { string: value }
|
||||
... on BytesValue { bytes: value }
|
||||
... on LinkValue { link: value }
|
||||
}
|
||||
}
|
||||
... on MapValue { map: value { key mapping: value { __typename } } }
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const refsField = `
|
||||
references {
|
||||
id
|
||||
}
|
||||
`;
|
||||
|
||||
const historyFields = `
|
||||
history {
|
||||
id
|
||||
height
|
||||
}
|
||||
`;
|
||||
|
||||
const auctionFields = `
|
||||
id
|
||||
status
|
||||
ownerAddress
|
||||
createTime
|
||||
commitsEndTime
|
||||
revealsEndTime
|
||||
commitFee {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
revealFee {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
minimumBid {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
winnerAddress
|
||||
winnerBid {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
winnerPrice {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
bids {
|
||||
bidderAddress
|
||||
status
|
||||
commitHash
|
||||
commitTime
|
||||
revealTime
|
||||
commitFee {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
revealFee {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
bidAmount {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* Registry
|
||||
*/
|
||||
export class RegistryClient {
|
||||
_restEndpoint: string
|
||||
_graph: any
|
||||
|
||||
/**
|
||||
* Get query result.
|
||||
*/
|
||||
static async getResult(query: any, key: string, modifier?: (rows: any[]) => {}) {
|
||||
const result = await query;
|
||||
if (result && result[key] && result[key].length && result[key][0] !== null) {
|
||||
if (modifier) {
|
||||
return modifier(result[key]);
|
||||
}
|
||||
return result[key];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare response attributes.
|
||||
*/
|
||||
static prepareAttributes(path: string) {
|
||||
return (rows: any[]) => {
|
||||
const result = rows.map(r => {
|
||||
set(r, path, Util.fromGQLAttributes(get(r, path)));
|
||||
return r;
|
||||
});
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* New Client.
|
||||
*/
|
||||
constructor(gqlEndpoint: string, restEndpoint: string) {
|
||||
assert(gqlEndpoint);
|
||||
this._graph = graphqlClient(gqlEndpoint, {
|
||||
method: 'POST',
|
||||
asJSON: true
|
||||
});
|
||||
|
||||
this._restEndpoint = restEndpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get server status.
|
||||
*/
|
||||
async getStatus() {
|
||||
const query = `query {
|
||||
getStatus {
|
||||
version
|
||||
node {
|
||||
id
|
||||
network
|
||||
moniker
|
||||
}
|
||||
sync {
|
||||
latest_block_hash
|
||||
latest_block_height
|
||||
latest_block_time
|
||||
catching_up
|
||||
}
|
||||
validator {
|
||||
address
|
||||
voting_power
|
||||
}
|
||||
validators {
|
||||
address
|
||||
voting_power
|
||||
proposer_priority
|
||||
}
|
||||
num_peers
|
||||
peers {
|
||||
node {
|
||||
id
|
||||
network
|
||||
moniker
|
||||
}
|
||||
is_outbound
|
||||
remote_ip
|
||||
}
|
||||
disk_usage
|
||||
}
|
||||
}`;
|
||||
|
||||
const { getStatus: status } = await this._graph(query)();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch Accounts.
|
||||
*/
|
||||
async getAccounts(addresses: string[]) {
|
||||
assert(addresses);
|
||||
assert(addresses.length);
|
||||
|
||||
const query = `query ($addresses: [String!]) {
|
||||
getAccounts(addresses: $addresses) {
|
||||
address
|
||||
pubKey
|
||||
number
|
||||
sequence
|
||||
balance {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
}
|
||||
}`;
|
||||
|
||||
const variables = {
|
||||
addresses
|
||||
};
|
||||
|
||||
return RegistryClient.getResult(this._graph(query)(variables), 'getAccounts');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get records by ids.
|
||||
*/
|
||||
async getRecordsByIds(ids: string[], refs = false) {
|
||||
assert(ids);
|
||||
assert(ids.length);
|
||||
|
||||
const query = `query ($ids: [String!]) {
|
||||
getRecordsByIds(ids: $ids) {
|
||||
id
|
||||
names
|
||||
owners
|
||||
bondId
|
||||
createTime
|
||||
expiryTime
|
||||
${attributeField}
|
||||
${refs ? refsField : ''}
|
||||
}
|
||||
}`;
|
||||
|
||||
const variables = {
|
||||
ids
|
||||
};
|
||||
|
||||
return RegistryClient.getResult(this._graph(query)(variables), 'getRecordsByIds', RegistryClient.prepareAttributes('attributes'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get records by attributes.
|
||||
*/
|
||||
async queryRecords(attributes: {[key: string]: any}, all = false, refs = false) {
|
||||
if (!attributes) {
|
||||
attributes = {};
|
||||
}
|
||||
|
||||
const query = `query ($attributes: [KeyValueInput!], $all: Boolean) {
|
||||
queryRecords(attributes: $attributes, all: $all) {
|
||||
id
|
||||
names
|
||||
owners
|
||||
bondId
|
||||
createTime
|
||||
expiryTime
|
||||
${attributeField}
|
||||
${refs ? refsField : ''}
|
||||
}
|
||||
}`;
|
||||
|
||||
const variables = {
|
||||
attributes: Util.toGQLAttributes(attributes),
|
||||
all
|
||||
};
|
||||
|
||||
let result = (await this._graph(query)(variables))['queryRecords'];
|
||||
result = RegistryClient.prepareAttributes('attributes')(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup authorities by names.
|
||||
*/
|
||||
async lookupAuthorities(names: string[], auction = false) {
|
||||
assert(names.length);
|
||||
|
||||
const query = `query ($names: [String!]) {
|
||||
lookupAuthorities(names: $names) {
|
||||
ownerAddress
|
||||
ownerPublicKey
|
||||
height
|
||||
status
|
||||
bondId
|
||||
expiryTime
|
||||
${auction ? ('auction { ' + auctionFields + ' }') : ''}
|
||||
}
|
||||
}`;
|
||||
|
||||
const variables = {
|
||||
names
|
||||
};
|
||||
|
||||
const result = await this._graph(query)(variables);
|
||||
|
||||
return result['lookupAuthorities'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get auctions by ids.
|
||||
*/
|
||||
async getAuctionsByIds(ids: string[]) {
|
||||
assert(ids);
|
||||
assert(ids.length);
|
||||
|
||||
const query = `query ($ids: [String!]) {
|
||||
getAuctionsByIds(ids: $ids) {
|
||||
${auctionFields}
|
||||
}
|
||||
}`;
|
||||
|
||||
const variables = {
|
||||
ids
|
||||
};
|
||||
|
||||
return RegistryClient.getResult(this._graph(query)(variables), 'getAuctionsByIds');
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup names.
|
||||
*/
|
||||
async lookupNames(names: string[], history = false) {
|
||||
assert(names.length);
|
||||
|
||||
const query = `query ($names: [String!]) {
|
||||
lookupNames(names: $names) {
|
||||
latest {
|
||||
id
|
||||
height
|
||||
}
|
||||
${history ? historyFields : ''}
|
||||
}
|
||||
}`;
|
||||
|
||||
const variables = {
|
||||
names
|
||||
};
|
||||
|
||||
const result = await this._graph(query)(variables);
|
||||
|
||||
return result['lookupNames'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve names to records.
|
||||
*/
|
||||
async resolveNames(names: string[], refs = false) {
|
||||
assert(names.length);
|
||||
|
||||
const query = `query ($names: [String!]) {
|
||||
resolveNames(names: $names) {
|
||||
id
|
||||
names
|
||||
owners
|
||||
bondId
|
||||
createTime
|
||||
expiryTime
|
||||
${attributeField}
|
||||
${refs ? refsField : ''}
|
||||
}
|
||||
}`;
|
||||
|
||||
const variables = {
|
||||
names
|
||||
};
|
||||
|
||||
let result = (await this._graph(query)(variables))['resolveNames'];
|
||||
result = RegistryClient.prepareAttributes('attributes')(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bonds by ids.
|
||||
*/
|
||||
async getBondsByIds(ids: string[]) {
|
||||
assert(ids);
|
||||
assert(ids.length);
|
||||
|
||||
const query = `query ($ids: [String!]) {
|
||||
getBondsByIds(ids: $ids) {
|
||||
id
|
||||
owner
|
||||
balance {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
}
|
||||
}`;
|
||||
|
||||
const variables = {
|
||||
ids
|
||||
};
|
||||
|
||||
return RegistryClient.getResult(this._graph(query)(variables), 'getBondsByIds');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get records by attributes.
|
||||
*/
|
||||
async queryBonds(attributes = {}) {
|
||||
const query = `query ($attributes: [KeyValueInput!]) {
|
||||
queryBonds(attributes: $attributes) {
|
||||
id
|
||||
owner
|
||||
balance {
|
||||
type
|
||||
quantity
|
||||
}
|
||||
}
|
||||
}`;
|
||||
|
||||
const variables = {
|
||||
attributes: Util.toGQLAttributes(attributes)
|
||||
};
|
||||
|
||||
return RegistryClient.getResult(this._graph(query)(variables), 'queryBonds');
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit transaction.
|
||||
*/
|
||||
async submit(tx: string) {
|
||||
assert(tx);
|
||||
|
||||
// Broadcast transaction.
|
||||
const { data } = await axios.post(
|
||||
`${this._restEndpoint}${generateEndpointBroadcast()}`,
|
||||
tx
|
||||
)
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema#",
|
||||
"id": "/Record",
|
||||
"type": "object"
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
import path from 'path';
|
||||
|
||||
import { Registry } from './index';
|
||||
import { getConfig, ensureUpdatedConfig, provisionBondId } from './testing/helper';
|
||||
|
||||
const WATCHER_YML_PATH = path.join(__dirname, './testing/data/watcher.yml');
|
||||
|
||||
jest.setTimeout(40 * 1000);
|
||||
|
||||
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
|
||||
|
||||
describe('Querying', () => {
|
||||
let watcher: any;
|
||||
let registry: Registry;
|
||||
let bondId: string;
|
||||
|
||||
beforeAll(async () => {
|
||||
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
bondId = await provisionBondId(registry, privateKey, fee);
|
||||
|
||||
const publishNewWatcherVersion = async () => {
|
||||
watcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
|
||||
await registry.setRecord({ privateKey, record: watcher.record, bondId }, privateKey, fee);
|
||||
return watcher.record.version;
|
||||
};
|
||||
|
||||
await publishNewWatcherVersion();
|
||||
});
|
||||
|
||||
test('Endpoint and chain ID.', async () => {
|
||||
expect(registry.endpoints.rest).toBe(restEndpoint);
|
||||
expect(registry.endpoints.gql).toBe(gqlEndpoint);
|
||||
expect(registry.chainID).toBe(chainId);
|
||||
});
|
||||
|
||||
test('Get status.', async () => {
|
||||
const status = await registry.getStatus();
|
||||
expect(status).toBeDefined();
|
||||
expect(status.version).toBeDefined();
|
||||
});
|
||||
|
||||
test('List records.', async () => {
|
||||
const records = await registry.queryRecords({}, true);
|
||||
expect(records.length).toBeGreaterThanOrEqual(1);
|
||||
});
|
||||
|
||||
test('Query records by reference.', async () => {
|
||||
const { repo_registration_record_cid } = watcher.record;
|
||||
const records = await registry.queryRecords({ repo_registration_record_cid }, true);
|
||||
expect(records.length).toBeGreaterThanOrEqual(1);
|
||||
|
||||
const { attributes: { repo_registration_record_cid: record_repo_registration_record_cid } } = records[0];
|
||||
expect(repo_registration_record_cid).toStrictEqual(record_repo_registration_record_cid);
|
||||
});
|
||||
|
||||
test('Query records by attributes.', async () => {
|
||||
const { version, url } = watcher.record;
|
||||
const records = await registry.queryRecords({ version, url, type: undefined }, true);
|
||||
expect(records.length).toBe(1);
|
||||
|
||||
[ watcher ] = records;
|
||||
const { attributes: { version: recordVersion, url: recordName } } = watcher;
|
||||
expect(recordVersion).toBe(version);
|
||||
expect(recordName).toBe(url);
|
||||
});
|
||||
|
||||
test('Query records by id.', async () => {
|
||||
const records = await registry.getRecordsByIds([watcher.id]);
|
||||
expect(records.length).toBe(1);
|
||||
expect(records[0].id).toBe(watcher.id);
|
||||
});
|
||||
|
||||
test('Query records passing refs true.', async () => {
|
||||
const [record] = await registry.getRecordsByIds([watcher.id], true);
|
||||
expect(record.id).toBe(watcher.id);
|
||||
// temp fix
|
||||
expect(record.attributes.repo_registration_record_cid).toBeDefined();
|
||||
expect(record.attributes.repo_registration_record_cid).toHaveProperty("/");
|
||||
expect(record.attributes.repo_registration_record_cid["/"]).toHaveLength(46);
|
||||
});
|
||||
});
|
@ -1,10 +0,0 @@
|
||||
record:
|
||||
type: WebsiteRegistrationRecord
|
||||
url: 'https://cerc.io'
|
||||
repo_registration_record_cid:
|
||||
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
||||
build_artifact_cid:
|
||||
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
||||
tls_cert_cid:
|
||||
/: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
|
||||
version: 1.0.23
|
@ -1,55 +0,0 @@
|
||||
import assert from 'assert';
|
||||
import yaml from 'node-yaml';
|
||||
import semver from 'semver';
|
||||
import { Fee } from '@tharsis/transactions';
|
||||
|
||||
import { DEFAULT_CHAIN_ID, Registry } from '../index';
|
||||
|
||||
export const ensureUpdatedConfig = async (path: string) => {
|
||||
const conf = await yaml.read(path);
|
||||
conf.record.version = semver.inc(conf.record.version, 'patch');
|
||||
await yaml.write(path, conf);
|
||||
|
||||
return conf;
|
||||
};
|
||||
|
||||
export const getBaseConfig = async (path: string) => {
|
||||
const conf = await yaml.read(path);
|
||||
conf.record.version = '0.0.1';
|
||||
|
||||
return conf;
|
||||
};
|
||||
|
||||
/**
|
||||
* Provision a bond for record registration.
|
||||
*/
|
||||
export const provisionBondId = async (registry: Registry, privateKey: string, fee: Fee) => {
|
||||
// let bonds = await registry.queryBonds();
|
||||
// console.log("found bonds: " + bonds.length)
|
||||
// if (!bonds.length) {
|
||||
// await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||
// bonds = await registry.queryBonds();
|
||||
// console.log("created bond and got back: " + bonds.length)
|
||||
// }
|
||||
let bondId: string;
|
||||
bondId = await registry.getNextBondId(privateKey);
|
||||
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||
return bondId
|
||||
//return bonds[0].id;
|
||||
};
|
||||
|
||||
export const getConfig = () => {
|
||||
assert(process.env.PRIVATE_KEY);
|
||||
|
||||
return {
|
||||
chainId: process.env.COSMOS_CHAIN_ID || DEFAULT_CHAIN_ID,
|
||||
privateKey: process.env.PRIVATE_KEY,
|
||||
restEndpoint: process.env.LACONICD_REST_ENDPOINT || 'http://localhost:1317',
|
||||
gqlEndpoint: process.env.LACONICD_GQL_ENDPOINT || 'http://localhost:9473/api',
|
||||
fee: {
|
||||
amount: '40',
|
||||
denom: 'aphoton',
|
||||
gas: '400000',
|
||||
}
|
||||
}
|
||||
};
|
@ -1,25 +0,0 @@
|
||||
import assert from 'assert';
|
||||
import {
|
||||
createTxRawEIP712,
|
||||
signatureToWeb3Extension,
|
||||
Chain,
|
||||
Sender
|
||||
} from '@tharsis/transactions'
|
||||
|
||||
import { Account } from './account';
|
||||
|
||||
/**
|
||||
* Generate a cosmos-sdk transaction.
|
||||
*/
|
||||
export const createTransaction = (message: any, account: Account, sender: Sender, chain: Chain) => {
|
||||
assert(message);
|
||||
assert(account);
|
||||
|
||||
// Sign transaction.
|
||||
const signature = account.sign(message);
|
||||
|
||||
let extension = signatureToWeb3Extension(chain, sender, signature)
|
||||
|
||||
// Create the txRaw.
|
||||
return createTxRawEIP712(message.legacyAmino.body, message.legacyAmino.authInfo, extension)
|
||||
};
|
130
src/types.ts
130
src/types.ts
@ -1,130 +0,0 @@
|
||||
import assert from 'assert';
|
||||
import { Validator } from 'jsonschema';
|
||||
|
||||
import RecordSchema from './schema/record.json';
|
||||
import { Util } from './util';
|
||||
|
||||
/**
|
||||
* Record.
|
||||
*/
|
||||
export class Record {
|
||||
_record: any
|
||||
|
||||
/**
|
||||
* New Record.
|
||||
*/
|
||||
constructor(record: any) {
|
||||
assert(record);
|
||||
|
||||
const validator = new Validator();
|
||||
const result = validator.validate(record, RecordSchema);
|
||||
if (!result.valid) {
|
||||
result.errors.map(console.error);
|
||||
throw new Error('Invalid record input.');
|
||||
}
|
||||
|
||||
this._record = record;
|
||||
}
|
||||
|
||||
get attributes() {
|
||||
return Buffer.from(JSON.stringify(this._record), 'binary')
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize record.
|
||||
*/
|
||||
serialize() {
|
||||
return {
|
||||
'id': '_',
|
||||
'bond_id': '_',
|
||||
'create_time': '_',
|
||||
'expiry_time': '_',
|
||||
// Setting deleted as false (zero value) throws error in EIP712 signature verification.
|
||||
'deleted': true,
|
||||
'attributes': this.attributes,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get message to calculate record signature.
|
||||
*/
|
||||
getMessageToSign() {
|
||||
return Util.sortJSON(this._record);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Record Signature.
|
||||
*/
|
||||
export class Signature {
|
||||
_pubKey: string
|
||||
_sig: string
|
||||
|
||||
/**
|
||||
* New Signature.
|
||||
*/
|
||||
constructor(pubKey: string, sig: string) {
|
||||
assert(pubKey);
|
||||
assert(sig);
|
||||
|
||||
this._pubKey = pubKey;
|
||||
this._sig = sig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize Signature.
|
||||
*/
|
||||
serialize() {
|
||||
return Util.sortJSON({
|
||||
'pub_key': this._pubKey,
|
||||
'sig': this._sig
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Message Payload.
|
||||
*/
|
||||
export class Payload {
|
||||
_record: Record
|
||||
_signatures: Signature[]
|
||||
|
||||
/**
|
||||
* New Payload.
|
||||
*/
|
||||
constructor(record: Record, ...signatures: Signature[]) {
|
||||
assert(record);
|
||||
|
||||
this._record = record;
|
||||
this._signatures = signatures;
|
||||
}
|
||||
|
||||
get record() {
|
||||
return this._record;
|
||||
}
|
||||
|
||||
get signatures() {
|
||||
return this._signatures;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add message signature to payload.
|
||||
*/
|
||||
addSignature(signature: any) {
|
||||
assert(signature);
|
||||
|
||||
this._signatures.push(signature);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize Payload.
|
||||
*/
|
||||
serialize() {
|
||||
// return Util.sortJSON({
|
||||
// });
|
||||
return {
|
||||
'record': this._record.serialize(),
|
||||
'signatures': this._signatures.map(s => s.serialize())
|
||||
}
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
import path from 'path';
|
||||
|
||||
import { Registry } from './index';
|
||||
import { getBaseConfig, getConfig } from './testing/helper';
|
||||
import { Util } from './util';
|
||||
|
||||
const WATCHER_YML_PATH = path.join(__dirname, './testing/data/watcher.yml');
|
||||
|
||||
jest.setTimeout(90 * 1000);
|
||||
|
||||
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
|
||||
|
||||
const utilTests = () => {
|
||||
let registry: Registry;
|
||||
|
||||
let bondId: string;
|
||||
let watcher: any;
|
||||
let watcherId: string;
|
||||
|
||||
beforeAll(async () => {
|
||||
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
|
||||
// Create bond.
|
||||
bondId = await registry.getNextBondId(privateKey);
|
||||
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||
|
||||
// Create watcher.
|
||||
watcher = await getBaseConfig(WATCHER_YML_PATH);
|
||||
const result = await registry.setRecord(
|
||||
{
|
||||
privateKey,
|
||||
bondId,
|
||||
record: watcher.record
|
||||
},
|
||||
privateKey,
|
||||
fee
|
||||
)
|
||||
|
||||
watcherId = result.data.id;
|
||||
});
|
||||
|
||||
test('Generate content id.', async () => {
|
||||
const cid = await Util.getContentId(watcher.record);
|
||||
expect(cid).toBe(watcherId)
|
||||
});
|
||||
}
|
||||
|
||||
describe('Util', utilTests);
|
120
src/util.ts
120
src/util.ts
@ -1,120 +0,0 @@
|
||||
import * as Block from 'multiformats/block'
|
||||
import { sha256 as hasher } from 'multiformats/hashes/sha2'
|
||||
import * as dagCBOR from '@ipld/dag-cbor'
|
||||
import * as dagJSON from '@ipld/dag-json'
|
||||
|
||||
/**
|
||||
* Utils
|
||||
*/
|
||||
export class Util {
|
||||
/**
|
||||
* Sorts JSON object.
|
||||
*/
|
||||
static sortJSON(obj: any) {
|
||||
if (obj instanceof Array) {
|
||||
for (let i = 0; i < obj.length; i++) {
|
||||
obj[i] = Util.sortJSON(obj[i]);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
if (typeof obj !== 'object' || obj === null) return obj;
|
||||
|
||||
let keys = Object.keys(obj);
|
||||
keys = keys.sort();
|
||||
const newObject: {[key: string]: any} = {};
|
||||
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
newObject[keys[i]] = Util.sortJSON(obj[keys[i]]);
|
||||
}
|
||||
return newObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marshal object into gql 'attributes' variable.
|
||||
*/
|
||||
static toGQLAttributes(obj: any) {
|
||||
const vars: any[] = [];
|
||||
Object.keys(obj).forEach(key => {
|
||||
const value = this.toGQLValue(obj[key]);
|
||||
|
||||
if (value !== undefined) {
|
||||
vars.push({ key, value });
|
||||
}
|
||||
});
|
||||
return vars;
|
||||
}
|
||||
|
||||
static toGQLValue(obj: any) {
|
||||
if (obj === null) {
|
||||
return null;
|
||||
}
|
||||
let type: string = typeof obj;
|
||||
switch (type) {
|
||||
case 'number':
|
||||
type = (obj % 1 === 0) ? 'int' : 'float';
|
||||
return { [type]: obj };
|
||||
case 'string':
|
||||
return { 'string': obj };
|
||||
case 'boolean':
|
||||
return { 'boolean': obj };
|
||||
case 'object':
|
||||
if (obj['/'] !== undefined) {
|
||||
return { 'link': obj['/'] };
|
||||
}
|
||||
if (obj instanceof Array) {
|
||||
return { 'array': obj };
|
||||
}
|
||||
return { 'map': obj };
|
||||
case 'undefined':
|
||||
return undefined;
|
||||
default:
|
||||
throw new Error(`Unknown object type '${type}': ${obj}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unmarshal attributes array to object.
|
||||
*/
|
||||
static fromGQLAttributes(attributes: any[] = []) {
|
||||
const res: {[key: string]: any} = {};
|
||||
|
||||
attributes.forEach(attr => {
|
||||
res[attr.key] = (attr.value === null) ? null : this.fromGQLValue(attr.value);
|
||||
});
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static fromGQLValue(obj: any) {
|
||||
// Get first non-null key
|
||||
const present = Object.keys(obj).find(k => obj[k] !== null);
|
||||
if (present === undefined) {
|
||||
throw new Error('Object has no non-null values');
|
||||
}
|
||||
|
||||
// Create an array if array type attribute
|
||||
if (present === 'array') {
|
||||
return obj[present].map((e: any) => {
|
||||
return this.fromGQLValue(e);
|
||||
});
|
||||
}
|
||||
|
||||
return obj[present];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get record content ID.
|
||||
*/
|
||||
static async getContentId(record: any) {
|
||||
const serialized = dagJSON.encode(record)
|
||||
const recordData = dagJSON.decode(serialized)
|
||||
|
||||
const block = await Block.encode({
|
||||
value: recordData,
|
||||
codec: dagCBOR,
|
||||
hasher
|
||||
})
|
||||
|
||||
return block.cid.toString();
|
||||
}
|
||||
}
|
@ -33,7 +33,7 @@
|
||||
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
"resolveJsonModule": true, /* Enable importing .json files */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files */
|
||||
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
/* JavaScript Support */
|
||||
@ -42,12 +42,12 @@
|
||||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
||||
|
||||
/* Emit */
|
||||
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
||||
"outDir": "./dist", /* Specify an output folder for all emitted files. */
|
||||
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
||||
// "removeComments": true, /* Disable emitting comments. */
|
||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||
@ -97,11 +97,5 @@
|
||||
/* Completeness */
|
||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"src/**/*.test.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user