Giter Site home page Giter Site logo

trustsdk-ios's Issues

Compile errors ... EthereumTransaction, EthereumAddress

Hi.... thanks for making this library...

In the example project, I get the following compile errors:

/TrustSDK-iOS/Sources/TrustSDK/Commands/SignTransactionCommand.swift:15:29: Use of undeclared type 'EthereumTransaction'
/TrustSDK-iOS/Sources/TrustSDK/Commands/SignTransactionCommand.swift:30:30: Use of undeclared type 'EthereumTransaction'
/TrustSDK-iOS/Sources/TrustSDK/Commands/SignTransactionCommand.swift:78:48: Use of undeclared type 'EthereumTransaction'
/TrustSDK-iOS/Sources/TrustSDK/ObjCWrapper/TrustSDKObjC.swift:27:27: Use of unresolved identifier 'EthereumTransaction'
/TrustSDK-iOS/Sources/TrustSDK/ObjCWrapper/TrustSDKObjC.swift:31:17: Use of unresolved identifier 'EthereumAddress'
/TrustSDK-iOS/Sources/TrustSDK/ObjCWrapper/TrustSDKObjC.swift:48:65: Use of unresolved identifier 'EthereumAddress'

Confirming transaction problem.

The DApp browser has been removed from the iOS version of Trust Wallet, so I went through all the steps to connect to pancakeswap on safari web browser to my trust wallet, but when I swap tokens on exchange.pancakeswap.finance it takes me back to my trust wallet to confirm the transaction, but there’s no option it gives me to confirm the transaction, it just takes me to my trust wallet main page. Please help.
Thank you.

Impossible to verify the signature

Good afternoon.

I've tried to verify the signature, but, unfortunately, I couldn't do that (I get 'false').

Signature created by: Trust.signMessage()

I've used this approach for verifying:

let hash = Crypto.hash(messageData)
let isValid = Crypto.verify(signature: signed, message: hash, publicKey: myWalletAddress.data(using: .utf8)!)

And two more things:

  1. signature verification is success on the https://etherscan.io/verifySig
  2. signatures, created for the same message on Android and iOS, are different

EthereumTransaction.ContractGeneric example

Hello!

Trying to sign eth contract method call with TrustSDK/WalletCore, then try to sign this data with sdk_sign URL Scheme. TrustWallet responds with the sign_error. Any example of how we can sign a contract call correctly?

    let signerInput = EthereumSigningInput.with {
      $0.toAddress = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
      $0.chainID = BigInt("1").serialize()!
      $0.nonce = BigInt("477").serialize()!
      $0.gasPrice = BigInt("2112000000").serialize()!
      $0.gasLimit = BigInt("21000").serialize()!
      $0.privateKey = wallet.getKeyForCoin(coin: .ethereum).data
      $0.transaction = EthereumTransaction.with {
        $0.contractGeneric = EthereumTransaction.ContractGeneric.with {
          $0.data = Data(hexString:"ad5c4648")!
          $0.amount = BigInt("0").serialize()!
        }
      }
    }

If we use erc20 transfer – it's all ok, but no success with ContractGeneric.

error: `'init' is inaccessible due to 'internal' protection level`

I am using TrustWalletCore(wallet-core) instead of TrustCore(trust-core) in TrustSDK-iOS

In TrustCore use EthereumTransaction for Transaction.
In TrustWalletCore I use EthereumSigner for Transaction.

Following is my code

TrustSDKObjC.swift

@objc
  public func signTransaction(_ gasPrice: String, _ gasLimit: UInt64, _ address: String, amount: String, success: @escaping (Data) -> Void, failure: @escaping (NSError) -> Void) {
    /*
      let transaction = EthereumTransaction(
          nonce: 0,
          gasPrice: BigInt(gasPrice)!,
          gasLimit: BigInt(gasLimit),
          to: EthereumAddress(string: address)!,
          amount: BigInt(amount)!,
          payload: .none
      )
      */
      
      let transaction = EthereumSigner (
          gasPrice: gasPrice.data(using: .utf8)!,
          gasLimit: gasLimit,
          to: EthereumAddress(string: address)!,
          amount: amount.data(using: .utf8)!,
          payload: .none
      )

      signTransaction(transaction) { result in
          switch result {
          case .success(let signedMesssage):
              success(signedMesssage)
          case .failure(let error):
              failure(error as NSError)
          }
      }
  }

