diff --git a/proto/vulcanize/registry/v1beta1/attributes.proto b/proto/vulcanize/registry/v1beta1/attributes.proto index b3caf74..64e49e5 100644 --- a/proto/vulcanize/registry/v1beta1/attributes.proto +++ b/proto/vulcanize/registry/v1beta1/attributes.proto @@ -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 { diff --git a/src/bond.test.ts b/src/bond.test.ts index f10e1e7..adfbd7a 100644 --- a/src/bond.test.ts +++ b/src/bond.test.ts @@ -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(); diff --git a/src/sdk.test.ts b/src/sdk.test.ts index 6f0d01e..b4275c1 100644 --- a/src/sdk.test.ts +++ b/src/sdk.test.ts @@ -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); }); }); diff --git a/src/testing/examples/binary_example.yml b/src/testing/examples/binary_example.yml index 88709fe..ad8db10 100644 --- a/src/testing/examples/binary_example.yml +++ b/src/testing/examples/binary_example.yml @@ -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 \ No newline at end of file diff --git a/src/testing/examples/chain_registration_example.yml b/src/testing/examples/chain_registration_example.yml index c1324ec..648c5c4 100644 --- a/src/testing/examples/chain_registration_example.yml +++ b/src/testing/examples/chain_registration_example.yml @@ -10,4 +10,4 @@ record: chain_id: laconic_9000-1 network_id: "1392" genesis_hash: - ref: f6fbe71210275adc7c7ef585a72c065cdb85f0c8d13dea0f229fd7c22d445a26 \ No newline at end of file + /: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D \ No newline at end of file diff --git a/src/testing/examples/docker_image_example.yml b/src/testing/examples/docker_image_example.yml index 9f2bc67..b7ecd09 100644 --- a/src/testing/examples/docker_image_example.yml +++ b/src/testing/examples/docker_image_example.yml @@ -1,8 +1,8 @@ record: image_id: 77af4d6b9913 binary_reference: - ref: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9 + /: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9 repo_reference: - ref: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D + /: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D version: 1.0.0 type: DockerImage \ No newline at end of file diff --git a/src/testing/examples/example1.yml b/src/testing/examples/example1.yml index 2046737..3f7b486 100644 --- a/src/testing/examples/example1.yml +++ b/src/testing/examples/example1.yml @@ -2,6 +2,6 @@ record: attr1: value1 attr2: value2 link1: - ref: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D + /: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D link2: - ref: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9 + /: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9 diff --git a/src/testing/examples/git_repo_example.yml b/src/testing/examples/git_repo_example.yml index b7762b6..d48777e 100644 --- a/src/testing/examples/git_repo_example.yml +++ b/src/testing/examples/git_repo_example.yml @@ -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 diff --git a/src/testing/examples/js_package_example.yml b/src/testing/examples/js_package_example.yml index a29bc00..9b06fbc 100644 --- a/src/testing/examples/js_package_example.yml +++ b/src/testing/examples/js_package_example.yml @@ -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 \ No newline at end of file diff --git a/src/testing/examples/responder_contract_example.yml b/src/testing/examples/responder_contract_example.yml index a327604..e503cc3 100644 --- a/src/testing/examples/responder_contract_example.yml +++ b/src/testing/examples/responder_contract_example.yml @@ -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 \ No newline at end of file diff --git a/src/testing/examples/service_provider_example.yml b/src/testing/examples/service_provider_example.yml index 84a3e51..ed06745 100644 --- a/src/testing/examples/service_provider_example.yml +++ b/src/testing/examples/service_provider_example.yml @@ -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 diff --git a/src/testing/examples/watcher_registraion_example.yml b/src/testing/examples/watcher_registration_example.yml similarity index 54% rename from src/testing/examples/watcher_registraion_example.yml rename to src/testing/examples/watcher_registration_example.yml index 1d49585..f3c398e 100644 --- a/src/testing/examples/watcher_registraion_example.yml +++ b/src/testing/examples/watcher_registration_example.yml @@ -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 diff --git a/src/testing/examples/website_registration_example.yml b/src/testing/examples/website_registration_example.yml index 60b9001..80fa3d9 100644 --- a/src/testing/examples/website_registration_example.yml +++ b/src/testing/examples/website_registration_example.yml @@ -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 diff --git a/src/types.ts b/src/types.ts index f568c81..dbe5b15 100644 --- a/src/types.ts +++ b/src/types.ts @@ -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",