# Use TOP Wallet
The TOP Wallet library forks from the Trust Wallet library, mainly for third-party wallets, and is used for address generation & management, transaction structure generation, and signing. Currently most mainstream tokens are supported (click here to view (opens new window)). Official code address: https://github.com/trustwallet/wallet-core.
This section describes how to use the TOP wallet library.
Address-related operations and transaction structure signature generation functions have been implemented in iOS and Android clients. And functions such as transferring, depositing, deposit cancelling, swapping for gas, cancel swapping are supported.
# iOS
Currently, only CocoaPods under Xcode is supported, you need to use the Top Wallet library via pod in iOS.
The usage method in iOS project is as follows:
Add
pod 'TopWalletCore'
in Podfile.Run
pod install
to install pod library.
If the installation fails, you can troubleshoot the problems in the following ways:
- Run
pod repo update
to update pod library. - Run
pod search TopWalletCore
to search for TOP Wallet library.
Code sample:
iOS sample project: https://github.com/hench-ye/wallet-core/tree/hench1/samples/osx/cocoapods
Swift code sample: https://github.com/hench-ye/wallet-core/blob/hench1/swift/Tests/Blockchains/TopTests.swift
# Android
Android library is submitted to GitHub for unified management.
The usage method in Android project is as follows:
Run
gradle install
.Add the following code in
app/build.gradle
file of yourproject:maven { name = "GitHubPackages" url = uri("https://maven.pkg.github.com/hench-ye/wallet-core") credentials { /**Create github.properties in root project folder file with gpr.usr=GITHUB_USER_ID & gpr.key =PERSONAL_ACCESS_TOKEN**/ username = "hench-ye" password = "*************************" } } implementation "com.topwallet:wallet-core:$walletcore_version"
In which:
username
andpassword
are used to download library from GitHub.password
is the personal access token generated from https://github.com/settings/tokens.$walletcore_version
is the latest version, which is 2.6.16 currently. You can check it out at https://github.com/hench-ye/wallet-core/releases.
Code sample:
- Android sample project: https://github.com/hench-ye/wallet-core/tree/hench1/samples/android
- Kotlin code sample: https://github.com/hench-ye/wallet-core/blob/hench1/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/top/TestTop.kt