forked from cerc-io/laconic-sdk
Compare commits
3 Commits
main
...
roy/tests-
Author | SHA1 | Date | |
---|---|---|---|
bd5b23a1b1 | |||
2bc89bcb5d | |||
e061b3da69 |
2
.dockerignore
Normal file
2
.dockerignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Dockerfile
|
||||||
|
node_modules
|
@ -7,16 +7,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [ 18.x ]
|
node-version: [ 16.x ]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
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 }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
@ -30,7 +26,7 @@ jobs:
|
|||||||
npm config set registry https://git.vdb.to/api/packages/cerc-io/npm/
|
npm config set registry https://git.vdb.to/api/packages/cerc-io/npm/
|
||||||
- name: Authenticate to git.vdb.to registry
|
- name: Authenticate to git.vdb.to registry
|
||||||
run: |
|
run: |
|
||||||
npm config set -- '//git.vdb.to/api/packages/cerc-io/npm/:_authToken' "${{ secrets.CICD_PUBLISH_TOKEN }}"
|
npm config set -- '//git.vdb.to/api/packages/cerc-io/npm/:_authToken' "${{ secrets.GITEA_PUBLISH_TOKEN }}"
|
||||||
- name: npm publish
|
- name: npm publish
|
||||||
run: |
|
run: |
|
||||||
npm publish
|
npm publish
|
||||||
|
@ -21,34 +21,18 @@ RUN \
|
|||||||
&& npm config -g set prefix ${NPM_GLOBAL} \
|
&& npm config -g set prefix ${NPM_GLOBAL} \
|
||||||
&& su ${USERNAME} -c "npm config -g set prefix ${NPM_GLOBAL}" \
|
&& su ${USERNAME} -c "npm config -g set prefix ${NPM_GLOBAL}" \
|
||||||
# Install eslint
|
# Install eslint
|
||||||
&& su ${USERNAME} -c "umask 0002 && npm install -g eslint lerna jest" \
|
&& su ${USERNAME} -c "umask 0002 && npm install -g eslint" \
|
||||||
&& npm cache clean --force > /dev/null 2>&1
|
&& npm cache clean --force > /dev/null 2>&1
|
||||||
|
|
||||||
# [Optional] Uncomment this section to install additional OS packages.
|
|
||||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
|
||||||
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
|
||||||
|
|
||||||
# [Optional] Uncomment if you want to install an additional version of node using nvm
|
|
||||||
# ARG EXTRA_NODE_VERSION=10
|
|
||||||
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
|
|
||||||
|
|
||||||
# [Optional] Uncomment if you want to install more global node modules
|
|
||||||
# RUN su node -c "npm install -g <your-package-list-here>"
|
|
||||||
|
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
RUN mkdir node_modules && mkdir proto && mkdir scripts && mkdir src
|
|
||||||
COPY node_modules ./node_modules/
|
|
||||||
COPY proto . ./proto/
|
|
||||||
COPY scripts ./scripts/
|
|
||||||
COPY src ./src/
|
|
||||||
COPY entrypoint.sh .
|
COPY entrypoint.sh .
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
# Placeholder CMD : generally this will be overridden at run time like :
|
|
||||||
# docker run -it -v /home/builder/cerc/laconic-sdk:/workspace cerc/builder-js sh -c 'cd /workspace && yarn && yarn build'
|
|
||||||
CMD node --version
|
CMD node --version
|
||||||
|
|
||||||
# Temp hack, clone the laconic-sdk repo here
|
WORKDIR /app/laconic-sdk
|
||||||
WORKDIR /app
|
|
||||||
|
COPY package*.json .
|
||||||
RUN yarn install
|
RUN yarn install
|
||||||
|
COPY . .
|
||||||
|
|
||||||
WORKDIR /app/laconic-sdk
|
WORKDIR /app/laconic-sdk
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cerc-io/laconic-sdk",
|
"name": "@cerc-io/laconic-sdk",
|
||||||
"version": "0.1.13",
|
"version": "0.1.6",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"repository": "git@github.com:cerc-io/laconic-sdk.git",
|
"repository": "git@github.com:cerc-io/laconic-sdk.git",
|
||||||
@ -14,7 +14,7 @@
|
|||||||
"dotenv": "^16.0.0",
|
"dotenv": "^16.0.0",
|
||||||
"google-protobuf": "^3.21.0",
|
"google-protobuf": "^3.21.0",
|
||||||
"jest": "29.0.0",
|
"jest": "29.0.0",
|
||||||
"protoc-gen-ts": "^0.8.7",
|
"protoc-gen-ts": "^0.8.5",
|
||||||
"ts-jest": "^29.0.2",
|
"ts-jest": "^29.0.2",
|
||||||
"typescript": "^4.6.2"
|
"typescript": "^4.6.2"
|
||||||
},
|
},
|
||||||
|
@ -31,101 +31,3 @@ message WebsiteRegistrationRecord {
|
|||||||
string type = 5 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
string type = 5 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
||||||
string version = 6 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
string version = 6 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
||||||
}
|
}
|
||||||
|
|
||||||
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 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 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 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 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 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\""];
|
|
||||||
}
|
|
||||||
|
|
||||||
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\""];
|
|
||||||
}
|
|
||||||
|
@ -12,20 +12,10 @@ jest.setTimeout(90 * 1000);
|
|||||||
const bondTests = () => {
|
const bondTests = () => {
|
||||||
let registry: Registry;
|
let registry: Registry;
|
||||||
|
|
||||||
let watcher: any;
|
|
||||||
|
|
||||||
let version1: string;
|
|
||||||
let version2: string;
|
|
||||||
|
|
||||||
let bondId1: string;
|
|
||||||
let bondId2: string;
|
|
||||||
|
|
||||||
let bondOwner: string;
|
|
||||||
|
|
||||||
const publishNewWatcherVersion = async (bondId: string) => {
|
const publishNewWatcherVersion = async (bondId: string) => {
|
||||||
watcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
|
let watcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
|
||||||
await registry.setRecord({ privateKey, record: watcher.record, bondId }, privateKey, fee);
|
await registry.setRecord({ privateKey, record: watcher.record, bondId }, privateKey, fee);
|
||||||
return watcher.record.version;
|
return watcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
@ -33,93 +23,119 @@ const bondTests = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Create bond.', async () => {
|
test('Create bond.', async () => {
|
||||||
bondId1 = await registry.getNextBondId(privateKey);
|
let bondId = await registry.getNextBondId(privateKey);
|
||||||
|
expect(bondId).toBeDefined();
|
||||||
|
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('With bond created', () => {
|
||||||
|
let bond1: any
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
let bondId1 = await registry.getNextBondId(privateKey);
|
||||||
expect(bondId1).toBeDefined();
|
expect(bondId1).toBeDefined();
|
||||||
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||||
})
|
|
||||||
|
[bond1] = await registry.getBondsByIds([bondId1]);
|
||||||
|
expect(bond1).toBeDefined();
|
||||||
|
expect(bond1.id).toEqual(bondId1);
|
||||||
|
});
|
||||||
|
|
||||||
test('Get bond by ID.', async () => {
|
test('Get bond by ID.', async () => {
|
||||||
const [bond] = await registry.getBondsByIds([bondId1]);
|
const [bond] = await registry.getBondsByIds([bond1.id]);
|
||||||
expect(bond).toBeDefined();
|
expect(bond).toBeDefined();
|
||||||
expect(bond.id).toBe(bondId1);
|
expect(bond.id).toBe(bond1.id);
|
||||||
expect(bond.balance).toHaveLength(1);
|
expect(bond.balance).toHaveLength(1);
|
||||||
expect(bond.balance[0]).toEqual({ type: 'aphoton', quantity: '1000000000' });
|
expect(bond.balance[0]).toEqual({ type: 'aphoton', quantity: '1000000000' });
|
||||||
bondOwner = bond.owner;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Query bonds.', async () => {
|
test('Query bonds.', async () => {
|
||||||
const bonds = await registry.queryBonds();
|
const bonds = await registry.queryBonds();
|
||||||
expect(bonds).toBeDefined();
|
expect(bonds).toBeDefined();
|
||||||
const bond = bonds.filter((bond: any) => bond.id === bondId1);
|
const bond = bonds.filter((bond: any) => bond.id === bond1.id);
|
||||||
expect(bond).toBeDefined();
|
expect(bond).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Query bonds by owner.', async () => {
|
test('Query bonds by owner.', async () => {
|
||||||
const bonds = await registry.queryBonds({ owner: bondOwner });
|
const bonds = await registry.queryBonds({ owner: bond1.owner });
|
||||||
expect(bonds).toBeDefined();
|
expect(bonds).toBeDefined();
|
||||||
const bond = bonds.filter((bond: any) => bond.id === bondId1);
|
const bond = bonds.filter((bond: any) => bond.id === bond1.id);
|
||||||
expect(bond).toBeDefined();
|
expect(bond).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Refill bond.', async () => {
|
test('Refill bond.', async () => {
|
||||||
await registry.refillBond({ id: bondId1, denom: 'aphoton', amount: '500' }, privateKey, fee);
|
await registry.refillBond({ id: bond1.id, denom: 'aphoton', amount: '500' }, privateKey, fee);
|
||||||
|
|
||||||
const [bond] = await registry.getBondsByIds([bondId1]);
|
const [bond] = await registry.getBondsByIds([bond1.id]);
|
||||||
expect(bond).toBeDefined();
|
expect(bond).toBeDefined();
|
||||||
expect(bond.id).toBe(bondId1);
|
expect(bond.id).toBe(bond1.id);
|
||||||
expect(bond.balance).toHaveLength(1);
|
expect(bond.balance).toHaveLength(1);
|
||||||
expect(bond.balance[0]).toEqual({ type: 'aphoton', quantity: '1000000500' });
|
expect(bond.balance[0]).toEqual({ type: 'aphoton', quantity: '1000000500' });
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Withdraw bond.', async () => {
|
test('Withdraw bond.', async () => {
|
||||||
await registry.withdrawBond({ id: bondId1, denom: 'aphoton', amount: '500' }, privateKey, fee);
|
await registry.withdrawBond({ id: bond1.id, denom: 'aphoton', amount: '500' }, privateKey, fee);
|
||||||
|
|
||||||
const [bond] = await registry.getBondsByIds([bondId1]);
|
const [bond] = await registry.getBondsByIds([bond1.id]);
|
||||||
expect(bond).toBeDefined();
|
expect(bond).toBeDefined();
|
||||||
expect(bond.id).toBe(bondId1);
|
expect(bond.id).toBe(bond1.id);
|
||||||
expect(bond.balance).toHaveLength(1);
|
expect(bond.balance).toHaveLength(1);
|
||||||
expect(bond.balance[0]).toEqual({ type: 'aphoton', quantity: '1000000000' });
|
expect(bond.balance[0]).toEqual({ type: 'aphoton', quantity: '1000000000' });
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Cancel bond.', async () => {
|
test('Cancel bond.', async () => {
|
||||||
await registry.cancelBond({ id: bondId1 }, privateKey, fee);
|
await registry.cancelBond({ id: bond1.id }, privateKey, fee);
|
||||||
|
|
||||||
const [bond] = await registry.getBondsByIds([bondId1]);
|
const [bond] = await registry.getBondsByIds([bond1.id]);
|
||||||
expect(bond.id).toBe("");
|
expect(bond.id).toBe("");
|
||||||
expect(bond.owner).toBe("");
|
expect(bond.owner).toBe("");
|
||||||
expect(bond.balance).toHaveLength(0);
|
expect(bond.balance).toHaveLength(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
test('Associate/Dissociate bond.', async () => {
|
test('Associate/Dissociate bond.', async () => {
|
||||||
|
let bondId1: string;
|
||||||
|
|
||||||
bondId1 = await registry.getNextBondId(privateKey);
|
bondId1 = await registry.getNextBondId(privateKey);
|
||||||
expect(bondId1).toBeDefined();
|
expect(bondId1).toBeDefined();
|
||||||
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||||
|
|
||||||
// Create a new record.
|
// Create a new record.
|
||||||
version1 = await publishNewWatcherVersion(bondId1);
|
let watcher = await publishNewWatcherVersion(bondId1);
|
||||||
let [record1] = await registry.queryRecords({ type: watcher.record.type, name: watcher.record.name, version: version1 }, true);
|
let query = { type: watcher.record.type, url: watcher.record.url, version: watcher.record.version };
|
||||||
|
let [record1] = await registry.queryRecords(query, true);
|
||||||
expect(record1.bondId).toBe(bondId1);
|
expect(record1.bondId).toBe(bondId1);
|
||||||
|
|
||||||
// Dissociate record, query and confirm.
|
// Dissociate record, query and confirm.
|
||||||
await registry.dissociateBond({ recordId: record1.id }, privateKey, fee);
|
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(query, true);
|
||||||
expect(record1.bondId).toBe('');
|
expect(record1.bondId).toBe('');
|
||||||
|
|
||||||
// Associate record with bond, query and confirm.
|
// Associate record with bond, query and confirm.
|
||||||
await registry.associateBond({ recordId: record1.id, bondId: bondId1 }, privateKey, fee);
|
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(query, true);
|
||||||
expect(record1.bondId).toBe(bondId1);
|
expect(record1.bondId).toBe(bondId1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Reassociate/Dissociate records.', async () => {
|
test('Reassociate/Dissociate records.', async () => {
|
||||||
|
let bondId1: string;
|
||||||
|
let bondId2: string;
|
||||||
|
|
||||||
|
bondId1 = await registry.getNextBondId(privateKey);
|
||||||
|
expect(bondId1).toBeDefined();
|
||||||
|
await registry.createBond({ denom: 'aphoton', amount: '1000000000' }, privateKey, fee);
|
||||||
|
|
||||||
// Create a new record version.
|
// Create a new record version.
|
||||||
version2 = await publishNewWatcherVersion(bondId1);
|
let watcher = await publishNewWatcherVersion(bondId1);
|
||||||
|
let queryv1 = { type: watcher.record.type, url: watcher.record.url, version: watcher.record.version };
|
||||||
|
let queryv2 = { type: watcher.record.type, url: watcher.record.url, version: watcher.record.version };
|
||||||
|
|
||||||
// Check version1, version2 as associated with bondId1.
|
// Check version1, version2 as associated with bondId1.
|
||||||
let records;
|
let records;
|
||||||
records = await registry.queryRecords({ type: watcher.record.type, name: watcher.record.name, version: version1 }, true);
|
records = await registry.queryRecords(queryv1, true);
|
||||||
expect(records[0].bondId).toBe(bondId1);
|
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(queryv2, true);
|
||||||
expect(records[0].bondId).toBe(bondId1);
|
expect(records[0].bondId).toBe(bondId1);
|
||||||
|
|
||||||
// Create another bond.
|
// Create another bond.
|
||||||
@ -131,16 +147,16 @@ const bondTests = () => {
|
|||||||
|
|
||||||
// Reassociate records from bondId1 to bondId2, verify change.
|
// Reassociate records from bondId1 to bondId2, verify change.
|
||||||
await registry.reassociateRecords({ oldBondId: bondId1, newBondId: bondId2 }, privateKey, fee);
|
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(queryv1, true);
|
||||||
expect(records[0].bondId).toBe(bondId2);
|
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(queryv2, true);
|
||||||
expect(records[0].bondId).toBe(bondId2);
|
expect(records[0].bondId).toBe(bondId2);
|
||||||
|
|
||||||
// Dissociate all records from bond, verify change.
|
// Dissociate all records from bond, verify change.
|
||||||
await registry.dissociateRecords({ bondId: bondId2 }, privateKey, fee);
|
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(queryv1, true);
|
||||||
expect(records[0].bondId).toBe('');
|
expect(records[0].bondId).toBe('');
|
||||||
records = await registry.queryRecords({ type: watcher.record.type, name: watcher.record.name, version: version2 }, true);
|
records = await registry.queryRecords(queryv2, true);
|
||||||
expect(records[0].bondId).toBe('');
|
expect(records[0].bondId).toBe('');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -18,12 +18,6 @@ const namingTests = () => {
|
|||||||
let watcher: any;
|
let watcher: any;
|
||||||
let watcherId: string;
|
let watcherId: string;
|
||||||
|
|
||||||
let authorityName: string;
|
|
||||||
let otherAuthorityName: string;
|
|
||||||
let otherPrivateKey: string;
|
|
||||||
|
|
||||||
let crn: string;
|
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||||
|
|
||||||
@ -46,11 +40,24 @@ const namingTests = () => {
|
|||||||
watcherId = result.data.id;
|
watcherId = result.data.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Authority tests', () => {
|
||||||
test('Reserve authority.', async () => {
|
test('Reserve authority.', async () => {
|
||||||
authorityName = `laconic-${Date.now()}`;
|
const authorityName = `laconic-${Date.now()}`;
|
||||||
|
|
||||||
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('With authority reserved', () => {
|
||||||
|
let authorityName: string;
|
||||||
|
let crn: string;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
authorityName = `laconic-${Date.now()}`;
|
||||||
|
crn = `crn://${authorityName}/app/test`;
|
||||||
|
|
||||||
|
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
||||||
|
})
|
||||||
|
|
||||||
test('Lookup authority.', async () => {
|
test('Lookup authority.', async () => {
|
||||||
const [record] = await registry.lookupAuthorities([authorityName]);
|
const [record] = await registry.lookupAuthorities([authorityName]);
|
||||||
|
|
||||||
@ -69,7 +76,8 @@ const namingTests = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Reserve already reserved authority', async () => {
|
test('Reserve already reserved authority', async () => {
|
||||||
await expect(registry.reserveAuthority({ name: authorityName }, privateKey, fee)).rejects.toThrow('Name already reserved.');
|
await expect(registry.reserveAuthority({ name: authorityName }, privateKey, fee)).
|
||||||
|
rejects.toThrow('Name already reserved.');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Reserve sub-authority.', async () => {
|
test('Reserve sub-authority.', async () => {
|
||||||
@ -105,23 +113,61 @@ const namingTests = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Set name for unbonded authority', async () => {
|
test('Set name for unbonded authority', async () => {
|
||||||
crn = `crn://${authorityName}/app/test`;
|
|
||||||
assert(watcherId)
|
assert(watcherId)
|
||||||
await expect(registry.setName({ crn, cid: watcherId }, privateKey, fee)).rejects.toThrow('Authority bond not found.');
|
await expect(registry.setName({ crn, cid: watcherId }, privateKey, fee)).
|
||||||
|
rejects.toThrow('Authority bond not found.');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Set authority bond', async () => {
|
test('Set authority bond', async () => {
|
||||||
await registry.setAuthorityBond({ name: authorityName, bondId }, privateKey, fee);
|
await registry.setAuthorityBond({ name: authorityName, bondId }, privateKey, fee);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Naming tests', () => {
|
||||||
|
let authorityName: string;
|
||||||
|
let otherAuthorityName: string;
|
||||||
|
let otherPrivateKey: string;
|
||||||
|
let otherAccount: Account;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
authorityName = `laconic-${Date.now()}`;
|
||||||
|
|
||||||
|
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
||||||
|
await registry.setAuthorityBond({ name: authorityName, bondId }, privateKey, fee);
|
||||||
|
|
||||||
|
// Create another account.
|
||||||
|
const mnenonic = Account.generateMnemonic();
|
||||||
|
otherAccount = await Account.generateFromMnemonic(mnenonic);
|
||||||
|
await registry.sendCoins({ denom: 'aphoton', amount: '1000000000', destinationAddress: otherAccount.formattedCosmosAddress }, privateKey, fee);
|
||||||
|
|
||||||
|
otherAuthorityName = `other-${Date.now()}`;
|
||||||
|
otherPrivateKey = otherAccount.privateKey.toString('hex');
|
||||||
|
});
|
||||||
|
|
||||||
test('Set name', async () => {
|
test('Set name', async () => {
|
||||||
crn = `crn://${authorityName}/app/test`;
|
const crn = `crn://${authorityName}/app/test1`;
|
||||||
|
|
||||||
await registry.setName({ crn, cid: watcherId }, privateKey, fee);
|
await registry.setName({ crn, cid: watcherId }, privateKey, fee);
|
||||||
|
|
||||||
// Query records should return it (some CRN points to it).
|
// Query records should return it (some CRN points to it).
|
||||||
const records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version });
|
const records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version });
|
||||||
expect(records).toBeDefined();
|
expect(records).toBeDefined();
|
||||||
expect(records).toHaveLength(1);
|
expect(records).toHaveLength(1);
|
||||||
|
|
||||||
|
await registry.deleteName({ crn }, privateKey, fee);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('With name set', () => {
|
||||||
|
let crn: string;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
crn = `crn://${authorityName}/app/test2`;
|
||||||
|
await registry.setName({ crn, cid: watcherId }, privateKey, fee);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await registry.deleteName({ crn }, privateKey, fee);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Lookup name', async () => {
|
test('Lookup name', async () => {
|
||||||
@ -179,42 +225,6 @@ const namingTests = () => {
|
|||||||
expect(oldRecord.height).toBeDefined();
|
expect(oldRecord.height).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Set name without reserving authority', async () => {
|
|
||||||
await expect(registry.setName({ crn: 'crn://not-reserved/app/test', cid: watcherId }, privateKey, fee))
|
|
||||||
.rejects.toThrow('Name authority not found.');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Set name for non-owned authority', async () => {
|
|
||||||
// Create another account.
|
|
||||||
const mnenonic = Account.generateMnemonic();
|
|
||||||
const otherAccount = await Account.generateFromMnemonic(mnenonic);
|
|
||||||
await registry.sendCoins({ denom: 'aphoton', amount: '1000000000', destinationAddress: otherAccount.formattedCosmosAddress }, privateKey, fee);
|
|
||||||
|
|
||||||
// Other account reserves an authority.
|
|
||||||
otherAuthorityName = `other-${Date.now()}`;
|
|
||||||
otherPrivateKey = otherAccount.privateKey.toString('hex');
|
|
||||||
await registry.reserveAuthority({ name: otherAuthorityName }, otherPrivateKey, fee);
|
|
||||||
|
|
||||||
// Try setting name under other authority.
|
|
||||||
await expect(registry.setName({ crn: `crn://${otherAuthorityName}/app/test`, cid: watcherId }, privateKey, fee)).rejects.toThrow('Access denied.');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Lookup non existing name', async () => {
|
|
||||||
const records = await registry.lookupNames(['crn://not-reserved/app/test']);
|
|
||||||
expect(records).toBeDefined();
|
|
||||||
expect(records).toHaveLength(1);
|
|
||||||
const [record] = records;
|
|
||||||
expect(record).toBeNull();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Resolve non existing name', async () => {
|
|
||||||
const records = await registry.resolveNames(['crn://not-reserved/app/test']);
|
|
||||||
expect(records).toBeDefined();
|
|
||||||
expect(records).toHaveLength(1);
|
|
||||||
const [record] = records;
|
|
||||||
expect(record).toBeNull();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Delete name', async () => {
|
test('Delete name', async () => {
|
||||||
await registry.deleteName({ crn }, privateKey, fee);
|
await registry.deleteName({ crn }, privateKey, fee);
|
||||||
|
|
||||||
@ -241,6 +251,7 @@ const namingTests = () => {
|
|||||||
|
|
||||||
test('Delete already deleted name', async () => {
|
test('Delete already deleted name', async () => {
|
||||||
await registry.deleteName({ crn }, privateKey, fee);
|
await registry.deleteName({ crn }, privateKey, fee);
|
||||||
|
await registry.deleteName({ crn }, privateKey, fee);
|
||||||
|
|
||||||
const records = await registry.lookupNames([crn], true);
|
const records = await registry.lookupNames([crn], true);
|
||||||
expect(records).toBeDefined();
|
expect(records).toBeDefined();
|
||||||
@ -252,6 +263,22 @@ const namingTests = () => {
|
|||||||
expect(latest.id).toBe('');
|
expect(latest.id).toBe('');
|
||||||
expect(latest.height).toBeDefined();
|
expect(latest.height).toBeDefined();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Set name without reserving authority', async () => {
|
||||||
|
await expect(registry.setName({ crn: 'crn://not-reserved/app/test', cid: watcherId }, privateKey, fee))
|
||||||
|
.rejects.toThrow('Name authority not found.');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Set name for non-owned authority', async () => {
|
||||||
|
await registry.sendCoins({ denom: 'aphoton', amount: '1000000000', destinationAddress: otherAccount.formattedCosmosAddress }, privateKey, fee);
|
||||||
|
|
||||||
|
// Other account reserves an authority.
|
||||||
|
await registry.reserveAuthority({ name: otherAuthorityName }, otherPrivateKey, fee);
|
||||||
|
|
||||||
|
// Try setting name under other authority.
|
||||||
|
await expect(registry.setName({ crn: `crn://${otherAuthorityName}/app/test`, cid: watcherId }, privateKey, fee)).rejects.toThrow('Access denied.');
|
||||||
|
});
|
||||||
|
|
||||||
test('Delete name for non-owned authority.', async () => {
|
test('Delete name for non-owned authority.', async () => {
|
||||||
const otherBondId = await registry.getNextBondId(otherPrivateKey);
|
const otherBondId = await registry.getNextBondId(otherPrivateKey);
|
||||||
@ -262,6 +289,23 @@ const namingTests = () => {
|
|||||||
// Try deleting name under other authority.
|
// Try deleting name under other authority.
|
||||||
await expect(registry.deleteName({ crn: `crn://${otherAuthorityName}/app/test` }, privateKey, fee)).rejects.toThrow('Access denied.');
|
await expect(registry.deleteName({ crn: `crn://${otherAuthorityName}/app/test` }, privateKey, fee)).rejects.toThrow('Access denied.');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Lookup non existing name', async () => {
|
||||||
|
const records = await registry.lookupNames(['crn://not-reserved/app/test']);
|
||||||
|
expect(records).toBeDefined();
|
||||||
|
expect(records).toHaveLength(1);
|
||||||
|
const [record] = records;
|
||||||
|
expect(record).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Resolve non existing name', async () => {
|
||||||
|
const records = await registry.resolveNames(['crn://not-reserved/app/test']);
|
||||||
|
expect(records).toBeDefined();
|
||||||
|
expect(records).toHaveLength(1);
|
||||||
|
const [record] = records;
|
||||||
|
expect(record).toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (process.env.TEST_AUCTIONS_ENABLED) {
|
if (process.env.TEST_AUCTIONS_ENABLED) {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: cosmos/base/query/v1beta1/pagination.proto
|
* source: cosmos/base/query/v1beta1/pagination.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as pb_1 from "google-protobuf";
|
import * as pb_1 from "google-protobuf";
|
||||||
@ -37,7 +37,7 @@ export namespace cosmos.base.query.v1beta1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
get key() {
|
get key() {
|
||||||
return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array;
|
return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array()) as Uint8Array;
|
||||||
}
|
}
|
||||||
set key(value: Uint8Array) {
|
set key(value: Uint8Array) {
|
||||||
pb_1.Message.setField(this, 1, value);
|
pb_1.Message.setField(this, 1, value);
|
||||||
@ -184,7 +184,7 @@ export namespace cosmos.base.query.v1beta1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
get next_key() {
|
get next_key() {
|
||||||
return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array;
|
return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array()) as Uint8Array;
|
||||||
}
|
}
|
||||||
set next_key(value: Uint8Array) {
|
set next_key(value: Uint8Array) {
|
||||||
pb_1.Message.setField(this, 1, value);
|
pb_1.Message.setField(this, 1, value);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: cosmos/base/v1beta1/coin.proto
|
* source: cosmos/base/v1beta1/coin.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: gogoproto/gogo.proto
|
* source: gogoproto/gogo.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../google/protobuf/descriptor";
|
import * as dependency_1 from "./../google/protobuf/descriptor";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: google/api/annotations.proto
|
* source: google/api/annotations.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./http";
|
import * as dependency_1 from "./http";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: google/api/http.proto
|
* source: google/api/http.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as pb_1 from "google-protobuf";
|
import * as pb_1 from "google-protobuf";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: google/protobuf/any.proto
|
* source: google/protobuf/any.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../gogoproto/gogo";
|
import * as dependency_1 from "./../../gogoproto/gogo";
|
||||||
@ -32,7 +32,7 @@ export namespace google.protobuf {
|
|||||||
pb_1.Message.setField(this, 1, value);
|
pb_1.Message.setField(this, 1, value);
|
||||||
}
|
}
|
||||||
get value() {
|
get value() {
|
||||||
return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array(0)) as Uint8Array;
|
return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array()) as Uint8Array;
|
||||||
}
|
}
|
||||||
set value(value: Uint8Array) {
|
set value(value: Uint8Array) {
|
||||||
pb_1.Message.setField(this, 2, value);
|
pb_1.Message.setField(this, 2, value);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: google/protobuf/descriptor.proto
|
* source: google/protobuf/descriptor.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as pb_1 from "google-protobuf";
|
import * as pb_1 from "google-protobuf";
|
||||||
@ -3604,7 +3604,7 @@ export namespace google.protobuf {
|
|||||||
return pb_1.Message.getField(this, 6) != null;
|
return pb_1.Message.getField(this, 6) != null;
|
||||||
}
|
}
|
||||||
get string_value() {
|
get string_value() {
|
||||||
return pb_1.Message.getFieldWithDefault(this, 7, new Uint8Array(0)) as Uint8Array;
|
return pb_1.Message.getFieldWithDefault(this, 7, new Uint8Array()) as Uint8Array;
|
||||||
}
|
}
|
||||||
set string_value(value: Uint8Array) {
|
set string_value(value: Uint8Array) {
|
||||||
pb_1.Message.setField(this, 7, value);
|
pb_1.Message.setField(this, 7, value);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: google/protobuf/duration.proto
|
* source: google/protobuf/duration.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as pb_1 from "google-protobuf";
|
import * as pb_1 from "google-protobuf";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: google/protobuf/timestamp.proto
|
* source: google/protobuf/timestamp.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as pb_1 from "google-protobuf";
|
import * as pb_1 from "google-protobuf";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: vulcanize/auction/v1beta1/genesis.proto
|
* source: vulcanize/auction/v1beta1/genesis.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: vulcanize/auction/v1beta1/query.proto
|
* source: vulcanize/auction/v1beta1/query.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: vulcanize/auction/v1beta1/tx.proto
|
* source: vulcanize/auction/v1beta1/tx.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: vulcanize/auction/v1beta1/types.proto
|
* source: vulcanize/auction/v1beta1/types.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: vulcanize/bond/v1beta1/bond.proto
|
* source: vulcanize/bond/v1beta1/bond.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: vulcanize/bond/v1beta1/genesis.proto
|
* source: vulcanize/bond/v1beta1/genesis.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: vulcanize/bond/v1beta1/query.proto
|
* source: vulcanize/bond/v1beta1/query.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: vulcanize/bond/v1beta1/tx.proto
|
* source: vulcanize/bond/v1beta1/tx.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: vulcanize/registry/v1beta1/genesis.proto
|
* source: vulcanize/registry/v1beta1/genesis.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: vulcanize/registry/v1beta1/query.proto
|
* source: vulcanize/registry/v1beta1/query.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./registry";
|
import * as dependency_1 from "./registry";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: vulcanize/registry/v1beta1/registry.proto
|
* source: vulcanize/registry/v1beta1/registry.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../google/protobuf/duration";
|
import * as dependency_1 from "./../../../google/protobuf/duration";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||||
* compiler version: 4.25.1
|
* compiler version: 3.12.4
|
||||||
* source: vulcanize/registry/v1beta1/tx.proto
|
* source: vulcanize/registry/v1beta1/tx.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as dependency_1 from "./../../../gogoproto/gogo";
|
import * as dependency_1 from "./../../../gogoproto/gogo";
|
||||||
|
19
src/types.ts
19
src/types.ts
@ -29,22 +29,17 @@ export class Record {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get attributes() {
|
get attributes() {
|
||||||
let a = new any.google.protobuf.Any();
|
|
||||||
|
|
||||||
if (this._record.type) {
|
var a = new any.google.protobuf.Any()
|
||||||
const namespace: any = attributes.vulcanize.registry.v1beta1;
|
|
||||||
if (!namespace[this._record.type]) {
|
|
||||||
throw new Error(`Class not found: ${this._record.type}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const value = namespace[this._record.type].fromObject(this._record);
|
if (this._record.type=="WebsiteRegistrationRecord"){
|
||||||
|
var attr= new attributes.vulcanize.registry.v1beta1.WebsiteRegistrationRecord(this._record)
|
||||||
a= new any.google.protobuf.Any({
|
a= new any.google.protobuf.Any({
|
||||||
type_url: `/vulcanize.registry.v1beta1.${this._record.type}`,
|
type_url: "/vulcanize.registry.v1beta1.WebsiteRegistrationRecord",
|
||||||
value: value.serialize(),
|
value: attr.serialize()
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
return a
|
||||||
return a;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3086,10 +3086,10 @@ protobufjs@~6.11.2:
|
|||||||
"@types/node" ">=13.7.0"
|
"@types/node" ">=13.7.0"
|
||||||
long "^4.0.0"
|
long "^4.0.0"
|
||||||
|
|
||||||
protoc-gen-ts@^0.8.7:
|
protoc-gen-ts@^0.8.5:
|
||||||
version "0.8.7"
|
version "0.8.5"
|
||||||
resolved "https://registry.yarnpkg.com/protoc-gen-ts/-/protoc-gen-ts-0.8.7.tgz#63e4d9af2ad30b753acf6f739323d01fc9f80b52"
|
resolved "https://registry.yarnpkg.com/protoc-gen-ts/-/protoc-gen-ts-0.8.5.tgz#5c277ff90b6b38f52313b1b0ad69e6c825305b29"
|
||||||
integrity sha512-jr4VJey2J9LVYCV7EVyVe53g1VMw28cCmYJhBe5e3YX5wiyiDwgxWxeDf9oTqAe4P1bN/YGAkW2jhlH8LohwiQ==
|
integrity sha512-LHZ+w/+DqmdgnhPtShgqtPtdv+hJ9bAXEIqNU0kkY2bPcCVIEWz5seOv20FCw6gbKorriTGP8xgz2RsIcrRvVw==
|
||||||
|
|
||||||
randombytes@^2.0.1, randombytes@^2.1.0:
|
randombytes@^2.0.1, randombytes@^2.1.0:
|
||||||
version "2.1.0"
|
version "2.1.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user