mirror of
https://github.com/lil-org/wallet.git
synced 2025-01-04 02:24:39 +03:00
Merge pull request #140 from lil-org/tune-extension-rpc
tune extension rpc
This commit is contained in:
commit
11853fa389
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
// Rewrite of error.js from trust-web3-provider.
|
||||
|
||||
"use strict";
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
// Rewrite of index.js from trust-web3-provider.
|
||||
|
||||
"use strict";
|
||||
@ -22,7 +22,7 @@ class TokenaryEthereum extends EventEmitter {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
const config = {address: "", chainId: "0x1", rpcUrl: "https://eth.llamarpc.com"};
|
||||
const config = {address: "", chainId: "0x1"};
|
||||
this.setConfig(config);
|
||||
this.idMapping = new IdMapping();
|
||||
this.callbacks = new Map();
|
||||
@ -66,15 +66,15 @@ class TokenaryEthereum extends EventEmitter {
|
||||
this.ready = !!address;
|
||||
}
|
||||
|
||||
updateAccount(eventName, addresses, chainId, rpcUrl) {
|
||||
updateAccount(eventName, addresses, chainId) {
|
||||
window.tokenary.eth.setAddress(addresses[0]);
|
||||
|
||||
if (eventName == "switchAccount") {
|
||||
window.tokenary.eth.emit("accountsChanged", addresses);
|
||||
}
|
||||
|
||||
if (window.tokenary.eth.rpc.rpcUrl != rpcUrl) {
|
||||
this.rpc = new RPCServer(rpcUrl);
|
||||
if (window.tokenary.eth.rpc.chainId != chainId) {
|
||||
this.rpc = new RPCServer(chainId);
|
||||
}
|
||||
|
||||
if (window.tokenary.eth.chainId != chainId) {
|
||||
@ -89,7 +89,7 @@ class TokenaryEthereum extends EventEmitter {
|
||||
|
||||
setConfig(config) {
|
||||
this.chainId = config.chainId;
|
||||
this.rpc = new RPCServer(config.rpcUrl);
|
||||
this.rpc = new RPCServer(config.chainId);
|
||||
this.setAddress(config.address);
|
||||
this.networkVersion = this.net_version();
|
||||
}
|
||||
@ -199,16 +199,9 @@ class TokenaryEthereum extends EventEmitter {
|
||||
case "eth_newPendingTransactionFilter":
|
||||
case "eth_uninstallFilter":
|
||||
case "eth_subscribe":
|
||||
throw new ProviderRpcError(4200, `Tokenary does not support calling ${payload.method}. Please use your own solution`);
|
||||
throw new ProviderRpcError(4200, `tiny wallet does not support ${payload.method}`);
|
||||
default:
|
||||
this.callbacks.delete(payload.id);
|
||||
this.wrapResults.delete(payload.id);
|
||||
return this.rpc
|
||||
.call(payload)
|
||||
.then((response) => {
|
||||
wrapResult ? resolve(response) : resolve(response.result);
|
||||
})
|
||||
.catch(reject);
|
||||
return this.rpc.call(payload);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -346,7 +339,7 @@ class TokenaryEthereum extends EventEmitter {
|
||||
if (response.name == "didLoadLatestConfiguration") {
|
||||
this.didGetLatestConfiguration = true;
|
||||
if (response.chainId) {
|
||||
this.updateAccount(response.name, response.results, response.chainId, response.rpcURL);
|
||||
this.updateAccount(response.name, response.results, response.chainId);
|
||||
}
|
||||
|
||||
for(let payload of this.pendingPayloads) {
|
||||
@ -362,14 +355,14 @@ class TokenaryEthereum extends EventEmitter {
|
||||
} else if ("results" in response) {
|
||||
if (response.name == "switchEthereumChain" || response.name == "addEthereumChain") {
|
||||
// Calling it before sending response matters for some dapps
|
||||
this.updateAccount(response.name, response.results, response.chainId, response.rpcURL);
|
||||
this.updateAccount(response.name, response.results, response.chainId);
|
||||
}
|
||||
if (response.name != "switchAccount") {
|
||||
this.sendResponse(id, response.results);
|
||||
}
|
||||
if (response.name == "requestAccounts" || response.name == "switchAccount") {
|
||||
// Calling it after sending response matters for some dapps
|
||||
this.updateAccount(response.name, response.results, response.chainId, response.rpcURL);
|
||||
this.updateAccount(response.name, response.results, response.chainId);
|
||||
}
|
||||
} else if ("error" in response) {
|
||||
this.sendError(id, response.error);
|
||||
@ -394,14 +387,15 @@ class TokenaryEthereum extends EventEmitter {
|
||||
let callback = this.callbacks.get(id);
|
||||
let wrapResult = this.wrapResults.get(id);
|
||||
let data = { jsonrpc: "2.0", id: originId };
|
||||
if (result !== null && result.jsonrpc && result.result) {
|
||||
if (result !== null && result.result) {
|
||||
data.result = result.result;
|
||||
} else {
|
||||
data.result = result;
|
||||
}
|
||||
if (callback) {
|
||||
wrapResult ? callback(null, data) : callback(null, result);
|
||||
wrapResult ? callback(null, data) : callback(null, data.result);
|
||||
this.callbacks.delete(id);
|
||||
this.wrapResults.delete(id);
|
||||
} else {
|
||||
console.log(`callback id: ${id} not found`);
|
||||
}
|
||||
@ -413,6 +407,7 @@ class TokenaryEthereum extends EventEmitter {
|
||||
if (callback) {
|
||||
callback(error instanceof Error ? error : new Error(error), null);
|
||||
this.callbacks.delete(id);
|
||||
this.wrapResults.delete(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
// Rewrite of id_mapping.js from trust-web3-provider.
|
||||
|
||||
"use strict";
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
// Rewrite of index.js from trust-web3-provider.
|
||||
|
||||
"use strict";
|
||||
@ -44,7 +44,9 @@ announceProvider();
|
||||
// - MARK: Process content script messages
|
||||
|
||||
window.addEventListener("message", function(event) {
|
||||
if (event.source == window && event.data && event.data.direction == "from-content-script") {
|
||||
if (event.source == window && event.data && event.data.direction == "rpc-back") {
|
||||
provider.processTokenaryResponse(event.data.response.id, event.data.response);
|
||||
} else if (event.source == window && event.data && event.data.direction == "from-content-script") {
|
||||
const response = event.data.response;
|
||||
const id = event.data.id;
|
||||
|
||||
|
@ -1,30 +1,18 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
// Rewrite of rpc.js from trust-web3-provider.
|
||||
|
||||
"use strict";
|
||||
|
||||
class RPCServer {
|
||||
constructor(rpcUrl) {
|
||||
this.rpcUrl = rpcUrl;
|
||||
|
||||
constructor(chainId) {
|
||||
this.chainId = chainId;
|
||||
}
|
||||
|
||||
call(payload) {
|
||||
return fetch(this.rpcUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(payload)
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(json => {
|
||||
if (!json.result && json.error) {
|
||||
console.log("<== rpc error", json.error);
|
||||
throw new Error(json.error.message || "rpc error");
|
||||
}
|
||||
return json;
|
||||
});
|
||||
payload.jsonrpc = "2.0";
|
||||
window.postMessage({direction: "rpc", message: {id: payload.id, subject: "rpc", chainId: this.chainId, body: JSON.stringify(payload)}}, "*");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
// Rewrite of utils.js from trust-web3-provider.
|
||||
|
||||
"use strict";
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,12 +1,14 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
struct InternalSafariRequest: Codable {
|
||||
let id: Int
|
||||
let subject: Subject
|
||||
let body: String?
|
||||
let chainId: String?
|
||||
|
||||
enum Subject: String, Codable {
|
||||
case getResponse, cancelRequest
|
||||
case getResponse, cancelRequest, rpc
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
if (!("pendingRequestsIds" in document)) {
|
||||
document.pendingRequestsIds = new Set();
|
||||
@ -37,7 +37,11 @@ function setup() {
|
||||
// Receive from inpage
|
||||
window.addEventListener("message", event => {
|
||||
if (event.source == window && event.data) {
|
||||
if (event.data.direction == "from-page-script") {
|
||||
if (event.data.direction == "rpc") {
|
||||
browser.runtime.sendMessage(event.data.message).then(response => {
|
||||
window.postMessage({direction: "rpc-back", response: response}, "*");
|
||||
}).catch(() => {});
|
||||
} else if (event.data.direction == "from-page-script") {
|
||||
sendMessageToNativeApp(event.data.message, false);
|
||||
} else if (event.data.subject == "disconnect") {
|
||||
const disconnectRequest = event.data;
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,7 +1,13 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
function handleOnMessage(request, sender, sendResponse) {
|
||||
if (request.subject === "message-to-wallet") {
|
||||
if (request.subject === "rpc") {
|
||||
browser.runtime.sendNativeMessage("mac.tokenary.io", request).then(response => {
|
||||
if (typeof response !== "undefined") {
|
||||
sendResponse(response);
|
||||
} else { sendResponse(); }
|
||||
}).catch(() => { sendResponse(); });
|
||||
} else if (request.subject === "message-to-wallet") {
|
||||
browser.runtime.sendNativeMessage("mac.tokenary.io", request.message).then(response => {
|
||||
if (typeof response !== "undefined") {
|
||||
sendResponse(response);
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import SafariServices
|
||||
|
||||
@ -21,6 +21,12 @@ class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
|
||||
if let internalSafariRequest = try? jsonDecoder.decode(InternalSafariRequest.self, from: data) {
|
||||
let id = internalSafariRequest.id
|
||||
switch internalSafariRequest.subject {
|
||||
case .rpc:
|
||||
if let body = internalSafariRequest.body, let chainId = internalSafariRequest.chainId {
|
||||
rpcRequest(id: id, chainId: chainId, body: body, context: context)
|
||||
} else {
|
||||
context.cancelRequest(withError: HandlerError.empty)
|
||||
}
|
||||
case .getResponse:
|
||||
if let response = ExtensionBridge.getResponse(id: id) {
|
||||
ExtensionBridge.removeResponse(id: id)
|
||||
@ -58,6 +64,32 @@ class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
|
||||
}
|
||||
}
|
||||
|
||||
private func rpcRequest(id: Int, chainId: String, body: String, context: NSExtensionContext) {
|
||||
guard let chainIdNumber = Int(hexString: chainId),
|
||||
let rpcURLString = Nodes.getNode(chainId: chainIdNumber),
|
||||
let url = URL(string: rpcURLString),
|
||||
let httpBody = body.data(using: .utf8) else {
|
||||
respond(with: ["id": id, "error": "something went wrong"], context: context)
|
||||
return
|
||||
}
|
||||
|
||||
var request = URLRequest(url: url)
|
||||
request.httpMethod = "POST"
|
||||
request.setValue("application/json", forHTTPHeaderField: "Accept")
|
||||
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
|
||||
request.httpBody = httpBody
|
||||
|
||||
let task = URLSession.shared.dataTask(with: request) { [weak self] data, response, error in
|
||||
if let data = data, var json = try? JSONSerialization.jsonObject(with: data) as? [String: Any] {
|
||||
if json["id"] == nil { json["id"] = id }
|
||||
self?.respond(with: json, context: context)
|
||||
} else {
|
||||
self?.respond(with: ["id": id, "error": "something went wrong"], context: context)
|
||||
}
|
||||
}
|
||||
task.resume()
|
||||
}
|
||||
|
||||
private func respond(with response: [String: Any], context: NSExtensionContext) {
|
||||
let item = NSExtensionItem()
|
||||
item.userInfo = [SFExtensionMessageKey: response]
|
||||
|
@ -1,3 +1,3 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
const isMobile = true;
|
||||
|
@ -42,13 +42,6 @@
|
||||
"activeTab",
|
||||
"tabs"
|
||||
],
|
||||
|
||||
"host_permissions": [
|
||||
"https://*.llamarpc.com/",
|
||||
"https://*.infura.io/*",
|
||||
"https://tokenary.io/*",
|
||||
"tokenary://*"
|
||||
],
|
||||
|
||||
"web_accessible_resources": [ "inpage.js" ]
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
const isMobile = false;
|
||||
|
@ -43,11 +43,5 @@
|
||||
"tabs"
|
||||
],
|
||||
|
||||
"host_permissions": [
|
||||
"https://*.llamarpc.com/",
|
||||
"https://*.infura.io/*",
|
||||
"https://tokenary.io/*"
|
||||
],
|
||||
|
||||
"web_accessible_resources": [ "inpage.js" ]
|
||||
}
|
||||
|
@ -8,5 +8,7 @@
|
||||
<array>
|
||||
<string>group.io.tokenary</string>
|
||||
</array>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
import WalletCore
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
import WalletCore
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
import BigInt
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
import BigInt
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import WalletCore
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import SwiftUI
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
enum ApprovalSubject {
|
||||
case signMessage
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
enum AuthenticationReason {
|
||||
case start
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
import WalletCore
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
import WalletCore
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
import CloudKit
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
import WalletCore
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
import CoreTelephony
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import StoreKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
import WalletCore
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import SwiftUI
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import SwiftUI
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import WalletCore
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
// Rewrite of Wallet.swift from Trust Wallet Core.
|
||||
|
||||
import Foundation
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
// Rewrite of KeyStore.swift from Trust Wallet Core.
|
||||
|
||||
import Foundation
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import XCTest
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import XCTest
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import XCTest
|
||||
#if os(iOS)
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
import WalletCore
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
import LocalAuthentication
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
import SwiftUI
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
import WalletCore
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
import WalletCore
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
import WalletCore
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
import Kingfisher
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import UIKit
|
||||
|
||||
@ -48,7 +48,7 @@ class PasswordViewController: UIViewController {
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
if mode != .enter {
|
||||
passwordTextField.becomeFirstResponder()
|
||||
focusOnPasswordTextField()
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +89,14 @@ class PasswordViewController: UIViewController {
|
||||
private func didFailLocalAuthentication() {
|
||||
navigationController?.setNavigationBarHidden(false, animated: false)
|
||||
initialOverlayView.isHidden = true
|
||||
passwordTextField.becomeFirstResponder()
|
||||
focusOnPasswordTextField()
|
||||
}
|
||||
|
||||
func focusOnPasswordTextField() {
|
||||
// TODO: remove temporary delay used to fix vision pro crash
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(1000)) { [weak self] in
|
||||
self?.passwordTextField.becomeFirstResponder()
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func okButtonTapped(_ sender: Any) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Cocoa
|
||||
import SafariServices
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Cocoa
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Cocoa
|
||||
import WalletCore
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Cocoa
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Cocoa
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Cocoa
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2022 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Cocoa
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2023 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import SwiftUI
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
// ∅ 2024 lil org
|
||||
|
||||
import Foundation
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user