mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-26 23:25:49 +00:00
* sets up linting config and runs `yarn lint --fix` once, so that all changes will show up correctly in future PRs. * Note that there are still a lot of linter errors.
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import * as schemaValidator from "xrpl-local/common/schema-validator";
|
|
|
|
import Wallet from "../../src/Wallet";
|
|
import { TestSuite } from "../testUtils";
|
|
|
|
const publicKey =
|
|
"030E58CDD076E798C84755590AAF6237CA8FAE821070A59F648B517A30DC6F589D";
|
|
const privateKey =
|
|
"00141BA006D3363D2FB2785E8DF4E44D3A49908780CB4FB51F6D217C08C021429F";
|
|
const address = "rhvh5SrgBL5V8oeV9EpDuVszeJSSCEkbPc";
|
|
|
|
/**
|
|
* Every test suite exports their tests in the default object.
|
|
* - Check out the "TestSuite" type for documentation on the interface.
|
|
* - Check out "test/api/index.ts" for more information about the test runner.
|
|
*/
|
|
export default <TestSuite>{
|
|
"sign transaction offline with txJSON": async (api) => {
|
|
// GIVEN a transaction
|
|
const txJSON = {
|
|
TransactionType: "Payment",
|
|
Account: address,
|
|
Destination: "rQ3PTWGLCbPz8ZCicV5tCX3xuymojTng5r",
|
|
Amount: "20000000",
|
|
Sequence: 1,
|
|
Fee: "12",
|
|
SigningPubKey: publicKey,
|
|
};
|
|
const wallet = new Wallet(publicKey, privateKey);
|
|
|
|
// WHEN signing a transaction offline
|
|
const signedTx: { signedTransaction: string; id: string } =
|
|
wallet.signTransaction(txJSON);
|
|
|
|
// THEN we get a signedTransaction
|
|
schemaValidator.schemaValidate("sign", signedTx);
|
|
},
|
|
};
|