Skip to content

Commit

Permalink
Update FlowAccount.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
lmcmz committed Sep 19, 2024
1 parent 51d8954 commit ecbb0c1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Sources/Models/FlowAccount.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,30 @@ public extension Flow {
public let address: Address

/// The balance of account in `BigInt` type
public let balance: BigInt
public let balance: BigInt?

/// The list of public key in `Flow.AccountKey` type
public var keys: [AccountKey]

/// The dictionary of all cadence contracts
public var contracts: [String: Code]?

public init(address: Flow.Address, balance: BigInt, keys: [Flow.AccountKey], contracts: [String: Flow.Code]) {
public init(address: Flow.Address, balance: BigInt? = nil, keys: [Flow.AccountKey], contracts: [String: Flow.Code]? = nil) {
self.address = address
self.balance = balance
self.keys = keys
self.contracts = contracts
}

public init(address: Flow.Address, balance: UInt64, keys: [Flow.AccountKey], contracts: [String: Flow.Code]) {
public init(address: Flow.Address, balance: UInt64? = nil, keys: [Flow.AccountKey], contracts: [String: Flow.Code]? = nil) {
self.address = address
self.balance = BigInt(balance)
self.keys = keys
self.contracts = contracts
if let balance {
self.balance = BigInt(balance)
} else {
self.balance = nil
}
}

public init(from decoder: Decoder) throws {
Expand Down

0 comments on commit ecbb0c1

Please sign in to comment.