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

js-soroban-sdk: transaction simulation failed #165

Closed
lush-onion opened this issue Oct 16, 2023 · 0 comments
Closed

js-soroban-sdk: transaction simulation failed #165

lush-onion opened this issue Oct 16, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@lush-onion
Copy link

lush-onion commented Oct 16, 2023

Describe the bug
I get an error transaction simulation failed when I simulate a transaction with one of operations restoreFootprint or bumpFootprintExpiration by method prepareTransaction. However, the simulation works correctly directly using fetch

What version are you on?
"soroban-client": "1.0.0-beta.3",

Creating a transaction:

getRestoreContractTx(publicKey: string, contract: Contract) {
      return this.server
            .getAccount(publicKey)
            .then((acc) => {
                return new SorobanClient.TransactionBuilder(acc, {
                    fee: BASE_FEE,
                    networkPassphrase: SorobanClient.Networks.TESTNET,
                })
                    .addOperation(SorobanClient.Operation.restoreFootprint({}))
                    .setSorobanData(
                        new SorobanClient.SorobanDataBuilder()
                            .setReadWrite([contact.getFootprint()[1]])
                            .build(),
                    )
                    .setTimeout(SorobanClient.TimeoutInfinite)
                    .build();
            })
    }

If I call the prepareTransaction from sdk I get an error transaction simulation failed

But if I do this, everything works:

prepareByFetch(tx): Promise<SorobanClient.Transaction> {
        const xdr = tx.toXDR();

        const requestObject = {
            jsonrpc: '2.0',
            method: 'simulateTransaction',
            id: 0,
            params: {
                transaction: xdr,
            },
        };

        return fetch(SOROBAN_SERVER, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify(requestObject),
        })
            .then((res) => res.json())
            .then(({ result }) => {
                return assembleTransaction(tx, SorobanClient.Networks.TESTNET, result).build();
            });
    }
@lush-onion lush-onion added the bug Something isn't working label Oct 16, 2023
@lush-onion lush-onion changed the title [js-soroban-client]: transaction simulation failed js-soroban-sdk: transaction simulation failed Oct 16, 2023
@Shaptic Shaptic self-assigned this Oct 23, 2023
@Shaptic Shaptic moved this from Backlog to Current Sprint in Platform Scrum Oct 23, 2023
@Shaptic Shaptic moved this from Current Sprint to Next Sprint Proposal in Platform Scrum Nov 2, 2023
@github-project-automation github-project-automation bot moved this from Next Sprint Proposal to Done in Platform Scrum Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants