Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
AyushBherwani1998 committed Dec 1, 2024
1 parent f927f2c commit 70474ae
Show file tree
Hide file tree
Showing 21 changed files with 127 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/web3auth/web3auth-swift-sdk";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 9.0.0;
branch = fix_resolve_invalid_session;
kind = branch;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/tkey/curvelib.swift",
"state" : {
"revision" : "9f88bd5e56d1df443a908f7a7e81ae4f4d9170ea",
"version" : "1.0.1"
"revision" : "432bf1abe7ff505fc2ac9fcf697341ff5b2dc6d0",
"version" : "2.0.0"
}
},
{
Expand Down Expand Up @@ -51,8 +51,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Web3Auth/session-manager-swift.git",
"state" : {
"revision" : "20cc7bff065d7fe53164d17e7714a3f17d4cea2a",
"version" : "4.0.2"
"revision" : "d86cd2a7f6d8095531ed609c728d851820fe85be",
"version" : "6.0.1"
}
},
{
Expand Down Expand Up @@ -150,8 +150,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/web3auth/web3auth-swift-sdk",
"state" : {
"revision" : "fb4971ad9452a0f0cbf9f5742f22d1c5c6d7759c",
"version" : "9.0.0"
"branch" : "fix_resolve_invalid_session",
"revision" : "d071596c6f8a44f88ce359b8e6f872b90f686f92"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,8 +665,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/Web3Auth/web3auth-swift-sdk/";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 9.0.0;
branch = fix_resolve_invalid_session;
kind = branch;
};
};
A4DCEE6F2C8B36670048A663 /* XCRemoteSwiftPackageReference "aptos-swift-sdk" */ = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "c5d16b0968e4fbe28d85effde140f5fd8b458629cafc7911d79915d17535e9c2",
"originHash" : "6b85e04c538f006ce2b9ae9841cd84700094308248d004c8af2dfa2cd222c76f",
"pins" : [
{
"identity" : "aptos-swift-sdk",
Expand Down Expand Up @@ -33,8 +33,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/tkey/curvelib.swift",
"state" : {
"revision" : "9f88bd5e56d1df443a908f7a7e81ae4f4d9170ea",
"version" : "1.0.1"
"revision" : "432bf1abe7ff505fc2ac9fcf697341ff5b2dc6d0",
"version" : "2.0.0"
}
},
{
Expand Down Expand Up @@ -69,8 +69,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Web3Auth/session-manager-swift.git",
"state" : {
"revision" : "20cc7bff065d7fe53164d17e7714a3f17d4cea2a",
"version" : "4.0.2"
"revision" : "d86cd2a7f6d8095531ed609c728d851820fe85be",
"version" : "6.0.1"
}
},
{
Expand Down Expand Up @@ -123,8 +123,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Web3Auth/web3auth-swift-sdk/",
"state" : {
"revision" : "fb4971ad9452a0f0cbf9f5742f22d1c5c6d7759c",
"version" : "9.0.0"
"branch" : "fix_resolve_invalid_session",
"revision" : "d071596c6f8a44f88ce359b8e6f872b90f686f92"
}
}
],
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,37 @@
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>5</integer>
<integer>6</integer>
</dict>
<key>Demo (Playground) 2.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>6</integer>
<integer>7</integer>
</dict>
<key>Demo (Playground).xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>5</integer>
</dict>
<key>MnemonicSwiftExample (Playground) 1.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>8</integer>
</dict>
<key>MnemonicSwiftExample (Playground) 2.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>9</integer>
</dict>
<key>MnemonicSwiftExample (Playground).xcscheme</key>
<dict>
<key>isShown</key>
<false/>
Expand Down Expand Up @@ -70,7 +91,7 @@
<key>ios-aptos-example.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>3</integer>
</dict>
</dict>
</dict>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ class AptosHelper {
/// - Parameter privateKey: The private key received from Web3Auth.
func initialize(privateKey: String) async throws {
aptosClient = Aptos(aptosConfig: .testnet)
account = try generateAptosAccount(privateKey: privateKey)

guard account != nil else {
throw NSError(domain: "AptosHelper", code: 1, userInfo: [NSLocalizedDescriptionKey: "Failed to generate Aptos account."])
if !privateKey.isEmpty {
account = try generateAptosAccount(privateKey: privateKey)
}

print("Aptos client and account initialized successfully.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/Web3Auth/web3auth-swift-sdk/";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 9.0.0;
branch = fix_resolve_invalid_session;
kind = branch;
};
};
2833BEE02BD6246900243B09 /* XCRemoteSwiftPackageReference "web3" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/tkey/curvelib.swift",
"state" : {
"revision" : "9f88bd5e56d1df443a908f7a7e81ae4f4d9170ea",
"version" : "1.0.1"
"revision" : "432bf1abe7ff505fc2ac9fcf697341ff5b2dc6d0",
"version" : "2.0.0"
}
},
{
Expand Down Expand Up @@ -51,8 +51,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Web3Auth/session-manager-swift.git",
"state" : {
"revision" : "20cc7bff065d7fe53164d17e7714a3f17d4cea2a",
"version" : "4.0.2"
"revision" : "d86cd2a7f6d8095531ed609c728d851820fe85be",
"version" : "6.0.1"
}
},
{
Expand Down Expand Up @@ -148,10 +148,10 @@
{
"identity" : "web3auth-swift-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/web3auth/web3auth-swift-sdk",
"location" : "https://github.com/Web3Auth/web3auth-swift-sdk/",
"state" : {
"revision" : "fb4971ad9452a0f0cbf9f5742f22d1c5c6d7759c",
"version" : "9.0.0"
"branch" : "fix_resolve_invalid_session",
"revision" : "d071596c6f8a44f88ce359b8e6f872b90f686f92"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/Web3Auth/web3auth-swift-sdk/";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 9.0.0;
branch = fix_resolve_invalid_session;
kind = branch;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/tkey/curvelib.swift",
"state" : {
"revision" : "9f88bd5e56d1df443a908f7a7e81ae4f4d9170ea",
"version" : "1.0.1"
"revision" : "432bf1abe7ff505fc2ac9fcf697341ff5b2dc6d0",
"version" : "2.0.0"
}
},
{
Expand Down Expand Up @@ -150,8 +150,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Web3Auth/session-manager-swift.git",
"state" : {
"revision" : "20cc7bff065d7fe53164d17e7714a3f17d4cea2a",
"version" : "4.0.2"
"revision" : "d86cd2a7f6d8095531ed609c728d851820fe85be",
"version" : "6.0.1"
}
},
{
Expand Down Expand Up @@ -267,8 +267,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Web3Auth/web3auth-swift-sdk/",
"state" : {
"revision" : "fb4971ad9452a0f0cbf9f5742f22d1c5c6d7759c",
"version" : "9.0.0"
"branch" : "fix_resolve_invalid_session",
"revision" : "d071596c6f8a44f88ce359b8e6f872b90f686f92"
}
},
{
Expand Down
47 changes: 21 additions & 26 deletions ios/ios-firebase-example/ios-firebase-example/UserDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Web3Auth
import web3

struct UserDetailView: View {

@State private var showingAlert = false
@StateObject var web3RPC: Web3RPC
@StateObject var viewModel: ViewModel
Expand All @@ -20,7 +20,7 @@ struct UserDetailView: View {
Section{
Button {
web3RPC.getAccounts()

} label: {
HStack{
Text("Get Public Key")
Expand All @@ -30,27 +30,27 @@ struct UserDetailView: View {
if(web3RPC.publicAddress != ""){
Text("\(web3RPC.publicAddress)")
}

} header: {
Text("Public key")
}
Section {
Text("Name \(user.userInfo?.name ?? "")")
Text("Email \(user.userInfo?.email ?? "")")
}
header: {
Text("User Info")
}
header: {
Text("User Info")
}
Section{
Button {
web3RPC.getBalance()

} label: {
HStack{
Text("Get Balance")
Spacer()
}
}
Button {
web3RPC.getBalance()
} label: {
HStack{
Text("Get Balance")
Spacer()
}
}
if(web3RPC.balance>=0){
Text("\(web3RPC.balance) Eth")

Expand Down Expand Up @@ -79,9 +79,9 @@ struct UserDetailView: View {
}

}
header: {
Text("Blockchain Calls")
}
header: {
Text("Blockchain Calls")
}

Section(
header: Text("Web3Auth Operations")
Expand All @@ -99,23 +99,18 @@ struct UserDetailView: View {
}

Button {
viewModel.request()
} label: {
Text("Request Signature")
}

Button {
viewModel.getSignature{
viewModel.request{
result in
self.signature = result
}
} label: {
Text("Get Signature")
Text("Request Signature")
}

if(!signature.isEmpty) {
Text(signature)
}

}


Expand Down
Loading

0 comments on commit 70474ae

Please sign in to comment.