/ json tag for ref

This commit is contained in:
0xmuralik 2023-03-09 16:51:09 +05:30
parent f622b40ca4
commit 76897789e9
14 changed files with 43 additions and 43 deletions

View File

@ -6,7 +6,7 @@ import "gogoproto/gogo.proto";
option go_package = "github.com/cerc-io/laconicd/x/registry/types";
message HashReference{
string ref =1;
string ref =1 [(gogoproto.jsontag) = "/"];
}
message ServiceProviderRecord {

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_registraion_example.yml');
const WATCHER_YML_PATH = path.join(__dirname, './testing/examples/watcher_registration_example.yml');
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();

View File

@ -46,7 +46,7 @@ describe('Querying', () => {
test('Query records by reference.', async () => {
const { ref } = watcher.record.repo_reference;
const records = await registry.queryRecords({ "repo_reference---ref---": ref}, true);
const records = await registry.queryRecords({ "repo_reference---/---": ref}, true);
expect(records.length).toBeGreaterThanOrEqual(1);
const { attributes: { repo_reference: {ref: record_repo_registration_record_cid} } } = records[0];
@ -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.ref).toBeDefined();
expect(record.attributes.repo_reference.ref).toHaveLength(46);
expect(record.attributes.repo_reference["/"]).toBeDefined();
expect(record.attributes.repo_reference["/"]).toHaveLength(46);
});
});

View File

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

View File

@ -10,4 +10,4 @@ record:
chain_id: laconic_9000-1
network_id: "1392"
genesis_hash:
ref: f6fbe71210275adc7c7ef585a72c065cdb85f0c8d13dea0f229fd7c22d445a26
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D

View File

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

View File

@ -2,6 +2,6 @@ record:
attr1: value1
attr2: value2
link1:
ref: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
link2:
ref: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@ record:
type: ServiceProviderRecord
bond_id: madeUpBondID
laconic_id: madeUpLaconicID
version: 1.0.12
version: 1.0.13
x500:
common_name: cerc-io
organization_unit: xyz

View File

@ -2,14 +2,14 @@ record:
metadata:
version: 0.32.0
chain_reference:
ref: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
repo_reference:
ref: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
wasm:
hash_reference:
ref: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
/: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
metadata:
compiler_version: 1.15.0
execution_engine_version: 0.16.1
version: 1.0.3
version: 1.0.25
type: WatcherRegistrationRecord

View File

@ -2,9 +2,9 @@ record:
type: WebsiteRegistrationRecord
url: 'https://cerc.io'
repo_reference:
ref: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
build_artifact_ref:
ref: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
tls_cert_ref:
ref: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
version: 1.0.28
/: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
version: 1.0.20

View File

@ -36,9 +36,9 @@ export class Record {
case "WebsiteRegistrationRecord": {
var webAttr= new attributes.vulcanize.registry.v1beta1.WebsiteRegistrationRecord({
url: this._record.url,
repo_reference: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.repo_reference),
build_artifact_ref: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.build_artifact_ref),
tls_cert_ref:new attributes.vulcanize.registry.v1beta1.HashReference(this._record.tls_cert_ref),
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,
})
@ -75,10 +75,10 @@ export class Record {
case "Binary": {
var binaryAttr= new attributes.vulcanize.registry.v1beta1.Binary({
hash_reference: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.hash_reference),
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(this._record.repo_reference),
repo_reference: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.repo_reference["/"]}),
version: this._record.version,
type: this._record.type,
})
@ -92,8 +92,8 @@ export class Record {
case "DockerImage": {
var dockerAttr= new attributes.vulcanize.registry.v1beta1.DockerImage({
image_id: this._record.image_id,
binary_reference: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.binary_reference),
repo_reference: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.repo_reference),
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,
})
@ -108,11 +108,11 @@ export class Record {
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(this._record.metadata.chain_reference),
chain_reference: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.metadata.chain_reference["/"]}),
}),
repo_reference: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.repo_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(this._record.wasm.hash_reference),
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,
@ -127,9 +127,9 @@ export class Record {
case "ResponderContract": {
var respAttr= new attributes.vulcanize.registry.v1beta1.ResponderContract({
service_provider_ref: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.service_provider_ref),
auction_ref: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.auction_ref),
watcher_ref: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.watcher_ref),
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,
})
@ -142,8 +142,8 @@ export class Record {
case "JSPackage": {
var jsAttr= new attributes.vulcanize.registry.v1beta1.JSPackage({
repo_reference: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.repo_reference),
js_package_ref: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.js_package_ref),
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,
@ -163,7 +163,7 @@ export class Record {
version: this._record.version,
chain_id: this._record.chain_id,
network_id: this._record.network_id,
genesis_hash: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.genesis_hash),
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",