Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught (in promise) TypeError: envelope.switch is not a function #1095

Open
mliu opened this issue Nov 5, 2024 · 0 comments
Open

Uncaught (in promise) TypeError: envelope.switch is not a function #1095

mliu opened this issue Nov 5, 2024 · 0 comments

Comments

@mliu
Copy link

mliu commented Nov 5, 2024

I'm seeing this error when trying to sign and submit my transaction with Freighter:

Uncaught (in promise) TypeError: envelope.switch is not a function
    at Function.fromXDR (transaction_builder.js:844:1)
    at _callee2$ (assembled_transaction.js:723:1)
    at tryCatch (assembled_transaction.js:251:1)
    at Generator.<anonymous> (assembled_transaction.js:339:1)
    at Generator.next (assembled_transaction.js:280:1)
    at asyncGeneratorStep (assembled_transaction.js:536:1)
    at _next (assembled_transaction.js:550:1)

I'm using the following dependencies:
"@stellar/stellar-sdk": "12.3.0"
"@stellar/freighter-api": "3.0.0"
"@huma-finance/soroban-tranche-vault": "0.0.15" (our client generated from soroban bindings)

Here's my relevant code to reproduce:

import { signTransaction } from '@stellar/freighter-api'
import { Client as TrancheVaultClient } from '@huma-finance/soroban-tranche-vault'
const trancheVaultClient = new TrancheVaultClient({
  publicKey: 'GDLSHY22H7KOU3V3B2GTSYWYZY6YRDNJTSQAGUK7XPHJAFIVPKPDFKH4',
  networkPassphrase: 'Test SDF Network ; September 2015',
  contractId: 'CB6K4IUC3CJHIWVHHLBDTGXVS6CT64EKGD5CGBIDNMSAKVZHCWQ3LM2D',
  rpcUrl: 'https://soroban-testnet.stellar.org',
  signTransaction,
})
const tx = await trancheVaultClient.deposit({
  lender: 'GDLSHY22H7KOU3V3B2GTSYWYZY6YRDNJTSQAGUK7XPHJAFIVPKPDFKH4',
  assets: 100000000,
})
console.log(tx)
const txSigned = await tx.signAndSend()
console.log(txSigned)

When I copy the XDR of the transaction and sign it in the Stellar Lab, it works just fine. Does anyone know how to fix this?

@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog (Not Ready)
Development

No branches or pull requests

1 participant