Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
3dabf399f7 | |||
73bef00dd3 | |||
809c4d8f5b | |||
fedf35d702 | |||
65001568c8 | |||
990e427c3f | |||
419dddc35a | |||
99bc3f0ce5 | |||
fc2987a5ca | |||
aba95a275c | |||
a3603e2738 | |||
27443c3cac | |||
b5fce86d48 | |||
82d8626d0f | |||
6b53c43c51 | |||
7dd8dca408 |
2
.dockerignore
Normal file
2
.dockerignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Dockerfile
|
||||||
|
node_modules
|
36
.gitea/workflows/publish.yaml
Normal file
36
.gitea/workflows/publish.yaml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
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
|
63
.gitea/workflows/test.yml
Normal file
63
.gitea/workflows/test.yml
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
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
|
63
.github/workflows/test.yml
vendored
63
.github/workflows/test.yml
vendored
@ -20,53 +20,34 @@ jobs:
|
|||||||
ref: main
|
ref: main
|
||||||
- name: Environment
|
- name: Environment
|
||||||
run: ls -tlh && env
|
run: ls -tlh && env
|
||||||
- name: build containers scripts
|
|
||||||
|
- name: Build laconicd container
|
||||||
working-directory: laconicd/tests/sdk_tests
|
working-directory: laconicd/tests/sdk_tests
|
||||||
run: ./build-laconicd-container.sh
|
run: ./build-laconicd-container.sh
|
||||||
- name: build test-container
|
- name: Build laconic-sdk container
|
||||||
run: docker build -t cerc-io/laconic-sdk-tester:local-test -f laconicd/tests/sdk_tests/Dockerfile-sdk .
|
run: ./scripts/build-sdk-test-container.sh
|
||||||
- name: start containers
|
|
||||||
|
- name: Start containers
|
||||||
working-directory: laconicd/tests/sdk_tests
|
working-directory: laconicd/tests/sdk_tests
|
||||||
run: docker compose up -d
|
run: docker compose up -d
|
||||||
- name: run basic tests
|
- name: Run tests
|
||||||
working-directory: laconicd/tests/sdk_tests
|
working-directory: laconicd/tests/sdk_tests
|
||||||
run: |
|
run: ./run-tests.sh
|
||||||
laconicd_key=$( docker compose exec laconicd echo y | docker compose exec laconicd laconicd keys export mykey --unarmored-hex --unsafe )
|
|
||||||
cosmos_chain_id=laconic_9000-1
|
- name: Start containers (auctions enabled)
|
||||||
laconicd_rest_endpoint=http://laconicd:1317
|
|
||||||
laconicd_gql_endpoint=http://laconicd:9473/api
|
|
||||||
sleep 30s
|
|
||||||
docker compose exec sdk-test-runner sh -c "COSMOS_CHAIN_ID=${cosmos_chain_id} LACONICD_REST_ENDPOINT=${laconicd_rest_endpoint} LACONICD_GQL_ENDPOINT=${laconicd_gql_endpoint} PRIVATE_KEY=${laconicd_key} yarn test"
|
|
||||||
- name: stop containers
|
|
||||||
working-directory: laconicd/tests/sdk_tests
|
working-directory: laconicd/tests/sdk_tests
|
||||||
run: docker compose down
|
env:
|
||||||
- name: start auction containers
|
TEST_AUCTION_ENABLED: true
|
||||||
|
run: docker compose up -d
|
||||||
|
- name: Run auction tests
|
||||||
working-directory: laconicd/tests/sdk_tests
|
working-directory: laconicd/tests/sdk_tests
|
||||||
run: docker compose -f docker-compose-auctions.yml up -d
|
run: ./run-tests.sh test:auctions
|
||||||
- name: run auction tests
|
|
||||||
|
- name: Start containers (expiry enabled)
|
||||||
working-directory: laconicd/tests/sdk_tests
|
working-directory: laconicd/tests/sdk_tests
|
||||||
run: |
|
env:
|
||||||
laconicd_key=$( docker compose exec laconicd echo y | docker compose exec laconicd laconicd keys export mykey --unarmored-hex --unsafe )
|
TEST_REGISTRY_EXPIRY: true
|
||||||
cosmos_chain_id=laconic_9000-1
|
run: docker compose up -d
|
||||||
laconicd_rest_endpoint=http://laconicd:1317
|
- name: Run nameservice expiry tests
|
||||||
laconicd_gql_endpoint=http://laconicd:9473/api
|
|
||||||
sleep 30s
|
|
||||||
docker compose exec sdk-test-runner sh -c "COSMOS_CHAIN_ID=${cosmos_chain_id} LACONICD_REST_ENDPOINT=${laconicd_rest_endpoint} LACONICD_GQL_ENDPOINT=${laconicd_gql_endpoint} PRIVATE_KEY=${laconicd_key} yarn test:auctions"
|
|
||||||
- name: start containers
|
|
||||||
working-directory: laconicd/tests/sdk_tests
|
working-directory: laconicd/tests/sdk_tests
|
||||||
run: docker compose down
|
run: ./run-tests.sh test:nameservice-expiry
|
||||||
- name: start containers
|
|
||||||
working-directory: laconicd/tests/sdk_tests
|
|
||||||
run: docker compose -f docker-compose-nameservice.yml up -d
|
|
||||||
- name: run nameservice expiry tests
|
|
||||||
working-directory: laconicd/tests/sdk_tests
|
|
||||||
run: |
|
|
||||||
laconicd_key=$( docker compose exec laconicd echo y | docker compose exec laconicd laconicd keys export mykey --unarmored-hex --unsafe )
|
|
||||||
cosmos_chain_id=laconic_9000-1
|
|
||||||
laconicd_rest_endpoint=http://laconicd:1317
|
|
||||||
laconicd_gql_endpoint=http://laconicd:9473/api
|
|
||||||
sleep 30s
|
|
||||||
docker compose exec sdk-test-runner sh -c "COSMOS_CHAIN_ID=${cosmos_chain_id} LACONICD_REST_ENDPOINT=${laconicd_rest_endpoint} LACONICD_GQL_ENDPOINT=${laconicd_gql_endpoint} PRIVATE_KEY=${laconicd_key} yarn test:nameservice-expiry"
|
|
||||||
- name: stop nameservice containers
|
|
||||||
working-directory: laconicd/tests/sdk_tests
|
|
||||||
run: docker compose down
|
|
||||||
|
@ -12,13 +12,5 @@ Run following scripts when [proto files](./proto/) are updated.
|
|||||||
2. Generate typescript code for the proto files
|
2. Generate typescript code for the proto files
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./scripts/create-proto-files.sh
|
./scripts/proto-gen.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Remove GRPC code from generated code
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./scripts/remove-grpc.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
Reference: https://github.com/tharsis/evmosjs/tree/main/packages/proto#note
|
|
||||||
|
@ -21,34 +21,18 @@ RUN \
|
|||||||
&& npm config -g set prefix ${NPM_GLOBAL} \
|
&& npm config -g set prefix ${NPM_GLOBAL} \
|
||||||
&& su ${USERNAME} -c "npm config -g set prefix ${NPM_GLOBAL}" \
|
&& su ${USERNAME} -c "npm config -g set prefix ${NPM_GLOBAL}" \
|
||||||
# Install eslint
|
# Install eslint
|
||||||
&& su ${USERNAME} -c "umask 0002 && npm install -g eslint lerna jest" \
|
&& su ${USERNAME} -c "umask 0002 && npm install -g eslint" \
|
||||||
&& npm cache clean --force > /dev/null 2>&1
|
&& npm cache clean --force > /dev/null 2>&1
|
||||||
|
|
||||||
# [Optional] Uncomment this section to install additional OS packages.
|
|
||||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
|
||||||
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
|
||||||
|
|
||||||
# [Optional] Uncomment if you want to install an additional version of node using nvm
|
|
||||||
# ARG EXTRA_NODE_VERSION=10
|
|
||||||
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
|
|
||||||
|
|
||||||
# [Optional] Uncomment if you want to install more global node modules
|
|
||||||
# RUN su node -c "npm install -g <your-package-list-here>"
|
|
||||||
|
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
RUN mkdir node_modules && mkdir proto && mkdir scripts && mkdir src
|
|
||||||
COPY node_modules ./node_modules/
|
|
||||||
COPY proto . ./proto/
|
|
||||||
COPY scripts ./scripts/
|
|
||||||
COPY src ./src/
|
|
||||||
COPY entrypoint.sh .
|
COPY entrypoint.sh .
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
# Placeholder CMD : generally this will be overridden at run time like :
|
|
||||||
# docker run -it -v /home/builder/cerc/laconic-sdk:/workspace cerc/builder-js sh -c 'cd /workspace && yarn && yarn build'
|
|
||||||
CMD node --version
|
CMD node --version
|
||||||
|
|
||||||
# Temp hack, clone the laconic-sdk repo here
|
WORKDIR /app/laconic-sdk
|
||||||
WORKDIR /app
|
|
||||||
|
COPY package*.json .
|
||||||
RUN yarn install
|
RUN yarn install
|
||||||
|
COPY . .
|
||||||
|
|
||||||
WORKDIR /app/laconic-sdk
|
WORKDIR /app/laconic-sdk
|
12
README.md
12
README.md
@ -34,6 +34,12 @@ Follow these steps to run the tests:
|
|||||||
|
|
||||||
- Run the tests with auctions enabled
|
- Run the tests with auctions enabled
|
||||||
|
|
||||||
|
- Remove laconicd data from previous run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rm -rf ~/.laconicd
|
||||||
|
```
|
||||||
|
|
||||||
- In laconicd repo run:
|
- In laconicd repo run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -54,6 +60,12 @@ Follow these steps to run the tests:
|
|||||||
|
|
||||||
- Run the tests for record and authority expiry
|
- Run the tests for record and authority expiry
|
||||||
|
|
||||||
|
- Remove laconicd data from previous run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rm -rf ~/.laconicd
|
||||||
|
```
|
||||||
|
|
||||||
- In laconicd repo run:
|
- In laconicd repo run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cerc-io/laconic-sdk",
|
"name": "@cerc-io/laconic-sdk",
|
||||||
"version": "0.1.6",
|
"version": "0.1.16",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"repository": "git@github.com:cerc-io/laconic-sdk.git",
|
"repository": "git@github.com:cerc-io/laconic-sdk.git",
|
||||||
@ -14,7 +14,7 @@
|
|||||||
"dotenv": "^16.0.0",
|
"dotenv": "^16.0.0",
|
||||||
"google-protobuf": "^3.21.0",
|
"google-protobuf": "^3.21.0",
|
||||||
"jest": "29.0.0",
|
"jest": "29.0.0",
|
||||||
"protoc-gen-ts": "^0.8.6-rc1",
|
"protoc-gen-ts": "^0.8.7",
|
||||||
"ts-jest": "^29.0.2",
|
"ts-jest": "^29.0.2",
|
||||||
"typescript": "^4.6.2"
|
"typescript": "^4.6.2"
|
||||||
},
|
},
|
||||||
@ -48,7 +48,7 @@
|
|||||||
"tiny-secp256k1": "^1.1.6"
|
"tiny-secp256k1": "^1.1.6"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest --runInBand --verbose",
|
"test": "jest --runInBand --verbose --testPathPattern=src",
|
||||||
"test:auctions": "TEST_AUCTIONS_ENABLED=1 jest --runInBand --verbose src/auction.test.ts",
|
"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",
|
"test:nameservice-expiry": "TEST_NAMESERVICE_EXPIRY=1 jest --runInBand --verbose src/nameservice-expiry.test.ts",
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
|
@ -1,97 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
package cosmos_proto;
|
|
||||||
|
|
||||||
import "google/protobuf/descriptor.proto";
|
|
||||||
|
|
||||||
option go_package = "github.com/cosmos/cosmos-proto;cosmos_proto";
|
|
||||||
|
|
||||||
extend google.protobuf.MessageOptions {
|
|
||||||
|
|
||||||
// implements_interface is used to indicate the type name of the interface
|
|
||||||
// that a message implements so that it can be used in google.protobuf.Any
|
|
||||||
// fields that accept that interface. A message can implement multiple
|
|
||||||
// interfaces. Interfaces should be declared using a declare_interface
|
|
||||||
// file option.
|
|
||||||
repeated string implements_interface = 93001;
|
|
||||||
}
|
|
||||||
|
|
||||||
extend google.protobuf.FieldOptions {
|
|
||||||
|
|
||||||
// accepts_interface is used to annotate that a google.protobuf.Any
|
|
||||||
// field accepts messages that implement the specified interface.
|
|
||||||
// Interfaces should be declared using a declare_interface file option.
|
|
||||||
string accepts_interface = 93001;
|
|
||||||
|
|
||||||
// scalar is used to indicate that this field follows the formatting defined
|
|
||||||
// by the named scalar which should be declared with declare_scalar. Code
|
|
||||||
// generators may choose to use this information to map this field to a
|
|
||||||
// language-specific type representing the scalar.
|
|
||||||
string scalar = 93002;
|
|
||||||
}
|
|
||||||
|
|
||||||
extend google.protobuf.FileOptions {
|
|
||||||
|
|
||||||
// declare_interface declares an interface type to be used with
|
|
||||||
// accepts_interface and implements_interface. Interface names are
|
|
||||||
// expected to follow the following convention such that their declaration
|
|
||||||
// can be discovered by tools: for a given interface type a.b.C, it is
|
|
||||||
// expected that the declaration will be found in a protobuf file named
|
|
||||||
// a/b/interfaces.proto in the file descriptor set.
|
|
||||||
repeated InterfaceDescriptor declare_interface = 793021;
|
|
||||||
|
|
||||||
// declare_scalar declares a scalar type to be used with
|
|
||||||
// the scalar field option. Scalar names are
|
|
||||||
// expected to follow the following convention such that their declaration
|
|
||||||
// can be discovered by tools: for a given scalar type a.b.C, it is
|
|
||||||
// expected that the declaration will be found in a protobuf file named
|
|
||||||
// a/b/scalars.proto in the file descriptor set.
|
|
||||||
repeated ScalarDescriptor declare_scalar = 793022;
|
|
||||||
}
|
|
||||||
|
|
||||||
// InterfaceDescriptor describes an interface type to be used with
|
|
||||||
// accepts_interface and implements_interface and declared by declare_interface.
|
|
||||||
message InterfaceDescriptor {
|
|
||||||
|
|
||||||
// name is the name of the interface. It should be a short-name (without
|
|
||||||
// a period) such that the fully qualified name of the interface will be
|
|
||||||
// package.name, ex. for the package a.b and interface named C, the
|
|
||||||
// fully-qualified name will be a.b.C.
|
|
||||||
string name = 1;
|
|
||||||
|
|
||||||
// description is a human-readable description of the interface and its
|
|
||||||
// purpose.
|
|
||||||
string description = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ScalarDescriptor describes an scalar type to be used with
|
|
||||||
// the scalar field option and declared by declare_scalar.
|
|
||||||
// Scalars extend simple protobuf built-in types with additional
|
|
||||||
// syntax and semantics, for instance to represent big integers.
|
|
||||||
// Scalars should ideally define an encoding such that there is only one
|
|
||||||
// valid syntactical representation for a given semantic meaning,
|
|
||||||
// i.e. the encoding should be deterministic.
|
|
||||||
message ScalarDescriptor {
|
|
||||||
|
|
||||||
// name is the name of the scalar. It should be a short-name (without
|
|
||||||
// a period) such that the fully qualified name of the scalar will be
|
|
||||||
// package.name, ex. for the package a.b and scalar named C, the
|
|
||||||
// fully-qualified name will be a.b.C.
|
|
||||||
string name = 1;
|
|
||||||
|
|
||||||
// description is a human-readable description of the scalar and its
|
|
||||||
// encoding format. For instance a big integer or decimal scalar should
|
|
||||||
// specify precisely the expected encoding format.
|
|
||||||
string description = 2;
|
|
||||||
|
|
||||||
// field_type is the type of field with which this scalar can be used.
|
|
||||||
// Scalars can be used with one and only one type of field so that
|
|
||||||
// encoding standards and simple and clear. Currently only string and
|
|
||||||
// bytes fields are supported for scalars.
|
|
||||||
repeated ScalarType field_type = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum ScalarType {
|
|
||||||
SCALAR_TYPE_UNSPECIFIED = 0;
|
|
||||||
SCALAR_TYPE_STRING = 1;
|
|
||||||
SCALAR_TYPE_BYTES = 2;
|
|
||||||
}
|
|
@ -1,243 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
package ethermint.evm.v1;
|
|
||||||
|
|
||||||
import "gogoproto/gogo.proto";
|
|
||||||
|
|
||||||
option go_package = "github.com/cerc-io/laconicd/x/evm/types";
|
|
||||||
|
|
||||||
// Params defines the EVM module parameters
|
|
||||||
message Params {
|
|
||||||
// evm_denom represents the token denomination used to run the EVM state
|
|
||||||
// transitions.
|
|
||||||
string evm_denom = 1 [(gogoproto.moretags) = "yaml:\"evm_denom\""];
|
|
||||||
// enable_create toggles state transitions that use the vm.Create function
|
|
||||||
bool enable_create = 2 [(gogoproto.moretags) = "yaml:\"enable_create\""];
|
|
||||||
// enable_call toggles state transitions that use the vm.Call function
|
|
||||||
bool enable_call = 3 [(gogoproto.moretags) = "yaml:\"enable_call\""];
|
|
||||||
// extra_eips defines the additional EIPs for the vm.Config
|
|
||||||
repeated int64 extra_eips = 4 [(gogoproto.customname) = "ExtraEIPs", (gogoproto.moretags) = "yaml:\"extra_eips\""];
|
|
||||||
// chain_config defines the EVM chain configuration parameters
|
|
||||||
ChainConfig chain_config = 5 [(gogoproto.moretags) = "yaml:\"chain_config\"", (gogoproto.nullable) = false];
|
|
||||||
// allow_unprotected_txs defines if replay-protected (i.e non EIP155
|
|
||||||
// signed) transactions can be executed on the state machine.
|
|
||||||
bool allow_unprotected_txs = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int values
|
|
||||||
// instead of *big.Int.
|
|
||||||
message ChainConfig {
|
|
||||||
// homestead_block switch (nil no fork, 0 = already homestead)
|
|
||||||
string homestead_block = 1 [
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.moretags) = "yaml:\"homestead_block\""
|
|
||||||
];
|
|
||||||
// dao_fork_block corresponds to TheDAO hard-fork switch block (nil no fork)
|
|
||||||
string dao_fork_block = 2 [
|
|
||||||
(gogoproto.customname) = "DAOForkBlock",
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.moretags) = "yaml:\"dao_fork_block\""
|
|
||||||
];
|
|
||||||
// dao_fork_support defines whether the nodes supports or opposes the DAO hard-fork
|
|
||||||
bool dao_fork_support = 3
|
|
||||||
[(gogoproto.customname) = "DAOForkSupport", (gogoproto.moretags) = "yaml:\"dao_fork_support\""];
|
|
||||||
// eip150_block: EIP150 implements the Gas price changes
|
|
||||||
// (https://github.com/ethereum/EIPs/issues/150) EIP150 HF block (nil no fork)
|
|
||||||
string eip150_block = 4 [
|
|
||||||
(gogoproto.customname) = "EIP150Block",
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.moretags) = "yaml:\"eip150_block\""
|
|
||||||
];
|
|
||||||
// eip150_hash: EIP150 HF hash (needed for header only clients as only gas pricing changed)
|
|
||||||
string eip150_hash = 5 [(gogoproto.customname) = "EIP150Hash", (gogoproto.moretags) = "yaml:\"byzantium_block\""];
|
|
||||||
// eip155_block: EIP155Block HF block
|
|
||||||
string eip155_block = 6 [
|
|
||||||
(gogoproto.customname) = "EIP155Block",
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.moretags) = "yaml:\"eip155_block\""
|
|
||||||
];
|
|
||||||
// eip158_block: EIP158 HF block
|
|
||||||
string eip158_block = 7 [
|
|
||||||
(gogoproto.customname) = "EIP158Block",
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.moretags) = "yaml:\"eip158_block\""
|
|
||||||
];
|
|
||||||
// byzantium_block: Byzantium switch block (nil no fork, 0 = already on byzantium)
|
|
||||||
string byzantium_block = 8 [
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.moretags) = "yaml:\"byzantium_block\""
|
|
||||||
];
|
|
||||||
// constantinople_block: Constantinople switch block (nil no fork, 0 = already activated)
|
|
||||||
string constantinople_block = 9 [
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.moretags) = "yaml:\"constantinople_block\""
|
|
||||||
];
|
|
||||||
// petersburg_block: Petersburg switch block (nil same as Constantinople)
|
|
||||||
string petersburg_block = 10 [
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.moretags) = "yaml:\"petersburg_block\""
|
|
||||||
];
|
|
||||||
// istanbul_block: Istanbul switch block (nil no fork, 0 = already on istanbul)
|
|
||||||
string istanbul_block = 11 [
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.moretags) = "yaml:\"istanbul_block\""
|
|
||||||
];
|
|
||||||
// muir_glacier_block: Eip-2384 (bomb delay) switch block (nil no fork, 0 = already activated)
|
|
||||||
string muir_glacier_block = 12 [
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.moretags) = "yaml:\"muir_glacier_block\""
|
|
||||||
];
|
|
||||||
// berlin_block: Berlin switch block (nil = no fork, 0 = already on berlin)
|
|
||||||
string berlin_block = 13 [
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.moretags) = "yaml:\"berlin_block\""
|
|
||||||
];
|
|
||||||
// DEPRECATED: EWASM, YOLOV3 and Catalyst block have been deprecated
|
|
||||||
reserved 14, 15, 16;
|
|
||||||
reserved "yolo_v3_block", "ewasm_block", "catalyst_block";
|
|
||||||
// london_block: London switch block (nil = no fork, 0 = already on london)
|
|
||||||
string london_block = 17 [
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.moretags) = "yaml:\"london_block\""
|
|
||||||
];
|
|
||||||
// arrow_glacier_block: Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already activated)
|
|
||||||
string arrow_glacier_block = 18 [
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.moretags) = "yaml:\"arrow_glacier_block\""
|
|
||||||
];
|
|
||||||
// DEPRECATED: merge fork block was deprecated: https://github.com/ethereum/go-ethereum/pull/24904
|
|
||||||
reserved 19;
|
|
||||||
reserved "merge_fork_block";
|
|
||||||
// gray_glacier_block: EIP-5133 (bomb delay) switch block (nil = no fork, 0 = already activated)
|
|
||||||
string gray_glacier_block = 20 [
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.moretags) = "yaml:\"gray_glacier_block\""
|
|
||||||
];
|
|
||||||
// merge_netsplit_block: Virtual fork after The Merge to use as a network splitter
|
|
||||||
string merge_netsplit_block = 21 [
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.moretags) = "yaml:\"merge_netsplit_block\""
|
|
||||||
];
|
|
||||||
// shanghai_block switch block (nil = no fork, 0 = already on shanghai)
|
|
||||||
string shanghai_block = 22 [
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.moretags) = "yaml:\"shanghai_block\""
|
|
||||||
];
|
|
||||||
// cancun_block switch block (nil = no fork, 0 = already on cancun)
|
|
||||||
string cancun_block = 23 [
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.moretags) = "yaml:\"cancun_block\""
|
|
||||||
];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// State represents a single Storage key value pair item.
|
|
||||||
message State {
|
|
||||||
// key is the stored key
|
|
||||||
string key = 1;
|
|
||||||
// value is the stored value for the given key
|
|
||||||
string value = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TransactionLogs define the logs generated from a transaction execution
|
|
||||||
// with a given hash. It it used for import/export data as transactions are not
|
|
||||||
// persisted on blockchain state after an upgrade.
|
|
||||||
message TransactionLogs {
|
|
||||||
// hash of the transaction
|
|
||||||
string hash = 1;
|
|
||||||
// logs is an array of Logs for the given transaction hash
|
|
||||||
repeated Log logs = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log represents an protobuf compatible Ethereum Log that defines a contract
|
|
||||||
// log event. These events are generated by the LOG opcode and stored/indexed by
|
|
||||||
// the node.
|
|
||||||
//
|
|
||||||
// NOTE: address, topics and data are consensus fields. The rest of the fields
|
|
||||||
// are derived, i.e. filled in by the nodes, but not secured by consensus.
|
|
||||||
message Log {
|
|
||||||
// address of the contract that generated the event
|
|
||||||
string address = 1;
|
|
||||||
// topics is a list of topics provided by the contract.
|
|
||||||
repeated string topics = 2;
|
|
||||||
// data which is supplied by the contract, usually ABI-encoded
|
|
||||||
bytes data = 3;
|
|
||||||
|
|
||||||
// block_number of the block in which the transaction was included
|
|
||||||
uint64 block_number = 4 [(gogoproto.jsontag) = "blockNumber"];
|
|
||||||
// tx_hash is the transaction hash
|
|
||||||
string tx_hash = 5 [(gogoproto.jsontag) = "transactionHash"];
|
|
||||||
// tx_index of the transaction in the block
|
|
||||||
uint64 tx_index = 6 [(gogoproto.jsontag) = "transactionIndex"];
|
|
||||||
// block_hash of the block in which the transaction was included
|
|
||||||
string block_hash = 7 [(gogoproto.jsontag) = "blockHash"];
|
|
||||||
// index of the log in the block
|
|
||||||
uint64 index = 8 [(gogoproto.jsontag) = "logIndex"];
|
|
||||||
|
|
||||||
// removed is true if this log was reverted due to a chain
|
|
||||||
// reorganisation. You must pay attention to this field if you receive logs
|
|
||||||
// through a filter query.
|
|
||||||
bool removed = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TxResult stores results of Tx execution.
|
|
||||||
message TxResult {
|
|
||||||
option (gogoproto.goproto_getters) = false;
|
|
||||||
|
|
||||||
// contract_address contains the ethereum address of the created contract (if
|
|
||||||
// any). If the state transition is an evm.Call, the contract address will be
|
|
||||||
// empty.
|
|
||||||
string contract_address = 1 [(gogoproto.moretags) = "yaml:\"contract_address\""];
|
|
||||||
// bloom represents the bloom filter bytes
|
|
||||||
bytes bloom = 2;
|
|
||||||
// tx_logs contains the transaction hash and the proto-compatible ethereum
|
|
||||||
// logs.
|
|
||||||
TransactionLogs tx_logs = 3 [(gogoproto.moretags) = "yaml:\"tx_logs\"", (gogoproto.nullable) = false];
|
|
||||||
// ret defines the bytes from the execution.
|
|
||||||
bytes ret = 4;
|
|
||||||
// reverted flag is set to true when the call has been reverted
|
|
||||||
bool reverted = 5;
|
|
||||||
// gas_used notes the amount of gas consumed while execution
|
|
||||||
uint64 gas_used = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccessTuple is the element type of an access list.
|
|
||||||
message AccessTuple {
|
|
||||||
option (gogoproto.goproto_getters) = false;
|
|
||||||
|
|
||||||
// address is a hex formatted ethereum address
|
|
||||||
string address = 1;
|
|
||||||
// storage_keys are hex formatted hashes of the storage keys
|
|
||||||
repeated string storage_keys = 2 [(gogoproto.jsontag) = "storageKeys"];
|
|
||||||
}
|
|
||||||
|
|
||||||
// TraceConfig holds extra parameters to trace functions.
|
|
||||||
message TraceConfig {
|
|
||||||
// DEPRECATED: DisableMemory and DisableReturnData have been renamed to
|
|
||||||
// Enable*.
|
|
||||||
reserved 4, 7;
|
|
||||||
reserved "disable_memory", "disable_return_data";
|
|
||||||
|
|
||||||
// tracer is a custom javascript tracer
|
|
||||||
string tracer = 1;
|
|
||||||
// timeout overrides the default timeout of 5 seconds for JavaScript-based tracing
|
|
||||||
// calls
|
|
||||||
string timeout = 2;
|
|
||||||
// reexec defines the number of blocks the tracer is willing to go back
|
|
||||||
uint64 reexec = 3;
|
|
||||||
// disable_stack switches stack capture
|
|
||||||
bool disable_stack = 5 [(gogoproto.jsontag) = "disableStack"];
|
|
||||||
// disable_storage switches storage capture
|
|
||||||
bool disable_storage = 6 [(gogoproto.jsontag) = "disableStorage"];
|
|
||||||
// debug can be used to print output during capture end
|
|
||||||
bool debug = 8;
|
|
||||||
// limit defines the maximum length of output, but zero means unlimited
|
|
||||||
int32 limit = 9;
|
|
||||||
// overrides can be used to execute a trace using future fork rules
|
|
||||||
ChainConfig overrides = 10;
|
|
||||||
// enable_memory switches memory capture
|
|
||||||
bool enable_memory = 11 [(gogoproto.jsontag) = "enableMemory"];
|
|
||||||
// enable_return_data switches the capture of return data
|
|
||||||
bool enable_return_data = 12 [(gogoproto.jsontag) = "enableReturnData"];
|
|
||||||
// tracer_json_config configures the tracer using a JSON string
|
|
||||||
string tracer_json_config = 13 [(gogoproto.jsontag) = "tracerConfig"];
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
package ethermint.evm.v1;
|
|
||||||
|
|
||||||
import "ethermint/evm/v1/evm.proto";
|
|
||||||
import "gogoproto/gogo.proto";
|
|
||||||
|
|
||||||
option go_package = "github.com/cerc-io/laconicd/x/evm/types";
|
|
||||||
|
|
||||||
// GenesisState defines the evm module's genesis state.
|
|
||||||
message GenesisState {
|
|
||||||
// accounts is an array containing the ethereum genesis accounts.
|
|
||||||
repeated GenesisAccount accounts = 1 [(gogoproto.nullable) = false];
|
|
||||||
// params defines all the parameters of the module.
|
|
||||||
Params params = 2 [(gogoproto.nullable) = false];
|
|
||||||
}
|
|
||||||
|
|
||||||
// GenesisAccount defines an account to be initialized in the genesis state.
|
|
||||||
// Its main difference between with Geth's GenesisAccount is that it uses a
|
|
||||||
// custom storage type and that it doesn't contain the private key field.
|
|
||||||
message GenesisAccount {
|
|
||||||
// address defines an ethereum hex formated address of an account
|
|
||||||
string address = 1;
|
|
||||||
// code defines the hex bytes of the account code.
|
|
||||||
string code = 2;
|
|
||||||
// storage defines the set of state key values for the account.
|
|
||||||
repeated State storage = 3 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "Storage"];
|
|
||||||
}
|
|
@ -1,298 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
package ethermint.evm.v1;
|
|
||||||
|
|
||||||
import "cosmos/base/query/v1beta1/pagination.proto";
|
|
||||||
import "ethermint/evm/v1/evm.proto";
|
|
||||||
import "ethermint/evm/v1/tx.proto";
|
|
||||||
import "gogoproto/gogo.proto";
|
|
||||||
import "google/api/annotations.proto";
|
|
||||||
import "google/protobuf/timestamp.proto";
|
|
||||||
|
|
||||||
option go_package = "github.com/cerc-io/laconicd/x/evm/types";
|
|
||||||
|
|
||||||
// Query defines the gRPC querier service.
|
|
||||||
service Query {
|
|
||||||
// Account queries an Ethereum account.
|
|
||||||
rpc Account(QueryAccountRequest) returns (QueryAccountResponse) {
|
|
||||||
option (google.api.http).get = "/ethermint/evm/v1/account/{address}";
|
|
||||||
}
|
|
||||||
|
|
||||||
// CosmosAccount queries an Ethereum account's Cosmos Address.
|
|
||||||
rpc CosmosAccount(QueryCosmosAccountRequest) returns (QueryCosmosAccountResponse) {
|
|
||||||
option (google.api.http).get = "/ethermint/evm/v1/cosmos_account/{address}";
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidatorAccount queries an Ethereum account's from a validator consensus
|
|
||||||
// Address.
|
|
||||||
rpc ValidatorAccount(QueryValidatorAccountRequest) returns (QueryValidatorAccountResponse) {
|
|
||||||
option (google.api.http).get = "/ethermint/evm/v1/validator_account/{cons_address}";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Balance queries the balance of a the EVM denomination for a single
|
|
||||||
// EthAccount.
|
|
||||||
rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) {
|
|
||||||
option (google.api.http).get = "/ethermint/evm/v1/balances/{address}";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Storage queries the balance of all coins for a single account.
|
|
||||||
rpc Storage(QueryStorageRequest) returns (QueryStorageResponse) {
|
|
||||||
option (google.api.http).get = "/ethermint/evm/v1/storage/{address}/{key}";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Code queries the balance of all coins for a single account.
|
|
||||||
rpc Code(QueryCodeRequest) returns (QueryCodeResponse) {
|
|
||||||
option (google.api.http).get = "/ethermint/evm/v1/codes/{address}";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Params queries the parameters of x/evm module.
|
|
||||||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
|
|
||||||
option (google.api.http).get = "/ethermint/evm/v1/params";
|
|
||||||
}
|
|
||||||
|
|
||||||
// EthCall implements the `eth_call` rpc api
|
|
||||||
rpc EthCall(EthCallRequest) returns (MsgEthereumTxResponse) {
|
|
||||||
option (google.api.http).get = "/ethermint/evm/v1/eth_call";
|
|
||||||
}
|
|
||||||
|
|
||||||
// EstimateGas implements the `eth_estimateGas` rpc api
|
|
||||||
rpc EstimateGas(EthCallRequest) returns (EstimateGasResponse) {
|
|
||||||
option (google.api.http).get = "/ethermint/evm/v1/estimate_gas";
|
|
||||||
}
|
|
||||||
|
|
||||||
// TraceTx implements the `debug_traceTransaction` rpc api
|
|
||||||
rpc TraceTx(QueryTraceTxRequest) returns (QueryTraceTxResponse) {
|
|
||||||
option (google.api.http).get = "/ethermint/evm/v1/trace_tx";
|
|
||||||
}
|
|
||||||
|
|
||||||
// TraceBlock implements the `debug_traceBlockByNumber` and `debug_traceBlockByHash` rpc api
|
|
||||||
rpc TraceBlock(QueryTraceBlockRequest) returns (QueryTraceBlockResponse) {
|
|
||||||
option (google.api.http).get = "/ethermint/evm/v1/trace_block";
|
|
||||||
}
|
|
||||||
|
|
||||||
// BaseFee queries the base fee of the parent block of the current block,
|
|
||||||
// it's similar to feemarket module's method, but also checks london hardfork status.
|
|
||||||
rpc BaseFee(QueryBaseFeeRequest) returns (QueryBaseFeeResponse) {
|
|
||||||
option (google.api.http).get = "/ethermint/evm/v1/base_fee";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryAccountRequest is the request type for the Query/Account RPC method.
|
|
||||||
message QueryAccountRequest {
|
|
||||||
option (gogoproto.equal) = false;
|
|
||||||
option (gogoproto.goproto_getters) = false;
|
|
||||||
|
|
||||||
// address is the ethereum hex address to query the account for.
|
|
||||||
string address = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryAccountResponse is the response type for the Query/Account RPC method.
|
|
||||||
message QueryAccountResponse {
|
|
||||||
// balance is the balance of the EVM denomination.
|
|
||||||
string balance = 1;
|
|
||||||
// code_hash is the hex-formatted code bytes from the EOA.
|
|
||||||
string code_hash = 2;
|
|
||||||
// nonce is the account's sequence number.
|
|
||||||
uint64 nonce = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryCosmosAccountRequest is the request type for the Query/CosmosAccount RPC
|
|
||||||
// method.
|
|
||||||
message QueryCosmosAccountRequest {
|
|
||||||
option (gogoproto.equal) = false;
|
|
||||||
option (gogoproto.goproto_getters) = false;
|
|
||||||
|
|
||||||
// address is the ethereum hex address to query the account for.
|
|
||||||
string address = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryCosmosAccountResponse is the response type for the Query/CosmosAccount
|
|
||||||
// RPC method.
|
|
||||||
message QueryCosmosAccountResponse {
|
|
||||||
// cosmos_address is the cosmos address of the account.
|
|
||||||
string cosmos_address = 1;
|
|
||||||
// sequence is the account's sequence number.
|
|
||||||
uint64 sequence = 2;
|
|
||||||
// account_number is the account number
|
|
||||||
uint64 account_number = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryValidatorAccountRequest is the request type for the
|
|
||||||
// Query/ValidatorAccount RPC method.
|
|
||||||
message QueryValidatorAccountRequest {
|
|
||||||
option (gogoproto.equal) = false;
|
|
||||||
option (gogoproto.goproto_getters) = false;
|
|
||||||
|
|
||||||
// cons_address is the validator cons address to query the account for.
|
|
||||||
string cons_address = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryValidatorAccountResponse is the response type for the
|
|
||||||
// Query/ValidatorAccount RPC method.
|
|
||||||
message QueryValidatorAccountResponse {
|
|
||||||
// account_address is the cosmos address of the account in bech32 format.
|
|
||||||
string account_address = 1;
|
|
||||||
// sequence is the account's sequence number.
|
|
||||||
uint64 sequence = 2;
|
|
||||||
// account_number is the account number
|
|
||||||
uint64 account_number = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryBalanceRequest is the request type for the Query/Balance RPC method.
|
|
||||||
message QueryBalanceRequest {
|
|
||||||
option (gogoproto.equal) = false;
|
|
||||||
option (gogoproto.goproto_getters) = false;
|
|
||||||
|
|
||||||
// address is the ethereum hex address to query the balance for.
|
|
||||||
string address = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryBalanceResponse is the response type for the Query/Balance RPC method.
|
|
||||||
message QueryBalanceResponse {
|
|
||||||
// balance is the balance of the EVM denomination.
|
|
||||||
string balance = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryStorageRequest is the request type for the Query/Storage RPC method.
|
|
||||||
message QueryStorageRequest {
|
|
||||||
option (gogoproto.equal) = false;
|
|
||||||
option (gogoproto.goproto_getters) = false;
|
|
||||||
|
|
||||||
// address is the ethereum hex address to query the storage state for.
|
|
||||||
string address = 1;
|
|
||||||
|
|
||||||
// key defines the key of the storage state
|
|
||||||
string key = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryStorageResponse is the response type for the Query/Storage RPC
|
|
||||||
// method.
|
|
||||||
message QueryStorageResponse {
|
|
||||||
// value defines the storage state value hash associated with the given key.
|
|
||||||
string value = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryCodeRequest is the request type for the Query/Code RPC method.
|
|
||||||
message QueryCodeRequest {
|
|
||||||
option (gogoproto.equal) = false;
|
|
||||||
option (gogoproto.goproto_getters) = false;
|
|
||||||
|
|
||||||
// address is the ethereum hex address to query the code for.
|
|
||||||
string address = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryCodeResponse is the response type for the Query/Code RPC
|
|
||||||
// method.
|
|
||||||
message QueryCodeResponse {
|
|
||||||
// code represents the code bytes from an ethereum address.
|
|
||||||
bytes code = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryTxLogsRequest is the request type for the Query/TxLogs RPC method.
|
|
||||||
message QueryTxLogsRequest {
|
|
||||||
option (gogoproto.equal) = false;
|
|
||||||
option (gogoproto.goproto_getters) = false;
|
|
||||||
|
|
||||||
// hash is the ethereum transaction hex hash to query the logs for.
|
|
||||||
string hash = 1;
|
|
||||||
// pagination defines an optional pagination for the request.
|
|
||||||
cosmos.base.query.v1beta1.PageRequest pagination = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryTxLogsResponse is the response type for the Query/TxLogs RPC method.
|
|
||||||
message QueryTxLogsResponse {
|
|
||||||
// logs represents the ethereum logs generated from the given transaction.
|
|
||||||
repeated Log logs = 1;
|
|
||||||
// pagination defines the pagination in the response.
|
|
||||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryParamsRequest defines the request type for querying x/evm parameters.
|
|
||||||
message QueryParamsRequest {}
|
|
||||||
|
|
||||||
// QueryParamsResponse defines the response type for querying x/evm parameters.
|
|
||||||
message QueryParamsResponse {
|
|
||||||
// params define the evm module parameters.
|
|
||||||
Params params = 1 [(gogoproto.nullable) = false];
|
|
||||||
}
|
|
||||||
|
|
||||||
// EthCallRequest defines EthCall request
|
|
||||||
message EthCallRequest {
|
|
||||||
// args uses the same json format as the json rpc api.
|
|
||||||
bytes args = 1;
|
|
||||||
// gas_cap defines the default gas cap to be used
|
|
||||||
uint64 gas_cap = 2;
|
|
||||||
// proposer_address of the requested block in hex format
|
|
||||||
bytes proposer_address = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ConsAddress"];
|
|
||||||
// chain_id is the eip155 chain id parsed from the requested block header
|
|
||||||
int64 chain_id = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
// EstimateGasResponse defines EstimateGas response
|
|
||||||
message EstimateGasResponse {
|
|
||||||
// gas returns the estimated gas
|
|
||||||
uint64 gas = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryTraceTxRequest defines TraceTx request
|
|
||||||
message QueryTraceTxRequest {
|
|
||||||
// msg is the MsgEthereumTx for the requested transaction
|
|
||||||
MsgEthereumTx msg = 1;
|
|
||||||
// tx_index is not necessary anymore
|
|
||||||
reserved 2;
|
|
||||||
reserved "tx_index";
|
|
||||||
// trace_config holds extra parameters to trace functions.
|
|
||||||
TraceConfig trace_config = 3;
|
|
||||||
// predecessors is an array of transactions included in the same block
|
|
||||||
// need to be replayed first to get correct context for tracing.
|
|
||||||
repeated MsgEthereumTx predecessors = 4;
|
|
||||||
// block_number of requested transaction
|
|
||||||
int64 block_number = 5;
|
|
||||||
// block_hash of requested transaction
|
|
||||||
string block_hash = 6;
|
|
||||||
// block_time of requested transaction
|
|
||||||
google.protobuf.Timestamp block_time = 7 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
|
|
||||||
// proposer_address is the proposer of the requested block
|
|
||||||
bytes proposer_address = 8 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ConsAddress"];
|
|
||||||
// chain_id is the the eip155 chain id parsed from the requested block header
|
|
||||||
int64 chain_id = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryTraceTxResponse defines TraceTx response
|
|
||||||
message QueryTraceTxResponse {
|
|
||||||
// data is the response serialized in bytes
|
|
||||||
bytes data = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryTraceBlockRequest defines TraceTx request
|
|
||||||
message QueryTraceBlockRequest {
|
|
||||||
// txs is an array of messages in the block
|
|
||||||
repeated MsgEthereumTx txs = 1;
|
|
||||||
// trace_config holds extra parameters to trace functions.
|
|
||||||
TraceConfig trace_config = 3;
|
|
||||||
// block_number of the traced block
|
|
||||||
int64 block_number = 5;
|
|
||||||
// block_hash (hex) of the traced block
|
|
||||||
string block_hash = 6;
|
|
||||||
// block_time of the traced block
|
|
||||||
google.protobuf.Timestamp block_time = 7 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
|
|
||||||
// proposer_address is the address of the requested block
|
|
||||||
bytes proposer_address = 8 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ConsAddress"];
|
|
||||||
// chain_id is the eip155 chain id parsed from the requested block header
|
|
||||||
int64 chain_id = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryTraceBlockResponse defines TraceBlock response
|
|
||||||
message QueryTraceBlockResponse {
|
|
||||||
// data is the response serialized in bytes
|
|
||||||
bytes data = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryBaseFeeRequest defines the request type for querying the EIP1559 base
|
|
||||||
// fee.
|
|
||||||
message QueryBaseFeeRequest {}
|
|
||||||
|
|
||||||
// QueryBaseFeeResponse returns the EIP1559 base fee.
|
|
||||||
message QueryBaseFeeResponse {
|
|
||||||
// base_fee is the EIP1559 base fee
|
|
||||||
string base_fee = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"];
|
|
||||||
}
|
|
@ -1,160 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
package ethermint.evm.v1;
|
|
||||||
|
|
||||||
import "cosmos_proto/cosmos.proto";
|
|
||||||
import "ethermint/evm/v1/evm.proto";
|
|
||||||
import "gogoproto/gogo.proto";
|
|
||||||
import "google/api/annotations.proto";
|
|
||||||
import "google/protobuf/any.proto";
|
|
||||||
|
|
||||||
option go_package = "github.com/cerc-io/laconicd/x/evm/types";
|
|
||||||
|
|
||||||
// Msg defines the evm Msg service.
|
|
||||||
service Msg {
|
|
||||||
// EthereumTx defines a method submitting Ethereum transactions.
|
|
||||||
rpc EthereumTx(MsgEthereumTx) returns (MsgEthereumTxResponse) {
|
|
||||||
option (google.api.http).post = "/ethermint/evm/v1/ethereum_tx";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// MsgEthereumTx encapsulates an Ethereum transaction as an SDK message.
|
|
||||||
message MsgEthereumTx {
|
|
||||||
option (gogoproto.goproto_getters) = false;
|
|
||||||
|
|
||||||
// data is inner transaction data of the Ethereum transaction
|
|
||||||
google.protobuf.Any data = 1;
|
|
||||||
|
|
||||||
// size is the encoded storage size of the transaction (DEPRECATED)
|
|
||||||
double size = 2 [(gogoproto.jsontag) = "-"];
|
|
||||||
// hash of the transaction in hex format
|
|
||||||
string hash = 3 [(gogoproto.moretags) = "rlp:\"-\""];
|
|
||||||
// from is the ethereum signer address in hex format. This address value is checked
|
|
||||||
// against the address derived from the signature (V, R, S) using the
|
|
||||||
// secp256k1 elliptic curve
|
|
||||||
string from = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
// LegacyTx is the transaction data of regular Ethereum transactions.
|
|
||||||
// NOTE: All non-protected transactions (i.e non EIP155 signed) will fail if the
|
|
||||||
// AllowUnprotectedTxs parameter is disabled.
|
|
||||||
message LegacyTx {
|
|
||||||
option (gogoproto.goproto_getters) = false;
|
|
||||||
option (cosmos_proto.implements_interface) = "TxData";
|
|
||||||
|
|
||||||
// nonce corresponds to the account nonce (transaction sequence).
|
|
||||||
uint64 nonce = 1;
|
|
||||||
// gas_price defines the value for each gas unit
|
|
||||||
string gas_price = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"];
|
|
||||||
// gas defines the gas limit defined for the transaction.
|
|
||||||
uint64 gas = 3 [(gogoproto.customname) = "GasLimit"];
|
|
||||||
// to is the hex formatted address of the recipient
|
|
||||||
string to = 4;
|
|
||||||
// value defines the unsigned integer value of the transaction amount.
|
|
||||||
string value = 5
|
|
||||||
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.customname) = "Amount"];
|
|
||||||
// data is the data payload bytes of the transaction.
|
|
||||||
bytes data = 6;
|
|
||||||
// v defines the signature value
|
|
||||||
bytes v = 7;
|
|
||||||
// r defines the signature value
|
|
||||||
bytes r = 8;
|
|
||||||
// s define the signature value
|
|
||||||
bytes s = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccessListTx is the data of EIP-2930 access list transactions.
|
|
||||||
message AccessListTx {
|
|
||||||
option (gogoproto.goproto_getters) = false;
|
|
||||||
option (cosmos_proto.implements_interface) = "TxData";
|
|
||||||
|
|
||||||
// chain_id of the destination EVM chain
|
|
||||||
string chain_id = 1 [
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.customname) = "ChainID",
|
|
||||||
(gogoproto.jsontag) = "chainID"
|
|
||||||
];
|
|
||||||
// nonce corresponds to the account nonce (transaction sequence).
|
|
||||||
uint64 nonce = 2;
|
|
||||||
// gas_price defines the value for each gas unit
|
|
||||||
string gas_price = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"];
|
|
||||||
// gas defines the gas limit defined for the transaction.
|
|
||||||
uint64 gas = 4 [(gogoproto.customname) = "GasLimit"];
|
|
||||||
// to is the recipient address in hex format
|
|
||||||
string to = 5;
|
|
||||||
// value defines the unsigned integer value of the transaction amount.
|
|
||||||
string value = 6
|
|
||||||
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.customname) = "Amount"];
|
|
||||||
// data is the data payload bytes of the transaction.
|
|
||||||
bytes data = 7;
|
|
||||||
// accesses is an array of access tuples
|
|
||||||
repeated AccessTuple accesses = 8
|
|
||||||
[(gogoproto.castrepeated) = "AccessList", (gogoproto.jsontag) = "accessList", (gogoproto.nullable) = false];
|
|
||||||
// v defines the signature value
|
|
||||||
bytes v = 9;
|
|
||||||
// r defines the signature value
|
|
||||||
bytes r = 10;
|
|
||||||
// s define the signature value
|
|
||||||
bytes s = 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
// DynamicFeeTx is the data of EIP-1559 dinamic fee transactions.
|
|
||||||
message DynamicFeeTx {
|
|
||||||
option (gogoproto.goproto_getters) = false;
|
|
||||||
option (cosmos_proto.implements_interface) = "TxData";
|
|
||||||
|
|
||||||
// chain_id of the destination EVM chain
|
|
||||||
string chain_id = 1 [
|
|
||||||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
|
|
||||||
(gogoproto.customname) = "ChainID",
|
|
||||||
(gogoproto.jsontag) = "chainID"
|
|
||||||
];
|
|
||||||
// nonce corresponds to the account nonce (transaction sequence).
|
|
||||||
uint64 nonce = 2;
|
|
||||||
// gas_tip_cap defines the max value for the gas tip
|
|
||||||
string gas_tip_cap = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"];
|
|
||||||
// gas_fee_cap defines the max value for the gas fee
|
|
||||||
string gas_fee_cap = 4 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"];
|
|
||||||
// gas defines the gas limit defined for the transaction.
|
|
||||||
uint64 gas = 5 [(gogoproto.customname) = "GasLimit"];
|
|
||||||
// to is the hex formatted address of the recipient
|
|
||||||
string to = 6;
|
|
||||||
// value defines the the transaction amount.
|
|
||||||
string value = 7
|
|
||||||
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.customname) = "Amount"];
|
|
||||||
// data is the data payload bytes of the transaction.
|
|
||||||
bytes data = 8;
|
|
||||||
// accesses is an array of access tuples
|
|
||||||
repeated AccessTuple accesses = 9
|
|
||||||
[(gogoproto.castrepeated) = "AccessList", (gogoproto.jsontag) = "accessList", (gogoproto.nullable) = false];
|
|
||||||
// v defines the signature value
|
|
||||||
bytes v = 10;
|
|
||||||
// r defines the signature value
|
|
||||||
bytes r = 11;
|
|
||||||
// s define the signature value
|
|
||||||
bytes s = 12;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ExtensionOptionsEthereumTx is an extension option for ethereum transactions
|
|
||||||
message ExtensionOptionsEthereumTx {
|
|
||||||
option (gogoproto.goproto_getters) = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// MsgEthereumTxResponse defines the Msg/EthereumTx response type.
|
|
||||||
message MsgEthereumTxResponse {
|
|
||||||
option (gogoproto.goproto_getters) = false;
|
|
||||||
|
|
||||||
// hash of the ethereum transaction in hex format. This hash differs from the
|
|
||||||
// Tendermint sha256 hash of the transaction bytes. See
|
|
||||||
// https://github.com/tendermint/tendermint/issues/6539 for reference
|
|
||||||
string hash = 1;
|
|
||||||
// logs contains the transaction hash and the proto-compatible ethereum
|
|
||||||
// logs.
|
|
||||||
repeated Log logs = 2;
|
|
||||||
// ret is the returned data from evm function (result or data supplied with revert
|
|
||||||
// opcode)
|
|
||||||
bytes ret = 3;
|
|
||||||
// vm_error is the error returned by vm execution
|
|
||||||
string vm_error = 4;
|
|
||||||
// gas_used specifies how much gas was consumed by the transaction
|
|
||||||
uint64 gas_used = 5;
|
|
||||||
}
|
|
115
proto/google/protobuf/duration.proto
Normal file
115
proto/google/protobuf/duration.proto
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
// 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;
|
||||||
|
}
|
144
proto/google/protobuf/timestamp.proto
Normal file
144
proto/google/protobuf/timestamp.proto
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
// 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,33 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
package vulcanize.registry.v1beta1;
|
|
||||||
|
|
||||||
import "gogoproto/gogo.proto";
|
|
||||||
|
|
||||||
option go_package = "github.com/cerc-io/laconicd/x/registry/types";
|
|
||||||
|
|
||||||
message ServiceProviderRegistration {
|
|
||||||
string bond_id = 1 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""];
|
|
||||||
string laconic_id = 2 [(gogoproto.moretags) = "json:\"laconicId\" yaml:\"laconicId\""];
|
|
||||||
X500 x500 = 3 [(gogoproto.moretags) = "json:\"x500\" yaml:\"x500\""];
|
|
||||||
string type = 4 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
|
||||||
string version = 6 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
|
||||||
}
|
|
||||||
|
|
||||||
message X500 {
|
|
||||||
string common_name = 1 [(gogoproto.moretags) = "json:\"commonName\" yaml:\"commonName\""];
|
|
||||||
string organization_unit = 2 [(gogoproto.moretags) = "json:\"organizationUnit\" yaml:\"organizationUnit\""];
|
|
||||||
string organization_name = 3 [(gogoproto.moretags) = "json:\"organizationName\" yaml:\"organizationName\""];
|
|
||||||
string locality_name = 4 [(gogoproto.moretags) = "json:\"localityName\" yaml:\"localityName\""];
|
|
||||||
string state_name = 5 [(gogoproto.moretags) = "json:\"stateName\" yaml:\"stateName\""];
|
|
||||||
string country = 6 [(gogoproto.moretags) = "json:\"country\" yaml:\"country\""];
|
|
||||||
}
|
|
||||||
|
|
||||||
message WebsiteRegistrationRecord {
|
|
||||||
string url = 1 [(gogoproto.moretags) = "json:\"url\" yaml:\"url\""];
|
|
||||||
string repo_registration_record_cid = 2
|
|
||||||
[(gogoproto.moretags) = "json:\"repoRegistrationRecordCID\" yaml:\"repoRegistrationRecordCID\""];
|
|
||||||
string build_artifact_cid = 3 [(gogoproto.moretags) = "json:\"buildArtifactCID\" yaml:\"buildArtifactCID\""];
|
|
||||||
string tls_cert_cid = 4 [(gogoproto.moretags) = "json:\"TLSCertCID\" yaml:\"TLSCertCID\""];
|
|
||||||
string type = 5 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
|
||||||
string version = 6 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
|
||||||
}
|
|
@ -67,17 +67,25 @@ message QueryParamsResponse {
|
|||||||
|
|
||||||
// QueryListRecordsRequest is request type for registry records list
|
// QueryListRecordsRequest is request type for registry records list
|
||||||
message QueryListRecordsRequest {
|
message QueryListRecordsRequest {
|
||||||
message ReferenceInput {
|
message LinkInput {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
}
|
}
|
||||||
|
message ArrayInput {
|
||||||
|
repeated ValueInput values = 1;
|
||||||
|
}
|
||||||
|
message MapInput {
|
||||||
|
map<string, ValueInput> values = 1;
|
||||||
|
}
|
||||||
message ValueInput {
|
message ValueInput {
|
||||||
string type = 1;
|
oneof value {
|
||||||
string string = 2;
|
string string = 1;
|
||||||
int64 int = 3;
|
int64 int = 2;
|
||||||
double float = 4;
|
double float = 3;
|
||||||
bool boolean = 5;
|
bool boolean = 4;
|
||||||
ReferenceInput reference = 6;
|
string link = 5;
|
||||||
repeated ValueInput values = 7;
|
ArrayInput array = 6;
|
||||||
|
MapInput map = 7;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
message KeyValueInput {
|
message KeyValueInput {
|
||||||
string key = 1;
|
string key = 1;
|
||||||
|
@ -5,7 +5,6 @@ import "google/protobuf/duration.proto";
|
|||||||
import "google/protobuf/timestamp.proto";
|
import "google/protobuf/timestamp.proto";
|
||||||
import "gogoproto/gogo.proto";
|
import "gogoproto/gogo.proto";
|
||||||
import "cosmos/base/v1beta1/coin.proto";
|
import "cosmos/base/v1beta1/coin.proto";
|
||||||
import "google/protobuf/any.proto";
|
|
||||||
|
|
||||||
option go_package = "github.com/cerc-io/laconicd/x/registry/types";
|
option go_package = "github.com/cerc-io/laconicd/x/registry/types";
|
||||||
|
|
||||||
@ -58,15 +57,15 @@ message Params {
|
|||||||
|
|
||||||
// Params defines the registry module records
|
// Params defines the registry module records
|
||||||
message Record {
|
message Record {
|
||||||
string id = 1 [(gogoproto.moretags) = "json:\"id\" yaml:\"id\""];
|
string id = 1 [(gogoproto.moretags) = "json:\"id\" yaml:\"id\""];
|
||||||
string bond_id = 2 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""];
|
string bond_id = 2 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""];
|
||||||
string create_time = 3 [(gogoproto.moretags) = "json:\"createTime\" yaml:\"createTime\""];
|
string create_time = 3 [(gogoproto.moretags) = "json:\"createTime\" yaml:\"createTime\""];
|
||||||
string expiry_time = 4 [(gogoproto.moretags) = "json:\"expiryTime\" yaml:\"expiryTime\""];
|
string expiry_time = 4 [(gogoproto.moretags) = "json:\"expiryTime\" yaml:\"expiryTime\""];
|
||||||
bool deleted = 5;
|
bool deleted = 5;
|
||||||
repeated string owners = 6 [(gogoproto.moretags) = "json:\"owners\" yaml:\"owners\""];
|
repeated string owners = 6 [(gogoproto.moretags) = "json:\"owners\" yaml:\"owners\""];
|
||||||
google.protobuf.Any attributes = 7 [(gogoproto.moretags) = "json:\"attributes\" yaml:\"attributes\""];
|
bytes attributes = 7 [(gogoproto.moretags) = "json:\"attributes\" yaml:\"attributes\""];
|
||||||
repeated string names = 8 [(gogoproto.moretags) = "json:\"names\" yaml:\"names\""];
|
repeated string names = 8 [(gogoproto.moretags) = "json:\"names\" yaml:\"names\""];
|
||||||
string type = 9 [(gogoproto.moretags) = "json:\"types\" yaml:\"types\""];
|
string type = 9 [(gogoproto.moretags) = "json:\"types\" yaml:\"types\""];
|
||||||
}
|
}
|
||||||
|
|
||||||
// AuthorityEntry defines the registry module AuthorityEntries
|
// AuthorityEntry defines the registry module AuthorityEntries
|
||||||
@ -131,4 +130,4 @@ message BlockChangeSet {
|
|||||||
message AuctionBidInfo {
|
message AuctionBidInfo {
|
||||||
string auction_id = 1 [(gogoproto.moretags) = "json:\"auctionID\" yaml:\"auctionID\""];
|
string auction_id = 1 [(gogoproto.moretags) = "json:\"auctionID\" yaml:\"auctionID\""];
|
||||||
string bidder_address = 2 [(gogoproto.moretags) = "json:\"bidderAddress\" yaml:\"bidderAddress\""];
|
string bidder_address = 2 [(gogoproto.moretags) = "json:\"bidderAddress\" yaml:\"bidderAddress\""];
|
||||||
}
|
}
|
||||||
|
2
scripts/build-sdk-test-container.sh
Executable file
2
scripts/build-sdk-test-container.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
docker build -t cerc/laconic-sdk-tester:local -f Dockerfile .
|
@ -1,12 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# NOTE: protoc is required
|
|
||||||
|
|
||||||
I=$(pwd)/proto
|
|
||||||
DEST_TS=$(pwd)/src/proto/
|
|
||||||
mkdir -p $DEST_TS
|
|
||||||
|
|
||||||
protoc \
|
|
||||||
--plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \
|
|
||||||
--ts_out=$DEST_TS \
|
|
||||||
--proto_path=$I \
|
|
||||||
$(find $(pwd)/proto/vulcanize $(pwd)/proto/ethermint -iname "*.proto")
|
|
40
scripts/proto-gen.sh
Executable file
40
scripts/proto-gen.sh
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
#!/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
|
@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
echo $PWD
|
|
||||||
for file in $(find src/proto -type f)
|
|
||||||
do
|
|
||||||
line=$(grep -n '@grpc/grpc-js' $file | cut -f1 -d':')
|
|
||||||
if [[ $line -gt 0 ]];
|
|
||||||
then
|
|
||||||
echo "Processing file... $file"
|
|
||||||
sed -i "${line}d" ${file}
|
|
||||||
functions=$(grep -n 'interface GrpcUnaryServiceInterface' $file | cut -f1 -d':')
|
|
||||||
sed -i "${functions},\$d" ${file}
|
|
||||||
echo '}' >> $file
|
|
||||||
fi
|
|
||||||
sed -i '1s#^#/* eslint-disable */\n#' $file
|
|
||||||
sed -i '1s#^#// @ts-nocheck\n#' $file
|
|
||||||
done
|
|
@ -166,10 +166,6 @@ export class Account {
|
|||||||
assert(message);
|
assert(message);
|
||||||
const eipMessageDomain: any = message.eipToSign.domain;
|
const eipMessageDomain: any = message.eipToSign.domain;
|
||||||
|
|
||||||
if(message.eipToSign.message.msgs[0].value.payload!=null){
|
|
||||||
message.eipToSign.message.msgs[0].value.payload.record.attributes.value=Array.from(message.eipToSign.message.msgs[0].value.payload.record.attributes.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
const signature = signTypedData({
|
const signature = signTypedData({
|
||||||
data: {
|
data: {
|
||||||
types: message.eipToSign.types as MessageTypes,
|
types: message.eipToSign.types as MessageTypes,
|
||||||
|
File diff suppressed because one or more lines are too long
152
src/bond.test.ts
152
src/bond.test.ts
@ -12,20 +12,10 @@ jest.setTimeout(90 * 1000);
|
|||||||
const bondTests = () => {
|
const bondTests = () => {
|
||||||
let registry: Registry;
|
let registry: Registry;
|
||||||
|
|
||||||
let watcher: any;
|
|
||||||
|
|
||||||
let version1: string;
|
|
||||||
let version2: string;
|
|
||||||
|
|
||||||
let bondId1: string;
|
|
||||||
let bondId2: string;
|
|
||||||
|
|
||||||
let bondOwner: string;
|
|
||||||
|
|
||||||
const publishNewWatcherVersion = async (bondId: string) => {
|
const publishNewWatcherVersion = async (bondId: string) => {
|
||||||
watcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
|
let watcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
|
||||||
await registry.setRecord({ privateKey, record: watcher.record, bondId }, privateKey, fee);
|
await registry.setRecord({ privateKey, record: watcher.record, bondId }, privateKey, fee);
|
||||||
return watcher.record.version;
|
return watcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
@ -33,93 +23,119 @@ const bondTests = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Create bond.', async () => {
|
test('Create bond.', async () => {
|
||||||
bondId1 = await registry.getNextBondId(privateKey);
|
let bondId = await registry.getNextBondId(privateKey);
|
||||||
expect(bondId1).toBeDefined();
|
expect(bondId).toBeDefined();
|
||||||
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||||
})
|
|
||||||
|
|
||||||
test('Get bond by ID.', async () => {
|
|
||||||
const [bond] = await registry.getBondsByIds([bondId1]);
|
|
||||||
expect(bond).toBeDefined();
|
|
||||||
expect(bond.id).toBe(bondId1);
|
|
||||||
expect(bond.balance).toHaveLength(1);
|
|
||||||
expect(bond.balance[0]).toEqual({ type: 'aphoton', quantity: '1000000000' });
|
|
||||||
bondOwner = bond.owner;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Query bonds.', async () => {
|
describe('With bond created', () => {
|
||||||
const bonds = await registry.queryBonds();
|
let bond1: any
|
||||||
expect(bonds).toBeDefined();
|
|
||||||
const bond = bonds.filter((bond: any) => bond.id === bondId1);
|
|
||||||
expect(bond).toBeDefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Query bonds by owner.', async () => {
|
beforeAll(async () => {
|
||||||
const bonds = await registry.queryBonds({ owner: bondOwner });
|
let bondId1 = await registry.getNextBondId(privateKey);
|
||||||
expect(bonds).toBeDefined();
|
expect(bondId1).toBeDefined();
|
||||||
const bond = bonds.filter((bond: any) => bond.id === bondId1);
|
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||||
expect(bond).toBeDefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Refill bond.', async () => {
|
[bond1] = await registry.getBondsByIds([bondId1]);
|
||||||
await registry.refillBond({ id: bondId1, denom: 'aphoton', amount: '500' }, privateKey, fee);
|
expect(bond1).toBeDefined();
|
||||||
|
expect(bond1.id).toEqual(bondId1);
|
||||||
|
});
|
||||||
|
|
||||||
const [bond] = await registry.getBondsByIds([bondId1]);
|
test('Get bond by ID.', async () => {
|
||||||
expect(bond).toBeDefined();
|
const [bond] = await registry.getBondsByIds([bond1.id]);
|
||||||
expect(bond.id).toBe(bondId1);
|
expect(bond).toBeDefined();
|
||||||
expect(bond.balance).toHaveLength(1);
|
expect(bond.id).toBe(bond1.id);
|
||||||
expect(bond.balance[0]).toEqual({ type: 'aphoton', quantity: '1000000500' });
|
expect(bond.balance).toHaveLength(1);
|
||||||
});
|
expect(bond.balance[0]).toEqual({ type: 'aphoton', quantity: '1000000000' });
|
||||||
|
});
|
||||||
|
|
||||||
test('Withdraw bond.', async () => {
|
test('Query bonds.', async () => {
|
||||||
await registry.withdrawBond({ id: bondId1, denom: 'aphoton', amount: '500' }, privateKey, fee);
|
const bonds = await registry.queryBonds();
|
||||||
|
expect(bonds).toBeDefined();
|
||||||
|
const bond = bonds.filter((bond: any) => bond.id === bond1.id);
|
||||||
|
expect(bond).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
const [bond] = await registry.getBondsByIds([bondId1]);
|
test('Query bonds by owner.', async () => {
|
||||||
expect(bond).toBeDefined();
|
const bonds = await registry.queryBonds({ owner: bond1.owner });
|
||||||
expect(bond.id).toBe(bondId1);
|
expect(bonds).toBeDefined();
|
||||||
expect(bond.balance).toHaveLength(1);
|
const bond = bonds.filter((bond: any) => bond.id === bond1.id);
|
||||||
expect(bond.balance[0]).toEqual({ type: 'aphoton', quantity: '1000000000' });
|
expect(bond).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Cancel bond.', async () => {
|
test('Refill bond.', async () => {
|
||||||
await registry.cancelBond({ id: bondId1 }, privateKey, fee);
|
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);
|
||||||
|
});
|
||||||
|
|
||||||
const [bond] = await registry.getBondsByIds([bondId1]);
|
|
||||||
expect(bond.id).toBe("");
|
|
||||||
expect(bond.owner).toBe("");
|
|
||||||
expect(bond.balance).toHaveLength(0);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Associate/Dissociate bond.', async () => {
|
test('Associate/Dissociate bond.', async () => {
|
||||||
|
let bondId1: string;
|
||||||
|
|
||||||
bondId1 = await registry.getNextBondId(privateKey);
|
bondId1 = await registry.getNextBondId(privateKey);
|
||||||
expect(bondId1).toBeDefined();
|
expect(bondId1).toBeDefined();
|
||||||
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||||
|
|
||||||
// Create a new record.
|
// Create a new record.
|
||||||
version1 = await publishNewWatcherVersion(bondId1);
|
let watcher = await publishNewWatcherVersion(bondId1);
|
||||||
let [record1] = await registry.queryRecords({ type: watcher.record.type, name: watcher.record.name, version: version1 }, true);
|
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);
|
expect(record1.bondId).toBe(bondId1);
|
||||||
|
|
||||||
// Dissociate record, query and confirm.
|
// Dissociate record, query and confirm.
|
||||||
await registry.dissociateBond({ recordId: record1.id }, privateKey, fee);
|
await registry.dissociateBond({ recordId: record1.id }, privateKey, fee);
|
||||||
[record1] = await registry.queryRecords({ type: watcher.record.type, name: watcher.record.name, version: version1 }, true);
|
[record1] = await registry.queryRecords(query, true);
|
||||||
expect(record1.bondId).toBe('');
|
expect(record1.bondId).toBe('');
|
||||||
|
|
||||||
// Associate record with bond, query and confirm.
|
// Associate record with bond, query and confirm.
|
||||||
await registry.associateBond({ recordId: record1.id, bondId: bondId1 }, privateKey, fee);
|
await registry.associateBond({ recordId: record1.id, bondId: bondId1 }, privateKey, fee);
|
||||||
[record1] = await registry.queryRecords({ type: watcher.record.type, name: watcher.record.name, version: version1 }, true);
|
[record1] = await registry.queryRecords(query, true);
|
||||||
expect(record1.bondId).toBe(bondId1);
|
expect(record1.bondId).toBe(bondId1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Reassociate/Dissociate records.', async () => {
|
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.
|
// Create a new record version.
|
||||||
version2 = await publishNewWatcherVersion(bondId1);
|
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.
|
// Check version1, version2 as associated with bondId1.
|
||||||
let records;
|
let records;
|
||||||
records = await registry.queryRecords({ type: watcher.record.type, name: watcher.record.name, version: version1 }, true);
|
records = await registry.queryRecords(queryv1, true);
|
||||||
expect(records[0].bondId).toBe(bondId1);
|
expect(records[0].bondId).toBe(bondId1);
|
||||||
records = await registry.queryRecords({ type: watcher.record.type, name: watcher.record.name, version: version2 }, true);
|
records = await registry.queryRecords(queryv2, true);
|
||||||
expect(records[0].bondId).toBe(bondId1);
|
expect(records[0].bondId).toBe(bondId1);
|
||||||
|
|
||||||
// Create another bond.
|
// Create another bond.
|
||||||
@ -131,16 +147,16 @@ const bondTests = () => {
|
|||||||
|
|
||||||
// Reassociate records from bondId1 to bondId2, verify change.
|
// Reassociate records from bondId1 to bondId2, verify change.
|
||||||
await registry.reassociateRecords({ oldBondId: bondId1, newBondId: bondId2 }, privateKey, fee);
|
await registry.reassociateRecords({ oldBondId: bondId1, newBondId: bondId2 }, privateKey, fee);
|
||||||
records = await registry.queryRecords({ type: watcher.record.type, name: watcher.record.name, version: version1 }, true);
|
records = await registry.queryRecords(queryv1, true);
|
||||||
expect(records[0].bondId).toBe(bondId2);
|
expect(records[0].bondId).toBe(bondId2);
|
||||||
records = await registry.queryRecords({ type: watcher.record.type, name: watcher.record.name, version: version2 }, true);
|
records = await registry.queryRecords(queryv2, true);
|
||||||
expect(records[0].bondId).toBe(bondId2);
|
expect(records[0].bondId).toBe(bondId2);
|
||||||
|
|
||||||
// Dissociate all records from bond, verify change.
|
// Dissociate all records from bond, verify change.
|
||||||
await registry.dissociateRecords({ bondId: bondId2 }, privateKey, fee);
|
await registry.dissociateRecords({ bondId: bondId2 }, privateKey, fee);
|
||||||
records = await registry.queryRecords({ type: watcher.record.type, name: watcher.record.name, version: version1 }, true);
|
records = await registry.queryRecords(queryv1, true);
|
||||||
expect(records[0].bondId).toBe('');
|
expect(records[0].bondId).toBe('');
|
||||||
records = await registry.queryRecords({ type: watcher.record.type, name: watcher.record.name, version: version2 }, true);
|
records = await registry.queryRecords(queryv2, true);
|
||||||
expect(records[0].bondId).toBe('');
|
expect(records[0].bondId).toBe('');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
import { ethers } from 'ethers';
|
|
||||||
|
|
||||||
import { Account } from './account';
|
|
||||||
import { Registry } from './index';
|
|
||||||
import { getConfig } from './testing/helper';
|
|
||||||
import { abi } from './artifacts/PhisherRegistry.json'
|
|
||||||
|
|
||||||
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
|
|
||||||
|
|
||||||
jest.setTimeout(90 * 1000);
|
|
||||||
|
|
||||||
const CONTRACT_ADDRESS = "0xD035Adc6d41f9136C9C19434E0500F7706664e66"
|
|
||||||
const ETH_RPC_ENDPOINT = "http://localhost:8545"
|
|
||||||
|
|
||||||
const evmTests = () => {
|
|
||||||
let registry: Registry;
|
|
||||||
|
|
||||||
beforeAll(async () => {
|
|
||||||
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
test.only('Send eth tx for contract method.', async() => {
|
|
||||||
// TODO: Refactor inside sendEthTx?
|
|
||||||
const provider = new ethers.providers.JsonRpcProvider(ETH_RPC_ENDPOINT)
|
|
||||||
const signer = new ethers.Wallet(privateKey, provider)
|
|
||||||
const contract = new ethers.Contract(CONTRACT_ADDRESS, abi, signer);
|
|
||||||
|
|
||||||
const populatedTx = await contract.populateTransaction
|
|
||||||
.claimIfPhisher('phisher1', true);
|
|
||||||
|
|
||||||
const signerPopulatedTx = await signer.populateTransaction(populatedTx);
|
|
||||||
const signedTxString = await signer.signTransaction(signerPopulatedTx);
|
|
||||||
const tx = ethers.utils.parseTransaction(signedTxString);
|
|
||||||
|
|
||||||
// TODO: Use laconicd queries in evm module
|
|
||||||
tx.gasLimit = await provider.estimateGas(signerPopulatedTx);
|
|
||||||
console.log('tx', tx)
|
|
||||||
|
|
||||||
await registry.sendEthTx(
|
|
||||||
{
|
|
||||||
tx,
|
|
||||||
from: signer.address
|
|
||||||
},
|
|
||||||
privateKey,
|
|
||||||
fee
|
|
||||||
);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('evm', evmTests);
|
|
40
src/index.ts
40
src/index.ts
@ -7,12 +7,11 @@ import {
|
|||||||
createMessageSend,
|
createMessageSend,
|
||||||
MessageSendParams
|
MessageSendParams
|
||||||
} from '@tharsis/transactions'
|
} from '@tharsis/transactions'
|
||||||
import { ethers } from 'ethers';
|
|
||||||
|
|
||||||
import { RegistryClient } from "./registry-client";
|
import { RegistryClient } from "./registry-client";
|
||||||
import { Account } from "./account";
|
import { Account } from "./account";
|
||||||
import { createTransaction } from "./txbuilder";
|
import { createTransaction } from "./txbuilder";
|
||||||
import { EthereumTxData, Payload, Record } from './types';
|
import { Payload, Record } from './types';
|
||||||
import { Util } from './util';
|
import { Util } from './util';
|
||||||
import {
|
import {
|
||||||
createTxMsgAssociateBond,
|
createTxMsgAssociateBond,
|
||||||
@ -52,11 +51,10 @@ import {
|
|||||||
MessageMsgCommitBid,
|
MessageMsgCommitBid,
|
||||||
MessageMsgRevealBid
|
MessageMsgRevealBid
|
||||||
} from './messages/auction';
|
} from './messages/auction';
|
||||||
import { createTxMsgEthereumTx, MessageMsgEthereumTx } from './messages/evm';
|
|
||||||
|
|
||||||
export const DEFAULT_CHAIN_ID = 'laconic_9000-1';
|
export const DEFAULT_CHAIN_ID = 'laconic_9000-1';
|
||||||
|
|
||||||
const DEFAULT_WRITE_ERROR = 'Unable to write to laconicd.';
|
const DEFAULT_WRITE_ERROR = 'Unable to write to laconicd';
|
||||||
|
|
||||||
// Parse Tx response from cosmos-sdk.
|
// Parse Tx response from cosmos-sdk.
|
||||||
export const parseTxResponse = (result: any, parseResponse?: (data: string) => any) => {
|
export const parseTxResponse = (result: any, parseResponse?: (data: string) => any) => {
|
||||||
@ -119,7 +117,8 @@ export class Registry {
|
|||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
|
|
||||||
return errorMessage || DEFAULT_WRITE_ERROR;
|
const [lastErrorLine] = error.split("\n").slice(-1);
|
||||||
|
return `${errorMessage || DEFAULT_WRITE_ERROR}: ${lastErrorLine}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(gqlUrl: string, restUrl: string = "", chainId: string = DEFAULT_CHAIN_ID) {
|
constructor(gqlUrl: string, restUrl: string = "", chainId: string = DEFAULT_CHAIN_ID) {
|
||||||
@ -182,9 +181,9 @@ export class Registry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Publish record.
|
* Publish record.
|
||||||
* @param transactionPrivateKey - private key in HEX to sign transaction.
|
* @param transactionPrivateKey - private key in HEX to sign transaction.
|
||||||
*/
|
*/
|
||||||
async setRecord(
|
async setRecord(
|
||||||
params: { privateKey: string, record: any, bondId: string },
|
params: { privateKey: string, record: any, bondId: string },
|
||||||
transactionPrivateKey: string,
|
transactionPrivateKey: string,
|
||||||
@ -464,31 +463,6 @@ export class Registry {
|
|||||||
return parseTxResponse(result);
|
return parseTxResponse(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Send ethereum transaction.
|
|
||||||
*/
|
|
||||||
async sendEthTx(
|
|
||||||
{ tx, from }: { tx: ethers.Transaction, from: string },
|
|
||||||
privateKey: string,
|
|
||||||
fee: Fee
|
|
||||||
) {
|
|
||||||
let result;
|
|
||||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
|
||||||
console.log('account.registryAddress', account.registryAddress);
|
|
||||||
const sender = await this._getSender(account);
|
|
||||||
|
|
||||||
const msgParams = {
|
|
||||||
data: new EthereumTxData(tx),
|
|
||||||
hash: tx.hash!,
|
|
||||||
from
|
|
||||||
}
|
|
||||||
|
|
||||||
const msg = createTxMsgEthereumTx(this._chain, sender, fee, '', msgParams)
|
|
||||||
result = await this._submitTx(msg, privateKey, sender);
|
|
||||||
|
|
||||||
return parseTxResponse(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submit record transaction.
|
* Submit record transaction.
|
||||||
* @param privateKey - private key in HEX to sign message.
|
* @param privateKey - private key in HEX to sign message.
|
||||||
|
@ -1,87 +0,0 @@
|
|||||||
import {
|
|
||||||
generateTypes,
|
|
||||||
} from '@tharsis/eip712'
|
|
||||||
import {
|
|
||||||
Chain,
|
|
||||||
Sender,
|
|
||||||
Fee,
|
|
||||||
} from '@tharsis/transactions'
|
|
||||||
|
|
||||||
import * as evmTx from '../proto/ethermint/evm/v1/tx'
|
|
||||||
import * as registry from '../proto/vulcanize/registry/v1beta1/registry'
|
|
||||||
import { EthereumTxData } from '../types'
|
|
||||||
import { createTx } from './util'
|
|
||||||
|
|
||||||
const MSG_ETHEREUM_TX_TYPES = {
|
|
||||||
MsgValue: [
|
|
||||||
{ name: 'data', type: 'TypeData' },
|
|
||||||
{ name: 'hash', type: 'string' },
|
|
||||||
{ name: 'from', type: 'string' }
|
|
||||||
],
|
|
||||||
TypeData: [
|
|
||||||
{ name: 'type_url', type: 'string' },
|
|
||||||
{ name: 'value', type: 'uint8[]' },
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface MessageMsgEthereumTx {
|
|
||||||
data: EthereumTxData,
|
|
||||||
hash: string,
|
|
||||||
from: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createTxMsgEthereumTx(
|
|
||||||
chain: Chain,
|
|
||||||
sender: Sender,
|
|
||||||
fee: Fee,
|
|
||||||
memo: string,
|
|
||||||
params: MessageMsgEthereumTx,
|
|
||||||
) {
|
|
||||||
const types = generateTypes(MSG_ETHEREUM_TX_TYPES)
|
|
||||||
|
|
||||||
const msg = createMsgEthereumTx(
|
|
||||||
params.data,
|
|
||||||
params.hash,
|
|
||||||
params.from
|
|
||||||
)
|
|
||||||
|
|
||||||
const msgCosmos = protoCreateMsgEthereumTx(
|
|
||||||
params.data,
|
|
||||||
params.hash,
|
|
||||||
params.from
|
|
||||||
)
|
|
||||||
|
|
||||||
return createTx(chain, sender, fee, memo, types, msg, msgCosmos)
|
|
||||||
}
|
|
||||||
|
|
||||||
function createMsgEthereumTx(
|
|
||||||
data: EthereumTxData,
|
|
||||||
hash: string,
|
|
||||||
from: string
|
|
||||||
) {
|
|
||||||
return {
|
|
||||||
type: 'evm/EthereumTx',
|
|
||||||
value: {
|
|
||||||
data: data.serialize(),
|
|
||||||
hash,
|
|
||||||
from
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const protoCreateMsgEthereumTx = (
|
|
||||||
data: EthereumTxData,
|
|
||||||
hash: string,
|
|
||||||
from: string
|
|
||||||
) => {
|
|
||||||
const ethereumTxMessage = new evmTx.ethermint.evm.v1.MsgEthereumTx({
|
|
||||||
data: data.serialize(),
|
|
||||||
hash,
|
|
||||||
from,
|
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
|
||||||
message: ethereumTxMessage,
|
|
||||||
path: 'ethermint.evm.v1.MsgEthereumTx',
|
|
||||||
}
|
|
||||||
}
|
|
@ -44,11 +44,7 @@ const MSG_SET_RECORD_TYPES = {
|
|||||||
{ name: 'create_time', type: 'string' },
|
{ name: 'create_time', type: 'string' },
|
||||||
{ name: 'expiry_time', type: 'string' },
|
{ name: 'expiry_time', type: 'string' },
|
||||||
{ name: 'deleted', type: 'bool' },
|
{ name: 'deleted', type: 'bool' },
|
||||||
{ name: 'attributes', type: 'TypePayloadRecordAttributes' },
|
{ name: 'attributes', type: 'bytes' },
|
||||||
],
|
|
||||||
TypePayloadRecordAttributes: [
|
|
||||||
{ name: 'type_url', type: 'string' },
|
|
||||||
{ name: 'value', type: 'uint8[]' },
|
|
||||||
],
|
],
|
||||||
TypePayloadSignatures: [
|
TypePayloadSignatures: [
|
||||||
{ name: 'sig', type: 'string' },
|
{ name: 'sig', type: 'string' },
|
||||||
@ -85,10 +81,10 @@ export const parseMsgSetRecordResponse = (data: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const NAMESERVICE_ERRORS = [
|
export const NAMESERVICE_ERRORS = [
|
||||||
'Name already reserved.',
|
'Name already reserved',
|
||||||
'Authority bond not found.',
|
'Authority bond not found',
|
||||||
'Name authority not found.',
|
'Name authority not found',
|
||||||
'Access denied.',
|
'Access denied',
|
||||||
]
|
]
|
||||||
|
|
||||||
export interface MessageMsgReserveAuthority {
|
export interface MessageMsgReserveAuthority {
|
||||||
|
@ -7,7 +7,7 @@ import { ensureUpdatedConfig, getConfig } from './testing/helper';
|
|||||||
|
|
||||||
const WATCHER_YML_PATH = path.join(__dirname, './testing/data/watcher.yml');
|
const WATCHER_YML_PATH = path.join(__dirname, './testing/data/watcher.yml');
|
||||||
|
|
||||||
jest.setTimeout(120 * 1000);
|
jest.setTimeout(5 * 60 * 1000);
|
||||||
|
|
||||||
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
|
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
|
||||||
|
|
||||||
@ -18,12 +18,6 @@ const namingTests = () => {
|
|||||||
let watcher: any;
|
let watcher: any;
|
||||||
let watcherId: string;
|
let watcherId: string;
|
||||||
|
|
||||||
let authorityName: string;
|
|
||||||
let otherAuthorityName: string;
|
|
||||||
let otherPrivateKey: string;
|
|
||||||
|
|
||||||
let crn: string;
|
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||||
|
|
||||||
@ -46,221 +40,272 @@ const namingTests = () => {
|
|||||||
watcherId = result.data.id;
|
watcherId = result.data.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Reserve authority.', async () => {
|
describe('Authority tests', () => {
|
||||||
authorityName = `laconic-${Date.now()}`;
|
test('Reserve authority.', async () => {
|
||||||
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
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);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Lookup authority.', async () => {
|
describe('Naming tests', () => {
|
||||||
const [record] = await registry.lookupAuthorities([authorityName]);
|
let authorityName: string;
|
||||||
|
let otherAuthorityName: string;
|
||||||
|
let otherPrivateKey: string;
|
||||||
|
let otherAccount: Account;
|
||||||
|
|
||||||
expect(record).toBeDefined();
|
beforeAll(async () => {
|
||||||
expect(record.ownerAddress).not.toBe('');
|
authorityName = `laconic-${Date.now()}`;
|
||||||
expect(record.ownerPublicKey).not.toBe('');
|
|
||||||
expect(Number(record.height)).toBeGreaterThan(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Lookup non existing authority', async () => {
|
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
||||||
const [record] = await registry.lookupAuthorities(['does-not-exist']);
|
await registry.setAuthorityBond({ name: authorityName, bondId }, privateKey, fee);
|
||||||
|
|
||||||
expect(record.ownerAddress).toBe('');
|
// Create another account.
|
||||||
expect(record.ownerPublicKey).toBe('');
|
const mnenonic = Account.generateMnemonic();
|
||||||
expect(Number(record.height)).toBe(0);
|
otherAccount = await Account.generateFromMnemonic(mnenonic);
|
||||||
});
|
await registry.sendCoins({ denom: 'aphoton', amount: '1000000000', destinationAddress: otherAccount.formattedCosmosAddress }, privateKey, fee);
|
||||||
|
|
||||||
test('Reserve already reserved authority', async () => {
|
otherAuthorityName = `other-${Date.now()}`;
|
||||||
await expect(registry.reserveAuthority({ name: authorityName }, privateKey, fee)).rejects.toThrow('Name already reserved.');
|
otherPrivateKey = otherAccount.privateKey.toString('hex');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Reserve sub-authority.', async () => {
|
test('Set name', async () => {
|
||||||
const subAuthority = `echo.${authorityName}`;
|
const crn = `crn://${authorityName}/app/test1`;
|
||||||
await registry.reserveAuthority({ name: subAuthority }, privateKey, fee);
|
|
||||||
|
|
||||||
const [record] = await registry.lookupAuthorities([subAuthority]);
|
await registry.setName({ crn, cid: watcherId }, privateKey, fee);
|
||||||
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 () => {
|
// Query records should return it (some CRN points to it).
|
||||||
// Create another account, send tx to set public key on the account.
|
const [record] = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version });
|
||||||
const mnenonic1 = Account.generateMnemonic();
|
expect(record).toBeDefined();
|
||||||
const otherAccount1 = await Account.generateFromMnemonic(mnenonic1);
|
expect(record.names).toHaveLength(1);
|
||||||
await registry.sendCoins({ denom: 'aphoton', amount: '1000000000', destinationAddress: otherAccount1.formattedCosmosAddress }, privateKey, fee);
|
|
||||||
|
|
||||||
const mnenonic2 = Account.generateMnemonic();
|
await registry.deleteName({ crn }, privateKey, fee);
|
||||||
const otherAccount2 = await Account.generateFromMnemonic(mnenonic2);
|
});
|
||||||
await registry.sendCoins({ denom: 'aphoton', amount: '10', destinationAddress: otherAccount2.formattedCosmosAddress }, otherAccount1.getPrivateKey(), fee);
|
|
||||||
|
|
||||||
const subAuthority = `halo.${authorityName}`;
|
describe('With name set', () => {
|
||||||
await registry.reserveAuthority({ name: subAuthority, owner: otherAccount1.formattedCosmosAddress }, privateKey, fee);
|
let crn: string;
|
||||||
|
|
||||||
const [record] = await registry.lookupAuthorities([subAuthority]);
|
beforeAll(async () => {
|
||||||
expect(record).toBeDefined();
|
crn = `crn://${authorityName}/app/test2`;
|
||||||
expect(record.ownerAddress).toBeDefined();
|
await registry.setName({ crn, cid: watcherId }, privateKey, fee);
|
||||||
expect(record.ownerAddress).toBe(otherAccount1.getCosmosAddress());
|
});
|
||||||
expect(record.ownerPublicKey).toBeDefined();
|
|
||||||
expect(Number(record.height)).toBeGreaterThan(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Set name for unbonded authority', async () => {
|
afterAll(async () => {
|
||||||
crn = `crn://${authorityName}/app/test`;
|
await registry.deleteName({ crn }, privateKey, fee);
|
||||||
assert(watcherId)
|
});
|
||||||
await expect(registry.setName({ crn, cid: watcherId }, privateKey, fee)).rejects.toThrow('Authority bond not found.');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Set authority bond', async () => {
|
test('Lookup name', async () => {
|
||||||
await registry.setAuthorityBond({ name: authorityName, bondId }, privateKey, fee);
|
const records = await registry.lookupNames([crn]);
|
||||||
});
|
expect(records).toBeDefined();
|
||||||
|
expect(records).toHaveLength(1);
|
||||||
|
|
||||||
test('Set name', async () => {
|
const [{ latest, history }] = records;
|
||||||
crn = `crn://${authorityName}/app/test`;
|
expect(latest).toBeDefined();
|
||||||
await registry.setName({ crn, cid: watcherId }, privateKey, fee);
|
expect(latest.id).toBeDefined();
|
||||||
|
expect(latest.id).toBe(watcherId);
|
||||||
|
expect(latest.height).toBeDefined();
|
||||||
|
expect(history).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
// Query records should return it (some CRN points to it).
|
test('Resolve name', async () => {
|
||||||
const records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version });
|
const records = await registry.resolveNames([crn]);
|
||||||
expect(records).toBeDefined();
|
expect(records).toBeDefined();
|
||||||
expect(records).toHaveLength(1);
|
expect(records).toHaveLength(1);
|
||||||
});
|
|
||||||
|
|
||||||
test('Lookup name', async () => {
|
const [{ attributes }] = records;
|
||||||
const records = await registry.lookupNames([crn]);
|
expect(attributes).toEqual(watcher.record);
|
||||||
expect(records).toBeDefined();
|
});
|
||||||
expect(records).toHaveLength(1);
|
|
||||||
|
|
||||||
const [{ latest, history }] = records;
|
test('Lookup name with history', async () => {
|
||||||
expect(latest).toBeDefined();
|
const updatedWatcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
|
||||||
expect(latest.id).toBeDefined();
|
const result = await registry.setRecord(
|
||||||
expect(latest.id).toBe(watcherId);
|
{
|
||||||
expect(latest.height).toBeDefined();
|
privateKey,
|
||||||
expect(history).toBeUndefined();
|
bondId,
|
||||||
});
|
record: updatedWatcher.record
|
||||||
|
},
|
||||||
|
privateKey,
|
||||||
|
fee
|
||||||
|
)
|
||||||
|
|
||||||
test('Resolve name', async () => {
|
const updatedWatcherId = result.data.id;
|
||||||
const records = await registry.resolveNames([crn]);
|
await registry.setName({ crn, cid: updatedWatcherId }, privateKey, fee);
|
||||||
expect(records).toBeDefined();
|
|
||||||
expect(records).toHaveLength(1);
|
|
||||||
|
|
||||||
const [{ attributes }] = records;
|
const records = await registry.lookupNames([crn], true);
|
||||||
expect(attributes).toEqual(watcher.record);
|
expect(records).toHaveLength(1);
|
||||||
});
|
|
||||||
|
|
||||||
test('Lookup name with history', async () => {
|
const [{ latest, history }] = records;
|
||||||
const updatedWatcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
|
expect(latest).toBeDefined();
|
||||||
const result = await registry.setRecord(
|
expect(latest.id).toBeDefined();
|
||||||
{
|
expect(latest.id).toBe(updatedWatcherId);
|
||||||
privateKey,
|
expect(latest.height).toBeDefined();
|
||||||
bondId,
|
expect(history).toBeDefined();
|
||||||
record: updatedWatcher.record
|
expect(history).toHaveLength(1);
|
||||||
},
|
|
||||||
privateKey,
|
|
||||||
fee
|
|
||||||
)
|
|
||||||
|
|
||||||
const updatedWatcherId = result.data.id;
|
const [oldRecord] = history;
|
||||||
await registry.setName({ crn, cid: updatedWatcherId }, privateKey, fee);
|
expect(oldRecord).toBeDefined();
|
||||||
|
expect(oldRecord.id).toBeDefined();
|
||||||
|
expect(oldRecord.id).toBe(watcherId);
|
||||||
|
expect(oldRecord.height).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
const records = await registry.lookupNames([crn], true);
|
test('Delete name', async () => {
|
||||||
expect(records).toHaveLength(1);
|
await registry.deleteName({ crn }, privateKey, fee);
|
||||||
|
|
||||||
const [{ latest, history }] = records;
|
let records = await registry.lookupNames([crn], true);
|
||||||
expect(latest).toBeDefined();
|
expect(records).toBeDefined();
|
||||||
expect(latest.id).toBeDefined();
|
expect(records).toHaveLength(1);
|
||||||
expect(latest.id).toBe(updatedWatcherId);
|
|
||||||
expect(latest.height).toBeDefined();
|
|
||||||
expect(history).toBeDefined();
|
|
||||||
expect(history).toHaveLength(1);
|
|
||||||
|
|
||||||
const [oldRecord] = history;
|
const [{ latest }] = records;
|
||||||
expect(oldRecord).toBeDefined();
|
expect(latest).toBeDefined();
|
||||||
expect(oldRecord.id).toBeDefined();
|
expect(latest.id).toBeDefined();
|
||||||
expect(oldRecord.id).toBe(watcherId);
|
expect(latest.id).toBe('');
|
||||||
expect(oldRecord.height).toBeDefined();
|
expect(latest.height).toBeDefined();
|
||||||
});
|
|
||||||
|
|
||||||
test('Set name without reserving authority', async () => {
|
// Query records should NOT return it (no CRN points to it).
|
||||||
await expect(registry.setName({ crn: 'crn://not-reserved/app/test', cid: watcherId }, privateKey, fee))
|
records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version });
|
||||||
.rejects.toThrow('Name authority not found.');
|
expect(records).toBeDefined();
|
||||||
});
|
expect(records).toHaveLength(0);
|
||||||
|
|
||||||
test('Set name for non-owned authority', async () => {
|
// Query all records should return it (all: true).
|
||||||
// Create another account.
|
records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version }, true);
|
||||||
const mnenonic = Account.generateMnemonic();
|
expect(records).toBeDefined();
|
||||||
const otherAccount = await Account.generateFromMnemonic(mnenonic);
|
expect(records).toHaveLength(1);
|
||||||
await registry.sendCoins({ denom: 'aphoton', amount: '1000000000', destinationAddress: otherAccount.formattedCosmosAddress }, privateKey, fee);
|
});
|
||||||
|
|
||||||
// Other account reserves an authority.
|
test('Delete already deleted name', async () => {
|
||||||
otherAuthorityName = `other-${Date.now()}`;
|
await registry.deleteName({ crn }, privateKey, fee);
|
||||||
otherPrivateKey = otherAccount.privateKey.toString('hex');
|
await registry.deleteName({ crn }, privateKey, fee);
|
||||||
await registry.reserveAuthority({ name: otherAuthorityName }, otherPrivateKey, fee);
|
|
||||||
|
|
||||||
// Try setting name under other authority.
|
const records = await registry.lookupNames([crn], true);
|
||||||
await expect(registry.setName({ crn: `crn://${otherAuthorityName}/app/test`, cid: watcherId }, privateKey, fee)).rejects.toThrow('Access denied.');
|
expect(records).toBeDefined();
|
||||||
});
|
expect(records).toHaveLength(1);
|
||||||
|
|
||||||
test('Lookup non existing name', async () => {
|
const [{ latest }] = records;
|
||||||
const records = await registry.lookupNames(['crn://not-reserved/app/test']);
|
expect(latest).toBeDefined();
|
||||||
expect(records).toBeDefined();
|
expect(latest.id).toBeDefined();
|
||||||
expect(records).toHaveLength(1);
|
expect(latest.id).toBe('');
|
||||||
const [record] = records;
|
expect(latest.height).toBeDefined();
|
||||||
expect(record).toBeNull();
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Resolve non existing name', async () => {
|
test('Set name without reserving authority', async () => {
|
||||||
const records = await registry.resolveNames(['crn://not-reserved/app/test']);
|
await expect(registry.setName({ crn: 'crn://not-reserved/app/test', cid: watcherId }, privateKey, fee))
|
||||||
expect(records).toBeDefined();
|
.rejects.toThrow('Name authority not found.');
|
||||||
expect(records).toHaveLength(1);
|
});
|
||||||
const [record] = records;
|
|
||||||
expect(record).toBeNull();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Delete name', async () => {
|
test('Set name for non-owned authority', async () => {
|
||||||
await registry.deleteName({ crn }, privateKey, fee);
|
await registry.sendCoins({ denom: 'aphoton', amount: '1000000000', destinationAddress: otherAccount.formattedCosmosAddress }, privateKey, fee);
|
||||||
|
|
||||||
let records = await registry.lookupNames([crn], true);
|
// Other account reserves an authority.
|
||||||
expect(records).toBeDefined();
|
await registry.reserveAuthority({ name: otherAuthorityName }, otherPrivateKey, fee);
|
||||||
expect(records).toHaveLength(1);
|
|
||||||
|
|
||||||
const [{ latest }] = records;
|
// Try setting name under other authority.
|
||||||
expect(latest).toBeDefined();
|
await expect(registry.setName({ crn: `crn://${otherAuthorityName}/app/test`, cid: watcherId }, privateKey, fee)).rejects.toThrow('Access denied.');
|
||||||
expect(latest.id).toBeDefined();
|
});
|
||||||
expect(latest.id).toBe('');
|
|
||||||
expect(latest.height).toBeDefined();
|
|
||||||
|
|
||||||
// Query records should NOT return it (no CRN points to it).
|
test('Delete name for non-owned authority.', async () => {
|
||||||
records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version });
|
const otherBondId = await registry.getNextBondId(otherPrivateKey);
|
||||||
expect(records).toBeDefined();
|
await registry.createBond({ denom: 'aphoton', amount: '10000' }, otherPrivateKey, fee);
|
||||||
expect(records).toHaveLength(0);
|
await registry.setAuthorityBond({ name: otherAuthorityName, bondId: otherBondId }, otherPrivateKey, fee);
|
||||||
|
await registry.setName({ crn: `crn://${otherAuthorityName}/app/test`, cid: watcherId }, otherPrivateKey, fee);
|
||||||
|
|
||||||
// Query all records should return it (all: true).
|
// Try deleting name under other authority.
|
||||||
records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version }, true);
|
await expect(registry.deleteName({ crn: `crn://${otherAuthorityName}/app/test` }, privateKey, fee)).rejects.toThrow('Access denied.');
|
||||||
expect(records).toBeDefined();
|
});
|
||||||
expect(records).toHaveLength(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Delete already deleted name', async () => {
|
test('Lookup non existing name', async () => {
|
||||||
await registry.deleteName({ crn }, privateKey, fee);
|
const records = await registry.lookupNames(['crn://not-reserved/app/test']);
|
||||||
|
expect(records).toBeDefined();
|
||||||
|
expect(records).toHaveLength(1);
|
||||||
|
const [record] = records;
|
||||||
|
expect(record).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
const records = await registry.lookupNames([crn], true);
|
test('Resolve non existing name', async () => {
|
||||||
expect(records).toBeDefined();
|
const records = await registry.resolveNames(['crn://not-reserved/app/test']);
|
||||||
expect(records).toHaveLength(1);
|
expect(records).toBeDefined();
|
||||||
|
expect(records).toHaveLength(1);
|
||||||
const [{ latest }] = records;
|
const [record] = records;
|
||||||
expect(latest).toBeDefined();
|
expect(record).toBeNull();
|
||||||
expect(latest.id).toBeDefined();
|
});
|
||||||
expect(latest.id).toBe('');
|
|
||||||
expect(latest.height).toBeDefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
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.');
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: cosmos/base/query/v1beta1/pagination.proto
|
* source: cosmos/base/query/v1beta1/pagination.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as pb_1 from "google-protobuf";
|
import * as pb_1 from "google-protobuf";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: cosmos/base/v1beta1/coin.proto
|
* source: cosmos/base/v1beta1/coin.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -1,219 +0,0 @@
|
|||||||
// @ts-nocheck
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
|
||||||
* compiler version: 3.12.4
|
|
||||||
* source: cosmos_proto/cosmos.proto
|
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
|
||||||
import * as dependency_1 from "./../google/protobuf/descriptor";
|
|
||||||
import * as pb_1 from "google-protobuf";
|
|
||||||
export namespace cosmos_proto {
|
|
||||||
export enum ScalarType {
|
|
||||||
SCALAR_TYPE_UNSPECIFIED = 0,
|
|
||||||
SCALAR_TYPE_STRING = 1,
|
|
||||||
SCALAR_TYPE_BYTES = 2
|
|
||||||
}
|
|
||||||
export class InterfaceDescriptor extends pb_1.Message {
|
|
||||||
#one_of_decls: number[][] = [];
|
|
||||||
constructor(data?: any[] | {
|
|
||||||
name?: string;
|
|
||||||
description?: 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 ("name" in data && data.name != undefined) {
|
|
||||||
this.name = data.name;
|
|
||||||
}
|
|
||||||
if ("description" in data && data.description != undefined) {
|
|
||||||
this.description = data.description;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
get name() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
|
||||||
}
|
|
||||||
set name(value: string) {
|
|
||||||
pb_1.Message.setField(this, 1, value);
|
|
||||||
}
|
|
||||||
get description() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
|
||||||
}
|
|
||||||
set description(value: string) {
|
|
||||||
pb_1.Message.setField(this, 2, value);
|
|
||||||
}
|
|
||||||
static fromObject(data: {
|
|
||||||
name?: string;
|
|
||||||
description?: string;
|
|
||||||
}): InterfaceDescriptor {
|
|
||||||
const message = new InterfaceDescriptor({});
|
|
||||||
if (data.name != null) {
|
|
||||||
message.name = data.name;
|
|
||||||
}
|
|
||||||
if (data.description != null) {
|
|
||||||
message.description = data.description;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
toObject() {
|
|
||||||
const data: {
|
|
||||||
name?: string;
|
|
||||||
description?: string;
|
|
||||||
} = {};
|
|
||||||
if (this.name != null) {
|
|
||||||
data.name = this.name;
|
|
||||||
}
|
|
||||||
if (this.description != null) {
|
|
||||||
data.description = this.description;
|
|
||||||
}
|
|
||||||
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.name.length)
|
|
||||||
writer.writeString(1, this.name);
|
|
||||||
if (this.description.length)
|
|
||||||
writer.writeString(2, this.description);
|
|
||||||
if (!w)
|
|
||||||
return writer.getResultBuffer();
|
|
||||||
}
|
|
||||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): InterfaceDescriptor {
|
|
||||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new InterfaceDescriptor();
|
|
||||||
while (reader.nextField()) {
|
|
||||||
if (reader.isEndGroup())
|
|
||||||
break;
|
|
||||||
switch (reader.getFieldNumber()) {
|
|
||||||
case 1:
|
|
||||||
message.name = reader.readString();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.description = reader.readString();
|
|
||||||
break;
|
|
||||||
default: reader.skipField();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
serializeBinary(): Uint8Array {
|
|
||||||
return this.serialize();
|
|
||||||
}
|
|
||||||
static deserializeBinary(bytes: Uint8Array): InterfaceDescriptor {
|
|
||||||
return InterfaceDescriptor.deserialize(bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export class ScalarDescriptor extends pb_1.Message {
|
|
||||||
#one_of_decls: number[][] = [];
|
|
||||||
constructor(data?: any[] | {
|
|
||||||
name?: string;
|
|
||||||
description?: string;
|
|
||||||
field_type?: ScalarType[];
|
|
||||||
}) {
|
|
||||||
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 ("name" in data && data.name != undefined) {
|
|
||||||
this.name = data.name;
|
|
||||||
}
|
|
||||||
if ("description" in data && data.description != undefined) {
|
|
||||||
this.description = data.description;
|
|
||||||
}
|
|
||||||
if ("field_type" in data && data.field_type != undefined) {
|
|
||||||
this.field_type = data.field_type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
get name() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
|
||||||
}
|
|
||||||
set name(value: string) {
|
|
||||||
pb_1.Message.setField(this, 1, value);
|
|
||||||
}
|
|
||||||
get description() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
|
||||||
}
|
|
||||||
set description(value: string) {
|
|
||||||
pb_1.Message.setField(this, 2, value);
|
|
||||||
}
|
|
||||||
get field_type() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 3, []) as ScalarType[];
|
|
||||||
}
|
|
||||||
set field_type(value: ScalarType[]) {
|
|
||||||
pb_1.Message.setField(this, 3, value);
|
|
||||||
}
|
|
||||||
static fromObject(data: {
|
|
||||||
name?: string;
|
|
||||||
description?: string;
|
|
||||||
field_type?: ScalarType[];
|
|
||||||
}): ScalarDescriptor {
|
|
||||||
const message = new ScalarDescriptor({});
|
|
||||||
if (data.name != null) {
|
|
||||||
message.name = data.name;
|
|
||||||
}
|
|
||||||
if (data.description != null) {
|
|
||||||
message.description = data.description;
|
|
||||||
}
|
|
||||||
if (data.field_type != null) {
|
|
||||||
message.field_type = data.field_type;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
toObject() {
|
|
||||||
const data: {
|
|
||||||
name?: string;
|
|
||||||
description?: string;
|
|
||||||
field_type?: ScalarType[];
|
|
||||||
} = {};
|
|
||||||
if (this.name != null) {
|
|
||||||
data.name = this.name;
|
|
||||||
}
|
|
||||||
if (this.description != null) {
|
|
||||||
data.description = this.description;
|
|
||||||
}
|
|
||||||
if (this.field_type != null) {
|
|
||||||
data.field_type = this.field_type;
|
|
||||||
}
|
|
||||||
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.name.length)
|
|
||||||
writer.writeString(1, this.name);
|
|
||||||
if (this.description.length)
|
|
||||||
writer.writeString(2, this.description);
|
|
||||||
if (this.field_type.length)
|
|
||||||
writer.writePackedEnum(3, this.field_type);
|
|
||||||
if (!w)
|
|
||||||
return writer.getResultBuffer();
|
|
||||||
}
|
|
||||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ScalarDescriptor {
|
|
||||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ScalarDescriptor();
|
|
||||||
while (reader.nextField()) {
|
|
||||||
if (reader.isEndGroup())
|
|
||||||
break;
|
|
||||||
switch (reader.getFieldNumber()) {
|
|
||||||
case 1:
|
|
||||||
message.name = reader.readString();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.description = reader.readString();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.field_type = reader.readPackedEnum();
|
|
||||||
break;
|
|
||||||
default: reader.skipField();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
serializeBinary(): Uint8Array {
|
|
||||||
return this.serialize();
|
|
||||||
}
|
|
||||||
static deserializeBinary(bytes: Uint8Array): ScalarDescriptor {
|
|
||||||
return ScalarDescriptor.deserialize(bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,218 +0,0 @@
|
|||||||
// @ts-nocheck
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
|
||||||
* compiler version: 3.12.4
|
|
||||||
* source: ethermint/evm/v1/genesis.proto
|
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
|
||||||
import * as dependency_1 from "./evm";
|
|
||||||
import * as dependency_2 from "./../../../gogoproto/gogo";
|
|
||||||
import * as pb_1 from "google-protobuf";
|
|
||||||
export namespace ethermint.evm.v1 {
|
|
||||||
export class GenesisState extends pb_1.Message {
|
|
||||||
#one_of_decls: number[][] = [];
|
|
||||||
constructor(data?: any[] | {
|
|
||||||
accounts?: GenesisAccount[];
|
|
||||||
params?: dependency_1.ethermint.evm.v1.Params;
|
|
||||||
}) {
|
|
||||||
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 ("accounts" in data && data.accounts != undefined) {
|
|
||||||
this.accounts = data.accounts;
|
|
||||||
}
|
|
||||||
if ("params" in data && data.params != undefined) {
|
|
||||||
this.params = data.params;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
get accounts() {
|
|
||||||
return pb_1.Message.getRepeatedWrapperField(this, GenesisAccount, 1) as GenesisAccount[];
|
|
||||||
}
|
|
||||||
set accounts(value: GenesisAccount[]) {
|
|
||||||
pb_1.Message.setRepeatedWrapperField(this, 1, value);
|
|
||||||
}
|
|
||||||
get params() {
|
|
||||||
return pb_1.Message.getWrapperField(this, dependency_1.ethermint.evm.v1.Params, 2) as dependency_1.ethermint.evm.v1.Params;
|
|
||||||
}
|
|
||||||
set params(value: dependency_1.ethermint.evm.v1.Params) {
|
|
||||||
pb_1.Message.setWrapperField(this, 2, value);
|
|
||||||
}
|
|
||||||
get has_params() {
|
|
||||||
return pb_1.Message.getField(this, 2) != null;
|
|
||||||
}
|
|
||||||
static fromObject(data: {
|
|
||||||
accounts?: ReturnType<typeof GenesisAccount.prototype.toObject>[];
|
|
||||||
params?: ReturnType<typeof dependency_1.ethermint.evm.v1.Params.prototype.toObject>;
|
|
||||||
}): GenesisState {
|
|
||||||
const message = new GenesisState({});
|
|
||||||
if (data.accounts != null) {
|
|
||||||
message.accounts = data.accounts.map(item => GenesisAccount.fromObject(item));
|
|
||||||
}
|
|
||||||
if (data.params != null) {
|
|
||||||
message.params = dependency_1.ethermint.evm.v1.Params.fromObject(data.params);
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
toObject() {
|
|
||||||
const data: {
|
|
||||||
accounts?: ReturnType<typeof GenesisAccount.prototype.toObject>[];
|
|
||||||
params?: ReturnType<typeof dependency_1.ethermint.evm.v1.Params.prototype.toObject>;
|
|
||||||
} = {};
|
|
||||||
if (this.accounts != null) {
|
|
||||||
data.accounts = this.accounts.map((item: GenesisAccount) => item.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.accounts.length)
|
|
||||||
writer.writeRepeatedMessage(1, this.accounts, (item: GenesisAccount) => item.serialize(writer));
|
|
||||||
if (this.has_params)
|
|
||||||
writer.writeMessage(2, this.params, () => this.params.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.accounts, () => pb_1.Message.addToRepeatedWrapperField(message, 1, GenesisAccount.deserialize(reader), GenesisAccount));
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
reader.readMessage(message.params, () => message.params = dependency_1.ethermint.evm.v1.Params.deserialize(reader));
|
|
||||||
break;
|
|
||||||
default: reader.skipField();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
serializeBinary(): Uint8Array {
|
|
||||||
return this.serialize();
|
|
||||||
}
|
|
||||||
static deserializeBinary(bytes: Uint8Array): GenesisState {
|
|
||||||
return GenesisState.deserialize(bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export class GenesisAccount extends pb_1.Message {
|
|
||||||
#one_of_decls: number[][] = [];
|
|
||||||
constructor(data?: any[] | {
|
|
||||||
address?: string;
|
|
||||||
code?: string;
|
|
||||||
storage?: dependency_1.ethermint.evm.v1.State[];
|
|
||||||
}) {
|
|
||||||
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 ("address" in data && data.address != undefined) {
|
|
||||||
this.address = data.address;
|
|
||||||
}
|
|
||||||
if ("code" in data && data.code != undefined) {
|
|
||||||
this.code = data.code;
|
|
||||||
}
|
|
||||||
if ("storage" in data && data.storage != undefined) {
|
|
||||||
this.storage = data.storage;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
get address() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
|
||||||
}
|
|
||||||
set address(value: string) {
|
|
||||||
pb_1.Message.setField(this, 1, value);
|
|
||||||
}
|
|
||||||
get code() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
|
||||||
}
|
|
||||||
set code(value: string) {
|
|
||||||
pb_1.Message.setField(this, 2, value);
|
|
||||||
}
|
|
||||||
get storage() {
|
|
||||||
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.ethermint.evm.v1.State, 3) as dependency_1.ethermint.evm.v1.State[];
|
|
||||||
}
|
|
||||||
set storage(value: dependency_1.ethermint.evm.v1.State[]) {
|
|
||||||
pb_1.Message.setRepeatedWrapperField(this, 3, value);
|
|
||||||
}
|
|
||||||
static fromObject(data: {
|
|
||||||
address?: string;
|
|
||||||
code?: string;
|
|
||||||
storage?: ReturnType<typeof dependency_1.ethermint.evm.v1.State.prototype.toObject>[];
|
|
||||||
}): GenesisAccount {
|
|
||||||
const message = new GenesisAccount({});
|
|
||||||
if (data.address != null) {
|
|
||||||
message.address = data.address;
|
|
||||||
}
|
|
||||||
if (data.code != null) {
|
|
||||||
message.code = data.code;
|
|
||||||
}
|
|
||||||
if (data.storage != null) {
|
|
||||||
message.storage = data.storage.map(item => dependency_1.ethermint.evm.v1.State.fromObject(item));
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
toObject() {
|
|
||||||
const data: {
|
|
||||||
address?: string;
|
|
||||||
code?: string;
|
|
||||||
storage?: ReturnType<typeof dependency_1.ethermint.evm.v1.State.prototype.toObject>[];
|
|
||||||
} = {};
|
|
||||||
if (this.address != null) {
|
|
||||||
data.address = this.address;
|
|
||||||
}
|
|
||||||
if (this.code != null) {
|
|
||||||
data.code = this.code;
|
|
||||||
}
|
|
||||||
if (this.storage != null) {
|
|
||||||
data.storage = this.storage.map((item: dependency_1.ethermint.evm.v1.State) => 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.address.length)
|
|
||||||
writer.writeString(1, this.address);
|
|
||||||
if (this.code.length)
|
|
||||||
writer.writeString(2, this.code);
|
|
||||||
if (this.storage.length)
|
|
||||||
writer.writeRepeatedMessage(3, this.storage, (item: dependency_1.ethermint.evm.v1.State) => item.serialize(writer));
|
|
||||||
if (!w)
|
|
||||||
return writer.getResultBuffer();
|
|
||||||
}
|
|
||||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): GenesisAccount {
|
|
||||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new GenesisAccount();
|
|
||||||
while (reader.nextField()) {
|
|
||||||
if (reader.isEndGroup())
|
|
||||||
break;
|
|
||||||
switch (reader.getFieldNumber()) {
|
|
||||||
case 1:
|
|
||||||
message.address = reader.readString();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.code = reader.readString();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
reader.readMessage(message.storage, () => pb_1.Message.addToRepeatedWrapperField(message, 3, dependency_1.ethermint.evm.v1.State.deserialize(reader), dependency_1.ethermint.evm.v1.State));
|
|
||||||
break;
|
|
||||||
default: reader.skipField();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
serializeBinary(): Uint8Array {
|
|
||||||
return this.serialize();
|
|
||||||
}
|
|
||||||
static deserializeBinary(bytes: Uint8Array): GenesisAccount {
|
|
||||||
return GenesisAccount.deserialize(bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: gogoproto/gogo.proto
|
* source: gogoproto/gogo.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../google/protobuf/descriptor";
|
import * as dependency_1 from "./../google/protobuf/descriptor";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: google/api/annotations.proto
|
* source: google/api/annotations.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./http";
|
import * as dependency_1 from "./http";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: google/api/http.proto
|
* source: google/api/http.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as pb_1 from "google-protobuf";
|
import * as pb_1 from "google-protobuf";
|
||||||
|
@ -1,101 +0,0 @@
|
|||||||
// @ts-nocheck
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
|
||||||
* compiler version: 3.12.4
|
|
||||||
* source: google/protobuf/any.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 google.protobuf {
|
|
||||||
export class Any extends pb_1.Message {
|
|
||||||
#one_of_decls: number[][] = [];
|
|
||||||
constructor(data?: any[] | {
|
|
||||||
type_url?: string;
|
|
||||||
value?: Uint8Array;
|
|
||||||
}) {
|
|
||||||
super();
|
|
||||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
|
||||||
if (!Array.isArray(data) && typeof data == "object") {
|
|
||||||
if ("type_url" in data && data.type_url != undefined) {
|
|
||||||
this.type_url = data.type_url;
|
|
||||||
}
|
|
||||||
if ("value" in data && data.value != undefined) {
|
|
||||||
this.value = data.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
get type_url() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
|
||||||
}
|
|
||||||
set type_url(value: string) {
|
|
||||||
pb_1.Message.setField(this, 1, value);
|
|
||||||
}
|
|
||||||
get value() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array(0)) as Uint8Array;
|
|
||||||
}
|
|
||||||
set value(value: Uint8Array) {
|
|
||||||
pb_1.Message.setField(this, 2, value);
|
|
||||||
}
|
|
||||||
static fromObject(data: {
|
|
||||||
type_url?: string;
|
|
||||||
value?: Uint8Array;
|
|
||||||
}): Any {
|
|
||||||
const message = new Any({});
|
|
||||||
if (data.type_url != null) {
|
|
||||||
message.type_url = data.type_url;
|
|
||||||
}
|
|
||||||
if (data.value != null) {
|
|
||||||
message.value = data.value;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
toObject() {
|
|
||||||
const data: {
|
|
||||||
type_url?: string;
|
|
||||||
value?: Uint8Array;
|
|
||||||
} = {};
|
|
||||||
if (this.type_url != null) {
|
|
||||||
data.type_url = this.type_url;
|
|
||||||
}
|
|
||||||
if (this.value != null) {
|
|
||||||
data.value = this.value;
|
|
||||||
}
|
|
||||||
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.type_url.length)
|
|
||||||
writer.writeString(1, this.type_url);
|
|
||||||
if (this.value.length)
|
|
||||||
writer.writeBytes(2, this.value);
|
|
||||||
if (!w)
|
|
||||||
return writer.getResultBuffer();
|
|
||||||
}
|
|
||||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Any {
|
|
||||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Any();
|
|
||||||
while (reader.nextField()) {
|
|
||||||
if (reader.isEndGroup())
|
|
||||||
break;
|
|
||||||
switch (reader.getFieldNumber()) {
|
|
||||||
case 1:
|
|
||||||
message.type_url = reader.readString();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.value = reader.readBytes();
|
|
||||||
break;
|
|
||||||
default: reader.skipField();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
serializeBinary(): Uint8Array {
|
|
||||||
return this.serialize();
|
|
||||||
}
|
|
||||||
static deserializeBinary(bytes: Uint8Array): Any {
|
|
||||||
return Any.deserialize(bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: google/protobuf/descriptor.proto
|
* source: google/protobuf/descriptor.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as pb_1 from "google-protobuf";
|
import * as pb_1 from "google-protobuf";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: google/protobuf/duration.proto
|
* source: google/protobuf/duration.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as pb_1 from "google-protobuf";
|
import * as pb_1 from "google-protobuf";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: google/protobuf/timestamp.proto
|
* source: google/protobuf/timestamp.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as pb_1 from "google-protobuf";
|
import * as pb_1 from "google-protobuf";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: vulcanize/auction/v1beta1/genesis.proto
|
* source: vulcanize/auction/v1beta1/genesis.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: vulcanize/auction/v1beta1/query.proto
|
* source: vulcanize/auction/v1beta1/query.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: vulcanize/auction/v1beta1/tx.proto
|
* source: vulcanize/auction/v1beta1/tx.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: vulcanize/auction/v1beta1/types.proto
|
* source: vulcanize/auction/v1beta1/types.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: vulcanize/bond/v1beta1/bond.proto
|
* source: vulcanize/bond/v1beta1/bond.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: vulcanize/bond/v1beta1/genesis.proto
|
* source: vulcanize/bond/v1beta1/genesis.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: vulcanize/bond/v1beta1/query.proto
|
* source: vulcanize/bond/v1beta1/query.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: vulcanize/bond/v1beta1/tx.proto
|
* source: vulcanize/bond/v1beta1/tx.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -1,537 +0,0 @@
|
|||||||
// @ts-nocheck
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
|
||||||
* compiler version: 3.12.4
|
|
||||||
* source: vulcanize/registry/v1beta1/attributes.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 vulcanize.registry.v1beta1 {
|
|
||||||
export class ServiceProviderRegistration extends pb_1.Message {
|
|
||||||
#one_of_decls: number[][] = [];
|
|
||||||
constructor(data?: any[] | {
|
|
||||||
bond_id?: string;
|
|
||||||
laconic_id?: string;
|
|
||||||
x500?: X500;
|
|
||||||
type?: string;
|
|
||||||
version?: 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 ("bond_id" in data && data.bond_id != undefined) {
|
|
||||||
this.bond_id = data.bond_id;
|
|
||||||
}
|
|
||||||
if ("laconic_id" in data && data.laconic_id != undefined) {
|
|
||||||
this.laconic_id = data.laconic_id;
|
|
||||||
}
|
|
||||||
if ("x500" in data && data.x500 != undefined) {
|
|
||||||
this.x500 = data.x500;
|
|
||||||
}
|
|
||||||
if ("type" in data && data.type != undefined) {
|
|
||||||
this.type = data.type;
|
|
||||||
}
|
|
||||||
if ("version" in data && data.version != undefined) {
|
|
||||||
this.version = data.version;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
get bond_id() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
|
||||||
}
|
|
||||||
set bond_id(value: string) {
|
|
||||||
pb_1.Message.setField(this, 1, value);
|
|
||||||
}
|
|
||||||
get laconic_id() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
|
||||||
}
|
|
||||||
set laconic_id(value: string) {
|
|
||||||
pb_1.Message.setField(this, 2, value);
|
|
||||||
}
|
|
||||||
get x500() {
|
|
||||||
return pb_1.Message.getWrapperField(this, X500, 3) as X500;
|
|
||||||
}
|
|
||||||
set x500(value: X500) {
|
|
||||||
pb_1.Message.setWrapperField(this, 3, value);
|
|
||||||
}
|
|
||||||
get has_x500() {
|
|
||||||
return pb_1.Message.getField(this, 3) != null;
|
|
||||||
}
|
|
||||||
get type() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
|
|
||||||
}
|
|
||||||
set type(value: string) {
|
|
||||||
pb_1.Message.setField(this, 4, value);
|
|
||||||
}
|
|
||||||
get version() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 6, "") as string;
|
|
||||||
}
|
|
||||||
set version(value: string) {
|
|
||||||
pb_1.Message.setField(this, 6, value);
|
|
||||||
}
|
|
||||||
static fromObject(data: {
|
|
||||||
bond_id?: string;
|
|
||||||
laconic_id?: string;
|
|
||||||
x500?: ReturnType<typeof X500.prototype.toObject>;
|
|
||||||
type?: string;
|
|
||||||
version?: string;
|
|
||||||
}): ServiceProviderRegistration {
|
|
||||||
const message = new ServiceProviderRegistration({});
|
|
||||||
if (data.bond_id != null) {
|
|
||||||
message.bond_id = data.bond_id;
|
|
||||||
}
|
|
||||||
if (data.laconic_id != null) {
|
|
||||||
message.laconic_id = data.laconic_id;
|
|
||||||
}
|
|
||||||
if (data.x500 != null) {
|
|
||||||
message.x500 = X500.fromObject(data.x500);
|
|
||||||
}
|
|
||||||
if (data.type != null) {
|
|
||||||
message.type = data.type;
|
|
||||||
}
|
|
||||||
if (data.version != null) {
|
|
||||||
message.version = data.version;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
toObject() {
|
|
||||||
const data: {
|
|
||||||
bond_id?: string;
|
|
||||||
laconic_id?: string;
|
|
||||||
x500?: ReturnType<typeof X500.prototype.toObject>;
|
|
||||||
type?: string;
|
|
||||||
version?: string;
|
|
||||||
} = {};
|
|
||||||
if (this.bond_id != null) {
|
|
||||||
data.bond_id = this.bond_id;
|
|
||||||
}
|
|
||||||
if (this.laconic_id != null) {
|
|
||||||
data.laconic_id = this.laconic_id;
|
|
||||||
}
|
|
||||||
if (this.x500 != null) {
|
|
||||||
data.x500 = this.x500.toObject();
|
|
||||||
}
|
|
||||||
if (this.type != null) {
|
|
||||||
data.type = this.type;
|
|
||||||
}
|
|
||||||
if (this.version != null) {
|
|
||||||
data.version = this.version;
|
|
||||||
}
|
|
||||||
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.bond_id.length)
|
|
||||||
writer.writeString(1, this.bond_id);
|
|
||||||
if (this.laconic_id.length)
|
|
||||||
writer.writeString(2, this.laconic_id);
|
|
||||||
if (this.has_x500)
|
|
||||||
writer.writeMessage(3, this.x500, () => this.x500.serialize(writer));
|
|
||||||
if (this.type.length)
|
|
||||||
writer.writeString(4, this.type);
|
|
||||||
if (this.version.length)
|
|
||||||
writer.writeString(6, this.version);
|
|
||||||
if (!w)
|
|
||||||
return writer.getResultBuffer();
|
|
||||||
}
|
|
||||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ServiceProviderRegistration {
|
|
||||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ServiceProviderRegistration();
|
|
||||||
while (reader.nextField()) {
|
|
||||||
if (reader.isEndGroup())
|
|
||||||
break;
|
|
||||||
switch (reader.getFieldNumber()) {
|
|
||||||
case 1:
|
|
||||||
message.bond_id = reader.readString();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.laconic_id = reader.readString();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
reader.readMessage(message.x500, () => message.x500 = X500.deserialize(reader));
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.type = reader.readString();
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
message.version = reader.readString();
|
|
||||||
break;
|
|
||||||
default: reader.skipField();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
serializeBinary(): Uint8Array {
|
|
||||||
return this.serialize();
|
|
||||||
}
|
|
||||||
static deserializeBinary(bytes: Uint8Array): ServiceProviderRegistration {
|
|
||||||
return ServiceProviderRegistration.deserialize(bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export class X500 extends pb_1.Message {
|
|
||||||
#one_of_decls: number[][] = [];
|
|
||||||
constructor(data?: any[] | {
|
|
||||||
common_name?: string;
|
|
||||||
organization_unit?: string;
|
|
||||||
organization_name?: string;
|
|
||||||
locality_name?: string;
|
|
||||||
state_name?: string;
|
|
||||||
country?: 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 ("common_name" in data && data.common_name != undefined) {
|
|
||||||
this.common_name = data.common_name;
|
|
||||||
}
|
|
||||||
if ("organization_unit" in data && data.organization_unit != undefined) {
|
|
||||||
this.organization_unit = data.organization_unit;
|
|
||||||
}
|
|
||||||
if ("organization_name" in data && data.organization_name != undefined) {
|
|
||||||
this.organization_name = data.organization_name;
|
|
||||||
}
|
|
||||||
if ("locality_name" in data && data.locality_name != undefined) {
|
|
||||||
this.locality_name = data.locality_name;
|
|
||||||
}
|
|
||||||
if ("state_name" in data && data.state_name != undefined) {
|
|
||||||
this.state_name = data.state_name;
|
|
||||||
}
|
|
||||||
if ("country" in data && data.country != undefined) {
|
|
||||||
this.country = data.country;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
get common_name() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
|
||||||
}
|
|
||||||
set common_name(value: string) {
|
|
||||||
pb_1.Message.setField(this, 1, value);
|
|
||||||
}
|
|
||||||
get organization_unit() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
|
||||||
}
|
|
||||||
set organization_unit(value: string) {
|
|
||||||
pb_1.Message.setField(this, 2, value);
|
|
||||||
}
|
|
||||||
get organization_name() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
|
|
||||||
}
|
|
||||||
set organization_name(value: string) {
|
|
||||||
pb_1.Message.setField(this, 3, value);
|
|
||||||
}
|
|
||||||
get locality_name() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
|
|
||||||
}
|
|
||||||
set locality_name(value: string) {
|
|
||||||
pb_1.Message.setField(this, 4, value);
|
|
||||||
}
|
|
||||||
get state_name() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 5, "") as string;
|
|
||||||
}
|
|
||||||
set state_name(value: string) {
|
|
||||||
pb_1.Message.setField(this, 5, value);
|
|
||||||
}
|
|
||||||
get country() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 6, "") as string;
|
|
||||||
}
|
|
||||||
set country(value: string) {
|
|
||||||
pb_1.Message.setField(this, 6, value);
|
|
||||||
}
|
|
||||||
static fromObject(data: {
|
|
||||||
common_name?: string;
|
|
||||||
organization_unit?: string;
|
|
||||||
organization_name?: string;
|
|
||||||
locality_name?: string;
|
|
||||||
state_name?: string;
|
|
||||||
country?: string;
|
|
||||||
}): X500 {
|
|
||||||
const message = new X500({});
|
|
||||||
if (data.common_name != null) {
|
|
||||||
message.common_name = data.common_name;
|
|
||||||
}
|
|
||||||
if (data.organization_unit != null) {
|
|
||||||
message.organization_unit = data.organization_unit;
|
|
||||||
}
|
|
||||||
if (data.organization_name != null) {
|
|
||||||
message.organization_name = data.organization_name;
|
|
||||||
}
|
|
||||||
if (data.locality_name != null) {
|
|
||||||
message.locality_name = data.locality_name;
|
|
||||||
}
|
|
||||||
if (data.state_name != null) {
|
|
||||||
message.state_name = data.state_name;
|
|
||||||
}
|
|
||||||
if (data.country != null) {
|
|
||||||
message.country = data.country;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
toObject() {
|
|
||||||
const data: {
|
|
||||||
common_name?: string;
|
|
||||||
organization_unit?: string;
|
|
||||||
organization_name?: string;
|
|
||||||
locality_name?: string;
|
|
||||||
state_name?: string;
|
|
||||||
country?: string;
|
|
||||||
} = {};
|
|
||||||
if (this.common_name != null) {
|
|
||||||
data.common_name = this.common_name;
|
|
||||||
}
|
|
||||||
if (this.organization_unit != null) {
|
|
||||||
data.organization_unit = this.organization_unit;
|
|
||||||
}
|
|
||||||
if (this.organization_name != null) {
|
|
||||||
data.organization_name = this.organization_name;
|
|
||||||
}
|
|
||||||
if (this.locality_name != null) {
|
|
||||||
data.locality_name = this.locality_name;
|
|
||||||
}
|
|
||||||
if (this.state_name != null) {
|
|
||||||
data.state_name = this.state_name;
|
|
||||||
}
|
|
||||||
if (this.country != null) {
|
|
||||||
data.country = this.country;
|
|
||||||
}
|
|
||||||
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.common_name.length)
|
|
||||||
writer.writeString(1, this.common_name);
|
|
||||||
if (this.organization_unit.length)
|
|
||||||
writer.writeString(2, this.organization_unit);
|
|
||||||
if (this.organization_name.length)
|
|
||||||
writer.writeString(3, this.organization_name);
|
|
||||||
if (this.locality_name.length)
|
|
||||||
writer.writeString(4, this.locality_name);
|
|
||||||
if (this.state_name.length)
|
|
||||||
writer.writeString(5, this.state_name);
|
|
||||||
if (this.country.length)
|
|
||||||
writer.writeString(6, this.country);
|
|
||||||
if (!w)
|
|
||||||
return writer.getResultBuffer();
|
|
||||||
}
|
|
||||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): X500 {
|
|
||||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new X500();
|
|
||||||
while (reader.nextField()) {
|
|
||||||
if (reader.isEndGroup())
|
|
||||||
break;
|
|
||||||
switch (reader.getFieldNumber()) {
|
|
||||||
case 1:
|
|
||||||
message.common_name = reader.readString();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.organization_unit = reader.readString();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.organization_name = reader.readString();
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.locality_name = reader.readString();
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
message.state_name = reader.readString();
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
message.country = reader.readString();
|
|
||||||
break;
|
|
||||||
default: reader.skipField();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
serializeBinary(): Uint8Array {
|
|
||||||
return this.serialize();
|
|
||||||
}
|
|
||||||
static deserializeBinary(bytes: Uint8Array): X500 {
|
|
||||||
return X500.deserialize(bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export class WebsiteRegistrationRecord extends pb_1.Message {
|
|
||||||
#one_of_decls: number[][] = [];
|
|
||||||
constructor(data?: any[] | {
|
|
||||||
url?: string;
|
|
||||||
repo_registration_record_cid?: string;
|
|
||||||
build_artifact_cid?: string;
|
|
||||||
tls_cert_cid?: string;
|
|
||||||
type?: string;
|
|
||||||
version?: 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 ("url" in data && data.url != undefined) {
|
|
||||||
this.url = data.url;
|
|
||||||
}
|
|
||||||
if ("repo_registration_record_cid" in data && data.repo_registration_record_cid != undefined) {
|
|
||||||
this.repo_registration_record_cid = data.repo_registration_record_cid;
|
|
||||||
}
|
|
||||||
if ("build_artifact_cid" in data && data.build_artifact_cid != undefined) {
|
|
||||||
this.build_artifact_cid = data.build_artifact_cid;
|
|
||||||
}
|
|
||||||
if ("tls_cert_cid" in data && data.tls_cert_cid != undefined) {
|
|
||||||
this.tls_cert_cid = data.tls_cert_cid;
|
|
||||||
}
|
|
||||||
if ("type" in data && data.type != undefined) {
|
|
||||||
this.type = data.type;
|
|
||||||
}
|
|
||||||
if ("version" in data && data.version != undefined) {
|
|
||||||
this.version = data.version;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
get url() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
|
||||||
}
|
|
||||||
set url(value: string) {
|
|
||||||
pb_1.Message.setField(this, 1, value);
|
|
||||||
}
|
|
||||||
get repo_registration_record_cid() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
|
||||||
}
|
|
||||||
set repo_registration_record_cid(value: string) {
|
|
||||||
pb_1.Message.setField(this, 2, value);
|
|
||||||
}
|
|
||||||
get build_artifact_cid() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
|
|
||||||
}
|
|
||||||
set build_artifact_cid(value: string) {
|
|
||||||
pb_1.Message.setField(this, 3, value);
|
|
||||||
}
|
|
||||||
get tls_cert_cid() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
|
|
||||||
}
|
|
||||||
set tls_cert_cid(value: string) {
|
|
||||||
pb_1.Message.setField(this, 4, value);
|
|
||||||
}
|
|
||||||
get type() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 5, "") as string;
|
|
||||||
}
|
|
||||||
set type(value: string) {
|
|
||||||
pb_1.Message.setField(this, 5, value);
|
|
||||||
}
|
|
||||||
get version() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 6, "") as string;
|
|
||||||
}
|
|
||||||
set version(value: string) {
|
|
||||||
pb_1.Message.setField(this, 6, value);
|
|
||||||
}
|
|
||||||
static fromObject(data: {
|
|
||||||
url?: string;
|
|
||||||
repo_registration_record_cid?: string;
|
|
||||||
build_artifact_cid?: string;
|
|
||||||
tls_cert_cid?: string;
|
|
||||||
type?: string;
|
|
||||||
version?: string;
|
|
||||||
}): WebsiteRegistrationRecord {
|
|
||||||
const message = new WebsiteRegistrationRecord({});
|
|
||||||
if (data.url != null) {
|
|
||||||
message.url = data.url;
|
|
||||||
}
|
|
||||||
if (data.repo_registration_record_cid != null) {
|
|
||||||
message.repo_registration_record_cid = data.repo_registration_record_cid;
|
|
||||||
}
|
|
||||||
if (data.build_artifact_cid != null) {
|
|
||||||
message.build_artifact_cid = data.build_artifact_cid;
|
|
||||||
}
|
|
||||||
if (data.tls_cert_cid != null) {
|
|
||||||
message.tls_cert_cid = data.tls_cert_cid;
|
|
||||||
}
|
|
||||||
if (data.type != null) {
|
|
||||||
message.type = data.type;
|
|
||||||
}
|
|
||||||
if (data.version != null) {
|
|
||||||
message.version = data.version;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
toObject() {
|
|
||||||
const data: {
|
|
||||||
url?: string;
|
|
||||||
repo_registration_record_cid?: string;
|
|
||||||
build_artifact_cid?: string;
|
|
||||||
tls_cert_cid?: string;
|
|
||||||
type?: string;
|
|
||||||
version?: string;
|
|
||||||
} = {};
|
|
||||||
if (this.url != null) {
|
|
||||||
data.url = this.url;
|
|
||||||
}
|
|
||||||
if (this.repo_registration_record_cid != null) {
|
|
||||||
data.repo_registration_record_cid = this.repo_registration_record_cid;
|
|
||||||
}
|
|
||||||
if (this.build_artifact_cid != null) {
|
|
||||||
data.build_artifact_cid = this.build_artifact_cid;
|
|
||||||
}
|
|
||||||
if (this.tls_cert_cid != null) {
|
|
||||||
data.tls_cert_cid = this.tls_cert_cid;
|
|
||||||
}
|
|
||||||
if (this.type != null) {
|
|
||||||
data.type = this.type;
|
|
||||||
}
|
|
||||||
if (this.version != null) {
|
|
||||||
data.version = this.version;
|
|
||||||
}
|
|
||||||
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.url.length)
|
|
||||||
writer.writeString(1, this.url);
|
|
||||||
if (this.repo_registration_record_cid.length)
|
|
||||||
writer.writeString(2, this.repo_registration_record_cid);
|
|
||||||
if (this.build_artifact_cid.length)
|
|
||||||
writer.writeString(3, this.build_artifact_cid);
|
|
||||||
if (this.tls_cert_cid.length)
|
|
||||||
writer.writeString(4, this.tls_cert_cid);
|
|
||||||
if (this.type.length)
|
|
||||||
writer.writeString(5, this.type);
|
|
||||||
if (this.version.length)
|
|
||||||
writer.writeString(6, this.version);
|
|
||||||
if (!w)
|
|
||||||
return writer.getResultBuffer();
|
|
||||||
}
|
|
||||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): WebsiteRegistrationRecord {
|
|
||||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new WebsiteRegistrationRecord();
|
|
||||||
while (reader.nextField()) {
|
|
||||||
if (reader.isEndGroup())
|
|
||||||
break;
|
|
||||||
switch (reader.getFieldNumber()) {
|
|
||||||
case 1:
|
|
||||||
message.url = reader.readString();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.repo_registration_record_cid = reader.readString();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
message.build_artifact_cid = reader.readString();
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
message.tls_cert_cid = reader.readString();
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
message.type = reader.readString();
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
message.version = reader.readString();
|
|
||||||
break;
|
|
||||||
default: reader.skipField();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
serializeBinary(): Uint8Array {
|
|
||||||
return this.serialize();
|
|
||||||
}
|
|
||||||
static deserializeBinary(bytes: Uint8Array): WebsiteRegistrationRecord {
|
|
||||||
return WebsiteRegistrationRecord.deserialize(bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: vulcanize/registry/v1beta1/genesis.proto
|
* source: vulcanize/registry/v1beta1/genesis.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: vulcanize/registry/v1beta1/query.proto
|
* source: vulcanize/registry/v1beta1/query.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./registry";
|
import * as dependency_1 from "./registry";
|
||||||
@ -239,7 +239,7 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
export namespace QueryListRecordsRequest {
|
export namespace QueryListRecordsRequest {
|
||||||
export class ReferenceInput extends pb_1.Message {
|
export class LinkInput extends pb_1.Message {
|
||||||
#one_of_decls: number[][] = [];
|
#one_of_decls: number[][] = [];
|
||||||
constructor(data?: any[] | {
|
constructor(data?: any[] | {
|
||||||
id?: string;
|
id?: string;
|
||||||
@ -260,8 +260,8 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
}
|
}
|
||||||
static fromObject(data: {
|
static fromObject(data: {
|
||||||
id?: string;
|
id?: string;
|
||||||
}): ReferenceInput {
|
}): LinkInput {
|
||||||
const message = new ReferenceInput({});
|
const message = new LinkInput({});
|
||||||
if (data.id != null) {
|
if (data.id != null) {
|
||||||
message.id = data.id;
|
message.id = data.id;
|
||||||
}
|
}
|
||||||
@ -285,8 +285,8 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
if (!w)
|
if (!w)
|
||||||
return writer.getResultBuffer();
|
return writer.getResultBuffer();
|
||||||
}
|
}
|
||||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ReferenceInput {
|
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): LinkInput {
|
||||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ReferenceInput();
|
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new LinkInput();
|
||||||
while (reader.nextField()) {
|
while (reader.nextField()) {
|
||||||
if (reader.isEndGroup())
|
if (reader.isEndGroup())
|
||||||
break;
|
break;
|
||||||
@ -302,27 +302,220 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
serializeBinary(): Uint8Array {
|
serializeBinary(): Uint8Array {
|
||||||
return this.serialize();
|
return this.serialize();
|
||||||
}
|
}
|
||||||
static deserializeBinary(bytes: Uint8Array): ReferenceInput {
|
static deserializeBinary(bytes: Uint8Array): LinkInput {
|
||||||
return ReferenceInput.deserialize(bytes);
|
return LinkInput.deserialize(bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export class ValueInput extends pb_1.Message {
|
export class ArrayInput extends pb_1.Message {
|
||||||
#one_of_decls: number[][] = [];
|
#one_of_decls: number[][] = [];
|
||||||
constructor(data?: any[] | {
|
constructor(data?: any[] | {
|
||||||
type?: string;
|
|
||||||
string?: string;
|
|
||||||
int?: number;
|
|
||||||
float?: number;
|
|
||||||
boolean?: boolean;
|
|
||||||
reference?: QueryListRecordsRequest.ReferenceInput;
|
|
||||||
values?: QueryListRecordsRequest.ValueInput[];
|
values?: QueryListRecordsRequest.ValueInput[];
|
||||||
}) {
|
}) {
|
||||||
super();
|
super();
|
||||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [7], this.#one_of_decls);
|
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls);
|
||||||
if (!Array.isArray(data) && typeof data == "object") {
|
if (!Array.isArray(data) && typeof data == "object") {
|
||||||
if ("type" in data && data.type != undefined) {
|
if ("values" in data && data.values != undefined) {
|
||||||
this.type = data.type;
|
this.values = data.values;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get values() {
|
||||||
|
return pb_1.Message.getRepeatedWrapperField(this, QueryListRecordsRequest.ValueInput, 1) as QueryListRecordsRequest.ValueInput[];
|
||||||
|
}
|
||||||
|
set values(value: QueryListRecordsRequest.ValueInput[]) {
|
||||||
|
pb_1.Message.setRepeatedWrapperField(this, 1, value);
|
||||||
|
}
|
||||||
|
static fromObject(data: {
|
||||||
|
values?: ReturnType<typeof QueryListRecordsRequest.ValueInput.prototype.toObject>[];
|
||||||
|
}): ArrayInput {
|
||||||
|
const message = new ArrayInput({});
|
||||||
|
if (data.values != null) {
|
||||||
|
message.values = data.values.map(item => QueryListRecordsRequest.ValueInput.fromObject(item));
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
toObject() {
|
||||||
|
const data: {
|
||||||
|
values?: ReturnType<typeof QueryListRecordsRequest.ValueInput.prototype.toObject>[];
|
||||||
|
} = {};
|
||||||
|
if (this.values != null) {
|
||||||
|
data.values = this.values.map((item: QueryListRecordsRequest.ValueInput) => 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.values.length)
|
||||||
|
writer.writeRepeatedMessage(1, this.values, (item: QueryListRecordsRequest.ValueInput) => item.serialize(writer));
|
||||||
|
if (!w)
|
||||||
|
return writer.getResultBuffer();
|
||||||
|
}
|
||||||
|
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ArrayInput {
|
||||||
|
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ArrayInput();
|
||||||
|
while (reader.nextField()) {
|
||||||
|
if (reader.isEndGroup())
|
||||||
|
break;
|
||||||
|
switch (reader.getFieldNumber()) {
|
||||||
|
case 1:
|
||||||
|
reader.readMessage(message.values, () => pb_1.Message.addToRepeatedWrapperField(message, 1, QueryListRecordsRequest.ValueInput.deserialize(reader), QueryListRecordsRequest.ValueInput));
|
||||||
|
break;
|
||||||
|
default: reader.skipField();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
serializeBinary(): Uint8Array {
|
||||||
|
return this.serialize();
|
||||||
|
}
|
||||||
|
static deserializeBinary(bytes: Uint8Array): ArrayInput {
|
||||||
|
return ArrayInput.deserialize(bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class MapInput extends pb_1.Message {
|
||||||
|
#one_of_decls: number[][] = [];
|
||||||
|
constructor(data?: any[] | {
|
||||||
|
values?: Map<string, QueryListRecordsRequest.ValueInput>;
|
||||||
|
}) {
|
||||||
|
super();
|
||||||
|
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||||
|
if (!Array.isArray(data) && typeof data == "object") {
|
||||||
|
if ("values" in data && data.values != undefined) {
|
||||||
|
this.values = data.values;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!this.values)
|
||||||
|
this.values = new Map();
|
||||||
|
}
|
||||||
|
get values() {
|
||||||
|
return pb_1.Message.getField(this, 1) as any as Map<string, QueryListRecordsRequest.ValueInput>;
|
||||||
|
}
|
||||||
|
set values(value: Map<string, QueryListRecordsRequest.ValueInput>) {
|
||||||
|
pb_1.Message.setField(this, 1, value as any);
|
||||||
|
}
|
||||||
|
static fromObject(data: {
|
||||||
|
values?: {
|
||||||
|
[key: string]: ReturnType<typeof QueryListRecordsRequest.ValueInput.prototype.toObject>;
|
||||||
|
};
|
||||||
|
}): MapInput {
|
||||||
|
const message = new MapInput({});
|
||||||
|
if (typeof data.values == "object") {
|
||||||
|
message.values = new Map(Object.entries(data.values).map(([key, value]) => [key, QueryListRecordsRequest.ValueInput.fromObject(value)]));
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
toObject() {
|
||||||
|
const data: {
|
||||||
|
values?: {
|
||||||
|
[key: string]: ReturnType<typeof QueryListRecordsRequest.ValueInput.prototype.toObject>;
|
||||||
|
};
|
||||||
|
} = {};
|
||||||
|
if (this.values != null) {
|
||||||
|
data.values = (Object.fromEntries)((Array.from)(this.values).map(([key, value]) => [key, value.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();
|
||||||
|
for (const [key, value] of this.values) {
|
||||||
|
writer.writeMessage(1, this.values, () => {
|
||||||
|
writer.writeString(1, key);
|
||||||
|
writer.writeMessage(2, value, () => value.serialize(writer));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!w)
|
||||||
|
return writer.getResultBuffer();
|
||||||
|
}
|
||||||
|
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MapInput {
|
||||||
|
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new MapInput();
|
||||||
|
while (reader.nextField()) {
|
||||||
|
if (reader.isEndGroup())
|
||||||
|
break;
|
||||||
|
switch (reader.getFieldNumber()) {
|
||||||
|
case 1:
|
||||||
|
reader.readMessage(message, () => pb_1.Map.deserializeBinary(message.values as any, reader, reader.readString, () => {
|
||||||
|
let value;
|
||||||
|
reader.readMessage(message, () => value = QueryListRecordsRequest.ValueInput.deserialize(reader));
|
||||||
|
return value;
|
||||||
|
}));
|
||||||
|
break;
|
||||||
|
default: reader.skipField();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
serializeBinary(): Uint8Array {
|
||||||
|
return this.serialize();
|
||||||
|
}
|
||||||
|
static deserializeBinary(bytes: Uint8Array): MapInput {
|
||||||
|
return MapInput.deserialize(bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class ValueInput extends pb_1.Message {
|
||||||
|
#one_of_decls: number[][] = [[1, 2, 3, 4, 5, 6, 7]];
|
||||||
|
constructor(data?: any[] | ({} & (({
|
||||||
|
string?: string;
|
||||||
|
int?: never;
|
||||||
|
float?: never;
|
||||||
|
boolean?: never;
|
||||||
|
link?: never;
|
||||||
|
array?: never;
|
||||||
|
map?: never;
|
||||||
|
} | {
|
||||||
|
string?: never;
|
||||||
|
int?: number;
|
||||||
|
float?: never;
|
||||||
|
boolean?: never;
|
||||||
|
link?: never;
|
||||||
|
array?: never;
|
||||||
|
map?: never;
|
||||||
|
} | {
|
||||||
|
string?: never;
|
||||||
|
int?: never;
|
||||||
|
float?: number;
|
||||||
|
boolean?: never;
|
||||||
|
link?: never;
|
||||||
|
array?: never;
|
||||||
|
map?: never;
|
||||||
|
} | {
|
||||||
|
string?: never;
|
||||||
|
int?: never;
|
||||||
|
float?: never;
|
||||||
|
boolean?: boolean;
|
||||||
|
link?: never;
|
||||||
|
array?: never;
|
||||||
|
map?: never;
|
||||||
|
} | {
|
||||||
|
string?: never;
|
||||||
|
int?: never;
|
||||||
|
float?: never;
|
||||||
|
boolean?: never;
|
||||||
|
link?: string;
|
||||||
|
array?: never;
|
||||||
|
map?: never;
|
||||||
|
} | {
|
||||||
|
string?: never;
|
||||||
|
int?: never;
|
||||||
|
float?: never;
|
||||||
|
boolean?: never;
|
||||||
|
link?: never;
|
||||||
|
array?: QueryListRecordsRequest.ArrayInput;
|
||||||
|
map?: never;
|
||||||
|
} | {
|
||||||
|
string?: never;
|
||||||
|
int?: never;
|
||||||
|
float?: never;
|
||||||
|
boolean?: never;
|
||||||
|
link?: never;
|
||||||
|
array?: never;
|
||||||
|
map?: QueryListRecordsRequest.MapInput;
|
||||||
|
})))) {
|
||||||
|
super();
|
||||||
|
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||||
|
if (!Array.isArray(data) && typeof data == "object") {
|
||||||
if ("string" in data && data.string != undefined) {
|
if ("string" in data && data.string != undefined) {
|
||||||
this.string = data.string;
|
this.string = data.string;
|
||||||
}
|
}
|
||||||
@ -335,72 +528,105 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
if ("boolean" in data && data.boolean != undefined) {
|
if ("boolean" in data && data.boolean != undefined) {
|
||||||
this.boolean = data.boolean;
|
this.boolean = data.boolean;
|
||||||
}
|
}
|
||||||
if ("reference" in data && data.reference != undefined) {
|
if ("link" in data && data.link != undefined) {
|
||||||
this.reference = data.reference;
|
this.link = data.link;
|
||||||
}
|
}
|
||||||
if ("values" in data && data.values != undefined) {
|
if ("array" in data && data.array != undefined) {
|
||||||
this.values = data.values;
|
this.array = data.array;
|
||||||
|
}
|
||||||
|
if ("map" in data && data.map != undefined) {
|
||||||
|
this.map = data.map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get type() {
|
get string() {
|
||||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||||
}
|
}
|
||||||
set type(value: string) {
|
|
||||||
pb_1.Message.setField(this, 1, value);
|
|
||||||
}
|
|
||||||
get string() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
|
||||||
}
|
|
||||||
set string(value: string) {
|
set string(value: string) {
|
||||||
pb_1.Message.setField(this, 2, value);
|
pb_1.Message.setOneofField(this, 1, this.#one_of_decls[0], value);
|
||||||
|
}
|
||||||
|
get has_string() {
|
||||||
|
return pb_1.Message.getField(this, 1) != null;
|
||||||
}
|
}
|
||||||
get int() {
|
get int() {
|
||||||
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
|
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
|
||||||
}
|
}
|
||||||
set int(value: number) {
|
set int(value: number) {
|
||||||
pb_1.Message.setField(this, 3, value);
|
pb_1.Message.setOneofField(this, 2, this.#one_of_decls[0], value);
|
||||||
|
}
|
||||||
|
get has_int() {
|
||||||
|
return pb_1.Message.getField(this, 2) != null;
|
||||||
}
|
}
|
||||||
get float() {
|
get float() {
|
||||||
return pb_1.Message.getFieldWithDefault(this, 4, 0) as number;
|
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
|
||||||
}
|
}
|
||||||
set float(value: number) {
|
set float(value: number) {
|
||||||
pb_1.Message.setField(this, 4, value);
|
pb_1.Message.setOneofField(this, 3, this.#one_of_decls[0], value);
|
||||||
|
}
|
||||||
|
get has_float() {
|
||||||
|
return pb_1.Message.getField(this, 3) != null;
|
||||||
}
|
}
|
||||||
get boolean() {
|
get boolean() {
|
||||||
return pb_1.Message.getFieldWithDefault(this, 5, false) as boolean;
|
return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean;
|
||||||
}
|
}
|
||||||
set boolean(value: boolean) {
|
set boolean(value: boolean) {
|
||||||
pb_1.Message.setField(this, 5, value);
|
pb_1.Message.setOneofField(this, 4, this.#one_of_decls[0], value);
|
||||||
}
|
}
|
||||||
get reference() {
|
get has_boolean() {
|
||||||
return pb_1.Message.getWrapperField(this, QueryListRecordsRequest.ReferenceInput, 6) as QueryListRecordsRequest.ReferenceInput;
|
return pb_1.Message.getField(this, 4) != null;
|
||||||
}
|
}
|
||||||
set reference(value: QueryListRecordsRequest.ReferenceInput) {
|
get link() {
|
||||||
pb_1.Message.setWrapperField(this, 6, value);
|
return pb_1.Message.getFieldWithDefault(this, 5, "") as string;
|
||||||
}
|
}
|
||||||
get has_reference() {
|
set link(value: string) {
|
||||||
|
pb_1.Message.setOneofField(this, 5, this.#one_of_decls[0], value);
|
||||||
|
}
|
||||||
|
get has_link() {
|
||||||
|
return pb_1.Message.getField(this, 5) != null;
|
||||||
|
}
|
||||||
|
get array() {
|
||||||
|
return pb_1.Message.getWrapperField(this, QueryListRecordsRequest.ArrayInput, 6) as QueryListRecordsRequest.ArrayInput;
|
||||||
|
}
|
||||||
|
set array(value: QueryListRecordsRequest.ArrayInput) {
|
||||||
|
pb_1.Message.setOneofWrapperField(this, 6, this.#one_of_decls[0], value);
|
||||||
|
}
|
||||||
|
get has_array() {
|
||||||
return pb_1.Message.getField(this, 6) != null;
|
return pb_1.Message.getField(this, 6) != null;
|
||||||
}
|
}
|
||||||
get values() {
|
get map() {
|
||||||
return pb_1.Message.getRepeatedWrapperField(this, QueryListRecordsRequest.ValueInput, 7) as QueryListRecordsRequest.ValueInput[];
|
return pb_1.Message.getWrapperField(this, QueryListRecordsRequest.MapInput, 7) as QueryListRecordsRequest.MapInput;
|
||||||
}
|
}
|
||||||
set values(value: QueryListRecordsRequest.ValueInput[]) {
|
set map(value: QueryListRecordsRequest.MapInput) {
|
||||||
pb_1.Message.setRepeatedWrapperField(this, 7, value);
|
pb_1.Message.setOneofWrapperField(this, 7, this.#one_of_decls[0], value);
|
||||||
|
}
|
||||||
|
get has_map() {
|
||||||
|
return pb_1.Message.getField(this, 7) != null;
|
||||||
|
}
|
||||||
|
get value() {
|
||||||
|
const cases: {
|
||||||
|
[index: number]: "none" | "string" | "int" | "float" | "boolean" | "link" | "array" | "map";
|
||||||
|
} = {
|
||||||
|
0: "none",
|
||||||
|
1: "string",
|
||||||
|
2: "int",
|
||||||
|
3: "float",
|
||||||
|
4: "boolean",
|
||||||
|
5: "link",
|
||||||
|
6: "array",
|
||||||
|
7: "map"
|
||||||
|
};
|
||||||
|
return cases[pb_1.Message.computeOneofCase(this, [1, 2, 3, 4, 5, 6, 7])];
|
||||||
}
|
}
|
||||||
static fromObject(data: {
|
static fromObject(data: {
|
||||||
type?: string;
|
|
||||||
string?: string;
|
string?: string;
|
||||||
int?: number;
|
int?: number;
|
||||||
float?: number;
|
float?: number;
|
||||||
boolean?: boolean;
|
boolean?: boolean;
|
||||||
reference?: ReturnType<typeof QueryListRecordsRequest.ReferenceInput.prototype.toObject>;
|
link?: string;
|
||||||
values?: ReturnType<typeof QueryListRecordsRequest.ValueInput.prototype.toObject>[];
|
array?: ReturnType<typeof QueryListRecordsRequest.ArrayInput.prototype.toObject>;
|
||||||
|
map?: ReturnType<typeof QueryListRecordsRequest.MapInput.prototype.toObject>;
|
||||||
}): ValueInput {
|
}): ValueInput {
|
||||||
const message = new ValueInput({});
|
const message = new ValueInput({});
|
||||||
if (data.type != null) {
|
|
||||||
message.type = data.type;
|
|
||||||
}
|
|
||||||
if (data.string != null) {
|
if (data.string != null) {
|
||||||
message.string = data.string;
|
message.string = data.string;
|
||||||
}
|
}
|
||||||
@ -413,27 +639,27 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
if (data.boolean != null) {
|
if (data.boolean != null) {
|
||||||
message.boolean = data.boolean;
|
message.boolean = data.boolean;
|
||||||
}
|
}
|
||||||
if (data.reference != null) {
|
if (data.link != null) {
|
||||||
message.reference = QueryListRecordsRequest.ReferenceInput.fromObject(data.reference);
|
message.link = data.link;
|
||||||
}
|
}
|
||||||
if (data.values != null) {
|
if (data.array != null) {
|
||||||
message.values = data.values.map(item => QueryListRecordsRequest.ValueInput.fromObject(item));
|
message.array = QueryListRecordsRequest.ArrayInput.fromObject(data.array);
|
||||||
|
}
|
||||||
|
if (data.map != null) {
|
||||||
|
message.map = QueryListRecordsRequest.MapInput.fromObject(data.map);
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
toObject() {
|
toObject() {
|
||||||
const data: {
|
const data: {
|
||||||
type?: string;
|
|
||||||
string?: string;
|
string?: string;
|
||||||
int?: number;
|
int?: number;
|
||||||
float?: number;
|
float?: number;
|
||||||
boolean?: boolean;
|
boolean?: boolean;
|
||||||
reference?: ReturnType<typeof QueryListRecordsRequest.ReferenceInput.prototype.toObject>;
|
link?: string;
|
||||||
values?: ReturnType<typeof QueryListRecordsRequest.ValueInput.prototype.toObject>[];
|
array?: ReturnType<typeof QueryListRecordsRequest.ArrayInput.prototype.toObject>;
|
||||||
|
map?: ReturnType<typeof QueryListRecordsRequest.MapInput.prototype.toObject>;
|
||||||
} = {};
|
} = {};
|
||||||
if (this.type != null) {
|
|
||||||
data.type = this.type;
|
|
||||||
}
|
|
||||||
if (this.string != null) {
|
if (this.string != null) {
|
||||||
data.string = this.string;
|
data.string = this.string;
|
||||||
}
|
}
|
||||||
@ -446,11 +672,14 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
if (this.boolean != null) {
|
if (this.boolean != null) {
|
||||||
data.boolean = this.boolean;
|
data.boolean = this.boolean;
|
||||||
}
|
}
|
||||||
if (this.reference != null) {
|
if (this.link != null) {
|
||||||
data.reference = this.reference.toObject();
|
data.link = this.link;
|
||||||
}
|
}
|
||||||
if (this.values != null) {
|
if (this.array != null) {
|
||||||
data.values = this.values.map((item: QueryListRecordsRequest.ValueInput) => item.toObject());
|
data.array = this.array.toObject();
|
||||||
|
}
|
||||||
|
if (this.map != null) {
|
||||||
|
data.map = this.map.toObject();
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -458,20 +687,20 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
serialize(w: pb_1.BinaryWriter): void;
|
serialize(w: pb_1.BinaryWriter): void;
|
||||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||||
const writer = w || new pb_1.BinaryWriter();
|
const writer = w || new pb_1.BinaryWriter();
|
||||||
if (this.type.length)
|
if (this.has_string)
|
||||||
writer.writeString(1, this.type);
|
writer.writeString(1, this.string);
|
||||||
if (this.string.length)
|
if (this.has_int)
|
||||||
writer.writeString(2, this.string);
|
writer.writeInt64(2, this.int);
|
||||||
if (this.int != 0)
|
if (this.has_float)
|
||||||
writer.writeInt64(3, this.int);
|
writer.writeDouble(3, this.float);
|
||||||
if (this.float != 0)
|
if (this.has_boolean)
|
||||||
writer.writeDouble(4, this.float);
|
writer.writeBool(4, this.boolean);
|
||||||
if (this.boolean != false)
|
if (this.has_link)
|
||||||
writer.writeBool(5, this.boolean);
|
writer.writeString(5, this.link);
|
||||||
if (this.has_reference)
|
if (this.has_array)
|
||||||
writer.writeMessage(6, this.reference, () => this.reference.serialize(writer));
|
writer.writeMessage(6, this.array, () => this.array.serialize(writer));
|
||||||
if (this.values.length)
|
if (this.has_map)
|
||||||
writer.writeRepeatedMessage(7, this.values, (item: QueryListRecordsRequest.ValueInput) => item.serialize(writer));
|
writer.writeMessage(7, this.map, () => this.map.serialize(writer));
|
||||||
if (!w)
|
if (!w)
|
||||||
return writer.getResultBuffer();
|
return writer.getResultBuffer();
|
||||||
}
|
}
|
||||||
@ -482,25 +711,25 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
break;
|
break;
|
||||||
switch (reader.getFieldNumber()) {
|
switch (reader.getFieldNumber()) {
|
||||||
case 1:
|
case 1:
|
||||||
message.type = reader.readString();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.string = reader.readString();
|
message.string = reader.readString();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 2:
|
||||||
message.int = reader.readInt64();
|
message.int = reader.readInt64();
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 3:
|
||||||
message.float = reader.readDouble();
|
message.float = reader.readDouble();
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 4:
|
||||||
message.boolean = reader.readBool();
|
message.boolean = reader.readBool();
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
message.link = reader.readString();
|
||||||
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
reader.readMessage(message.reference, () => message.reference = QueryListRecordsRequest.ReferenceInput.deserialize(reader));
|
reader.readMessage(message.array, () => message.array = QueryListRecordsRequest.ArrayInput.deserialize(reader));
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
reader.readMessage(message.values, () => pb_1.Message.addToRepeatedWrapperField(message, 7, QueryListRecordsRequest.ValueInput.deserialize(reader), QueryListRecordsRequest.ValueInput));
|
reader.readMessage(message.map, () => message.map = QueryListRecordsRequest.MapInput.deserialize(reader));
|
||||||
break;
|
break;
|
||||||
default: reader.skipField();
|
default: reader.skipField();
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,13 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: vulcanize/registry/v1beta1/registry.proto
|
* source: vulcanize/registry/v1beta1/registry.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../google/protobuf/duration";
|
import * as dependency_1 from "./../../../google/protobuf/duration";
|
||||||
import * as dependency_2 from "./../../../google/protobuf/timestamp";
|
import * as dependency_2 from "./../../../google/protobuf/timestamp";
|
||||||
import * as dependency_3 from "./../../../gogoproto/gogo";
|
import * as dependency_3 from "./../../../gogoproto/gogo";
|
||||||
import * as dependency_4 from "./../../../cosmos/base/v1beta1/coin";
|
import * as dependency_4 from "./../../../cosmos/base/v1beta1/coin";
|
||||||
import * as dependency_5 from "./../../../google/protobuf/any";
|
|
||||||
import * as pb_1 from "google-protobuf";
|
import * as pb_1 from "google-protobuf";
|
||||||
export namespace vulcanize.registry.v1beta1 {
|
export namespace vulcanize.registry.v1beta1 {
|
||||||
export class Params extends pb_1.Message {
|
export class Params extends pb_1.Message {
|
||||||
@ -348,7 +347,7 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
expiry_time?: string;
|
expiry_time?: string;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
owners?: string[];
|
owners?: string[];
|
||||||
attributes?: dependency_5.google.protobuf.Any;
|
attributes?: Uint8Array;
|
||||||
names?: string[];
|
names?: string[];
|
||||||
type?: string;
|
type?: string;
|
||||||
}) {
|
}) {
|
||||||
@ -421,13 +420,10 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
pb_1.Message.setField(this, 6, value);
|
pb_1.Message.setField(this, 6, value);
|
||||||
}
|
}
|
||||||
get attributes() {
|
get attributes() {
|
||||||
return pb_1.Message.getWrapperField(this, dependency_5.google.protobuf.Any, 7) as dependency_5.google.protobuf.Any;
|
return pb_1.Message.getFieldWithDefault(this, 7, new Uint8Array(0)) as Uint8Array;
|
||||||
}
|
}
|
||||||
set attributes(value: dependency_5.google.protobuf.Any) {
|
set attributes(value: Uint8Array) {
|
||||||
pb_1.Message.setWrapperField(this, 7, value);
|
pb_1.Message.setField(this, 7, value);
|
||||||
}
|
|
||||||
get has_attributes() {
|
|
||||||
return pb_1.Message.getField(this, 7) != null;
|
|
||||||
}
|
}
|
||||||
get names() {
|
get names() {
|
||||||
return pb_1.Message.getFieldWithDefault(this, 8, []) as string[];
|
return pb_1.Message.getFieldWithDefault(this, 8, []) as string[];
|
||||||
@ -448,7 +444,7 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
expiry_time?: string;
|
expiry_time?: string;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
owners?: string[];
|
owners?: string[];
|
||||||
attributes?: ReturnType<typeof dependency_5.google.protobuf.Any.prototype.toObject>;
|
attributes?: Uint8Array;
|
||||||
names?: string[];
|
names?: string[];
|
||||||
type?: string;
|
type?: string;
|
||||||
}): Record {
|
}): Record {
|
||||||
@ -472,7 +468,7 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
message.owners = data.owners;
|
message.owners = data.owners;
|
||||||
}
|
}
|
||||||
if (data.attributes != null) {
|
if (data.attributes != null) {
|
||||||
message.attributes = dependency_5.google.protobuf.Any.fromObject(data.attributes);
|
message.attributes = data.attributes;
|
||||||
}
|
}
|
||||||
if (data.names != null) {
|
if (data.names != null) {
|
||||||
message.names = data.names;
|
message.names = data.names;
|
||||||
@ -490,7 +486,7 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
expiry_time?: string;
|
expiry_time?: string;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
owners?: string[];
|
owners?: string[];
|
||||||
attributes?: ReturnType<typeof dependency_5.google.protobuf.Any.prototype.toObject>;
|
attributes?: Uint8Array;
|
||||||
names?: string[];
|
names?: string[];
|
||||||
type?: string;
|
type?: string;
|
||||||
} = {};
|
} = {};
|
||||||
@ -513,7 +509,7 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
data.owners = this.owners;
|
data.owners = this.owners;
|
||||||
}
|
}
|
||||||
if (this.attributes != null) {
|
if (this.attributes != null) {
|
||||||
data.attributes = this.attributes.toObject();
|
data.attributes = this.attributes;
|
||||||
}
|
}
|
||||||
if (this.names != null) {
|
if (this.names != null) {
|
||||||
data.names = this.names;
|
data.names = this.names;
|
||||||
@ -539,8 +535,8 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
writer.writeBool(5, this.deleted);
|
writer.writeBool(5, this.deleted);
|
||||||
if (this.owners.length)
|
if (this.owners.length)
|
||||||
writer.writeRepeatedString(6, this.owners);
|
writer.writeRepeatedString(6, this.owners);
|
||||||
if (this.has_attributes)
|
if (this.attributes.length)
|
||||||
writer.writeMessage(7, this.attributes, () => this.attributes.serialize(writer));
|
writer.writeBytes(7, this.attributes);
|
||||||
if (this.names.length)
|
if (this.names.length)
|
||||||
writer.writeRepeatedString(8, this.names);
|
writer.writeRepeatedString(8, this.names);
|
||||||
if (this.type.length)
|
if (this.type.length)
|
||||||
@ -573,7 +569,7 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
pb_1.Message.addToRepeatedField(message, 6, reader.readString());
|
pb_1.Message.addToRepeatedField(message, 6, reader.readString());
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
reader.readMessage(message.attributes, () => message.attributes = dependency_5.google.protobuf.Any.deserialize(reader));
|
message.attributes = reader.readBytes();
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
pb_1.Message.addToRepeatedField(message, 8, reader.readString());
|
pb_1.Message.addToRepeatedField(message, 8, reader.readString());
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 3.12.4
|
* compiler version: 4.25.1
|
||||||
* source: vulcanize/registry/v1beta1/tx.proto
|
* source: vulcanize/registry/v1beta1/tx.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -10,15 +10,23 @@ const attributeField = `
|
|||||||
attributes {
|
attributes {
|
||||||
key
|
key
|
||||||
value {
|
value {
|
||||||
null
|
... on BooleanValue { bool: value }
|
||||||
int
|
... on IntValue { int: value }
|
||||||
float
|
... on FloatValue { float: value }
|
||||||
string
|
... on StringValue { string: value }
|
||||||
boolean
|
... on BytesValue { bytes: value }
|
||||||
json
|
... on LinkValue { link: value }
|
||||||
reference {
|
... on ArrayValue {
|
||||||
id
|
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 } } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
@ -50,18 +50,18 @@ describe('Querying', () => {
|
|||||||
expect(records.length).toBeGreaterThanOrEqual(1);
|
expect(records.length).toBeGreaterThanOrEqual(1);
|
||||||
|
|
||||||
const { attributes: { repo_registration_record_cid: record_repo_registration_record_cid } } = records[0];
|
const { attributes: { repo_registration_record_cid: record_repo_registration_record_cid } } = records[0];
|
||||||
expect(repo_registration_record_cid).toBe(record_repo_registration_record_cid);
|
expect(repo_registration_record_cid).toStrictEqual(record_repo_registration_record_cid);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Query records by attributes.', async () => {
|
test('Query records by attributes.', async () => {
|
||||||
const { version, name } = watcher.record;
|
const { version, url } = watcher.record;
|
||||||
const records = await registry.queryRecords({ version, name }, true);
|
const records = await registry.queryRecords({ version, url, type: undefined }, true);
|
||||||
expect(records.length).toBe(1);
|
expect(records.length).toBe(1);
|
||||||
|
|
||||||
[ watcher ] = records;
|
[ watcher ] = records;
|
||||||
const { attributes: { version: recordVersion, name: recordName } } = watcher;
|
const { attributes: { version: recordVersion, url: recordName } } = watcher;
|
||||||
expect(recordVersion).toBe(version);
|
expect(recordVersion).toBe(version);
|
||||||
expect(recordName).toBe(name);
|
expect(recordName).toBe(url);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Query records by id.', async () => {
|
test('Query records by id.', async () => {
|
||||||
@ -75,6 +75,7 @@ describe('Querying', () => {
|
|||||||
expect(record.id).toBe(watcher.id);
|
expect(record.id).toBe(watcher.id);
|
||||||
// temp fix
|
// temp fix
|
||||||
expect(record.attributes.repo_registration_record_cid).toBeDefined();
|
expect(record.attributes.repo_registration_record_cid).toBeDefined();
|
||||||
expect(record.attributes.repo_registration_record_cid).toHaveLength(46);
|
expect(record.attributes.repo_registration_record_cid).toHaveProperty("/");
|
||||||
|
expect(record.attributes.repo_registration_record_cid["/"]).toHaveLength(46);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
record:
|
record:
|
||||||
type: WebsiteRegistrationRecord
|
type: WebsiteRegistrationRecord
|
||||||
url: 'https://cerc.io'
|
url: 'https://cerc.io'
|
||||||
repo_registration_record_cid: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
repo_registration_record_cid:
|
||||||
build_artifact_cid: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
||||||
tls_cert_cid: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
|
build_artifact_cid:
|
||||||
|
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
||||||
|
tls_cert_cid:
|
||||||
|
/: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
|
||||||
version: 1.0.23
|
version: 1.0.23
|
||||||
|
46
src/types.ts
46
src/types.ts
@ -1,12 +1,8 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { Validator } from 'jsonschema';
|
import { Validator } from 'jsonschema';
|
||||||
import { ethers } from 'ethers';
|
|
||||||
|
|
||||||
import RecordSchema from './schema/record.json';
|
import RecordSchema from './schema/record.json';
|
||||||
import { Util } from './util';
|
import { Util } from './util';
|
||||||
import * as attributes from './proto/vulcanize/registry/v1beta1/attributes';
|
|
||||||
import * as evmTx from './proto/ethermint/evm/v1/tx';
|
|
||||||
import * as any from './proto/google/protobuf/any';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Record.
|
* Record.
|
||||||
@ -31,17 +27,7 @@ export class Record {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get attributes() {
|
get attributes() {
|
||||||
|
return Buffer.from(JSON.stringify(this._record), 'binary')
|
||||||
var a = new any.google.protobuf.Any()
|
|
||||||
|
|
||||||
if (this._record.type=="WebsiteRegistrationRecord"){
|
|
||||||
var attr= new attributes.vulcanize.registry.v1beta1.WebsiteRegistrationRecord(this._record)
|
|
||||||
a= new any.google.protobuf.Any({
|
|
||||||
type_url: "/vulcanize.registry.v1beta1.WebsiteRegistrationRecord",
|
|
||||||
value: attr.serialize()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return a
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,33 +128,3 @@ export class Payload {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class EthereumTxData {
|
|
||||||
_tx: ethers.Transaction
|
|
||||||
|
|
||||||
constructor (tx: ethers.Transaction) {
|
|
||||||
this._tx = tx
|
|
||||||
}
|
|
||||||
|
|
||||||
serialize () {
|
|
||||||
var data= new evmTx.ethermint.evm.v1.LegacyTx({
|
|
||||||
nonce: this._tx.nonce,
|
|
||||||
data: ethers.utils.arrayify(this._tx.data),
|
|
||||||
gas: this._tx.gasLimit.toNumber(),
|
|
||||||
gas_price: this._tx.gasPrice?.toString(),
|
|
||||||
r: ethers.utils.arrayify(this._tx.r!),
|
|
||||||
s: ethers.utils.arrayify(this._tx.s!),
|
|
||||||
|
|
||||||
// TODO: Check if need to put in array
|
|
||||||
v: ethers.utils.arrayify([this._tx.v!]),
|
|
||||||
|
|
||||||
to: this._tx.to,
|
|
||||||
value: this._tx.value.toString()
|
|
||||||
})
|
|
||||||
|
|
||||||
return new any.google.protobuf.Any({
|
|
||||||
type_url: "/ethermint.evm.v1.TxData",
|
|
||||||
value: data.serialize()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
98
src/util.ts
98
src/util.ts
@ -10,21 +10,21 @@ export class Util {
|
|||||||
/**
|
/**
|
||||||
* Sorts JSON object.
|
* Sorts JSON object.
|
||||||
*/
|
*/
|
||||||
static sortJSON(object: any) {
|
static sortJSON(obj: any) {
|
||||||
if (object instanceof Array) {
|
if (obj instanceof Array) {
|
||||||
for (let i = 0; i < object.length; i++) {
|
for (let i = 0; i < obj.length; i++) {
|
||||||
object[i] = Util.sortJSON(object[i]);
|
obj[i] = Util.sortJSON(obj[i]);
|
||||||
}
|
}
|
||||||
return object;
|
return obj;
|
||||||
}
|
}
|
||||||
if (typeof object !== 'object' || object === null) return object;
|
if (typeof obj !== 'object' || obj === null) return obj;
|
||||||
|
|
||||||
let keys = Object.keys(object);
|
let keys = Object.keys(obj);
|
||||||
keys = keys.sort();
|
keys = keys.sort();
|
||||||
const newObject: {[key: string]: any} = {};
|
const newObject: {[key: string]: any} = {};
|
||||||
|
|
||||||
for (let i = 0; i < keys.length; i++) {
|
for (let i = 0; i < keys.length; i++) {
|
||||||
newObject[keys[i]] = Util.sortJSON(object[keys[i]]);
|
newObject[keys[i]] = Util.sortJSON(obj[keys[i]]);
|
||||||
}
|
}
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
@ -32,31 +32,46 @@ export class Util {
|
|||||||
/**
|
/**
|
||||||
* Marshal object into gql 'attributes' variable.
|
* Marshal object into gql 'attributes' variable.
|
||||||
*/
|
*/
|
||||||
static toGQLAttributes(object: any) {
|
static toGQLAttributes(obj: any) {
|
||||||
const vars: any[] = [];
|
const vars: any[] = [];
|
||||||
|
Object.keys(obj).forEach(key => {
|
||||||
|
const value = this.toGQLValue(obj[key]);
|
||||||
|
|
||||||
Object.keys(object).forEach(key => {
|
if (value !== undefined) {
|
||||||
let type: string = typeof object[key];
|
vars.push({ key, value });
|
||||||
if (object[key] === null) {
|
|
||||||
vars.push({ key, value: { 'null': true } });
|
|
||||||
} else if (type === 'number') {
|
|
||||||
type = (object[key] % 1 === 0) ? 'int' : 'float';
|
|
||||||
vars.push({ key, value: { [type]: object[key] } });
|
|
||||||
} else if (type === 'string') {
|
|
||||||
vars.push({ key, value: { 'string': object[key] } });
|
|
||||||
} else if (type === 'boolean') {
|
|
||||||
vars.push({ key, value: { 'boolean': object[key] } });
|
|
||||||
} else if (type === 'object') {
|
|
||||||
const nestedObject = object[key];
|
|
||||||
if (nestedObject['/'] !== undefined) {
|
|
||||||
vars.push({ key, value: { 'reference': { id: nestedObject['/'] } } });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return vars;
|
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.
|
* Unmarshal attributes array to object.
|
||||||
*/
|
*/
|
||||||
@ -64,24 +79,29 @@ export class Util {
|
|||||||
const res: {[key: string]: any} = {};
|
const res: {[key: string]: any} = {};
|
||||||
|
|
||||||
attributes.forEach(attr => {
|
attributes.forEach(attr => {
|
||||||
if (attr.value.null) {
|
res[attr.key] = (attr.value === null) ? null : this.fromGQLValue(attr.value);
|
||||||
res[attr.key] = null;
|
|
||||||
} else if (attr.value.json) {
|
|
||||||
res[attr.key] = JSON.parse(attr.value.json);
|
|
||||||
} else if (attr.value.reference) {
|
|
||||||
// Convert GQL reference to IPLD style link.
|
|
||||||
const ref = attr.value.reference;
|
|
||||||
res[attr.key] = { '/': ref.id };
|
|
||||||
} else {
|
|
||||||
const { values, null: n, ...types } = attr.value;
|
|
||||||
const value = Object.values(types).find(v => v !== null);
|
|
||||||
res[attr.key] = value;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return res;
|
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.
|
* Get record content ID.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user