OpenWallet.swift
Open Wallet Protocol implementation for Swift based client platforms
Goals
This library implements Open Wallet Protocol for platforms with native Swift support.
It allows applications to interact with Blockchain wallets with implemented Open Wallet protocol.
Features
- Can check is Wallet installed and supports needed API.
- Can interact with installed Wallet.
- Can be used by Wallets for OpenWallet implementation.
Implemented APIs
- Ethereum
- Keychain API
Getting started
Web3
This is not a Web3 implementation.
We have a Web3 implementation too: EthereumWeb3.swift
Installation
Ethereum
Add the following to your Podfile:
pod 'Tesseract.OpenWallet/Ethereum'
# Uncomment this line if you want to enable PromiseKit extensions
# pod 'Tesseract.OpenWallet/EthereumPromiseKit'
Then run pod install
.
Examples
Ethereum
Get user accounts (public addresses)
import OpenWallet
let openWallet = OpenWallet(networks: [.Ethereum])
// Mainnnet Network ID = 1
openWallet.eth_accounts(networkId: 1) { response in
switch response {
case .success(let accounts): print("Accounts:", accounts)
case .failure(let error): print("Error:", error)
}
}
Sign data
import OpenWallet
let data = "some string".data(using: .utf8)!
let address = try! Address(hex: "0x0000000000000000000000000000000000000000")
let openWallet = OpenWallet(networks: [.Ethereum])
// Mainnnet Network ID = 1
openWallet.eth_signData(account: address, data: data, networkId: 1) { response in
switch response {
case .success(let signature): print("Signature:", signature)
case .failure(let error): print("Error:", error)
}
}
Wallet
Installation
Ethereum
Add the following to your Podfile:
pod 'Tesseract.OpenWallet/WalletEthereum'
Then run pod install
.
Usage
Inherit your Extension main View Controller from ExtensionViewController
class from this library.
Author
License
OpenWallet.swift
is available under the Apache 2.0 license. See the LICENSE file for more information.