diff --git a/Sources/VIZ/Client.swift b/Sources/VIZ/Client.swift index d349eeb..1a24b71 100644 --- a/Sources/VIZ/Client.swift +++ b/Sources/VIZ/Client.swift @@ -260,6 +260,7 @@ public class Client { urlRequest.setValue("swift-viz/1.0", forHTTPHeaderField: "User-Agent") urlRequest.httpMethod = "POST" urlRequest.httpBody = try encoder.encode(payload) +// print(String(data:urlRequest.httpBody!, encoding: .utf8)) return urlRequest } diff --git a/Sources/VIZ/Operation.swift b/Sources/VIZ/Operation.swift index 42d6022..ddb20b1 100644 --- a/Sources/VIZ/Operation.swift +++ b/Sources/VIZ/Operation.swift @@ -183,12 +183,12 @@ public struct Operation { /// Updates an account. public struct AccountUpdate: OperationType, Equatable { public var account: String - public var master: Authority? public var masterIsSet: Bool - public var active: Authority? + public var master: Authority? public var activeIsSet: Bool - public var regular: Authority? + public var active: Authority? public var regularIsSet: Bool + public var regular: Authority? public var memoKey: PublicKey public var jsonMetadata: String diff --git a/Sources/VIZ/Transaction.swift b/Sources/VIZ/Transaction.swift index 3baafb6..abb7dd3 100644 --- a/Sources/VIZ/Transaction.swift +++ b/Sources/VIZ/Transaction.swift @@ -55,6 +55,7 @@ public struct Transaction: _Transaction { public func digest(forChain chain: ChainId = .mainNet) throws -> Data { var data = chain.data data.append(try VIZEncoder.encode(self)) +// print(data.hexEncodedString()) return data.sha256Digest() } } diff --git a/Tests/IntegrationTests/API.swift b/Tests/IntegrationTests/API.swift index 8471b8c..fe4678a 100644 --- a/Tests/IntegrationTests/API.swift +++ b/Tests/IntegrationTests/API.swift @@ -85,7 +85,6 @@ class ClientTest: XCTestCase { func testAccountUpdate() { let test = expectation(description: "Response") - let key = PrivateKey("5HvwFjGA5QWNXiB8nSCKW2dDjVPBJcrkcpprsViS1YBBcozpmbk")! let accountName = "microb" let password = "some random generated string" @@ -103,7 +102,7 @@ class ClientTest: XCTestCase { let memoPublicKey = PrivateKey(seed: accountName + "memo" + password)!.createPublic() - let accountUpdate = VIZ.Operation.AccountUpdate(account: accountName, masterAuthority: nil, activeAuthority: nil, regularAuthority: nil, memoKey: memoPublicKey) + let accountUpdate = VIZ.Operation.AccountUpdate(account: accountName, master: masterAuthority, active: activeAuthority, regular: regularAuthority, memoKey: memoPublicKey) client.send(API.GetDynamicGlobalProperties()) { props, error in XCTAssertNil(error) guard let props = props else { @@ -117,7 +116,7 @@ class ClientTest: XCTestCase { operations: [accountUpdate] ) - guard let stx = try? tx.sign(usingKey: key) else { + guard let stx = try? tx.sign(usingKey: masterKey) else { return XCTFail("Unable to sign tx") } let trx = API.BroadcastTransaction(transaction: stx)