Skip to content

Commit

Permalink
changed it to list details
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebuehler committed Feb 3, 2022
1 parent f169ca5 commit 1dda68b
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 64 deletions.
52 changes: 52 additions & 0 deletions cmds/list_cmds/details.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const ob = require('urbit-ob')
const ajs = require('azimuth-js')
const {validate, eth} = require('../../utils')

exports.command = 'details <point>'
exports.desc = 'Outputs various information about a <point>. Such as owner and proxy addresses.'
exports.builder = (yargs) =>{
}

exports.handler = async function (argv) {
const ctx = await eth.createContext(argv);
const p = validate.point(argv.point, true);
const patp = ob.patp(p);
console.log(`urbit ID (patp): ${patp}`);
console.log(`urbit ID number (p): ${p}`);

const shipType = ob.clan(patp);
console.log(`ship type: ${shipType}`);

const parentPatp = ob.sein(patp);
const parentP = ob.patp2dec(parentPatp);
console.log(`parent: ${parentPatp}`);

const sponsorP = await ajs.azimuth.getSponsor(ctx.contracts, p);
const sponsorPatp = ob.patp(sponsorP);
const hasSponsor = await ajs.azimuth.hasSponsor(ctx.contracts, p);
console.log(`sponsor: ${hasSponsor ? sponsorPatp : 'null'}`);

const ownerAddress = sanitizeAddress(await ajs.azimuth.getOwner(ctx.contracts, p));
console.log(`owner address: ${ownerAddress}`);

const spawnProxyAddress = sanitizeAddress(await ajs.azimuth.getSpawnProxy(ctx.contracts, p));
console.log(`spawn proxy address: ${spawnProxyAddress}`);

const networkKeysSet = await ajs.azimuth.hasBeenLinked(ctx.contracts, p);
console.log(`network keys set: ${networkKeysSet}`);
const networkKeysRevision = await ajs.azimuth.getKeyRevisionNumber(ctx.contracts, p);
console.log(`network keys revision: ${networkKeysRevision}`);

const continuityNumber = await ajs.azimuth.getContinuityNumber(ctx.contracts, p);
console.log(`continuity number: ${continuityNumber}`);

const spawnedChildrenCount = await ajs.azimuth.getSpawnCount(ctx.contracts, p);
console.log(`spawned children: ${spawnedChildrenCount}`);
}

function sanitizeAddress(address){
if(address && !ajs.utils.addressEquals('0x0000000000000000000000000000000000000000', address)){
return address.toLowerCase();
}
return null;
}
21 changes: 0 additions & 21 deletions cmds/list_cmds/owner-of.js

This file was deleted.

21 changes: 0 additions & 21 deletions cmds/list_cmds/spawn-proxy-of.js

This file was deleted.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 4 additions & 21 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,27 +211,10 @@ describe('#list', async function() {
});
});

describe('owner-of zod', async function() {
it('should list owner address of zod', async function() {
let output = await execCliAndGetLines('list', 'owner-of', galaxy, ...baseArgs);
expect(output).to.have.lengthOf(1);
assert.isTrue(ajs.utils.addressEquals(output[0], ac0), `output addr: ${output[0]}, owner addr: ${ac0}`);
});
});

describe('owner-of unspawned', async function() {
it('should say that there is no owner yet', async function() {
let output = await execCliAndGetLines('list', 'owner-of', planet1d, ...baseArgs);
expect(output).to.have.lengthOf(1);
assert.isTrue(output[0].startsWith('Point'), `output: ${output[0]}`);
});
});

describe('spawn-proxy-of zod', async function() {
it('should say that there is no spawn proxy set', async function() {
let output = await execCliAndGetLines('list', 'spawn-proxy-of', galaxy, ...baseArgs);
expect(output).to.have.lengthOf(1);
assert.isTrue(output[0].startsWith('Point'), `output: ${output[0]}`);
describe('details zod', async function() {
it('should list details about zod', async function() {
let output = await execCliAndGetLines('list', 'details', galaxy, ...baseArgs);
expect(output).to.have.lengthOf.at.least(10);
});
});

Expand Down

0 comments on commit 1dda68b

Please sign in to comment.