Trust Wallet team is proud to announce the release of the first version of TrustSDK. This will help developers grow the DApp ecosystem and Crypto adoption.
What is TrustSDK?
Building a Crypto wallet is not an easy task. You have to manage Private Keys, take care of security and build a whole infrastructure to sign and broadcast transactions. Most DApp developers can rely only on browser applications, which most of them are broken for mobile users or deliver a bad experience.
We believe that best mobile experience is achieved with native tools and we understand that most developers just want to sign or broadcast a transaction and be focused on building their own apps. That is why we have developed TrustSDK, a mobile native crypto SDK that allows developers to sign and broadcast transactions without all the challenges of building a wallet!
How to Use it?
Go to TrustSDK-iOS Github repo and follow the installation and configuration instructions.
To sign Ethereum transaction you just have to configure the transaction input
let input = EthereumSigningInput.with {
$0.toAddress = "0x3D60643Bf82b928602bce34EE426a7d392157b69"
$0.chainID = BigInt("1").serialize()!
$0.nonce = BigInt("464").serialize()!
$0.gasPrice = BigInt("11500000000").serialize()!
$0.gasLimit = BigInt("21000").serialize()!
$0.amount = BigInt("1000000000000000").serialize()!
}
then call
TrustSDK.signers.ethereum.sign(input: input) { result in
switch result {
case .success(let output):
// Handle the signing output
case .failure(let error):
// Handle failres like user rejections
}
}
The transaction output is a TrustWalletCore object with all data required to broadcast it.
You can also ask TrustSDK to broadcast the transaction for you, have to call TrustSDK.signers.ethereum.signThenSend(input:callback:)
method and TrustSDK will send you back the transaction hash.
You can get the user’s public address by calling
TrustSDK.getAccounts(for: [.ethereum, .aion]) { result in
switch result {
case .success(let addresses):
// Handle the address array
case .failure(let error):
// Handle failure
}
}
TrustSDK also supports a variety of blockchains. Please check the list of supported blockchains and replace ethereum
prefix to the blockchain you want to connect.
Checkout TrustSDK, try the demo and share your thoughts! What do you want to build with it?
Post your questions or concerns at our Developers section.
You can also send us a message at Trust Developers Telegram channel at Telegram: Contact @trust_developers
When Android?
We’re working hard to build the same experience in Android and will have it released by the next month. Stay tuned!