But getting following error

Sources/TrustSDK/ObjCWrapper/TrustSDKObjC.swift

error: 'init' is inaccessible due to 'internal' protection level
note: 'init' declared here

!

!

Pod::Spec.new do |s| s.name = 'TrustSDK' s.version = '1.4.7' s.summary = 'Trust Wallet SDK' s.homepage = 'https://github.com/TrustWallet/TrustSDK-iOS' s.license = { :type => 'MIT', :file => 'LICENSE' } s.authors = { 'Leone Parise' => 'leoneparise', 'Viktor Radchenko' => 'vikmeup' } s.source = { :git => 'https://github.com/TrustWallet/TrustSDK-iOS.git', :tag => s.version.to_s } s.ios.deployment_target = '11.0' s.swift_version = '5.1' s.default_subspec = 'Client' s.subspec 'Client' do |cs| cs.resource_bundles = { 'TrustSDK' => ['TrustSDK/Resources/**/*.xcassets', 'TrustSDK/Resources/**/*.strings'] } cs.source_files = 'TrustSDK/Classes/Client/**/*' cs.dependency 'TrustWalletCore/Types' cs.dependency 'BigInt' end s.subspec 'Wallet' do |cs| cs.source_files = 'TrustSDK/Classes/Wallet/**/*' cs.dependency 'TrustSDK/Client' end end

no such module

User reported:

thanks for TrustSDK this is great, want to integrate it in iOS project but got problems like no TrustSDK "no such module", have tried all type of general solution but no luck,

followed this link : https://github.com/TrustWallet/TrustSDK-iOS

please help me how can i integrate it in my project (need steps).

pod install giving issue.

On pod install getting error : "Unable to find a specification for TrezorCrypto (~> 0.0.8) depended upon by TrustCore"

Incorrect assign to transaction payload field

Hi, I have an issue when I try to send transaction with a "payload" field. For Example, when I send transaction with some data to TrustWallet:

var transaction = Transaction(gasPrice: BigInt(21), gasLimit: 21000, to: address)
transaction.amount = amount
transaction.payload = Data(hexString: "0x8f834227000000000000000000000000000000005224") //some data

trustSDK.signTransaction(transaction) { [weak self] signedTransaction in
    let alert = UIAlertController(title: "Signed Transaction", message: signedTransaction.hexString, 
        preferredStyle: .alert)
    alert.addAction(.init(title: "OK", style: .default, handler: nil))
    self?.present(alert, animated: true, completion: nil)
}

it doesn't display at screen:
image

I think it happened because transaction data is base64 encoded string and TrustWalletSDK can't parse it correctly. If change this code (in source TrustWalletSDK - > TrustWalletSDK.swift -> handleSignTransaction function):

 transaction.payload = components.queryParameterValue(for: "data").flatMap({ Data(hexString: $0) })

for something like this:

let data = components.queryParameterValue(for: "data").flatMap({ String($0) })!
let dataEncoded = Data(base64Encoded: data)!
transaction.payload = dataEncoded

now it's work correct:
image

Questions on the functional

Good afternoon.

Tell me, please, how can I decode signedTransaction data to Transaction object?

On Android I've done like this:

val tx = Geth.newTransactionFromRLP(Numeric.hexStringToByteArray(response.result))

Thank you in advance.

.

HH

Wallet Connect doesn't work properly for IOS

Description
Although Trust has Wallet connect (nice!), it doesn't work if you close the app.

When the Wallet Trust App is in the background or closed, and you try to use the Dapp, the Dapp will send the transaction to be signed by the wallet. The issue is that if the app is not opened this message is lost. Furthermore, if you open later Trust wallet Dapp on top of not getting the messages sent while it was inactive, it doesn't get any new messages either.

My best guess is that, once the websocket is broken, it doesn't recover and recreate a new websocket using the topic id.

Other wallets, like Metamask allow the app to be in the background

How to reproduce

  1. Go to any Dapp, like Uniswap
  2. Connect using Wallet Connect
  3. Try to swap 2 tokens, see how the transaction is shown in Trust ✅
  4. Close the app
  5. Open the app, see how the transaction is NOT shown in Trust automatically ❌
  6. Try to swap 2 tokens again, see how the transaction is NOT shown in Trust

Not working as expected

The SDK implementation or even the example is not working on my iPhone XR. It opens the Trust Wallet app but does nothing.

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.