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

Cannot get balance and total issuance, account info #94

Open
efeint01 opened this issue Feb 14, 2024 · 1 comment
Open

Cannot get balance and total issuance, account info #94

efeint01 opened this issue Feb 14, 2024 · 1 comment

Comments

@efeint01
Copy link

efeint01 commented Feb 14, 2024

When im trying to run get account info got ArrayIndexOutOfBoundsException Exception.

Full code:

import io.emeraldpay.polkaj.api.PolkadotApi;
import io.emeraldpay.polkaj.api.StandardCommands;
import io.emeraldpay.polkaj.apihttp.JavaHttpAdapter;
import io.emeraldpay.polkaj.apiws.JavaHttpSubscriptionAdapter;
import io.emeraldpay.polkaj.scaletypes.AccountInfo;
import io.emeraldpay.polkaj.tx.AccountRequests;
import io.emeraldpay.polkaj.types.Address;
import io.emeraldpay.polkaj.types.ByteData;
import io.emeraldpay.polkaj.types.DotAmount;
import io.emeraldpay.polkaj.types.DotAmountFormatter;
import io.emeraldpay.polkaj.types.Units;

public class Balance {

    public static void main(String[] args) throws Exception {

        String node_url = "Node";

        try (PolkadotApi client = PolkadotApi.newBuilder().rpcCallAdapter(JavaHttpAdapter.newBuilder().connectTo(node_url).build()).build()) {
            DotAmountFormatter formatter = DotAmountFormatter.autoFormatter();
            AccountInfo accountInfo = AccountRequests.balanceOf(Address.from("Address")).execute(client).get();
            System.out.println(accountInfo.getNonce());
        }
    }
}

Exception: Caused by: java.lang.ArrayIndexOutOfBoundsException: arraycopy: last source index 69 out of bounds for byte[56]
	at java.base/java.lang.System.arraycopy(Native Method)
	at io.emeraldpay.polkaj.scale.ScaleCodecReader.readByteArray(ScaleCodecReader.java:141)
	at io.emeraldpay.polkaj.scale.reader.UInt128Reader.read(UInt128Reader.java:23)
	at io.emeraldpay.polkaj.scale.ScaleCodecReader.readUint128(ScaleCodecReader.java:100)
	at io.emeraldpay.polkaj.scaletypes.BalanceReader.read(BalanceReader.java:16)
	at io.emeraldpay.polkaj.scaletypes.BalanceReader.read(BalanceReader.java:10)
	at io.emeraldpay.polkaj.scale.ScaleCodecReader.read(ScaleCodecReader.java:84)
	at io.emeraldpay.polkaj.scaletypes.AccountDataReader.read(AccountDataReader.java:14)
	at io.emeraldpay.polkaj.scaletypes.AccountDataReader.read(AccountDataReader.java:6)
	at io.emeraldpay.polkaj.scale.ScaleCodecReader.read(ScaleCodecReader.java:84)
	at io.emeraldpay.polkaj.scaletypes.AccountInfoReader.read(AccountInfoReader.java:12)
	at io.emeraldpay.polkaj.scaletypes.AccountInfoReader.read(AccountInfoReader.java:6)
	at io.emeraldpay.polkaj.scale.ScaleCodecReader.read(ScaleCodecReader.java:84)
	at io.emeraldpay.polkaj.tx.AccountRequests$AddressBalance.apply(AccountRequests.java:91)
	at io.emeraldpay.polkaj.tx.AccountRequests$AddressBalance.apply(AccountRequests.java:65)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
	at java.base/java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614)
	at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:844)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

@efeint01
Copy link
Author

@splix any update?

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

No branches or pull requests

1 participant