2022-02-14 21:54:38 +03:00
|
|
|
// Copyright © 2022 Tokenary. All rights reserved.
|
|
|
|
|
|
|
|
import Foundation
|
2022-05-07 23:06:17 +03:00
|
|
|
import WalletCore
|
2022-02-14 21:54:38 +03:00
|
|
|
|
|
|
|
enum DappRequestAction {
|
|
|
|
case none
|
|
|
|
case justShowApp
|
2022-07-13 17:11:10 +03:00
|
|
|
case switchAccount(SelectAccountAction)
|
2022-02-14 21:54:38 +03:00
|
|
|
case selectAccount(SelectAccountAction)
|
|
|
|
case approveMessage(SignMessageAction)
|
|
|
|
case approveTransaction(SendTransactionAction)
|
|
|
|
}
|
|
|
|
|
|
|
|
struct SelectAccountAction {
|
2022-08-23 18:00:48 +03:00
|
|
|
let peer: PeerMeta?
|
|
|
|
let coinType: CoinType?
|
|
|
|
var selectedAccounts: Set<SpecificWalletAccount>
|
2022-08-19 13:15:34 +03:00
|
|
|
let initiallyConnectedProviders: Set<Web3Provider>
|
2022-08-30 19:59:30 +03:00
|
|
|
var network: EthereumChain?
|
2022-08-31 16:05:23 +03:00
|
|
|
let source: Source
|
2022-08-19 13:56:49 +03:00
|
|
|
let completion: (EthereumChain?, [SpecificWalletAccount]?) -> Void
|
2022-08-31 16:05:23 +03:00
|
|
|
|
|
|
|
enum Source {
|
|
|
|
case walletConnect, safariExtension
|
|
|
|
}
|
2022-02-14 21:54:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
struct SignMessageAction {
|
|
|
|
let provider: Web3Provider
|
|
|
|
let subject: ApprovalSubject
|
2022-05-08 22:44:12 +03:00
|
|
|
let account: Account
|
2022-02-14 21:54:38 +03:00
|
|
|
let meta: String
|
|
|
|
let peerMeta: PeerMeta
|
|
|
|
let completion: (Bool) -> Void
|
|
|
|
}
|
|
|
|
|
|
|
|
struct SendTransactionAction {
|
|
|
|
let provider: Web3Provider
|
|
|
|
let transaction: Transaction
|
|
|
|
let chain: EthereumChain
|
2022-05-08 22:44:12 +03:00
|
|
|
let account: Account
|
2022-02-14 21:54:38 +03:00
|
|
|
let peerMeta: PeerMeta
|
|
|
|
let completion: (Transaction?) -> Void
|
|
|
|
}
|