Add initializers for new operations

This commit is contained in:
Vladimir Babin 2021-02-27 01:01:06 +05:00
parent 324ad26114
commit 1b903d476c
1 changed files with 28 additions and 14 deletions

View File

@ -801,6 +801,34 @@ public struct Operation {
get { return self.jsonMetadata.object }
}
}
public struct Award: OperationType, Equatable {
public let initiator: String
public let receiver: String
public let energy: UInt16
public let customSequence: UInt64
public let memo: String
public let beneficiaries: [Beneficiary]
public init(initiator: String, receiver: String, energy: UInt16, customSequence: UInt64, memo: String, beneficiaries: [Operation.Beneficiary]) {
self.initiator = initiator
self.receiver = receiver
self.energy = energy
self.customSequence = customSequence
self.memo = memo
self.beneficiaries = beneficiaries
}
}
public struct Beneficiary: OperationType, Equatable {
public let account: String
public let weight: UInt16
public init(account: String, weight: UInt16) {
self.account = account
self.weight = weight
}
}
// Virtual operations.
@ -910,20 +938,6 @@ public struct Operation {
public let producer: String
public let vestingShares: Asset
}
public struct Award: OperationType, Equatable {
public let initiator: String
public let receiver: String
public let energy: UInt16
public let customSequence: UInt64
public let memo: String
public let beneficiaries: [Beneficiary]
}
public struct Beneficiary: OperationType, Equatable {
public let account: String
public let weight: UInt16
}
/// Unknown operation, seen if the decoder encounters operation which has no type defined.
/// - Note: Not encodable, the encoder will throw if encountering this operation.