Skip to content

Commit

Permalink
fix: show name pointers line by line
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Apr 17, 2023
1 parent dae4df9 commit 9dbcf41
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/utils/print.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ function printNameUpdateTransaction(tx = {}, tabs = '') {
printUnderscored(`${tabs}Client TTL`, tx?.tx?.clientTtl ?? 'N/A');
printUnderscored(`${tabs}Name ID`, tx?.tx?.nameId ?? 'N/A');
printUnderscored(`${tabs}Name TTL`, tx?.tx?.nameTtl ?? 'N/A');
printUnderscored(`${tabs}Pointers`, JSON.stringify(tx?.tx?.pointers) ?? 'N/A');
const pointers = tx?.tx?.pointers;
if (pointers?.length) pointers.forEach(({ key, id }) => printUnderscored(`Pointer ${key}`, id));
else printUnderscored('Pointers', 'N/A');

printUnderscored(`${tabs}Fee`, tx?.tx?.fee ?? 'N/A');
printUnderscored(`${tabs}Nonce`, tx?.tx?.nonce ?? 'N/A');
Expand Down Expand Up @@ -370,6 +372,7 @@ export function printName(name, json) {
}
printUnderscored('Status', name.status ?? 'N/A');
printUnderscored('Name hash', name.id ?? 'N/A');
printUnderscored('Pointers', JSON.stringify(name.pointers) ?? 'N/A');
if (name.pointers?.length) name.pointers.forEach(({ key, id }) => printUnderscored(`Pointer ${key}`, id));
else printUnderscored('Pointers', 'N/A');
printUnderscored('TTL', name.ttl ?? 0);
}
4 changes: 3 additions & 1 deletion test/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,9 @@ TTL _____________________________________ 0
expect(res).to.equal(`
Status __________________________________ CLAIMED
Name hash _______________________________ ${resJson.id}
Pointers ________________________________ [{"key":"myKey","id":"${sdk.address}"},{"key":"account_pubkey","id":"${sdk.address}"},{"key":"oracle_pubkey","id":"${sdk.address}"}]
Pointer myKey ___________________________ ${sdk.address}
Pointer account_pubkey __________________ ${sdk.address}
Pointer oracle_pubkey ___________________ ${sdk.address}
TTL _____________________________________ ${resJson.ttl}
`.trim());
}).timeout(4000);
Expand Down
2 changes: 1 addition & 1 deletion test/tx.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ Account _________________________________ ${TX_KEYS.publicKey}
Client TTL ______________________________ 84600
Name ID _________________________________ ${nameId}
Name TTL ________________________________ 180000
Pointers ________________________________ [{"key":"account_pubkey","id":"${TX_KEYS.publicKey}"}]
Pointer account_pubkey __________________ ${TX_KEYS.publicKey}
Fee _____________________________________ 17800000000000
Nonce ___________________________________ ${nonce}
TTL _____________________________________ N/A
Expand Down

0 comments on commit 9dbcf41

Please sign in to comment.