Skip to content

Commit

Permalink
refactor(crypto)!: remove duplicate crypto unpack command
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `crypto unpack` command removed
Use `inspect` instead.
```diff
- aecli crypto unpack <tx-prefixed transaction>
+ aecli inspect <tx-prefixed transaction>
```
  • Loading branch information
davidyuk committed Apr 24, 2023
1 parent a0d9b05 commit 37b9965
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 23 deletions.
13 changes: 1 addition & 12 deletions src/commands/crypto.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Command } from 'commander';
import fs from 'fs-extra';
import { unpackTx, Tag, MemoryAccount } from '@aeternity/aepp-sdk';
import { print } from '../utils/print';
import { MemoryAccount } from '@aeternity/aepp-sdk';
import CliError from '../utils/CliError';
import { decryptKey } from '../utils/encrypt-key';
import { networkIdOption, passwordOption } from '../arguments';
Expand All @@ -28,14 +27,4 @@ program
console.log(await account.signTransaction(tx, { networkId }));
});

program
.command('unpack <tx>')
// ## Transaction Deserialization
// This helper function deserialized the transaction `tx` and prints the result.
.action((tx) => {
const unpackedTx = unpackTx(tx);
unpackedTx.txType = Tag[unpackedTx.tag];
print(unpackedTx);
});

export default program;
10 changes: 0 additions & 10 deletions test/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,4 @@ describe('Crypto Module', () => {
]);
expect(unpackTx(output).tag).to.equal(Tag.SignedTx);
});

it('unpacks transaction', async () => {
const output = await executeCrypto([
'unpack', 'tx_+F0MAaEB4TK48d23oE5jt/qWR5pUu8UlpTGn8bwM5JISGQMGf7ChAeEyuPHdt6BOY7f6lkeaVLvFJaUxp/G8DOSSEhkDBn+wiBvBbWdOyAAAhg9e1n8oAAABhHRlc3QLK3OW',
]);
expect(output).to.include('SpendTx');
expect(output).to.include('"recipientId": "ak_2iBPH7HUz3cSDVEUWiHg76MZJ6tZooVNBmmxcgVK6VV8KAE688"');
expect(output).to.include('"amount": "2000000000000000000"');
expect(output).to.include('"payload": "ba_dGVzdJVNWkk="');
});
});
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export async function executeProgram(program, args) {
const allArgs = [
...args.map((arg) => arg.toString()),
...[
'config', 'sign', 'unpack', 'select-node', 'select-compiler',
'config', 'sign', 'select-node', 'select-compiler',
].includes(args[0]) ? [] : ['--url', url],
...[
'compile', 'deploy', 'call', 'encode-calldata', 'decode-call-result',
Expand Down

0 comments on commit 37b9965

Please sign in to comment.