EtherWalletKit 0.1.4

EtherWalletKit 0.1.4

swiftlychangeSteadyAction 维护。



 
依赖关系
web3swift~> 2.0
SwiftKeychainWrapper>= 0
 

  • 作者
  • SteadyAction

EtherWalletKit

Swift Xcode License: MIT iOS

简介

EtherWalletKit 是一款适用于 iOS 的以太坊钱包工具包。

我希望加密货币和无中心化代币经济得到更广泛的应用。然而,鉴于区块链和加密货币的复杂性,需要许多新知识,一些开发者犹豫是否在应用程序上添加加密钱包。

别担心。
借助 EtherWalletKit,您可以在没有服务器和区块链知识的情况下实现以太坊钱包。

特性

已发布的特性

  • 创建/导入账户(地址和私钥)
  • 检查以太币和代币余额
  • 将以太币和代币发送到其他地址
  • 浏览代币信息
  • 支持测试网(Rinkeby & Ropsten)

计划中的特性

  • 浏览交易历史记录
  • Keystore / BIP39 轻密码
  • 自定义配置/高级交易
  • 多个账户
  • 第三方 API
  • 支持 ERC-721

安装

CocoaPods

为了使用 CocoaPods 将 EtherWalletKit 集成到您的 Xcode 项目中,请在您的 Podfile 中指定它。

pod 'EtherWalletKit'

快速入门

0. 请务必导入

import EtherWalletKit

1. 创建以太坊钱包

// Generate a new account with its new password.
try? EtherWallet.account.generateAccount(password: "ABCDEFG")

// Import an existing account from its private key and set its new password.
try? EtherWallet.account.importAccount(privateKey: "1dcbc1d6e0a4587a3a9095984cf051a1bc6ed975f15380a0ac97f01c0c045062, password: "ABCDEFG")

注意:密码将被加密并保存在设备上,访问钱包时需要用它。

2. 获取余额

// Get balance of Ether
EtherWallet.balance.etherBalance { balance in
    print(balance)
}

// Get balance of a token
EtherWallet.balance.tokenBalance(contractAddress: "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07") { balance in
    print(balance)
}

3. 发送

// send Ether to an address.
EtherWallet.transaction.sendEther(to: "0x7777787C97a35d37Db8E5afb0C92BCfd4F6480bE", amount: "1.5", password: "ABCDEFG") { txHash in
    print(txHash)
}

// send a token to an address.
EtherWallet.transaction.sendToken(to: "0x7777787C97a35d37Db8E5afb0C92BCfd4F6480bE", contractAddress: "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07", amount: "20", password: "ABCDEFG", decimal: 18) { txHash in
    print(txHash)
}

注意:密码应与创建的钱包密码相同。您还可以将 gasPrice 作为额外的参数来设置交易 gas 价格。

有关完整文档,请参阅 此处

备注

  • 不会向服务器发送任何内容。所有操作都将在本设备和以太坊区块链上进行。
  • 不需要下载和同步节点,因为Infura正在为您完成。
  • 钱包的 password 与私钥文件的密码相同。请确保密码足够长以保证安全。

贡献

  • 请确保您有GitHub账户。
  • 为您的贡献在GitHub上创建一个拉取请求。
    • 清楚地描述问题或功能。
  • 将GitHub上的仓库进行分支。
  • 从您希望开始工作的branch创建一个topic branch。(接受Gitflow方法)
    • 请避免直接在master分支上工作。
  • 确保您已经添加了为您的更改所需的所有测试,并确保所有测试通过。

捐赠

仅接受加密货币。😂

ETH: 0x7777787C97a35d37Db8E5afb0C92BCfd4F6480bE
XLM: GBWP4JXW4PJGORNTVN3ZIFRZN5NXDNU534G5KULGPUGJE7IHCQILUQ3B

许可

EtherWalletKit在MIT许可下可用。有关更多信息,请参阅LICENSE文件。