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] incorrect query and network config for standalone #1077

Merged
merged 1 commit into from
Jan 5, 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
10 changes: 6 additions & 4 deletions @shared/api/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,14 @@ export const confirmPassword = async (

export const getAccountIndexerBalances = async (
publicKey: string,
network: NETWORKS,
networkDetails: NetworkDetails,
): Promise<AccountBalancesInterface> => {
try {
const contractIds = await getTokenIds(network);
const contractIds = await getTokenIds(networkDetails.network as NETWORKS);
const url = new URL(`${INDEXER_URL}/account-balances/${publicKey}`);
url.searchParams.append("network", network);
url.searchParams.append("network", networkDetails.network);
url.searchParams.append("horizon_url", networkDetails.networkUrl);
url.searchParams.append("soroban_url", networkDetails.sorobanRpcUrl!);
for (const id of contractIds) {
url.searchParams.append("contract_ids", id);
}
Expand Down Expand Up @@ -385,7 +387,7 @@ export const getIndexerAccountHistory = async ({
}) => {
try {
const url = new URL(
`${INDEXER_URL}/account-history/${publicKey}?network=${networkDetails.network}&soroban_rpc_url=${networkDetails.sorobanRpcUrl}`,
`${INDEXER_URL}/account-history/${publicKey}?network=${networkDetails.network}&soroban_url=${networkDetails.sorobanRpcUrl}&horizon_url=${networkDetails.networkUrl}`,
);
const response = await fetch(url.href);
const data = (await response.json()) as HorizonOperation;
Expand Down
2 changes: 1 addition & 1 deletion extension/src/helpers/stellar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export const isActiveNetwork = (
networkB: NetworkDetails,
) => isEqual(networkA, networkB);

export const CUSTOM_NETWORK = "CUSTOM";
export const CUSTOM_NETWORK = "STANDALONE";

export const isCustomNetwork = (networkDetails: NetworkDetails) => {
const { network } = networkDetails;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export const HistoryItem = ({

try {
const response = await fetch(
`${INDEXER_URL}/token-details/${attrs.contractId}?pub_key=${publicKey}&network=${networkDetails.network}&soroban_rpc_url=${networkDetails.sorobanRpcUrl}`,
`${INDEXER_URL}/token-details/${attrs.contractId}?pub_key=${publicKey}&horizon_url=${networkDetails.network}&soroban_url=${networkDetails.sorobanRpcUrl}`,
);
const tokenDetails = await response.json();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ export const Operations = ({
if (!contractId) return;
const fetchContractDecimals = async () => {
const response = await fetch(
`${INDEXER_URL}/token-details/${contractId}?pub_key=${publicKey}&network=${networkDetails.network}&soroban_rpc_url=${networkDetails.sorobanRpcUrl}`,
`${INDEXER_URL}/token-details/${contractId}?pub_key=${publicKey}&horizon_url=${networkDetails.network}&soroban_url=${networkDetails.sorobanRpcUrl}`,
);
const tokenDetails = await response.json();
setDecimals(tokenDetails.decimals);
Expand Down
7 changes: 2 additions & 5 deletions extension/src/popup/ducks/transactionSubmission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export const getAccountBalances = createAsyncThunk<
try {
const balances = await internalgetAccountIndexerBalances(
publicKey,
networkDetails.network as NETWORKS,
networkDetails,
);
storeBalanceMetricData(publicKey, balances.isFunded || false);
return balances;
Expand All @@ -305,10 +305,7 @@ export const getDestinationBalances = createAsyncThunk<
{ rejectValue: ErrorMessage }
>("getDestinationBalances", async ({ publicKey, networkDetails }, thunkApi) => {
try {
return await internalgetAccountIndexerBalances(
publicKey,
networkDetails.network as NETWORKS,
);
return await internalgetAccountIndexerBalances(publicKey, networkDetails);
} catch (e) {
return thunkApi.rejectWithValue({ errorMessage: e });
}
Expand Down
2 changes: 1 addition & 1 deletion extension/src/popup/views/IntegrationTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export const IntegrationTest = () => {

res = await getAccountIndexerBalances(
testPublicKey,
TESTNET_NETWORK_DETAILS.network as NETWORKS,
TESTNET_NETWORK_DETAILS,
);
runAsserts("getAccountBalances", () => {
assertEq(Object.keys(res.balances).length > 0, true);
Expand Down
Loading