Compare commits

..
Author SHA1 Message Date
Michael Shaw c6a37ac419 quick README update to reflect reality 2023-02-06 12:47:29 -05:00
Ian Norden 80348594f8 Merge pull request #20 from cerc-io/zramsay-patch-1
remove duplicate line in tests
2023-01-12 18:59:34 -06:00
Zach 55675c7b55 rm duplicate line (typo?) 2023-01-11 18:27:00 -05:00
Zach 10d58ca028 Merge pull request #19 from cerc-io/ian/bump_version
Update package to 0.1.5
2023-01-11 17:02:56 -05:00
i-norden 95bdacb4a1 version 0.1.5 2023-01-11 15:48:24 -06:00
7 changed files with 7 additions and 23 deletions
-1
View File
@@ -1,4 +1,3 @@
node_modules
dist
.env
.idea/
+1 -1
View File
@@ -57,7 +57,7 @@ Follow these steps to run the tests:
- In laconicd repo run:
```bash
TEST_NAMESERVICE_EXPIRY=true ./init.sh
TEST_REGISTRY_EXPIRY=true ./init.sh
```
- Export the private key and change it in `.env` file again using:
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@cerc-io/laconic-sdk",
"version": "0.1.4",
"version": "0.1.5",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": "git@github.com:cerc-io/laconic-sdk.git",
+3 -1
View File
@@ -75,10 +75,12 @@ export const parseMsgSetRecordResponse = (data: string) => {
const responseBytes = Buffer.from(data, 'hex')
// TODO: Decode response using protobuf.
// const msgSetRecordResponse = registryTx.vulcanize.registry.v1beta1.MsgSetRecordResponse.deserialize(responseBytes);
// const msgSetRecordResponse = nameserviceTx.vulcanize.nameservice.v1beta1.MsgSetRecordResponse.deserialize(responseBytes);
// return msgSetRecordResponse.toObject();
// Workaround as proto based decoding is not working.
const [_, id] = responseBytes.toString().split(';')
return { id }
}
-1
View File
@@ -244,7 +244,6 @@ const namingTests = () => {
const records = await registry.lookupNames([crn], true);
expect(records).toBeDefined();
expect(records).toBeDefined();
expect(records).toHaveLength(1);
const [{ latest }] = records;
+1 -1
View File
@@ -25,7 +25,7 @@ const utilTests = () => {
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
// Create watcher.
watcher = await getBaseConfig(WATCHER_YML_PATH); //this overwrites version to 0.0.1
watcher = await getBaseConfig(WATCHER_YML_PATH);
const result = await registry.setRecord(
{
privateKey,
+1 -17
View File
@@ -2,8 +2,6 @@ import * as Block from 'multiformats/block'
import { sha256 as hasher } from 'multiformats/hashes/sha2'
import * as dagCBOR from '@ipld/dag-cbor'
import * as dagJSON from '@ipld/dag-json'
//import { CID } from 'multiformats/cid'
//import * as json from 'multiformats/codecs/json'
/**
* Utils
@@ -88,29 +86,15 @@ export class Util {
* Get record content ID.
*/
static async getContentId(record: any) {
//this encode/decode does nothing, afaict
const serialized = dagJSON.encode(record)
const recordData = dagJSON.decode(serialized)
//these are for version 0.0.1 of watcher.yml test data:
//const dside = {"build_artifact_cid":"QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9","repo_registration_record_cid":"QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D","tls_cert_cid":"QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR","type":"WebsiteRegistrationRecord","url":"https://cerc.io","version":"0.0.1"}
//bafyreiek4hnoqmits66bjyxswapplweuoqe4en2ux6u772o4y3askpd3ny is the CBOR encoding w/ sha 256 hasher
//bafyreifalhff7dp6o4hd573b5zdbbnl2wml5q2nrms474lrzp7dgptwxkm is expected DAG-CBOR w/ sha 256 hasher
//bafyreihpfkdvib5muloxlj5b3tgdwibjdcu3zdsuhyft33z7gtgnlzlkpm is CBOR??? encoding of empty json payload.
const block = await Block.encode({
value: recordData,
codec: dagCBOR,
hasher
})
//manual CID construction
//const dbytes = dagCBOR.encode(dside)
//console.log("BYTES: " + dbytes)
//const hash = await hasher.digest(dbytes)
//console.log("HASH: " + hash)
//const cid = CID.create(1, dagCBOR.code, hash)
//console.log("TEST CID: " + cid.toString())
return block.cid.toString();
}
}