Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
crystalin committed May 25, 2023
1 parent 461cea7 commit 921d083
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 34 deletions.
1 change: 0 additions & 1 deletion src/methods/createTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export async function createTx(
} = {};
const signer = {
signPayload: async (payload: SignerPayloadJSON) => {

// Forces the address to be the same as the one provided.
// Otherwise it would be using SS58Prefix 0
payload.address = address;
Expand Down
5 changes: 2 additions & 3 deletions src/methods/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import prompts from "prompts";
import fs from "fs";
import { NetworkType } from "./types";

import knownSubstrate from '@substrate/ss58-registry';

import knownSubstrate from "@substrate/ss58-registry";

function getSigner(
keyring: Keyring,
Expand Down Expand Up @@ -47,7 +46,7 @@ function signFile(type: NetworkType, file: string, privKeyOrMnemonic: string, de
throw new Error("Invalid decoded address checksum");
}
ss58Prefix = ss58Decoded;
ss58Network = knownSubstrate.find(s => s.prefix === ss58Prefix)?.network || "unkown";
ss58Network = knownSubstrate.find((s) => s.prefix === ss58Prefix)?.network || "unkown";
keyring.setSS58Format(ss58Decoded);
}

Expand Down
58 changes: 29 additions & 29 deletions test/samples/sample-1.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"message": "0x1d010040c4301003d5d109819d51372edf6d0477ce8e3c13f98f951b7926003e5e632f0000000000d50200009a2400001400000091b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3a973beb861564605da73e5773e1053fef25903e475761229ca39f05a4234b80b",
"payload": {
"specVersion": "0x0000249a",
"transactionVersion": "0x00000014",
"address": "5EcFvNvYgK351fXoFY3CrurAZqpzFe5AXgEVyC1GE33WtJbt",
"blockHash": "0xa973beb861564605da73e5773e1053fef25903e475761229ca39f05a4234b80b",
"blockNumber": "0x00ef406d",
"era": "0xd502",
"genesisHash": "0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3",
"method": "0x1d010040c4301003d5d109819d51372edf6d0477ce8e3c13f98f951b7926003e5e632f0000000000",
"nonce": "0x00000000",
"signedExtensions": [
"CheckNonZeroSender",
"CheckSpecVersion",
"CheckTxVersion",
"CheckGenesis",
"CheckMortality",
"CheckNonce",
"CheckWeight",
"ChargeTransactionPayment",
"PrevalidateAttests"
],
"tip": "0x00000000000000000000000000000000",
"version": 4
},
"_extra": {
"command": "./moonbeam-signer-linux create --network polkadot --tx proxy.addProxy --params '[\"12TvLz5jAFCrCPWHZw6VWZJ63hxLwh15wxnatwfEZASCxAt2\", \"Any\", 0]' --address 5EcFvNvYgK351fXoFY3CrurAZqpzFe5AXgEVyC1GE33WtJbt --file sample-1"
}
}
"message": "0x1d010040c4301003d5d109819d51372edf6d0477ce8e3c13f98f951b7926003e5e632f0000000000d50200009a2400001400000091b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3a973beb861564605da73e5773e1053fef25903e475761229ca39f05a4234b80b",
"payload": {
"specVersion": "0x0000249a",
"transactionVersion": "0x00000014",
"address": "5EcFvNvYgK351fXoFY3CrurAZqpzFe5AXgEVyC1GE33WtJbt",
"blockHash": "0xa973beb861564605da73e5773e1053fef25903e475761229ca39f05a4234b80b",
"blockNumber": "0x00ef406d",
"era": "0xd502",
"genesisHash": "0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3",
"method": "0x1d010040c4301003d5d109819d51372edf6d0477ce8e3c13f98f951b7926003e5e632f0000000000",
"nonce": "0x00000000",
"signedExtensions": [
"CheckNonZeroSender",
"CheckSpecVersion",
"CheckTxVersion",
"CheckGenesis",
"CheckMortality",
"CheckNonce",
"CheckWeight",
"ChargeTransactionPayment",
"PrevalidateAttests"
],
"tip": "0x00000000000000000000000000000000",
"version": 4
},
"_extra": {
"command": "./moonbeam-signer-linux create --network polkadot --tx proxy.addProxy --params '[\"12TvLz5jAFCrCPWHZw6VWZJ63hxLwh15wxnatwfEZASCxAt2\", \"Any\", 0]' --address 5EcFvNvYgK351fXoFY3CrurAZqpzFe5AXgEVyC1GE33WtJbt --file sample-1"
}
}
2 changes: 1 addition & 1 deletion test/sign.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe("Signature - file", function () {
const { signature } = JSON.parse(originalSample);
assert.equal(signature, null);
});

after("Restore sample", async function () {
fs.writeFileSync(FILE_SAMPLE_1, originalSample);
});
Expand Down

0 comments on commit 921d083

Please sign in to comment.