Git Product home page Git Product logo

trust-web3-provider's Introduction

Trust Web3 Provider

                    ___           ___           ___
      ___          /  /\         /  /\         /  /\          ___
     /__/\        /  /::\       /  /:/        /  /::\        /__/\
     \  \:\      /  /:/\:\     /  /:/        /__/:/\:\       \  \:\
      \__\:\    /  /::\ \:\   /  /:/        _\_ \:\ \:\       \__\:\
      /  /::\  /__/:/\:\_\:\ /__/:/     /\ /__/\ \:\ \:\      /  /::\
     /  /:/\:\ \__\/~|::\/:/ \  \:\    /:/ \  \:\ \:\_\/     /  /:/\:\
    /  /:/__\/    |  |:|::/   \  \:\  /:/   \  \:\_\:\      /  /:/__\/
   /__/:/         |  |:|\/     \  \:\/:/     \  \:\/:/     /__/:/
   \__\/          |__|:|~       \  \::/       \  \::/      \__\/
                   \__\|         \__\/         \__\/

A modular TypeScript library designed to offer Web3 interfaces, enabling your wallet to connect with decentralized applications.

 +----------------+            +------------------+           +---------------+
 |                |            |                  |           |               |
 |      dApps     |  <----->   |   web3 provider  |  <----->  |  your wallet  |
 |                |            |                  |           |               |
 +----------------+            +------------------+           +---------------+

Supported chains

  • Cosmos Docs
  • Solana - Wallet Standard fully compatible Docs
  • Ethereum EIP-1193 Docs

Useful links

Using the library

Contributing

Adding a new chain

trust-web3-provider's People

Contributors

y3fers0n avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trust-web3-provider's Issues

Cannot find function 'executeCallback' when using provider in iOS

Hi @hewigovens & @vikmeup ,

I forked this provider here: https://github.com/James-Sangalli/AlphaWallet-web3-provider
Merely changing the naming to map to AlphaWallet rather than trust.

And I implemented the handling in iOS here: AlphaWallet/alpha-wallet-ios@79bed87

Many of the functions like sendAsync are there and things like web3.currentProvider, window.ethereum and web3.currentProvider.isAlphaWallet are all set.

When I go to this website: https://rstormsf.github.io/js-eth-personal-sign-examples/ I am able to trigger prompts for signing but every time a call is supposed to be made back to the device hooks, I get an error stating that there is not executeCallback function in the script.

Perplexed, I looked at the sample minified file inside the android part of the provider and found that executeCallback was there and that the version built for android differs for the one that is built to the dist folder.

It seems this is working well in trust, so would it be possible to let in some insight about the exact version being used in the podspec and perhaps whether the wkscripts implemented in iOS differ to the ones being implemented here?

If so, we can fix this for other users.

Report bug in TrustWeb3Provider.setConfig

https://github.com/TrustWallet/trust-web3-provider/blob/ae735bb046030e671b313de4049947d46c11f658/src/index.js#L33

Line 33 of index.js:

It should be something like:

this.filterMgr = new FilterMgr(this.rpc);

current as in ae735bb:

this.filterMgr = new FilterMgr(config.rpcUrl);

For FilterMgr, a RPCServer instance is required instead of String of a url.

I was trying to make a pull request, but I'm not able to create a new branch for this repo and the repo I forked is used for something else.

Thank you for your work,

Liwei

edit: added direct link to the source code

not receive any events in android

@hewigovens
DevTools failed to load SourceMap: Could not load content for https://hyperdragons.alfakingdom.com/trust-min.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
(index):703 Uncaught TypeError: Cannot set property 'setProvider' of undefined
at (index):703
index.ecf9adcf.js:1 [FAILED][/get-bulletin-list]: System Error
(anonymous) @ index.ecf9adcf.js:1
sa.gif:1 Failed to load resource: net::ERR_CONNECTION_REFUSED
index.ecf9adcf.js:1 [FAILED][/get-ave-eth-price]: Command Failed
(anonymous) @ index.ecf9adcf.js:1

eth_signTypedData_v3 on android fails for uint256 values >= 2^255

