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

Type AccountResponse not assignable to type Account anymore #653

Closed
TorstenStueber opened this issue May 18, 2021 · 0 comments · Fixed by #655
Closed

Type AccountResponse not assignable to type Account anymore #653

TorstenStueber opened this issue May 18, 2021 · 0 comments · Fixed by #655
Labels

Comments

@TorstenStueber
Copy link

TorstenStueber commented May 18, 2021

Describe the bug
In the past one could use the value of type AccountResponse returned by loadAccount of class Server directly as an argument for new TransactionBuilder. This standard use case does not work anymore as the TransactionBuilder constructor expects an Account, which has a member createSubaccount on the latest version of stellar-base. This member does not exist on AccountResponse, though.

The reference code does not typecheck anymore.

What version are you on?
8.2.0

To Reproduce
Compile this typescript code:

import { Server, TransactionBuilder } from "stellar-sdk";

async function main() {
  const server = new Server("https://horizon-testnet.stellar.org");
  const accountResponse = await server.loadAccount("GA2Q3Q73GJV56M5YZFFUWP5W4HH3KAAWHAI2RDIYFT4Z7G5KR3V6TAY5");
  new TransactionBuilder(accountResponse, { fee: "100" });
}

main();

This will generate the following error

Argument of type 'AccountResponse' is not assignable to parameter of type 'Account'.

Expected behavior
No error occurs and AccountResponse is assignable to parameter of type Account.

Additional context
Works correctly with version 8.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant