OneKeyHQ / OneKeyHQ/app-monorepo

[BUG]: Stellar Testnet not applied after network switch in Chrome extension

Open
#11,610 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
2.4k
Forks
533
Avg merge
21h 55m
Merged PRs (30d)
497

Description

## Describe the bug

When using the OneKey Chrome extension and switching the network from Stellar Mainnet to Stellar Testnet, the wallet does not display the TESTNET XLM balance.

Additionally, calling:

```js
window.$onekey.stellar.getNetwork()
```

still returns the Mainnet network instead of Testnet after switching.

Another related issue occurs when signing a Stellar Testnet transaction:

```js
const result = await window.$onekey!.stellar!.signTransaction(xdr, {
address: options.address,
networkPassphrase: 'Test SDF Network ; September 2015', // Stellar TESTNET
});
```

When the OneKey modal opens, it still displays Stellar Mainnet transaction data and shows an error saying the wallet does not have enough XLM to fund the transaction, even though the transaction is intended for Stellar Testnet.

## To Reproduce

1. Open the OneKey Chrome extension.
2. Switch the network from Stellar Mainnet to Stellar Testnet.
3. Observe that the TESTNET XLM balance is not displayed.
4. Call:

```js
window.$onekey.stellar.getNetwork()
```

5. Observe that it still returns Mainnet.
6. Attempt to sign a Stellar Testnet transaction using:

```js
const result = await window.$onekey!.stellar!.signTransaction(xdr, {
address: options.address,
networkPassphrase: 'Test SDF Network ; September 2015',
});
```

7. Observe that the signing modal still behaves as if the transaction is on Mainnet and reports insufficient XLM balance.

## Expected behavior

* Switching to Stellar Testnet should display the correct TESTNET XLM balance.
* `window.$onekey.stellar.getNetwork()` should return the currently selected network (Testnet).
* The signing modal should recognize the transaction as a Stellar Testnet transaction and use the Testnet account/balance context instead of Mainnet.

## Desktop (please complete the following information)

* OS: Ubuntu 24.04
* Browser: Chrome
* Version: 139.0.7258

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.