Skip to content

Commit

Permalink
fix: allow terra testnet to work correctly with station extension
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronCQL committed Mar 5, 2024
1 parent 3839477 commit 3cb5ad3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## `v0.0.57`

### Fixes

- Allow Terra testnet to work correctly with Station extenion

## `v0.0.56`

### Features
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cosmes",
"version": "0.0.56",
"version": "0.0.57",
"private": false,
"packageManager": "[email protected]",
"sideEffects": false,
Expand Down
17 changes: 12 additions & 5 deletions src/wallet/wallets/station/StationController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ import { ChainInfo, WalletController } from "../WalletController";
import { StationExtension } from "./StationExtension";
import { StationWalletConnectV1 } from "./StationWalletConnectV1";

const TERRA_CLASSIC_CHAIN_ID = "columbus-5";
const TERRA_CHAIN_ID = "phoenix-1";
const TERRA_CHAINS = [TERRA_CLASSIC_CHAIN_ID, TERRA_CHAIN_ID];
const TERRA_CLASSIC_MAINNET_CHAIN_ID = "columbus-5";
const TERRA_MAINNET_CHAIN_ID = "phoenix-1";
const TERRA_TESTNET_CHAIN_ID = "pisco-1";
const TERRA_CHAINS = [
TERRA_CLASSIC_MAINNET_CHAIN_ID,
TERRA_MAINNET_CHAIN_ID,
TERRA_TESTNET_CHAIN_ID,
];

export class StationController extends WalletController {
private readonly wc: WalletConnectV1;
Expand Down Expand Up @@ -77,8 +82,10 @@ export class StationController extends WalletController {
const { addresses, pubkey } = await ext.connect();
// Station will only return one or the other, but not both
// so we simply set the other one manually
addresses[TERRA_CLASSIC_CHAIN_ID] ??= addresses[TERRA_CHAIN_ID];
addresses[TERRA_CHAIN_ID] ??= addresses[TERRA_CLASSIC_CHAIN_ID];
addresses[TERRA_CLASSIC_MAINNET_CHAIN_ID] ??=
addresses[TERRA_MAINNET_CHAIN_ID] ?? addresses[TERRA_TESTNET_CHAIN_ID];
addresses[TERRA_MAINNET_CHAIN_ID] ??=
addresses[TERRA_CLASSIC_MAINNET_CHAIN_ID];
for (const { chainId, rpc, gasPrice } of chains) {
const address = addresses[chainId];
if (address == null) {
Expand Down

0 comments on commit 3cb5ad3

Please sign in to comment.