I noticed that eth_signTypedData_v3 signatures are incorrectly computed for uint256 values in certain cases. It only appears to affect Trust Wallet on Android. iOS works OK, as does Metamask on all platforms.

Specifically, it seems when the value is >= 2^255 it fails. It should be able to handle values up to the top of the uint256 range (2^256 - 1). Maybe it's treating the value as signed somewhere?

I created a test case available here: https://hoytech.github.io/js-eth-personal-sign-examples/

Just click on the "Trust-Wallet eip-712 bug" button in trust wallet on android and you'll see "Failed to verify..."

Apologies if this is the wrong repo to report this. Please point me to the correct one if so.

Thanks!

Flutter Ios injection failed

I tried to inject trust.js on the Flutter side, and it worked normally on the Android side device, and the following message was reported on the IOS side.
javaScript string was: 'parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire ... ... Error Domain=WKErrorDomain Code=5 "JavaScript execution returned a result of an unsupported type" UserInfo={NSLocalizedDescription=JavaScript execution returned a result of an unsupported type}
project use webview_flutter: ^1.0.5 Ios is backed by a ‘WKWebView ’

This problem has troubled me for a long time, I hope to help solve it, thank you

how to use in my android app?

How to use in my android app?
How to combine with WebView components or other use?
Please give some ideas?
thank you very much!!!

web3 variations and support

Appolgies not really an issue but an inquiry
I developed a dapp browser using the metamask provider repo https://github.com/MetaMask/provider-engine

However when loading some notable dapps (that work with the metamask chrome extension) in my dapp browser I get the error Web3ProviderEngine does not support synchronous requests

I see the dapp is calling synchronous methods (web.eth.accounts[0]) but seems like they should be calling async however the dapps works in the metamask chrome extension. I switched to using teh trust provider instead and the dapps also now work

So my question is what is the standard here? seems dapps should be using the async method but most arent, is there any official guideline on this? or a good place to find out more?

thanks!

Проблема после подтверждения транзакции

В коде Dapp вызываю по кнопке в форме функцию контракта:

miniToken.deposit( { from: address, value: amountinwei }) .then(function (txHash) { alert('Transaction sent ' + txHash); }) .catch(console.error)

Далее подтверждаю транзакцию во всплывающем окошке кошелька.

Используя Метамаск, алерт срабатывает после подтверждения транзакции. Используя Траст (андроид), не срабатывает. Проблема появилась после 12 сентября (точную дату не назову, но 12го точно всё работало - есть видео). С этого момента был ряд обновлений кошелька.

Прошу проверить или подсказать вариант решения для меня. Кстати, было бы удобно использовать сеть Ropsten для отлова багов, но тестовые сети теперь недоступны.

Заранее благодарю!

eip-1102 problem, window.ethereum is not working with trustwallet

1st time this code was ok, but next time not work.
I don't konw what I missed.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
  <script>
    window.addEventListener('load', async () => {
      if (window.ethereum) {
        window.web3 = new Web3(ethereum);
        try {
          await ethereum.enable();
          window.alert('Modern dapp browsers')
        } catch (error) {
          window.alert('User denied account access')
        }
      }
      else if (window.web3) {
        window.web3 = new Web3(web3.currentProvider);
        window.alert('Legacy dapp browsers')
      }
      else {
        window.alert('Non-Ethereum browser detected.');
      }
    });
  </script>
</body>
</html>

Don't see executeCallback function

Sorry for my misunderstanding!
I see in trust-wallet-ios, you are using commit: f4e0ebb - in this commit you have executeCallback in Trust (provider). But in current version, I don't see this function again.
So how can I execute callback after I signed a transaction in my wallet?
Hope the helps.
Thanks.

IOS vs Android Bug

Here you can see bug:

Android:
2019-08-30 07 09 05
IOS:
2019-08-30 07 09 21

According to the docs here:
https://developer.trustwallet.com/trust-provider

Interface of account must be like this:

[
  {
    network: number,
    address: string
  }
]

However for Android App it is like this:

[
  {
    id: number,
    address: string
  }
]

