forked from cerc-io/laconic-sdk
/ json tag for ref
This commit is contained in:
parent
f622b40ca4
commit
76897789e9
@ -6,7 +6,7 @@ import "gogoproto/gogo.proto";
|
|||||||
option go_package = "github.com/cerc-io/laconicd/x/registry/types";
|
option go_package = "github.com/cerc-io/laconicd/x/registry/types";
|
||||||
|
|
||||||
message HashReference{
|
message HashReference{
|
||||||
string ref =1;
|
string ref =1 [(gogoproto.jsontag) = "/"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message ServiceProviderRecord {
|
message ServiceProviderRecord {
|
||||||
|
@ -3,7 +3,7 @@ import path from 'path';
|
|||||||
import { Registry } from './index';
|
import { Registry } from './index';
|
||||||
import { ensureUpdatedConfig, getConfig } from './testing/helper';
|
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();
|
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ describe('Querying', () => {
|
|||||||
|
|
||||||
test('Query records by reference.', async () => {
|
test('Query records by reference.', async () => {
|
||||||
const { ref } = watcher.record.repo_reference;
|
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);
|
expect(records.length).toBeGreaterThanOrEqual(1);
|
||||||
|
|
||||||
const { attributes: { repo_reference: {ref: record_repo_registration_record_cid} } } = records[0];
|
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);
|
const [record] = await registry.getRecordsByIds([watcher.id], true);
|
||||||
expect(record.id).toBe(watcher.id);
|
expect(record.id).toBe(watcher.id);
|
||||||
// temp fix
|
// temp fix
|
||||||
expect(record.attributes.repo_reference.ref).toBeDefined();
|
expect(record.attributes.repo_reference["/"]).toBeDefined();
|
||||||
expect(record.attributes.repo_reference.ref).toHaveLength(46);
|
expect(record.attributes.repo_reference["/"]).toHaveLength(46);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
record:
|
record:
|
||||||
hash_reference:
|
hash_reference:
|
||||||
ref: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
||||||
targeted_arch: x86_64
|
targeted_arch: x86_64
|
||||||
runtime_version: go 1.18
|
runtime_version: go 1.18
|
||||||
repo_reference:
|
repo_reference:
|
||||||
ref: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
type: Binary
|
type: Binary
|
@ -10,4 +10,4 @@ record:
|
|||||||
chain_id: laconic_9000-1
|
chain_id: laconic_9000-1
|
||||||
network_id: "1392"
|
network_id: "1392"
|
||||||
genesis_hash:
|
genesis_hash:
|
||||||
ref: f6fbe71210275adc7c7ef585a72c065cdb85f0c8d13dea0f229fd7c22d445a26
|
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
@ -1,8 +1,8 @@
|
|||||||
record:
|
record:
|
||||||
image_id: 77af4d6b9913
|
image_id: 77af4d6b9913
|
||||||
binary_reference:
|
binary_reference:
|
||||||
ref: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
||||||
repo_reference:
|
repo_reference:
|
||||||
ref: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
type: DockerImage
|
type: DockerImage
|
@ -2,6 +2,6 @@ record:
|
|||||||
attr1: value1
|
attr1: value1
|
||||||
attr2: value2
|
attr2: value2
|
||||||
link1:
|
link1:
|
||||||
ref: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
||||||
link2:
|
link2:
|
||||||
ref: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
||||||
|
@ -2,5 +2,5 @@ record:
|
|||||||
name: cosmos-sdk
|
name: cosmos-sdk
|
||||||
repo_reference: 'https://github.com/cosmos/cosmos-sdk'
|
repo_reference: 'https://github.com/cosmos/cosmos-sdk'
|
||||||
description: This is a description string
|
description: This is a description string
|
||||||
version: 0.46.31
|
version: 0.46.48
|
||||||
type: GitRepository
|
type: GitRepository
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
record:
|
record:
|
||||||
repo_reference:
|
repo_reference:
|
||||||
ref: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
||||||
js_package_ref:
|
js_package_ref:
|
||||||
ref: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
type: JSPackage
|
type: JSPackage
|
||||||
name: test-JSPackage
|
name: test-JSPackage
|
@ -1,9 +1,9 @@
|
|||||||
record:
|
record:
|
||||||
service_provider_ref:
|
service_provider_ref:
|
||||||
ref: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
||||||
auction_ref:
|
auction_ref:
|
||||||
ref: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
||||||
watcher_ref:
|
watcher_ref:
|
||||||
ref: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
|
/: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
type: ResponderContract
|
type: ResponderContract
|
@ -2,7 +2,7 @@ record:
|
|||||||
type: ServiceProviderRecord
|
type: ServiceProviderRecord
|
||||||
bond_id: madeUpBondID
|
bond_id: madeUpBondID
|
||||||
laconic_id: madeUpLaconicID
|
laconic_id: madeUpLaconicID
|
||||||
version: 1.0.12
|
version: 1.0.13
|
||||||
x500:
|
x500:
|
||||||
common_name: cerc-io
|
common_name: cerc-io
|
||||||
organization_unit: xyz
|
organization_unit: xyz
|
||||||
|
@ -2,14 +2,14 @@ record:
|
|||||||
metadata:
|
metadata:
|
||||||
version: 0.32.0
|
version: 0.32.0
|
||||||
chain_reference:
|
chain_reference:
|
||||||
ref: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
||||||
repo_reference:
|
repo_reference:
|
||||||
ref: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
||||||
wasm:
|
wasm:
|
||||||
hash_reference:
|
hash_reference:
|
||||||
ref: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
|
/: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
|
||||||
metadata:
|
metadata:
|
||||||
compiler_version: 1.15.0
|
compiler_version: 1.15.0
|
||||||
execution_engine_version: 0.16.1
|
execution_engine_version: 0.16.1
|
||||||
version: 1.0.3
|
version: 1.0.25
|
||||||
type: WatcherRegistrationRecord
|
type: WatcherRegistrationRecord
|
@ -2,9 +2,9 @@ record:
|
|||||||
type: WebsiteRegistrationRecord
|
type: WebsiteRegistrationRecord
|
||||||
url: 'https://cerc.io'
|
url: 'https://cerc.io'
|
||||||
repo_reference:
|
repo_reference:
|
||||||
ref: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
||||||
build_artifact_ref:
|
build_artifact_ref:
|
||||||
ref: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
||||||
tls_cert_ref:
|
tls_cert_ref:
|
||||||
ref: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
|
/: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
|
||||||
version: 1.0.28
|
version: 1.0.20
|
||||||
|
32
src/types.ts
32
src/types.ts
@ -36,9 +36,9 @@ export class Record {
|
|||||||
case "WebsiteRegistrationRecord": {
|
case "WebsiteRegistrationRecord": {
|
||||||
var webAttr= new attributes.vulcanize.registry.v1beta1.WebsiteRegistrationRecord({
|
var webAttr= new attributes.vulcanize.registry.v1beta1.WebsiteRegistrationRecord({
|
||||||
url: this._record.url,
|
url: this._record.url,
|
||||||
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["/"],}),
|
||||||
build_artifact_ref: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.build_artifact_ref),
|
build_artifact_ref: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.build_artifact_ref["/"]}),
|
||||||
tls_cert_ref:new attributes.vulcanize.registry.v1beta1.HashReference(this._record.tls_cert_ref),
|
tls_cert_ref:new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.tls_cert_ref["/"]}),
|
||||||
type: this._record.type,
|
type: this._record.type,
|
||||||
version:this._record.version,
|
version:this._record.version,
|
||||||
})
|
})
|
||||||
@ -75,10 +75,10 @@ export class Record {
|
|||||||
|
|
||||||
case "Binary": {
|
case "Binary": {
|
||||||
var binaryAttr= new attributes.vulcanize.registry.v1beta1.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,
|
targeted_arch: this._record.targeted_arch,
|
||||||
runtime_version: this._record.runtime_version,
|
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,
|
version: this._record.version,
|
||||||
type: this._record.type,
|
type: this._record.type,
|
||||||
})
|
})
|
||||||
@ -92,8 +92,8 @@ export class Record {
|
|||||||
case "DockerImage": {
|
case "DockerImage": {
|
||||||
var dockerAttr= new attributes.vulcanize.registry.v1beta1.DockerImage({
|
var dockerAttr= new attributes.vulcanize.registry.v1beta1.DockerImage({
|
||||||
image_id: this._record.image_id,
|
image_id: this._record.image_id,
|
||||||
binary_reference: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.binary_reference),
|
binary_reference: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.binary_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["/"]}),
|
||||||
version: this._record.version,
|
version: this._record.version,
|
||||||
type: this._record.type,
|
type: this._record.type,
|
||||||
})
|
})
|
||||||
@ -108,11 +108,11 @@ export class Record {
|
|||||||
var watcherAttr= new attributes.vulcanize.registry.v1beta1.WatcherRegistrationRecord({
|
var watcherAttr= new attributes.vulcanize.registry.v1beta1.WatcherRegistrationRecord({
|
||||||
metadata: new attributes.vulcanize.registry.v1beta1.WatcherRegistrationRecord.WatcherMetadata({
|
metadata: new attributes.vulcanize.registry.v1beta1.WatcherRegistrationRecord.WatcherMetadata({
|
||||||
version: this._record.metadata.version,
|
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({
|
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),
|
metadata: new attributes.vulcanize.registry.v1beta1.WatcherRegistrationRecord.WASMBinaryMetadata(this._record.wasm.metadata),
|
||||||
}),
|
}),
|
||||||
version: this._record.version,
|
version: this._record.version,
|
||||||
@ -127,9 +127,9 @@ export class Record {
|
|||||||
|
|
||||||
case "ResponderContract": {
|
case "ResponderContract": {
|
||||||
var respAttr= new attributes.vulcanize.registry.v1beta1.ResponderContract({
|
var respAttr= new attributes.vulcanize.registry.v1beta1.ResponderContract({
|
||||||
service_provider_ref: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.service_provider_ref),
|
service_provider_ref: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.service_provider_ref["/"]}),
|
||||||
auction_ref: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.auction_ref),
|
auction_ref: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.auction_ref["/"]}),
|
||||||
watcher_ref: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.watcher_ref),
|
watcher_ref: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.watcher_ref["/"]}),
|
||||||
version: this._record.version,
|
version: this._record.version,
|
||||||
type: this._record.type,
|
type: this._record.type,
|
||||||
})
|
})
|
||||||
@ -142,8 +142,8 @@ export class Record {
|
|||||||
|
|
||||||
case "JSPackage": {
|
case "JSPackage": {
|
||||||
var jsAttr= new attributes.vulcanize.registry.v1beta1.JSPackage({
|
var jsAttr= new attributes.vulcanize.registry.v1beta1.JSPackage({
|
||||||
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["/"]}),
|
||||||
js_package_ref: new attributes.vulcanize.registry.v1beta1.HashReference(this._record.js_package_ref),
|
js_package_ref: new attributes.vulcanize.registry.v1beta1.HashReference({ref:this._record.js_package_ref["/"]}),
|
||||||
version: this._record.version,
|
version: this._record.version,
|
||||||
type: this._record.type,
|
type: this._record.type,
|
||||||
name: this._record.name,
|
name: this._record.name,
|
||||||
@ -163,7 +163,7 @@ export class Record {
|
|||||||
version: this._record.version,
|
version: this._record.version,
|
||||||
chain_id: this._record.chain_id,
|
chain_id: this._record.chain_id,
|
||||||
network_id: this._record.network_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({
|
a= new any.google.protobuf.Any({
|
||||||
type_url: "/vulcanize.registry.v1beta1.ChainRegistrationRecord",
|
type_url: "/vulcanize.registry.v1beta1.ChainRegistrationRecord",
|
||||||
|
Loading…
Reference in New Issue
Block a user