-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from XYOracleNetwork/feature/archivist-insert
Feature/archivist insert
- Loading branch information
Showing
21 changed files
with
227 additions
and
80 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"cSpell.words": ["Alamofire", "keccak", "secp"] | ||
"cSpell.words": ["Alamofire", "keccak", "secp", "unkeyed"] | ||
} |
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,8 @@ | ||
import Foundation | ||
|
||
public protocol AccountInstance { | ||
var address: String? { get } | ||
var addressBytes: Data? { get } | ||
var previousHash: String? { get } | ||
func sign(hash: String) throws -> String? | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
public class XyoApiConfig { | ||
public class ApiConfig { | ||
var apiDomain: String | ||
var token: String? | ||
|
||
|
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
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
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
open class AbstractModule: Module { | ||
|
||
private let _account: XyoAddress | ||
|
||
public var account: AccountInstance { | ||
_account | ||
} | ||
|
||
public var address: String? { | ||
_account.addressHex | ||
} | ||
|
||
public var previousHash: String? { | ||
_account.previousHash | ||
} | ||
|
||
public init(account: XyoAddress? = nil) { | ||
self._account = account ?? XyoAddress() | ||
} | ||
} |
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,5 @@ | ||
public protocol Module { | ||
var address: String? { get } | ||
var account: AccountInstance { get } | ||
var previousHash: String? { get } | ||
} |
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,32 @@ | ||
import Foundation | ||
|
||
public class ModuleQueryResult: Encodable, Decodable { | ||
var bw: XyoBoundWitnessJson | ||
var payloads: [XyoPayload] | ||
var errors: [XyoPayload] | ||
init(bw: XyoBoundWitnessJson, payloads: [XyoPayload] = [], errors: [XyoPayload] = []) { | ||
self.bw = bw | ||
self.payloads = payloads | ||
self.errors = errors | ||
} | ||
public func encode(to encoder: Encoder) throws { | ||
// Create an unkeyed container for array encoding | ||
var container = encoder.unkeyedContainer() | ||
// Encode `bw` as the first element | ||
try container.encode(bw) | ||
// Encode `payloads` as the second element | ||
try container.encode(payloads) | ||
// Encode `errors` as the third element | ||
try container.encode(errors) | ||
} | ||
public required init(from decoder: Decoder) throws { | ||
var container = try decoder.unkeyedContainer() | ||
// Decode elements in the expected order from the array | ||
bw = try container.decode(XyoBoundWitnessJson.self) | ||
// TODO: Decodable Payloads | ||
// payloads = try container.decode([XyoPayload].self) | ||
// errors = try container.decode([XyoPayload].self) | ||
payloads = [] | ||
errors = [] | ||
} | ||
} |
Oops, something went wrong.