-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix waves output json * compare whole json * Fix codacy warnigns * Fix codacy
- Loading branch information
1 parent
3f77d9c
commit 9e3dbbe
Showing
5 changed files
with
45 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,4 @@ SPEC CHECKSUMS: | |
|
||
PODFILE CHECKSUM: cbcc5bab5b64fa9f7863e62cc106d25d3fc1dfc5 | ||
|
||
COCOAPODS: 1.7.1 | ||
COCOAPODS: 1.7.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright © 2017-2019 Trust Wallet. | ||
// | ||
// This file is part of Trust. The full Trust copyright notice, including | ||
// terms governing use, modification, and redistribution, is contained in the | ||
// file LICENSE at the root of the source code distribution tree. | ||
|
||
import XCTest | ||
import TrustWalletCore | ||
|
||
class WavesTests: XCTestCase { | ||
|
||
func testSigner() throws { | ||
|
||
let privateKey = PrivateKey(data: Data(hexString: "68b7a9adb4a655b205f43dac413803785921e22cd7c4d05857b203a62621075f")!)! | ||
|
||
let input = WavesSigningInput.with { | ||
$0.amount = 100_000_000 | ||
$0.asset = "DacnEpaUVFRCYk8Fcd1F3cqUZuT4XG7qW9mRyoZD81zq" | ||
$0.fee = 100_000 | ||
$0.feeAsset = "DacnEpaUVFRCYk8Fcd1F3cqUZuT4XG7qW9mRyoZD81zq" | ||
$0.to = "3PPCZQkvdMJpmx7Zrz1cnYsPe9Bt1XT2Ckx" | ||
$0.attachment = Data(hexString: "0x68656c6c6f")! | ||
$0.timestamp = 1559146613 | ||
$0.privateKey = privateKey.data | ||
} | ||
|
||
let output = WavesSigner.sign(input: input) | ||
guard let json = try JSONSerialization.jsonObject(with: output.json.data(using: .utf8)!, options: []) as? [String: Any] else { | ||
XCTFail("unable to decode json") | ||
return | ||
} | ||
XCTAssertNotNil(json["proofs"] as? [String]) | ||
// swiftlint:disable line_length | ||
XCTAssertEqual(output.json, "{\"amount\":100000000,\"assetId\":\"DacnEpaUVFRCYk8Fcd1F3cqUZuT4XG7qW9mRyoZD81zq\",\"attachment\":\"Cn8eVZg\",\"fee\":100000,\"feeAssetId\":\"DacnEpaUVFRCYk8Fcd1F3cqUZuT4XG7qW9mRyoZD81zq\",\"proofs\":[\"2sKtLEXdvK3Yy94S7ypdVyCkUc7BT7RgG6xzLd8qr1NUE24iXcnu1MYF4HKMXRsxnP3akgVS25V3Xet9auv1evte\"],\"recipient\":\"3PPCZQkvdMJpmx7Zrz1cnYsPe9Bt1XT2Ckx\",\"senderPublicKey\":\"9AXmkhYSNGev6iUfR1oJ9X1SjqKsqp518TriHiLLHuKA\",\"timestamp\":1559146613,\"type\":4,\"version\":2}") | ||
XCTAssertEqual(output.signature.hexString, "5d6a77b1fd9b53d9735cd2543ba94215664f2b07d6c7befb081221fcd49f5b6ad6b9ac108582e8d3e74943bdf35fd80d985edf4b4de1fb1c5c427e84d0879f8f") | ||
// swiftlint:enable line_length | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters