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

fix: pass url for new networks #395

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/rich-radios-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@stacks/connect': patch
---

Fix bug where url wasn't passed to network instance
5 changes: 3 additions & 2 deletions packages/connect/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ export function legacyNetworkFromConnectNetwork(network?: ConnectNetwork): Legac
if (!network) return new LegacyStacksTestnet();
if (typeof network === 'string') return LegacyStacksNetwork.fromName(network);
if ('version' in network) return network; // legacy type

if ('url' in network) return new LegacyStacksMainnet({ url: network.url }); // experimental

return network.transactionVersion === (TransactionVersion.Mainnet as number)
? new LegacyStacksMainnet()
: new LegacyStacksTestnet();
? new LegacyStacksMainnet({ url: network.client.baseUrl })
: new LegacyStacksTestnet({ url: network.client.baseUrl });
}
Loading