Skip to content
Snippets Groups Projects
Unverified Commit a15da80c authored by joe petrowski's avatar joe petrowski
Browse files

linting

parent eb286a46
Branches
No related merge requests found
......@@ -54,7 +54,7 @@ describe('decode', () => {
);
});
it('should decode signing payload', async done => {
it('should decode signing payload', done => {
const unsigned = balanceTransfer(TEST_TX_INFO);
const signingPayload = createSigningPayload(unsigned);
......@@ -69,7 +69,7 @@ describe('decode', () => {
'nonce',
// 'specVersion',
'tip',
'to',
'to'
] as const).forEach(key => expect(txInfo[key]).toBe(TEST_TX_INFO[key]));
expect(txInfo.validityPeriod).toBeGreaterThanOrEqual(
......
......@@ -29,17 +29,19 @@ export function decode(signedTx: string, metadataRpc: string): DecodedSignedTx;
* @param metadataRpc - The SCALE-encoded metadata, as a hex string. Can be
* retrieved via the RPC call `state_getMetadata`.
*/
export function decode(signingPayload: string, metadataRpc: string): DecodedSigningPayload;
export function decode(
signingPayload: string,
metadataRpc: string
): DecodedSigningPayload;
export function decode(
data: string | UnsignedTransaction,
metadataRpc: string
): DecodedSignedTx | TxInfo | DecodedSigningPayload {
if (typeof data === 'string') {
var decodedInfo: DecodedSigningPayload | DecodedSignedTx;
let decodedInfo: DecodedSigningPayload | DecodedSignedTx;
try {
decodedInfo = decodeSigningPayload(data, metadataRpc);
}
catch {
} catch {
decodedInfo = decodeSignedTx(data, metadataRpc);
}
return decodedInfo;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment