Update parameters order

This commit is contained in:
Vladimir Babin 2021-03-30 11:09:09 +05:00
parent 16789ed2d7
commit d35b1327cc
4 changed files with 7 additions and 6 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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()
}
}

View File

@ -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)