diff --git a/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start.xcodeproj/project.pbxproj b/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start.xcodeproj/project.pbxproj index 9574f6c3..acf80f58 100644 --- a/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start.xcodeproj/project.pbxproj +++ b/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start.xcodeproj/project.pbxproj @@ -7,8 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 284712222BFB94220088411D /* MpcProviderSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 284712212BFB94220088411D /* MpcProviderSwift */; }; - 284712242BFB94450088411D /* Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 284712232BFB94450088411D /* Extension.swift */; }; 284712272BFB97FE0088411D /* mpc-core-kit-swift in Frameworks */ = {isa = PBXBuildFile; productRef = 284712262BFB97FE0088411D /* mpc-core-kit-swift */; }; 284BE5FE2BC509500049C203 /* mpc_core_kit_ios_quick_startApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 284BE5FD2BC509500049C203 /* mpc_core_kit_ios_quick_startApp.swift */; }; 284BE6002BC509500049C203 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 284BE5FF2BC509500049C203 /* ContentView.swift */; }; @@ -22,7 +20,6 @@ 284BE6322BC50C4A0049C203 /* UserStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 284BE6312BC50C4A0049C203 /* UserStorage.swift */; }; 284BE6342BC512A80049C203 /* RecoveryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 284BE6332BC512A80049C203 /* RecoveryView.swift */; }; 284BE6362BC512B20049C203 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 284BE6352BC512B20049C203 /* HomeView.swift */; }; - 284BE63E2BC55A080049C203 /* EthereumHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 284BE63D2BC55A080049C203 /* EthereumHelper.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -43,7 +40,6 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 284712232BFB94450088411D /* Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extension.swift; sourceTree = ""; }; 284BE5FA2BC509500049C203 /* mpc-core-kit-ios-quick-start.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "mpc-core-kit-ios-quick-start.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 284BE5FD2BC509500049C203 /* mpc_core_kit_ios_quick_startApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = mpc_core_kit_ios_quick_startApp.swift; sourceTree = ""; }; 284BE5FF2BC509500049C203 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; @@ -59,7 +55,6 @@ 284BE6312BC50C4A0049C203 /* UserStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserStorage.swift; sourceTree = ""; }; 284BE6332BC512A80049C203 /* RecoveryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecoveryView.swift; sourceTree = ""; }; 284BE6352BC512B20049C203 /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = ""; }; - 284BE63D2BC55A080049C203 /* EthereumHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EthereumHelper.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -67,7 +62,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 284712222BFB94220088411D /* MpcProviderSwift in Frameworks */, 284712272BFB97FE0088411D /* mpc-core-kit-swift in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -170,8 +164,6 @@ isa = PBXGroup; children = ( 284BE6312BC50C4A0049C203 /* UserStorage.swift */, - 284BE63D2BC55A080049C203 /* EthereumHelper.swift */, - 284712232BFB94450088411D /* Extension.swift */, ); path = Helpers; sourceTree = ""; @@ -193,7 +185,6 @@ ); name = "mpc-core-kit-ios-quick-start"; packageProductDependencies = ( - 284712212BFB94220088411D /* MpcProviderSwift */, 284712262BFB97FE0088411D /* mpc-core-kit-swift */, ); productName = "mpc-core-kit-ios-quick-start"; @@ -269,7 +260,6 @@ ); mainGroup = 284BE5F12BC509500049C203; packageReferences = ( - 284712202BFB94220088411D /* XCRemoteSwiftPackageReference "MpcProviderSwift" */, 284712252BFB97FE0088411D /* XCRemoteSwiftPackageReference "mpc-core-kit-swift" */, ); productRefGroup = 284BE5FB2BC509500049C203 /* Products */; @@ -314,14 +304,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 284712242BFB94450088411D /* Extension.swift in Sources */, 284BE62D2BC50A1F0049C203 /* LoginView.swift in Sources */, 284BE6362BC512B20049C203 /* HomeView.swift in Sources */, 284BE6002BC509500049C203 /* ContentView.swift in Sources */, 284BE5FE2BC509500049C203 /* mpc_core_kit_ios_quick_startApp.swift in Sources */, 284BE6342BC512A80049C203 /* RecoveryView.swift in Sources */, 284BE62F2BC50A310049C203 /* MainViewModel.swift in Sources */, - 284BE63E2BC55A080049C203 /* EthereumHelper.swift in Sources */, 284BE6322BC50C4A0049C203 /* UserStorage.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -654,30 +642,17 @@ /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ - 284712202BFB94220088411D /* XCRemoteSwiftPackageReference "MpcProviderSwift" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/tkey/MpcProviderSwift"; - requirement = { - branch = main; - kind = branch; - }; - }; 284712252BFB97FE0088411D /* XCRemoteSwiftPackageReference "mpc-core-kit-swift" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/tkey/mpc-core-kit-swift"; requirement = { - branch = main; + branch = update_dependencies; kind = branch; }; }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ - 284712212BFB94220088411D /* MpcProviderSwift */ = { - isa = XCSwiftPackageProductDependency; - package = 284712202BFB94220088411D /* XCRemoteSwiftPackageReference "MpcProviderSwift" */; - productName = MpcProviderSwift; - }; 284712262BFB97FE0088411D /* mpc-core-kit-swift */ = { isa = XCSwiftPackageProductDependency; package = 284712252BFB97FE0088411D /* XCRemoteSwiftPackageReference "mpc-core-kit-swift" */; diff --git a/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 6c08f666..4729ba26 100644 --- a/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,15 +1,6 @@ { - "originHash" : "d4e2e31ed5983dc7f95752b5f7cec96879f6838af173debe46909665a1b9adab", + "originHash" : "a1509d2a856212180557fe4f56258427a69e92170ff9076780949a6bad766059", "pins" : [ - { - "identity" : "anycodable", - "kind" : "remoteSourceControl", - "location" : "https://github.com/Flight-School/AnyCodable", - "state" : { - "revision" : "862808b2070cd908cb04f9aafe7de83d35f81b05", - "version" : "0.6.7" - } - }, { "identity" : "bigint", "kind" : "remoteSourceControl", @@ -33,8 +24,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/torusresearch/customauth-swift-sdk", "state" : { - "revision" : "60b48acb161fb4341c353c27bc6dd96af76887ff", - "version" : "10.0.1" + "branch" : "features_update", + "revision" : "576139ce446e397bce4f2b68b9b7d28ab5b0082f" } }, { @@ -42,17 +33,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/torusresearch/fetch-node-details-swift.git", "state" : { - "revision" : "22bfadf7491d77a0bc1953af002cadbd61383e7d", - "version" : "6.0.2" - } - }, - { - "identity" : "generic-json-swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/iwill/generic-json-swift", - "state" : { - "revision" : "0a06575f4038b504e78ac330913d920f1630f510", - "version" : "2.0.2" + "revision" : "4bd96c33ba8d02d9e27190c5c7cedf09cfdfd656", + "version" : "6.0.3" } }, { @@ -78,26 +60,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/tkey/mpc-core-kit-swift", "state" : { - "branch" : "main", - "revision" : "183f205cb24ff8aa9c6c59bea905f365fe03d34e" - } - }, - { - "identity" : "mpcproviderswift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/tkey/MpcProviderSwift", - "state" : { - "branch" : "main", - "revision" : "f087b89ee543710fc23b35dc05fa233b1d16b7e1" - } - }, - { - "identity" : "secp256k1.swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/GigaBitcoin/secp256k1.swift.git", - "state" : { - "revision" : "9683e8e311c76d8114cd308b697dad2f9fc58fed", - "version" : "0.17.0" + "branch" : "update_dependencies", + "revision" : "ac05a42d98d26ee4a24ade9e3bd3f483eb844743" } }, { @@ -114,8 +78,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Web3Auth/single-factor-auth-swift", "state" : { - "revision" : "73c5066d369c7d2aa1057c56a89b7f1dcdda3270", - "version" : "5.0.0" + "branch" : "7.0.0", + "revision" : "d9a8fd7885e37e74e61010f8fb240cbbafd1e577" } }, { @@ -136,103 +100,13 @@ "version" : "4.0.6" } }, - { - "identity" : "swift-atomics", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-atomics.git", - "state" : { - "revision" : "cd142fd2f64be2100422d658e7411e39489da985", - "version" : "1.2.0" - } - }, - { - "identity" : "swift-collections", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-collections.git", - "state" : { - "revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb", - "version" : "1.1.0" - } - }, - { - "identity" : "swift-http-types", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-http-types", - "state" : { - "revision" : "9bee2fdb79cc740081abd8ebd80738063d632286", - "version" : "1.1.0" - } - }, - { - "identity" : "swift-log", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-log.git", - "state" : { - "revision" : "e97a6fcb1ab07462881ac165fdbb37f067e205d5", - "version" : "1.5.4" - } - }, - { - "identity" : "swift-nio", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-nio.git", - "state" : { - "revision" : "359c461e5561d22c6334828806cc25d759ca7aa6", - "version" : "2.65.0" - } - }, - { - "identity" : "swift-nio-extras", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-nio-extras.git", - "state" : { - "revision" : "a3b640d7dc567225db7c94386a6e71aded1bfa63", - "version" : "1.22.0" - } - }, - { - "identity" : "swift-nio-http2", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-nio-http2.git", - "state" : { - "revision" : "c6afe04165c865faaa687b42c32ed76dfcc91076", - "version" : "1.31.0" - } - }, - { - "identity" : "swift-nio-ssl", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-nio-ssl.git", - "state" : { - "revision" : "7c381eb6083542b124a6c18fae742f55001dc2b5", - "version" : "2.26.0" - } - }, - { - "identity" : "swift-nio-transport-services", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-nio-transport-services.git", - "state" : { - "revision" : "38ac8221dd20674682148d6451367f89c2652980", - "version" : "1.21.0" - } - }, - { - "identity" : "swift-system", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-system.git", - "state" : { - "revision" : "f9266c85189c2751589a50ea5aec72799797e471", - "version" : "1.3.0" - } - }, { "identity" : "tkey-mpc-swift", "kind" : "remoteSourceControl", "location" : "https://github.com/tkey/tkey-mpc-swift", "state" : { - "revision" : "8fe0cc8d5cc2ad5d38bf068bc29f6af7e3146d08", - "version" : "3.0.0" + "branch" : "update_features", + "revision" : "00ed189447df83681092aabd5c64e65671ccd0d1" } }, { @@ -240,8 +114,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/torusresearch/torus-utils-swift.git", "state" : { - "revision" : "ff85c3e96bfa29013309b487875c4d9383e4ac80", - "version" : "8.1.1" + "revision" : "23083bf8196d1f78c05b085ba8347f94734b1a16", + "version" : "9.0.1" } }, { @@ -252,24 +126,6 @@ "revision" : "40246d5e3ff1d2c97d41846576f7a81d58858981", "version" : "4.0.0" } - }, - { - "identity" : "web3.swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/argentlabs/web3.swift", - "state" : { - "revision" : "1e75f98a5738c470b23bbfffa9314e9f788df76b", - "version" : "1.6.1" - } - }, - { - "identity" : "websocket-kit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/vapor/websocket-kit.git", - "state" : { - "revision" : "4232d34efa49f633ba61afde365d3896fc7f8740", - "version" : "2.15.0" - } } ], "version" : 3 diff --git a/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start.xcodeproj/project.xcworkspace/xcuserdata/dmstrider.xcuserdatad/UserInterfaceState.xcuserstate b/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start.xcodeproj/project.xcworkspace/xcuserdata/dmstrider.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 00000000..94e9433e Binary files /dev/null and b/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start.xcodeproj/project.xcworkspace/xcuserdata/dmstrider.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start.xcodeproj/xcuserdata/dmstrider.xcuserdatad/xcschemes/xcschememanagement.plist b/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start.xcodeproj/xcuserdata/dmstrider.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 00000000..80252220 --- /dev/null +++ b/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start.xcodeproj/xcuserdata/dmstrider.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,203 @@ + + + + + SchemeUserState + + AnyCodable (Playground) 1.xcscheme + + isShown + + orderHint + 11 + + AnyCodable (Playground) 2.xcscheme + + isShown + + orderHint + 12 + + AnyCodable (Playground).xcscheme + + isShown + + orderHint + 10 + + Demo (Playground) 1.xcscheme + + isShown + + orderHint + 8 + + Demo (Playground) 10.xcscheme + + isShown + + orderHint + 32 + + Demo (Playground) 11.xcscheme + + isShown + + orderHint + 33 + + Demo (Playground) 2.xcscheme + + isShown + + orderHint + 9 + + Demo (Playground) 3.xcscheme + + isShown + + orderHint + 13 + + Demo (Playground) 4.xcscheme + + isShown + + orderHint + 14 + + Demo (Playground) 5.xcscheme + + isShown + + orderHint + 15 + + Demo (Playground) 6.xcscheme + + isShown + + orderHint + 28 + + Demo (Playground) 7.xcscheme + + isShown + + orderHint + 29 + + Demo (Playground) 8.xcscheme + + isShown + + orderHint + 30 + + Demo (Playground) 9.xcscheme + + isShown + + orderHint + 31 + + Demo (Playground).xcscheme + + isShown + + orderHint + 7 + + JWTDecode (Playground) 1.xcscheme + + isShown + + orderHint + 5 + + JWTDecode (Playground) 2.xcscheme + + isShown + + orderHint + 6 + + JWTDecode (Playground) 3.xcscheme + + isShown + + orderHint + 16 + + JWTDecode (Playground) 4.xcscheme + + isShown + + orderHint + 17 + + JWTDecode (Playground) 5.xcscheme + + isShown + + orderHint + 18 + + JWTDecode (Playground) 6.xcscheme + + isShown + + orderHint + 25 + + JWTDecode (Playground) 7.xcscheme + + isShown + + orderHint + 26 + + JWTDecode (Playground) 8.xcscheme + + isShown + + orderHint + 27 + + JWTDecode (Playground).xcscheme + + isShown + + orderHint + 4 + + Playground (Playground) 1.xcscheme + + isShown + + orderHint + 2 + + Playground (Playground) 2.xcscheme + + isShown + + orderHint + 3 + + Playground (Playground).xcscheme + + isShown + + orderHint + 1 + + mpc-core-kit-ios-quick-start.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start/Helpers/EthereumHelper.swift b/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start/Helpers/EthereumHelper.swift deleted file mode 100644 index 639b68a1..00000000 --- a/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start/Helpers/EthereumHelper.swift +++ /dev/null @@ -1,78 +0,0 @@ -// -// EthereumHelper.swift -// mpc-core-kit-ios-quick-start -// -// Created by Ayush B on 09/04/24. -// - -import Foundation -import Foundation -import web3 -import BigInt - -struct EthereumClient { - let web3Client: EthereumHttpClient! - var networkId: String = "11155111" - - init() { - self.web3Client = EthereumHttpClient( - url: URL(string: "https://1rpc.io/sepolia")!, - network: .fromString(networkId) - ) - } - - func getNonce(address: EthereumAddress) async throws -> Int{ - do { - let nonce = try await web3Client.eth_getTransactionCount( - address: address, block: .Latest - ) - return nonce + 1 - } catch let error { - throw error - } - } - - func getGasPrice() async throws -> BigUInt { - do { - let gasPrice = try await web3Client.eth_gasPrice() - return gasPrice - } catch let error { - throw error - } - } - - func getGasLimit(transaction: EthereumTransaction) async throws -> BigUInt { - do { - let gasLimit = try await web3Client.eth_estimateGas(transaction) - return gasLimit - } catch let error { - throw error - } - } - - func broadcastSignedTransaction(transaction: SignedTransaction) async throws -> String { - do { - guard let transactionHex = transaction.raw?.web3.hexString else { - throw EthereumClientError.encodeIssue - } - - let data = try await web3Client.networkProvider.send( - method: "eth_sendRawTransaction", - params: [transactionHex], - receive: String.self - ) - - if let hash = data as? String { - return hash - } else { - throw EthereumClientError.unexpectedReturnValue - } - } catch let error { - throw error - } - } - - func getChainId() -> String { - return networkId - } -} diff --git a/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start/Helpers/Extension.swift b/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start/Helpers/Extension.swift deleted file mode 100644 index 2f100462..00000000 --- a/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start/Helpers/Extension.swift +++ /dev/null @@ -1,28 +0,0 @@ -// -// Extension.swift -// mpc-core-kit-ios-quick-start -// -// Created by Ayush B on 20/05/24. -// - -import Foundation -import mpc_core_kit_swift -import tkey -import MpcProviderSwift -import web3 - -extension MpcCoreKit : EvmSigner { - public func sign(message: Data) throws -> Data { - let data = try self.tssSign(message: message) - return data - } - - public var publicKey: Data { - let fullAddress = try! KeyPoint( - address: self.getTssPubKey().hexString - ).getPublicKey(format: .FullAddress) - - return Data(hex: fullAddress).suffix(64) - } - -} diff --git a/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start/Models/MainViewModel.swift b/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start/Models/MainViewModel.swift index 291c5fee..d12893d7 100644 --- a/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start/Models/MainViewModel.swift +++ b/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start/Models/MainViewModel.swift @@ -7,8 +7,7 @@ import Foundation import mpc_core_kit_swift -import MpcProviderSwift -import web3 +import CustomAuth import UIKit class MainViewModel: ObservableObject { @@ -20,17 +19,14 @@ class MainViewModel: ObservableObject { private var mpcCoreKit: MpcCoreKit! - private var ethereumClient: EthereumClient! - private var mpcEthereumProvider: MPCEthereumProvider! func initialize() { - mpcCoreKit = MpcCoreKit( + mpcCoreKit = try! MpcCoreKit(options: Web3AuthOptions( web3AuthClientId: "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ", - web3AuthNetwork: .SAPPHIRE_MAINNET, - localStorage: UserStorage() + manualSync: true, + web3AuthNetwork: .sapphire(.SAPPHIRE_MAINNET), + localStorage: UserStorage()) ) - - ethereumClient = EthereumClient() } func loginWithJWT() { @@ -56,11 +52,7 @@ class MainViewModel: ObservableObject { func loginWithOAuth() { Task { do { - let result = try await mpcCoreKit.loginWithOAuth( - loginProvider: .google, - clientId: "519228911939-cri01h55lsjbsia1k7ll6qpalrus75ps.apps.googleusercontent.com", - verifier: "w3a-google-demo" - + let result = try await mpcCoreKit.loginWithOAuth(singleLoginParams: SingleLoginParams(typeOfLogin: .google, verifier: "w3a-google-demo", clientId: "519228911939-cri01h55lsjbsia1k7ll6qpalrus75ps.apps.googleusercontent.com") ) DispatchQueue.main.async { @@ -105,8 +97,8 @@ class MainViewModel: ObservableObject { Task { do { print(mpcCoreKit.debugDescription) - let signature = try mpcEthereumProvider.signMessage(message: "YOUR_MESSAGE".data(using: .ascii)!) - onSigned(signature, nil) + //let signature = try mpcEthereumProvider.signMessage(message: "YOUR_MESSAGE".data(using: .ascii)!) + //onSigned(signature, nil) } catch let error { onSigned(nil, error.localizedDescription) } @@ -116,7 +108,7 @@ class MainViewModel: ObservableObject { func sendTransaction(onSend: @escaping (String?, String?) -> ()) { Task { do { - + /* let address = EthereumAddress( stringLiteral: self.publicAddress ) @@ -151,7 +143,7 @@ class MainViewModel: ObservableObject { ) onSend(hash, nil) - + */ } catch let error { print(error.localizedDescription) @@ -164,17 +156,15 @@ class MainViewModel: ObservableObject { Task { do { let factor = try await mpcCoreKit.createFactor( - tssShareIndex: .RECOVERY, + tssShareIndex: .recovery, factorKey: nil, factorDescription: .SeedPhrase ) - guard let seedPhrase = mpcCoreKit.keyToMnemonic( + let seedPhrase = try mpcCoreKit.keyToMnemonic( factorKey: factor, format: "mnemonic" - ) else { - return - } + ) print(seedPhrase) @@ -187,12 +177,10 @@ class MainViewModel: ObservableObject { func recoverUsingSeedPhrase(seedPhrase: String) { Task { do { - guard let factorKey = mpcCoreKit.mnemonicToKey( + let factorKey = try mpcCoreKit.mnemonicToKey( shareMnemonic: seedPhrase, format: "mnemonic" - ) else { - return - } + ) print(factorKey.count) @@ -223,8 +211,8 @@ class MainViewModel: ObservableObject { } private func login() async throws { - mpcEthereumProvider = MPCEthereumProvider(evmSigner: mpcCoreKit) - publicAddress = mpcEthereumProvider.address.toChecksumAddress() + // mpcEthereumProvider = MPCEthereumProvider(evmSigner: mpcCoreKit) + // publicAddress = mpcEthereumProvider.address.toChecksumAddress() try await refreshFactorPubs() toggleIsLoggedIn() } diff --git a/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start/Views/LoginView.swift b/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start/Views/LoginView.swift index a7b41785..3281663c 100644 --- a/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start/Views/LoginView.swift +++ b/mpc-core-kit-ios/mpc-core-kit-ios-quick-start/mpc-core-kit-ios-quick-start/Views/LoginView.swift @@ -26,7 +26,7 @@ struct LoginView: View { ).buttonStyle(.bordered) Spacer() }.onAppear { - viewModel.initialize() + viewModel.initialize() } }