Skip to content

Type AccountResponse not assignable to type Account anymore #653

Closed
@TorstenStueber

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions