forked from cerc-io/laconic-sdk
Compare commits
1 Commits
main
...
murali/fix
Author | SHA1 | Date | |
---|---|---|---|
|
297353f123 |
@ -1,36 +0,0 @@
|
||||
name: Publish npm package to gitea
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
jobs:
|
||||
npm_publish:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [ 18.x ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Download yarn
|
||||
run: |
|
||||
curl -fsSL -o /usr/local/bin/yarn https://github.com/yarnpkg/yarn/releases/download/v1.22.21/yarn-1.22.21.js
|
||||
chmod +x /usr/local/bin/yarn
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- run: yarn
|
||||
- name: Run yarn build
|
||||
run: |
|
||||
yarn build
|
||||
- name: Configure git.vdb.to npm registry
|
||||
run: |
|
||||
npm config set registry https://git.vdb.to/api/packages/cerc-io/npm/
|
||||
- name: Authenticate to git.vdb.to registry
|
||||
run: |
|
||||
npm config set -- '//git.vdb.to/api/packages/cerc-io/npm/:_authToken' "${{ secrets.CICD_PUBLISH_TOKEN }}"
|
||||
- name: npm publish
|
||||
run: |
|
||||
npm publish
|
@ -1,81 +0,0 @@
|
||||
name: Tests
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/**
|
||||
|
||||
env:
|
||||
DOCKER_HOST: unix:///var/run/dind.sock
|
||||
|
||||
jobs:
|
||||
sdk_tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout laconicd
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: "./laconicd/"
|
||||
repository: cerc-io/laconicd
|
||||
fetch-depth: 0
|
||||
ref: main
|
||||
- name: Environment
|
||||
run: ls -tlh && env
|
||||
- name: Start dockerd
|
||||
run: |
|
||||
dockerd -H $DOCKER_HOST --userland-proxy=false &
|
||||
sleep 5
|
||||
- name: build containers scripts
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: ./build-laconicd-container.sh
|
||||
- name: build test-container
|
||||
run: docker build -t cerc-io/laconic-sdk-tester:local-test -f laconicd/tests/sdk_tests/Dockerfile-sdk .
|
||||
- name: start containers
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: docker compose up -d
|
||||
- name: run basic 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"
|
||||
- name: stop containers
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: docker compose down
|
||||
- name: start auction containers
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: docker compose -f docker-compose-auctions.yml up -d
|
||||
- name: run auction 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:auctions"
|
||||
- name: start containers
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: docker compose down
|
||||
- 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
|
72
.github/workflows/test.yml
vendored
72
.github/workflows/test.yml
vendored
@ -1,72 +0,0 @@
|
||||
name: Tests
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/**
|
||||
|
||||
jobs:
|
||||
sdk_tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout laconicd
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: "./laconicd/"
|
||||
repository: cerc-io/laconicd
|
||||
fetch-depth: 0
|
||||
ref: main
|
||||
- name: Environment
|
||||
run: ls -tlh && env
|
||||
- name: build containers scripts
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: ./build-laconicd-container.sh
|
||||
- name: build test-container
|
||||
run: docker build -t cerc-io/laconic-sdk-tester:local-test -f laconicd/tests/sdk_tests/Dockerfile-sdk .
|
||||
- name: start containers
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: docker compose up -d
|
||||
- name: run basic 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"
|
||||
- name: stop containers
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: docker compose down
|
||||
- name: start auction containers
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: docker compose -f docker-compose-auctions.yml up -d
|
||||
- name: run auction 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:auctions"
|
||||
- name: start containers
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: docker compose down
|
||||
- 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
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,3 @@
|
||||
node_modules
|
||||
dist
|
||||
.env
|
||||
.idea*
|
@ -1,54 +0,0 @@
|
||||
# Originally from: https://github.com/devcontainers/images/blob/main/src/javascript-node/.devcontainer/Dockerfile
|
||||
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
|
||||
ARG VARIANT=16-bullseye
|
||||
FROM node:${VARIANT}
|
||||
|
||||
ARG USERNAME=node
|
||||
ARG NPM_GLOBAL=/usr/local/share/npm-global
|
||||
|
||||
# Add NPM global to PATH.
|
||||
ENV PATH=${NPM_GLOBAL}/bin:${PATH}
|
||||
|
||||
RUN \
|
||||
# Configure global npm install location, use group to adapt to UID/GID changes
|
||||
if ! cat /etc/group | grep -e "^npm:" > /dev/null 2>&1; then groupadd -r npm; fi \
|
||||
&& usermod -a -G npm ${USERNAME} \
|
||||
&& umask 0002 \
|
||||
&& mkdir -p ${NPM_GLOBAL} \
|
||||
&& touch /usr/local/etc/npmrc \
|
||||
&& chown ${USERNAME}:npm ${NPM_GLOBAL} /usr/local/etc/npmrc \
|
||||
&& chmod g+s ${NPM_GLOBAL} \
|
||||
&& npm config -g set prefix ${NPM_GLOBAL} \
|
||||
&& su ${USERNAME} -c "npm config -g set prefix ${NPM_GLOBAL}" \
|
||||
# Install eslint
|
||||
&& su ${USERNAME} -c "umask 0002 && npm install -g eslint lerna jest" \
|
||||
&& 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 /
|
||||
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 .
|
||||
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
|
||||
|
||||
# Temp hack, clone the laconic-sdk repo here
|
||||
WORKDIR /app
|
||||
RUN yarn install
|
||||
|
||||
WORKDIR /app/laconic-sdk
|
@ -57,7 +57,7 @@ Follow these steps to run the tests:
|
||||
- In laconicd repo run:
|
||||
|
||||
```bash
|
||||
TEST_REGISTRY_EXPIRY=true ./init.sh
|
||||
TEST_NAMESERVICE_EXPIRY=true ./init.sh
|
||||
```
|
||||
|
||||
- Export the private key and change it in `.env` file again using:
|
||||
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
exec "$@"
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cerc-io/laconic-sdk",
|
||||
"version": "0.1.13",
|
||||
"version": "0.1.5",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"repository": "git@github.com:cerc-io/laconic-sdk.git",
|
||||
@ -14,7 +14,7 @@
|
||||
"dotenv": "^16.0.0",
|
||||
"google-protobuf": "^3.21.0",
|
||||
"jest": "29.0.0",
|
||||
"protoc-gen-ts": "^0.8.7",
|
||||
"protoc-gen-ts": "^0.8.5",
|
||||
"ts-jest": "^29.0.2",
|
||||
"typescript": "^4.6.2"
|
||||
},
|
||||
|
@ -30,102 +30,4 @@ message WebsiteRegistrationRecord {
|
||||
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\""];
|
||||
}
|
||||
|
||||
message ApplicationRecord {
|
||||
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
||||
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
|
||||
string description = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
|
||||
string version = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
||||
string homepage = 5 [(gogoproto.moretags) = "json:\"homepage\" yaml:\"homepage\""];
|
||||
string license = 6 [(gogoproto.moretags) = "json:\"license\" yaml:\"license\""];
|
||||
string author = 7 [(gogoproto.moretags) = "json:\"author\" yaml:\"author\""];
|
||||
repeated string repository = 8 [(gogoproto.moretags) = "json:\"repository\" yaml:\"repository\""];
|
||||
string repository_ref = 9 [(gogoproto.moretags) = "json:\"repositoryRef\" yaml:\"repositoryRef\""];
|
||||
string app_version = 10 [(gogoproto.moretags) = "json:\"appVersion\" yaml:\"appVersion\""];
|
||||
string app_type = 11 [(gogoproto.moretags) = "json:\"appType\" yaml:\"appType\""];
|
||||
string engines = 12 [(gogoproto.moretags) = "json:\"engines\" yaml:\"engines\""];
|
||||
repeated string os = 13 [(gogoproto.moretags) = "json:\"os\" yaml:\"os\""];
|
||||
repeated string cpu = 14 [(gogoproto.moretags) = "json:\"cpu\" yaml:\"cpu\""];
|
||||
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
|
||||
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
|
||||
}
|
||||
|
||||
message ApplicationArtifact {
|
||||
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
||||
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
|
||||
string description = 4 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
|
||||
string version = 5 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
||||
string application = 6 [(gogoproto.moretags) = "json:\"application\" yaml:\"application\""];
|
||||
string content_type = 7 [(gogoproto.moretags) = "json:\"contentType\" yaml:\"contentType\""];
|
||||
string os = 8 [(gogoproto.moretags) = "json:\"os\" yaml:\"os\""];
|
||||
string cpu = 9 [(gogoproto.moretags) = "json:\"cpu\" yaml:\"cpu\""];
|
||||
repeated string uri = 10 [(gogoproto.moretags) = "json:\"uri\" yaml:\"uri\""];
|
||||
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
|
||||
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
|
||||
}
|
||||
|
||||
message DnsRecord {
|
||||
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
||||
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
|
||||
string version = 3 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
||||
string resource_type = 4 [(gogoproto.moretags) = "json:\"resourceType\" yaml:\"resourceType\""];
|
||||
string value = 5 [(gogoproto.moretags) = "json:\"value\" yaml:\"value\""];
|
||||
string request = 6 [(gogoproto.moretags) = "json:\"request\" yaml:\"request\""];
|
||||
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
|
||||
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
|
||||
}
|
||||
|
||||
message ApplicationDeploymentRequest {
|
||||
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
||||
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
|
||||
string version = 3 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
||||
string application = 4 [(gogoproto.moretags) = "json:\"application\" yaml:\"application\""];
|
||||
string dns = 5 [(gogoproto.moretags) = "json:\"dns\" yaml:\"dns\""];
|
||||
string config = 6 [(gogoproto.moretags) = "json:\"config\" yaml:\"config\""];
|
||||
string deployment = 7 [(gogoproto.moretags) = "json:\"deployment\" yaml:\"deployment\""];
|
||||
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
|
||||
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
|
||||
}
|
||||
|
||||
message ApplicationDeploymentRecord {
|
||||
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
||||
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
|
||||
string description = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
|
||||
string version = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
||||
string application = 5 [(gogoproto.moretags) = "json:\"application\" yaml:\"application\""];
|
||||
string url = 6 [(gogoproto.moretags) = "json:\"url\" yaml:\"url\""];
|
||||
string dns = 7 [(gogoproto.moretags) = "json:\"dns\" yaml:\"dns\""];
|
||||
string request = 8 [(gogoproto.moretags) = "json:\"request\" yaml:\"request\""];
|
||||
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
|
||||
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
|
||||
}
|
||||
|
||||
message ApplicationDeploymentRemovalRequest {
|
||||
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
||||
string version = 2 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
||||
string deployment = 3 [(gogoproto.moretags) = "json:\"deployment\" yaml:\"deployment\""];
|
||||
string request = 4 [(gogoproto.moretags) = "json:\"request\" yaml:\"request\""];
|
||||
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
|
||||
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
|
||||
}
|
||||
|
||||
message ApplicationDeploymentRemovalRecord {
|
||||
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
||||
string version = 2 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
||||
string deployment = 3 [(gogoproto.moretags) = "json:\"deployment\" yaml:\"deployment\""];
|
||||
string request = 4 [(gogoproto.moretags) = "json:\"request\" yaml:\"request\""];
|
||||
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
|
||||
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
|
||||
}
|
||||
|
||||
message GeneralRecord {
|
||||
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
||||
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
|
||||
string description = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
|
||||
string version = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
||||
string category = 5 [(gogoproto.moretags) = "json:\"category\" yaml:\"category\""];
|
||||
string value = 6 [(gogoproto.moretags) = "json:\"value\" yaml:\"value\""];
|
||||
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
|
||||
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@ const nameserviceExpiryTests = () => {
|
||||
test('Set record and check bond balance', async () => {
|
||||
// Create watcher.
|
||||
watcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
|
||||
const result = await registry.setRecord(
|
||||
await registry.setRecord(
|
||||
{
|
||||
privateKey,
|
||||
bondId,
|
||||
@ -39,8 +39,8 @@ const nameserviceExpiryTests = () => {
|
||||
privateKey,
|
||||
fee
|
||||
)
|
||||
console.log("SetRecordResult: " + result.data.id)
|
||||
const [record] = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version }, true);
|
||||
|
||||
const [record] = await registry.queryRecords({ type: watcher.record.type, version: watcher.record.version }, true);
|
||||
recordExpiryTime = new Date(record.expiryTime);
|
||||
|
||||
const [bond] = await registry.getBondsByIds([bondId]);
|
||||
@ -63,22 +63,21 @@ const nameserviceExpiryTests = () => {
|
||||
});
|
||||
|
||||
test('Check record expiry time', async() => {
|
||||
const [record] = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version }, true);
|
||||
const updatedExpiryTime = new Date();
|
||||
const [record] = await registry.queryRecords({ type: watcher.record.type, version: watcher.record.version }, true);
|
||||
const updatedExpiryTime = new Date(record.expiryTime);
|
||||
expect(updatedExpiryTime.getTime()).toBeGreaterThan(recordExpiryTime.getTime());
|
||||
recordExpiryTime = updatedExpiryTime;
|
||||
})
|
||||
|
||||
test('Check authority expiry time', async() => {
|
||||
const [authority] = await registry.lookupAuthorities([authorityName]);
|
||||
const updatedExpiryTime = new Date();
|
||||
const updatedExpiryTime = new Date(authority.expiryTime);
|
||||
expect(updatedExpiryTime.getTime()).toBeGreaterThan(authorityExpiryTime.getTime());
|
||||
authorityExpiryTime = updatedExpiryTime;
|
||||
})
|
||||
|
||||
test('Check bond balance', async () => {
|
||||
const [bond] = await registry.getBondsByIds([bondId]);
|
||||
console.log(bond)
|
||||
expect(bond).toBeDefined();
|
||||
expect(bond.balance).toHaveLength(0);
|
||||
})
|
||||
@ -88,7 +87,7 @@ const nameserviceExpiryTests = () => {
|
||||
});
|
||||
|
||||
test('Check record deleted without bond balance', async() => {
|
||||
const records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version }, true);
|
||||
const records = await registry.queryRecords({ type: watcher.record.type, version: watcher.record.version }, true);
|
||||
expect(records).toHaveLength(0);
|
||||
})
|
||||
|
||||
@ -105,7 +104,7 @@ if (!process.env.TEST_NAMESERVICE_EXPIRY) {
|
||||
/**
|
||||
Running these tests requires timers to be set. In laconicd repo run:
|
||||
|
||||
TEST_REGISTRY_EXPIRY=true ./init.sh
|
||||
TEST_NAMESERVICE_EXPIRY=true ./init.sh
|
||||
|
||||
|
||||
Run tests:
|
||||
|
@ -29,7 +29,7 @@ const namingTests = () => {
|
||||
|
||||
// Create bond.
|
||||
bondId = await registry.getNextBondId(privateKey);
|
||||
await registry.createBond({ denom: 'aphoton', amount: '2000000000' }, privateKey, fee);
|
||||
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||
|
||||
// Create watcher.
|
||||
watcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: cosmos/base/query/v1beta1/pagination.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as pb_1 from "google-protobuf";
|
||||
@ -37,7 +37,7 @@ export namespace cosmos.base.query.v1beta1 {
|
||||
}
|
||||
}
|
||||
get key() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array;
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array()) as Uint8Array;
|
||||
}
|
||||
set key(value: Uint8Array) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
@ -184,7 +184,7 @@ export namespace cosmos.base.query.v1beta1 {
|
||||
}
|
||||
}
|
||||
get next_key() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array;
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array()) as Uint8Array;
|
||||
}
|
||||
set next_key(value: Uint8Array) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: cosmos/base/v1beta1/coin.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: gogoproto/gogo.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../google/protobuf/descriptor";
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: google/api/annotations.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./http";
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: google/api/http.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as pb_1 from "google-protobuf";
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* 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";
|
||||
@ -32,7 +32,7 @@ export namespace google.protobuf {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get value() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array(0)) as Uint8Array;
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array()) as Uint8Array;
|
||||
}
|
||||
set value(value: Uint8Array) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: google/protobuf/descriptor.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as pb_1 from "google-protobuf";
|
||||
@ -3604,7 +3604,7 @@ export namespace google.protobuf {
|
||||
return pb_1.Message.getField(this, 6) != null;
|
||||
}
|
||||
get string_value() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 7, new Uint8Array(0)) as Uint8Array;
|
||||
return pb_1.Message.getFieldWithDefault(this, 7, new Uint8Array()) as Uint8Array;
|
||||
}
|
||||
set string_value(value: Uint8Array) {
|
||||
pb_1.Message.setField(this, 7, value);
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: google/protobuf/duration.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as pb_1 from "google-protobuf";
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: google/protobuf/timestamp.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as pb_1 from "google-protobuf";
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: vulcanize/auction/v1beta1/genesis.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: vulcanize/auction/v1beta1/query.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: vulcanize/auction/v1beta1/tx.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: vulcanize/auction/v1beta1/types.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: vulcanize/bond/v1beta1/bond.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: vulcanize/bond/v1beta1/genesis.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: vulcanize/bond/v1beta1/query.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: vulcanize/bond/v1beta1/tx.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: vulcanize/registry/v1beta1/genesis.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: vulcanize/registry/v1beta1/query.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./registry";
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: vulcanize/registry/v1beta1/registry.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../google/protobuf/duration";
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.25.1
|
||||
* compiler version: 3.12.4
|
||||
* source: vulcanize/registry/v1beta1/tx.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||
|
@ -4,4 +4,4 @@ record:
|
||||
repo_registration_record_cid: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
||||
build_artifact_cid: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
||||
tls_cert_cid: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
|
||||
version: 1.0.23
|
||||
version: 1.0.18
|
||||
|
@ -24,18 +24,13 @@ export const getBaseConfig = async (path: string) => {
|
||||
* Provision a bond for record registration.
|
||||
*/
|
||||
export const provisionBondId = async (registry: Registry, privateKey: string, fee: Fee) => {
|
||||
// let bonds = await registry.queryBonds();
|
||||
// console.log("found bonds: " + bonds.length)
|
||||
// if (!bonds.length) {
|
||||
// await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||
// bonds = await registry.queryBonds();
|
||||
// console.log("created bond and got back: " + bonds.length)
|
||||
// }
|
||||
let bondId: string;
|
||||
bondId = await registry.getNextBondId(privateKey);
|
||||
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||
return bondId
|
||||
//return bonds[0].id;
|
||||
let bonds = await registry.queryBonds();
|
||||
if (!bonds.length) {
|
||||
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||
bonds = await registry.queryBonds();
|
||||
}
|
||||
|
||||
return bonds[0].id;
|
||||
};
|
||||
|
||||
export const getConfig = () => {
|
||||
|
21
src/types.ts
21
src/types.ts
@ -29,22 +29,17 @@ export class Record {
|
||||
}
|
||||
|
||||
get attributes() {
|
||||
let a = new any.google.protobuf.Any();
|
||||
|
||||
if (this._record.type) {
|
||||
const namespace: any = attributes.vulcanize.registry.v1beta1;
|
||||
if (!namespace[this._record.type]) {
|
||||
throw new Error(`Class not found: ${this._record.type}`);
|
||||
}
|
||||
var a = new any.google.protobuf.Any()
|
||||
|
||||
const value = namespace[this._record.type].fromObject(this._record);
|
||||
a = new any.google.protobuf.Any({
|
||||
type_url: `/vulcanize.registry.v1beta1.${this._record.type}`,
|
||||
value: value.serialize(),
|
||||
});
|
||||
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;
|
||||
return a
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3086,10 +3086,10 @@ protobufjs@~6.11.2:
|
||||
"@types/node" ">=13.7.0"
|
||||
long "^4.0.0"
|
||||
|
||||
protoc-gen-ts@^0.8.7:
|
||||
version "0.8.7"
|
||||
resolved "https://registry.yarnpkg.com/protoc-gen-ts/-/protoc-gen-ts-0.8.7.tgz#63e4d9af2ad30b753acf6f739323d01fc9f80b52"
|
||||
integrity sha512-jr4VJey2J9LVYCV7EVyVe53g1VMw28cCmYJhBe5e3YX5wiyiDwgxWxeDf9oTqAe4P1bN/YGAkW2jhlH8LohwiQ==
|
||||
protoc-gen-ts@^0.8.5:
|
||||
version "0.8.5"
|
||||
resolved "https://registry.yarnpkg.com/protoc-gen-ts/-/protoc-gen-ts-0.8.5.tgz#5c277ff90b6b38f52313b1b0ad69e6c825305b29"
|
||||
integrity sha512-LHZ+w/+DqmdgnhPtShgqtPtdv+hJ9bAXEIqNU0kkY2bPcCVIEWz5seOv20FCw6gbKorriTGP8xgz2RsIcrRvVw==
|
||||
|
||||
randombytes@^2.0.1, randombytes@^2.1.0:
|
||||
version "2.1.0"
|
||||
|
Loading…
Reference in New Issue
Block a user