Android version: 1.7.030
IOS version: 2.6905 (6905)

Mintable.app - cannot access the trust wallet address for user's wallets

Hello, I'm a dapp developer for Mintable.app - our dapp worked on Trust wallet but after our recent beta upgrade - it cannot access the trust wallet address for user's wallets - it works with metamask and coinbase wallet fine though. Is there a developer support or team member I can chat with to fix the issue for our Trust Wallet users?? We can share some information with a team dev and see as to why our Web3 calls are not working in trust wallet but work within coinbase wallet, status, and metamask

Thanks, can you please link the issue for me? Here is more information related to whats going on - looks like polyfills are needed for trust wallet since its a little older browser version The problem with trust wallet seems to be related to this:
https://github.com/LogRocket/redux-logger/issues/293

web3.js v1 not working with Trust Wallet

Can be refer to #3

Currently, I had issue making the code work in TrustWallet, if I write in vanilla js (without webpack or babel), it will work. ( Links to the testing, Code )

I used truffle box to generate a new react project to regenerate the problem.

Version

  • truffle v5.0.5
  • web3 v1.0.0-beta.37
  • TrustWallet Android v1.6.276

Create project

$ npm install -g truffle
$ truffle unbox react
$ cd client
$ yarn
# Change the code in "/src/App.js"
$ yarn dev

On trust wallet, this is what I got:

screenshot_2019-02-27-15-35-04

I added a repo to reproduce this bug. (I tweak a bit of code in "src/App.js"), https://github.com/superoo7/trustwallet-web3-bug

Possible reason

  • Web3 version for Trust Wallet is not v1 yet
  • Babel/Webpack transpile code of async await

Web3 provider does not catch new events/block updates

Some dApps doesn't work properly in the Trust browser, I think it's related to block tracker functionality.

Once you sent transaction, dApp expect to receive new events or block updates but it never receives it and hangs for the user.

How to emulate:
https://github.com/TrustWallet/trust-wallet-ios - run in XCode and see debug menu.

Contact me if you have any questions: @vikmeup telegram or Discord

List of DApps for testing:

DApps for testing that doesn't work in Trust browser(works fine in MetaMask)
Go to https://manager.0xcert.org/
Press deploy contract.
It will hang forever.

simulator screen shot - iphone x - 2018-05-23 at 23 30 12

Not getting any events with Trust Wallet

I hope this is the right repo, i haven't used Trust Wallet before and am unsure about all its components.

My dApp (https://myth.cash) is not loading any events, you can check this by opening any page other than the startsite, they all have some kind of tables that should display events but don't. I've tried to connect sentry to get any way to catch errors but all i get is: TypeError: Failed to fetch

The website works as it should with MetaMask and a user let me know how broken it is on your wallet. Any ideas how i could fix this behaviour? Or what the actual issue is behind that?

License

I saw the trust-web3-provider is declared to MIT lincense, but there is one file /src/package.json write down the license is GPL3.0, so what the License term is correct ?

Legacy eth_signTypedData Never Fires a Callback

Hello! Thanks for taking time coming across this issue!

I came here from Trust's iOS app.

Regardless of the standard, it seems that eth_signTypedData call is unresponsive (neither give a sign popup nor throws an error):

      window.web3.currentProvider.sendAsync({
        method: 'eth_signTypedData',
        params: [data, state.currentEthereumAccount.toString()],
        from: state.currentEthereumAccount.toString(),
      }, function (err, result) {
        // It never executes this code
        state.globalInfoMessage = `err ${err}, result: ${result}`;
      });

Though if I call method: "eth_signTypedData100500" it throws an error.

Platform: Trust for iOS
Live demo: here (press "Confirm" and see that there are no sign pop-ups, while if you do the same with Metamask it works)

I understand that eth_signTypedData is not a standard yet; however, it has to throw an error at least if you don't support this method or invalid parameters are given.

As a result, I need to code a hack which will suggest another signature standard for the user, instead of just automatically switching to this standard because there are errors detected in eth_signTypedData.

Hope to hear any feedback from you. Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.