Compare commits

..

14 Commits

Author SHA1 Message Date
990e427c3f Add ApplicationDeploymentRemovalRequests (#51)
```
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\""];
}
```

Reviewed-on: cerc-io/laconic-sdk#51
Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com>
Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
2023-12-21 21:19:49 +00:00
419dddc35a Make 'repository' a repeated value and add ApplicationArtifact type. (#50)
Reviewed-on: cerc-io/laconic-sdk#50
Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com>
Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
2023-12-13 20:51:12 +00:00
99bc3f0ce5 Deployment, not crn (#49)
Reviewed-on: cerc-io/laconic-sdk#49
Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com>
Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
2023-12-08 04:37:09 +00:00
fc2987a5ca Add DnsRecord and ApplicationDeploymentRequest (#48)
```
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 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\""];
  repeated string crn   = 7 [(gogoproto.moretags) = "json:\"crn\" yaml:\"crn\""];
  string meta           = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
  repeated string tags  = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}
```

Also rename WebAppDeploymentRecord to ApplicationDeploymentRecord.

Reviewed-on: cerc-io/laconic-sdk#48
Reviewed-by: David Boreham <dboreham@noreply.git.vdb.to>
Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com>
Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
2023-12-07 22:08:49 +00:00
aba95a275c More publishing fixes
Reviewed-on: cerc-io/laconic-sdk#47
Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com>
Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
2023-11-21 23:29:12 +00:00
a3603e2738 Fix publishing (#46)
Reviewed-on: cerc-io/laconic-sdk#46
Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com>
Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
2023-11-21 22:55:18 +00:00
27443c3cac v0.1.7 (#45)
Reviewed-on: cerc-io/laconic-sdk#45
Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com>
Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
2023-11-21 22:31:06 +00:00
b5fce86d48 Add new record types ApplicationRecord, WebAppDeploymentRecord, GeneralRecord (#44)
See also: cerc-io/laconicd#113

![image](/attachments/db05bbb6-86ca-4fbb-a8a4-fcd06501b1b1)

```
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\""];
  string repository     = 8 [(gogoproto.moretags) = "json:\"repository\" yaml:\"repository\""];
  string repository_tag = 9 [(gogoproto.moretags) = "json:\"repositoryTag\" yaml:\"repositoryTag\""];
  string app_version    = 10 [(gogoproto.moretags) = "json:\"appVersion\" yaml:\"appVersion\""];
  string app_type       = 11 [(gogoproto.moretags) = "json:\"appType\" yaml:\"appType\""];
  string meta           = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
  repeated string tags  = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}

message WebAppDeploymentRecord {
  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:\"\" yaml:\"name\""];
  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\""];
```

```
❯ cat general.yml
record:
  type: GeneralRecord
  name: my-generic-record
  version: 0.0.1
  value: "anything-goes-here"
  category: filter-by-this
  tags:
    - a
    - b
    - c
  meta:
    foo: bar
    bar:
      baz: boz

❯ bin/laconic cns record publish --filename general.yml --bond-id ba774084e25af5b29be126dda0bb910d93dea3634713a438ac257da5bbdc631c
{
  "id": "bafyreigt3he52eia5g4i5pnst4dfcuwwgjdoul6xmcke2obz5os4xwoo3q"
}

❯ bin/laconic cns record get --id bafyreigt3he52eia5g4i5pnst4dfcuwwgjdoul6xmcke2obz5os4xwoo3q
[
  {
    "id": "bafyreigt3he52eia5g4i5pnst4dfcuwwgjdoul6xmcke2obz5os4xwoo3q",
    "names": null,
    "owners": [
      "9A66500A9AA574CAAB4EDB26F7333590BF452CE0"
    ],
    "bondId": "ba774084e25af5b29be126dda0bb910d93dea3634713a438ac257da5bbdc631c",
    "createTime": "2023-11-17T23:11:27Z",
    "expiryTime": "2024-11-16T23:11:27Z",
    "attributes": {
      "meta": "{\"foo\":\"bar\",\"bar\":{\"baz\":\"boz\"}}",
      "tags": [
        "a",
        "b",
        "c"
      ],
      "type": "GeneralRecord",
      "name": "my-generic-record",
      "version": "0.0.1",
      "category": "filter-by-this",
      "value": "anything-goes-here"
    }
  }
]
```

> Note: The repeated items are preserved as lists, but the object/map ends up encoded as a string.  It would be nice to avoid this.

Reviewed-on: cerc-io/laconic-sdk#44
Reviewed-by: David Boreham <dboreham@noreply.git.vdb.to>
Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com>
Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
2023-11-20 22:01:19 +00:00
82d8626d0f
typo (#40) 2023-04-20 14:36:32 -05:00
6b53c43c51
typo (#39) 2023-04-20 14:32:44 -05:00
7dd8dca408
Running Gitea actions (#38)
* Gitea actions.

* Tweak for gitea

* Tweak for gitea
2023-03-29 18:12:24 -05:00
Michael
2493e2c706
Revert "remaining record types support (#27)" (#35)
This reverts commit db3f9707d2.
2023-03-06 16:54:02 -05:00
Michael
81f45e95a8
debugging statements for provisionBondId (#34)
* debugging statements for provisionBondId

* always create new bond with provisionBondId helper call
2023-03-06 16:30:04 -05:00
Murali Krishna Komatireddy
db3f9707d2
remaining record types support (#27)
* remaining record types support

* fix sdk tests

* create record types from examples

* bond tests

* registry expiry tests

* fix typos
2023-03-06 16:17:43 -05:00
44 changed files with 2915 additions and 2532 deletions

View 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

81
.gitea/workflows/test.yml Normal file
View File

@ -0,0 +1,81 @@
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

View File

@ -1,6 +1,6 @@
{
"name": "@cerc-io/laconic-sdk",
"version": "0.1.6",
"version": "0.1.13",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": "git@github.com:cerc-io/laconic-sdk.git",
@ -14,9 +14,9 @@
"dotenv": "^16.0.0",
"google-protobuf": "^3.21.0",
"jest": "29.0.0",
"protoc-gen-ts": "^0.8.5",
"protoc-gen-ts": "^0.8.7",
"ts-jest": "^29.0.2",
"typescript": "^4.7.3"
"typescript": "^4.6.2"
},
"dependencies": {
"@cosmjs/amino": "^0.28.1",

View File

@ -5,109 +5,127 @@ import "gogoproto/gogo.proto";
option go_package = "github.com/cerc-io/laconicd/x/registry/types";
message HashReference{
string ref =1 [(gogoproto.jsontag) = "/"];
}
message ServiceProviderRecord {
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 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\""];
HashReference repo_reference = 2
[(gogoproto.moretags) = "json:\"repoReference\" yaml:\"repoReference\""];
HashReference build_artifact_ref = 3 [(gogoproto.moretags) = "json:\"buildArtifactRef\" yaml:\"buildArtifactRef\""];
HashReference tls_cert_ref = 4 [(gogoproto.moretags) = "json:\"tlsCertRef\" yaml:\"tlsCertRef\""];
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\""];
}
message GitRepository{
string name =1 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
string repo_reference=2 [(gogoproto.moretags) = "json:\"repo_reference\" yaml:\"repo_reference\""];
string description=3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
string version = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
string type =5 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
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 Binary{
HashReference hash_reference=1;
string targeted_arch=2;
string runtime_version=3;
HashReference repo_reference=4;
string version=5;
string type=6;
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 DockerImage{
string image_id=1;
HashReference binary_reference=2;
HashReference repo_reference=3;
string version=4;
string type=5;
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 WatcherRegistrationRecord{
WatcherMetadata metadata =1;
HashReference repo_reference=2;
WASMBinary wasm=3;
string version=4;
string type=5;
message WatcherMetadata{
string version=1;
HashReference chain_reference=2;
}
message WASMBinary{
HashReference hash_reference=1;
WASMBinaryMetadata metadata=2;
}
message WASMBinaryMetadata{
string compiler_version=1;
string execution_engine_version=2;
}
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 ResponderContract{
HashReference service_provider_ref=1;
HashReference auction_ref=2;
HashReference watcher_ref=3;
string version=4;
string type=5;
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 JSPackage{
HashReference repo_reference=1;
HashReference js_package_ref=2;
string version=3;
string type=4;
string name =5;
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 ChainRegistrationRecord{
string name=1;
repeated string ipld_types=2;
string type=3;
string version=4;
string chain_id=5;
string network_id=6;
HashReference genesis_hash=7;
}
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\""];
}

View File

@ -3,7 +3,7 @@ import path from 'path';
import { Registry } from './index';
import { ensureUpdatedConfig, getConfig } from './testing/helper';
const WATCHER_YML_PATH = path.join(__dirname, './testing/examples/watcher_registration_example.yml');
const WATCHER_YML_PATH = path.join(__dirname, './testing/data/watcher.yml');
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
@ -97,17 +97,17 @@ const bondTests = () => {
// Create a new record.
version1 = await publishNewWatcherVersion(bondId1);
let [record1] = await registry.queryRecords({ "type---": watcher.record.type, "name---": watcher.record.name, "version---": version1 }, true);
let [record1] = await registry.queryRecords({ type: watcher.record.type, name: watcher.record.name, version: version1 }, true);
expect(record1.bondId).toBe(bondId1);
// Dissociate record, query and confirm.
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({ type: watcher.record.type, name: watcher.record.name, version: version1 }, true);
expect(record1.bondId).toBe('');
// Associate record with bond, query and confirm.
await registry.associateBond({ recordId: record1.id, bondId: bondId1 }, privateKey, fee);
[record1] = await registry.queryRecords({ "type---": watcher.record.type, "name---": watcher.record.name, "version---": version1 }, true);
[record1] = await registry.queryRecords({ type: watcher.record.type, name: watcher.record.name, version: version1 }, true);
expect(record1.bondId).toBe(bondId1);
});
@ -117,9 +117,9 @@ const bondTests = () => {
// Check version1, version2 as associated with bondId1.
let records;
records = await registry.queryRecords({ "type---": watcher.record.type, "name---": watcher.record.name, "version---": version1 }, true);
records = await registry.queryRecords({ type: watcher.record.type, name: watcher.record.name, version: version1 }, true);
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({ type: watcher.record.type, name: watcher.record.name, version: version2 }, true);
expect(records[0].bondId).toBe(bondId1);
// Create another bond.
@ -131,16 +131,16 @@ const bondTests = () => {
// Reassociate records from bondId1 to bondId2, verify change.
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({ type: watcher.record.type, name: watcher.record.name, version: version1 }, true);
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({ type: watcher.record.type, name: watcher.record.name, version: version2 }, true);
expect(records[0].bondId).toBe(bondId2);
// Dissociate all records from bond, verify change.
await registry.dissociateRecords({ bondId: bondId2 }, privateKey, fee);
records = await registry.queryRecords({ "type---": watcher.record.type, "name---": watcher.record.name, "version---": version1 }, true);
records = await registry.queryRecords({ type: watcher.record.type, name: watcher.record.name, version: version1 }, true);
expect(records[0].bondId).toBe('');
records = await registry.queryRecords({ "type---": watcher.record.type, "name---": watcher.record.name, "version---": version2 }, true);
records = await registry.queryRecords({ type: watcher.record.type, name: watcher.record.name, version: version2 }, true);
expect(records[0].bondId).toBe('');
});
};

View File

@ -3,7 +3,7 @@ import path from 'path';
import { Registry } from './index';
import { ensureUpdatedConfig, getConfig } from './testing/helper';
const WATCHER_YML_PATH = path.join(__dirname, './testing/examples/git_repo_example.yml');
const WATCHER_YML_PATH = path.join(__dirname, './testing/data/watcher.yml');
jest.setTimeout(120 * 1000);
@ -40,7 +40,7 @@ const nameserviceExpiryTests = () => {
fee
)
console.log("SetRecordResult: " + result.data.id)
const [record] = await registry.queryRecords({ "type---": watcher.record.type, "version---": watcher.record.version }, true);
const [record] = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version }, true);
recordExpiryTime = new Date(record.expiryTime);
const [bond] = await registry.getBondsByIds([bondId]);
@ -63,7 +63,7 @@ const nameserviceExpiryTests = () => {
});
test('Check record expiry time', async() => {
const [record] = await registry.queryRecords({ "type---": watcher.record.type, "version---": watcher.record.version }, true);
const [record] = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version }, true);
const updatedExpiryTime = new Date();
expect(updatedExpiryTime.getTime()).toBeGreaterThan(recordExpiryTime.getTime());
recordExpiryTime = updatedExpiryTime;
@ -88,7 +88,7 @@ const nameserviceExpiryTests = () => {
});
test('Check record deleted without bond balance', async() => {
const records = await registry.queryRecords({ "type---": watcher.record.type, "version---": watcher.record.version }, true);
const records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version }, true);
expect(records).toHaveLength(0);
})

View File

@ -5,7 +5,7 @@ import { Account } from './account';
import { Registry } from './index';
import { ensureUpdatedConfig, getConfig } from './testing/helper';
const WATCHER_YML_PATH = path.join(__dirname, './testing/examples/git_repo_example.yml');
const WATCHER_YML_PATH = path.join(__dirname, './testing/data/watcher.yml');
jest.setTimeout(120 * 1000);
@ -119,7 +119,7 @@ const namingTests = () => {
await registry.setName({ crn, cid: watcherId }, privateKey, fee);
// Query records should return it (some CRN points to it).
const records = await registry.queryRecords({ "type---": watcher.record.type, "version---": watcher.record.version });
const records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version });
expect(records).toBeDefined();
expect(records).toHaveLength(1);
});
@ -229,12 +229,12 @@ const namingTests = () => {
expect(latest.height).toBeDefined();
// Query records should NOT return it (no CRN points to it).
records = await registry.queryRecords({ "type---": watcher.record.type, "version---": watcher.record.version });
records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version });
expect(records).toBeDefined();
expect(records).toHaveLength(0);
// Query all records should return it (all: true).
records = await registry.queryRecords({ "type---": watcher.record.type, "version---": watcher.record.version }, true);
records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version }, true);
expect(records).toBeDefined();
expect(records).toHaveLength(1);
});

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* 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
* 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()) as Uint8Array;
return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) 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()) as Uint8Array;
return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array;
}
set next_key(value: Uint8Array) {
pb_1.Message.setField(this, 1, value);

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* 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
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./../../../gogoproto/gogo";

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* Generated by the protoc-gen-ts. DO NOT EDIT!
* compiler version: 3.12.4
* compiler version: 4.25.1
* source: gogoproto/gogo.proto
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./../google/protobuf/descriptor";

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* Generated by the protoc-gen-ts. DO NOT EDIT!
* compiler version: 3.12.4
* compiler version: 4.25.1
* source: google/api/annotations.proto
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./http";

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* Generated by the protoc-gen-ts. DO NOT EDIT!
* compiler version: 3.12.4
* compiler version: 4.25.1
* source: google/api/http.proto
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as pb_1 from "google-protobuf";

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* Generated by the protoc-gen-ts. DO NOT EDIT!
* compiler version: 3.12.4
* compiler version: 4.25.1
* 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()) as Uint8Array;
return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array(0)) as Uint8Array;
}
set value(value: Uint8Array) {
pb_1.Message.setField(this, 2, value);

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* Generated by the protoc-gen-ts. DO NOT EDIT!
* compiler version: 3.12.4
* compiler version: 4.25.1
* 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()) as Uint8Array;
return pb_1.Message.getFieldWithDefault(this, 7, new Uint8Array(0)) as Uint8Array;
}
set string_value(value: Uint8Array) {
pb_1.Message.setField(this, 7, value);

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* Generated by the protoc-gen-ts. DO NOT EDIT!
* compiler version: 3.12.4
* compiler version: 4.25.1
* source: google/protobuf/duration.proto
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as pb_1 from "google-protobuf";

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* Generated by the protoc-gen-ts. DO NOT EDIT!
* compiler version: 3.12.4
* compiler version: 4.25.1
* source: google/protobuf/timestamp.proto
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as pb_1 from "google-protobuf";

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* 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
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./../../../gogoproto/gogo";

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* 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
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./../../../gogoproto/gogo";

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* 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
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./../../../gogoproto/gogo";

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* 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
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./../../../gogoproto/gogo";

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* 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
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./../../../gogoproto/gogo";

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* 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
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./../../../gogoproto/gogo";

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* 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
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./../../../gogoproto/gogo";

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* 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
* 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

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* 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
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./../../../gogoproto/gogo";

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* 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
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./registry";

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* 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
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./../../../google/protobuf/duration";

View File

@ -2,7 +2,7 @@
/* eslint-disable */
/**
* 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
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./../../../gogoproto/gogo";

View File

@ -3,7 +3,7 @@ import path from 'path';
import { Registry } from './index';
import { getConfig, ensureUpdatedConfig, provisionBondId } from './testing/helper';
const WATCHER_YML_PATH = path.join(__dirname, './testing/examples/website_registration_example.yml');
const WATCHER_YML_PATH = path.join(__dirname, './testing/data/watcher.yml');
jest.setTimeout(40 * 1000);
@ -45,17 +45,17 @@ describe('Querying', () => {
});
test('Query records by reference.', async () => {
const { ref } = watcher.record.repo_reference;
const records = await registry.queryRecords({ "repo_reference---/---": ref}, true);
const { repo_registration_record_cid } = watcher.record;
const records = await registry.queryRecords({ repo_registration_record_cid }, true);
expect(records.length).toBeGreaterThanOrEqual(1);
const { attributes: { repo_reference: {ref: record_repo_registration_record_cid} } } = records[0];
expect(ref).toBe(record_repo_registration_record_cid);
const { attributes: { repo_registration_record_cid: record_repo_registration_record_cid } } = records[0];
expect(repo_registration_record_cid).toBe(record_repo_registration_record_cid);
});
test('Query records by attributes.', async () => {
const { version, name } = watcher.record;
const records = await registry.queryRecords({ "version---": version, "name---": name }, true);
const records = await registry.queryRecords({ version, name }, true);
expect(records.length).toBe(1);
[ watcher ] = records;
@ -74,7 +74,7 @@ describe('Querying', () => {
const [record] = await registry.getRecordsByIds([watcher.id], true);
expect(record.id).toBe(watcher.id);
// temp fix
expect(record.attributes.repo_reference["/"]).toBeDefined();
expect(record.attributes.repo_reference["/"]).toHaveLength(46);
expect(record.attributes.repo_registration_record_cid).toBeDefined();
expect(record.attributes.repo_registration_record_cid).toHaveLength(46);
});
});

View File

@ -1,9 +0,0 @@
record:
hash_reference:
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
targeted_arch: x86_64
runtime_version: go 1.18
repo_reference:
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
version: 1.0.0
type: Binary

View File

@ -1,13 +0,0 @@
record:
name: Laconic
ipld_types:
- type3
- type11
- schema2
- codec5
type: ChainRegistrationRecord
version: 0.11.2
chain_id: laconic_9000-1
network_id: "1392"
genesis_hash:
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D

View File

@ -1,8 +0,0 @@
record:
image_id: 77af4d6b9913
binary_reference:
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
repo_reference:
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
version: 1.0.0
type: DockerImage

View File

@ -1,7 +0,0 @@
record:
attr1: value1
attr2: value2
link1:
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
link2:
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9

View File

@ -1,6 +0,0 @@
record:
name: cosmos-sdk
repo_reference: 'https://github.com/cosmos/cosmos-sdk'
description: This is a description string
version: 0.46.48
type: GitRepository

View File

@ -1,8 +0,0 @@
record:
repo_reference:
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
js_package_ref:
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
version: 1.0.0
type: JSPackage
name: test-JSPackage

View File

@ -1,9 +0,0 @@
record:
service_provider_ref:
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
auction_ref:
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
watcher_ref:
/: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
version: 1.0.0
type: ResponderContract

View File

@ -1,12 +0,0 @@
record:
type: ServiceProviderRecord
bond_id: madeUpBondID
laconic_id: madeUpLaconicID
version: 1.0.13
x500:
common_name: cerc-io
organization_unit: xyz
organization_name: abc
state_name: california
country: US
locality_name: local

View File

@ -1,15 +0,0 @@
record:
metadata:
version: 0.32.0
chain_reference:
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
repo_reference:
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
wasm:
hash_reference:
/: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
metadata:
compiler_version: 1.15.0
execution_engine_version: 0.16.1
version: 1.0.25
type: WatcherRegistrationRecord

View File

@ -1,10 +0,0 @@
record:
type: WebsiteRegistrationRecord
url: 'https://cerc.io'
repo_reference:
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
build_artifact_ref:
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
tls_cert_ref:
/: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
version: 1.0.20

View File

@ -24,13 +24,18 @@ 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();
if (!bonds.length) {
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
bonds = await registry.queryBonds();
}
return bonds[0].id;
// let bonds = await registry.queryBonds();
// console.log("found bonds: " + bonds.length)
// if (!bonds.length) {
// await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
// bonds = await registry.queryBonds();
// console.log("created bond and got back: " + bonds.length)
// }
let bondId: string;
bondId = await registry.getNextBondId(privateKey);
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
return bondId
//return bonds[0].id;
};
export const getConfig = () => {

View File

@ -29,156 +29,22 @@ export class Record {
}
get attributes() {
let a = new any.google.protobuf.Any();
var 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}`);
}
switch (this._record.type){
case "WebsiteRegistrationRecord": {
var webAttr= new attributes.vulcanize.registry.v1beta1.WebsiteRegistrationRecord({
url: this._record.url,
repo_reference: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.repo_reference["/"],}),
build_artifact_ref: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.build_artifact_ref["/"]}),
tls_cert_ref:new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.tls_cert_ref["/"]}),
type: this._record.type,
version:this._record.version,
})
a= new any.google.protobuf.Any({
type_url: "/vulcanize.registry.v1beta1.WebsiteRegistrationRecord",
value: webAttr.serialize()
})
};
break;
case "ServiceProviderRecord": {
var serAttr= new attributes.vulcanize.registry.v1beta1.ServiceProviderRecord({
bond_id:this._record.bond_id,
laconic_id:this._record.laconic_id,
type:this._record.type,
version:this._record.version,
x500: new attributes.vulcanize.registry.v1beta1.ServiceProviderRecord.X500(this._record.x500)
})
a= new any.google.protobuf.Any({
type_url: "/vulcanize.registry.v1beta1.ServiceProviderRecord",
value: serAttr.serialize()
})
};
break;
case "GitRepository": {
var gitAttr= new attributes.vulcanize.registry.v1beta1.GitRepository(this._record)
a= new any.google.protobuf.Any({
type_url: "/vulcanize.registry.v1beta1.GitRepository",
value: gitAttr.serialize()
})
};
break;
case "Binary": {
var binaryAttr= new attributes.vulcanize.registry.v1beta1.Binary({
hash_reference: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.hash_reference["/"]}),
targeted_arch: this._record.targeted_arch,
runtime_version: this._record.runtime_version,
repo_reference: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.repo_reference["/"]}),
version: this._record.version,
type: this._record.type,
})
a= new any.google.protobuf.Any({
type_url: "/vulcanize.registry.v1beta1.Binary",
value: binaryAttr.serialize()
})
};
break;
case "DockerImage": {
var dockerAttr= new attributes.vulcanize.registry.v1beta1.DockerImage({
image_id: this._record.image_id,
binary_reference: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.binary_reference["/"]}),
repo_reference: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.repo_reference["/"]}),
version: this._record.version,
type: this._record.type,
})
a= new any.google.protobuf.Any({
type_url: "/vulcanize.registry.v1beta1.DockerImage",
value: dockerAttr.serialize()
})
};
break;
case "WatcherRegistrationRecord": {
var watcherAttr= new attributes.vulcanize.registry.v1beta1.WatcherRegistrationRecord({
metadata: new attributes.vulcanize.registry.v1beta1.WatcherRegistrationRecord.WatcherMetadata({
version: this._record.metadata.version,
chain_reference: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.metadata.chain_reference["/"]}),
}),
repo_reference: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.repo_reference["/"]}),
wasm: new attributes.vulcanize.registry.v1beta1.WatcherRegistrationRecord.WASMBinary({
hash_reference: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.wasm.hash_reference["/"]}),
metadata: new attributes.vulcanize.registry.v1beta1.WatcherRegistrationRecord.WASMBinaryMetadata(this._record.wasm.metadata),
}),
version: this._record.version,
type: this._record.type,
})
a= new any.google.protobuf.Any({
type_url: "/vulcanize.registry.v1beta1.WatcherRegistrationRecord",
value: watcherAttr.serialize()
})
};
break;
case "ResponderContract": {
var respAttr= new attributes.vulcanize.registry.v1beta1.ResponderContract({
service_provider_ref: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.service_provider_ref["/"]}),
auction_ref: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.auction_ref["/"]}),
watcher_ref: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.watcher_ref["/"]}),
version: this._record.version,
type: this._record.type,
})
a= new any.google.protobuf.Any({
type_url: "/vulcanize.registry.v1beta1.ResponderContract",
value: respAttr.serialize()
})
};
break;
case "JSPackage": {
var jsAttr= new attributes.vulcanize.registry.v1beta1.JSPackage({
repo_reference: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.repo_reference["/"]}),
js_package_ref: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.js_package_ref["/"]}),
version: this._record.version,
type: this._record.type,
name: this._record.name,
})
a= new any.google.protobuf.Any({
type_url: "/vulcanize.registry.v1beta1.JSPackage",
value: jsAttr.serialize()
})
};
break;
case "ChainRegistrationRecord": {
var chainAttr= new attributes.vulcanize.registry.v1beta1.ChainRegistrationRecord({
name: this._record.name,
ipld_types: this._record.ipld_types,
type: this._record.type,
version: this._record.version,
chain_id: this._record.chain_id,
network_id: this._record.network_id,
genesis_hash: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.genesis_hash["/"]}),
})
a= new any.google.protobuf.Any({
type_url: "/vulcanize.registry.v1beta1.ChainRegistrationRecord",
value: chainAttr.serialize()
})
};
break;
default: {
const err = new Error("Unsupported reocrd type");
console.error(err);
throw err;
};
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(),
});
}
return a
return a;
}
/**

View File

@ -4,7 +4,7 @@ import { Registry } from './index';
import { getBaseConfig, getConfig } from './testing/helper';
import { Util } from './util';
const WATCHER_YML_PATH = path.join(__dirname, './testing/examples/git_repo_example.yml');
const WATCHER_YML_PATH = path.join(__dirname, './testing/data/watcher.yml');
jest.setTimeout(90 * 1000);

916
yarn.lock

File diff suppressed because it is too large Load Diff