Skip to content

Commit

Permalink
Merge pull request #3434 from safe-global/GH-3428/preload-chains
Browse files Browse the repository at this point in the history
Gh 3428/preload chains
  • Loading branch information
DmitryBespalov authored Jul 1, 2024
2 parents 48aaef6 + b5a5c4f commit f0d31c8
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion Multisig/Features/Data Export/ImportExportDataController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,27 @@ class ImportExportDataController {

let MAX_NAME_LENGTH = 500

// chains

func loadChains() async -> [SCGModels.Chain] {
await withCheckedContinuation { continuation in
App.shared.clientGatewayService.asyncChains { result in
do {
let results = try result.get()
continuation.resume(returning: results.results)
} catch {
continuation.resume(returning: [])
}
}
}
}

let chains = await loadChains()
for chain in chains {
Chain.createOrUpdate(chain)
}
NotificationCenter.default.post(name: .chainInfoChanged, object: nil)


// safes
let safes: [SerializedDataFile.SerializedSafe] = file.data.safes
Expand Down Expand Up @@ -373,7 +393,11 @@ class ImportExportDataController {

let name = str(safe.name, MAX_NAME_LENGTH)

Safe.create(address: address.checksummed, version: version, name: name, chain: chain)
let cdSafe = Safe.create(address: address.checksummed, version: version, name: name, chain: chain)
cdSafe.update(from: info)

App.shared.notificationHandler.safeAdded(address: address)

}

// keys
Expand Down

0 comments on commit f0d31c8

Please sign in to comment.