trustwallet / developer Goto Github PK
View Code? Open in Web Editor NEWTrust Developer documentation: developer.trustwallet.com
Home Page: https://developer.trustwallet.com
License: MIT License
Trust Developer documentation: developer.trustwallet.com
Home Page: https://developer.trustwallet.com
License: MIT License
Update server side golang example with new function "TWMnemonicIsValid" to verify mnemonic.
pragma solidity ^0.4.24; // ---------------------------------------------------------------------------- // '0Fucks' token contract // // Deployed to : 0x5A86f0cafD4ef3ba4f0344C138afcC84bd1ED222 // Symbol : 0FUCKS // Name : 0 Fucks Token // Total supply: 100000000 // Decimals : 18 // // Enjoy. // // (c) by Moritz Neto with BokkyPooBah / Bok Consulting Pty Ltd Au 2017. The MIT Licence. // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // Safe maths // ---------------------------------------------------------------------------- contract SafeMath { function safeAdd(uint a, uint b) public pure returns (uint c) { c = a + b; require(c >= a); } function safeSub(uint a, uint b) public pure returns (uint c) { require(b <= a); c = a - b; } function safeMul(uint a, uint b) public pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function safeDiv(uint a, uint b) public pure returns (uint c) { require(b > 0); c = a / b; } } // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // ---------------------------------------------------------------------------- contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } // ---------------------------------------------------------------------------- // Contract function to receive approval and execute function in one call // // Borrowed from MiniMeToken // ---------------------------------------------------------------------------- contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes data) public; } // ---------------------------------------------------------------------------- // Owned contract // ---------------------------------------------------------------------------- contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); constructor() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; } function acceptOwnership() public { require(msg.sender == newOwner); emit OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(0); } } // ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ---------------------------------------------------------------------------- contract FucksToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "0FUCKS"; name = "0 Fucks Token"; decimals = 18; _totalSupply = 100000000000000000000000000; balances[0x5A86f0cafD4ef3ba4f0344C138afcC84bd1ED222] = _totalSupply; emit Transfer(address(0), 0x5A86f0cafD4ef3ba4f0344C138afcC84bd1ED222, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
Hello, after reinstalling the wallet I lost my transaction history, is there anyway to get all in-app browser history?
Importing by public key is possible, this may partly satisfy your use cases.
Importing the private key (extended or not) or recovery phrase is not supported, and it would not be a good idea for security: private key should not leave the hardware wallet in any form.
Another issue is that currently Trust Wallet does not support multiple wallet addresses for the same coin, and there are no plans to support this in the foreseeable future.
See the section 'Method 4: Import via Public Key' section of the guide:
https://community.trustwallet.com/t/how-to-import-a-wallet/87#method-4-import-via-public-key
Due to the decentralized nature of Trust Wallet, you can import your old Trust Wallet or a 3rd party wallets using a Recovery Phrase, Private Key or a Keystore File. Also, you can import a Public Key which simply lets you view the contents of a wallet. Attention! You are solely responsible for your wallets security. Always create a backup before making any changes to your wallet. This guide is for educational purposes only. Create a Backup In order to export your wallet, you need to gain ...
Originally posted by @catenocrypt in trustwallet/wallet-core#1058 (comment)
https://developer.trustwallet.com/trust-provider
TODO: Add description on how to use trust provider: https://github.com/trustwallet/web-core/tree/master/packages/provider
sensitive eyes please
Remove web-core / trust platform reference
Describe the bug
A clear and concise description of what the bug is.
When i add below line in my android kotlin project
val output = AnySigner.sign(signerInput, CoinType.ETHEREUM, Ethereum.SigningOutput.parser()) println("Signed transaction: \n${signerOutput.encoded.toByteArray().toHexString()}")
then i get this error:
ype mismatch: inferred type is wallet.core.jni.proto.Ethereum.SigningInput! but wallet.core.jni.proto.Any.SigningInput! was expected
Too many arguments for public open fun sign(p0: Any.SigningInput!): Any.SigningOutput! defined in wallet.core.jni.AnySigner
Unresolved reference: encoded
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Describe the bug
It looks like EthereumSigningInput does not have the property "amount" exposed and cannot be properly instantiated.
To Reproduce
Steps to reproduce the behavior:
Try to instantiate EthereumSigningInput with the amount property:
let input = EthereumSigningInput.with {
$0.amount = amountData!
}
Expected behavior
One should be able to pass in the amount, just like in the docs: https://developer.trustwallet.com/wallet-core/integration-guide/wallet-core-usage#ethereum-transaction-signing
Additional context
Using WalletCore 2.7.1 installed via the package manager for XCode
Hi Trust Wallet Team, Wallet Core is a really good corss-blockchain library. Do you have any typescript documentation so I can integrate it into my Electron project? BTW, is Windows supported?
doc link: https://developer.trustwallet.com/wallet-connect/dapp
@trustwallet/walletconnect
was deprecated, we can simply suggest user to use official walletconnect lib, and add helpers (https://github.com/trustwallet/web-core/blob/master/packages/walletconnect/src/index.ts) to the sample code
Add mainnet to blockchain requirements.
Binance signature data
chainId accountNumber sequence
https://dex.binance.org/api/v1/node-info get network
https://dex.binance.org/api/v1/account/ get accountNumber sequence
Hi @hewigovens and team.
Thank you for updating docs for Dapp page.
I have tried to run freeze
order according to new instruction which is updated on the docs. But unfortunately, ._sendCallRequest(request)
is never going to return the request
. After debugging, looks function is stacking on utf8ToBytes
function forever.
I think method: 'trust_signTransaction',
is not working properly since get_accounts
order is working well.
This is my code to run freeze function. Kindly please check and advise.
(Please feel free to clone the repo and reproduce this issue!)
Demo:
https://beptool-fork-git-feat-walletconnectclient.roy1210.vercel.app/
P.S.
The old library, @trustwallet/walletconnect
will handle freeze
order without any issue. Hence, kindly investigate how this issue happens. Maybe missing something in my code?? Much appreciate if you can add an example of Binance orders as well. Thank you!
Code (Using @trustwallet/walletconnect): https://github.com/roy1210/beptool_fork/blob/feat/%40trustwallet/walletconnect/src/components/pages/Freezer.js#L150
Demo:
https://beptool-fork-git-feat-trustwalletwalletconnect.roy1210.vercel.app/
const request = connector._formatRequest({
method: 'trust_signTransaction',
params: [
{
network,
transaction: JSON.stringify(tx),
},
],
});
connector
// Memo: Didn't return anything
._sendCallRequest(request)
.then(result => {
// Returns transaction signed in json or encoded format
console.log(result);
})
.catch(error => {
// Error returned when rejected
console.error(error);
});
Hi, I was transferring funds #fantom from Trust Wallet to Binance like I did the previous 2 times, but this time around, the transaction was stuck on pending and nothing was showing up on block chain explorer either so I reimported my wallet like the guide on the Trust Wallet forum. After reimporting, my pending transaction disappeared and the amount of funds I was transferring have vanished as well. They’ve been deducted from my Trust Wallet without the transaction actually going through. What should I do now to get lost crypto back
Hi,
Want to add validator into Trust Wallet to enable user to delegate tokens.
Name : KysenPool
Hi. I want to integrate trustwallet with my website. Is there API or any other way of doing this?
Let me know please
More detailed building instructions, on a separate file. Currently some instructions are in the Contributing, some in the Linux section.
Create a section for Platform and list the process of onboarding a validator:
assets/blockchain/<chain> /validators/list.json, add a
name,
id,
description, and
website`.assets/blockchain/<chain>/validators/assets/<validator_address>
add a 256x256 pixel logo.png
file.After Filcoin signs the transaction, use Filecoin.MpoolPush RPC to broadcast the transaction error, error message"{"jsonrpc":"2.0","id":1,"error":{"code":1,"message":"signature did not match"}}"
sign json response:{"Message":{"From":"f1afn74ati4fxle3r4wts6hy6zhz6bmhhqkl4smma","GasFeeCap":"232340646288838001506612","GasLimit":595335,"GasPremium":"54083036854064","Nonce":0,"To":"f1icys7esrj6h5htoar45qv5hjhblniyvci5ygcqq","Value":"232284873704446901628976"},"Signature":{"Data":"lEbB9ClQVsdiwg4inbX3unwKf3/tWsPuTZxeDf7nxaQqI4WFSqFkHXVQxQ/zFcSoFZd7YepUl3DnXXoqF3qytAE=","Type":1}}
Add Documentation section for trustwallet/web-core
.
BlockAtlas structure has been changed a lot, update according to latest changes and explain platform interfaces concept.
Separate docs at https://github.com/trustwallet/docs
Why are these things split up? Very confusing.
Is your feature request related to a problem? Please describe.
Hi, our Atomic Swap dapp interact with bitcoin blockchain, but now trustwallet doesn't have any API for this
Describe the solution you'd like
would be great if trustwallet's dapp browser pass window.bitcoin
object to dapp
simplest example:
window.bitcoin.address
>16bFRqtBivrvdBi37kxPtiSUH5qWwaoH15
also woukd be great if <a href="bitcoin:16bFRqtBivrvdBi37kxPtiSUH5qWwaoH15?amount=0.001">pay 0.001</a>
works too (or somt like window.bitcoin.send
...
Describe alternatives you've considered
(i tried deep link https://link.trustwallet.com/send...
but no success ).
Additional context
We should add a link to https://t.me/walletcore here, any thoughts?
Good day,
I think i made a mistake somehow in uploading logo for Token UMC.
How do i know if my logo went through or not.
I'm receiving an error from merge-bot that the contract format is invalid. I renamed the file temporarily to a different name and then correctly to the one that the bot suggested. Despite this, I still get an error. Please advise.
regarding this file location: https://github.com/trustwallet/assets/tree/master/blockchains/smartchain/assets
Contract address: 0x89671544190eE39E469C8393009875dF6565457a
Hi Team,
As we are working with the iOS SDK. We need to change the language of the mnemonic show to the user and pass the same to the SDK base on the user-selected language(English, Chinese, Japanese). So Please give us the break in how we will do it.
Please update the documentation in https://developer.trustwallet.com/wallet-core/integration-guide/ios-guide import TrustWalletCore
to import WalletCore
.
Took me a while to figure this out :(
Document TrustSDK specs describing all URL formats, parameters and data types.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.