Skip to content
Open
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
35 changes: 18 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ Before you begin, ensure you have met the following requirements:

Copy the .env.example file to create a new .env file:

```bash
cp .env.local.example .env
```
```bash
cp .env.local.example .env
```

Edit the `.env` file. Check the `.env.local.example` file for explanations
```md

The `NEXT_PUBLIC_TEST_TOKENS_ADMIN_SECRET_KEY` should be the same as the one that deployed the tokens in the `core` repository.
This is only important if you will be minting testnet tokens, otherwise is not interesting.
Expand All @@ -35,34 +35,35 @@ To enable or disable features like the `Soroswap backend` or the `aggregator`, s

Navigate to the the `run.sh` script inside the `docker` folder

```bash
bash docker/run.sh
```
```bash
bash docker/run.sh
```

If the soroswap-network does not exisit, please create: `docker network create soroswap-network`

This script will set up and start the Docker containers required for Soroswap.

4. Install the Dependencies
2. Install the Dependencies

After the Docker container is up, you will be inside the root folder on the container. Then, install the dependencies using Yarn:

```bash
yarn install
```
```bash
yarn install
```

5. Run the Development Instance
3. Run the Development Instance

Now you are ready to start the development instance. Run the following command:

```bash
yarn dev
```
```bash
yarn dev
```

This will start the Soroswap development instance.
http://localhost:3000


6. For Tesntet Development, check your Freigher Wallet Configuration if you are running your one node
4. For Tesntet Development, check your Freigher Wallet Configuration if you are running your one node
THis is not necesary if you are using Mainnet or Testnet.

For Standalone network
Expand All @@ -89,7 +90,7 @@ To enable or disable features like the `Soroswap backend` or the `aggregator`, s

** Important:** You should also do: Preferences> Allow experimental mode

7. Last, but not least, add some lumens to your Freighter wallet!
5. Last, but not least, add some lumens to your Freighter wallet!

Do it directly on the wallet or use:

Expand Down
3 changes: 1 addition & 2 deletions src/components/UnsafeTokenModal/UnsafeTokenModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { Box, useTheme } from 'soroswap-ui';
import { ButtonPrimary } from 'components/Buttons/Button';
import { CloseButton } from 'components/Buttons/CloseButton';
Expand Down Expand Up @@ -32,7 +31,7 @@ const UnsafeTokenModalContent = ({ onDismiss, onConfirm, isSafe }: Props) => {
</SubHeaderLarge>
{isSafe === false && (
<SubHeaderSmall color={"textSecondary"} textAlign="center" marginBottom="12px">
The chosen token has been identified as potentially unsafe due to a mismatch between its contract ID and the expected CODE:ISSUER combination indicated by its name.
The chosen token has been identified as potentially unsafe due to a mismatch between its contract ID and the expected (CODE:ISSUER or CODE-ISSUER) combination indicated by its name.
</SubHeaderSmall>
)}
{isSafe === undefined && (
Expand Down
17 changes: 13 additions & 4 deletions src/helpers/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export function isValidSymbol(code: string): boolean {

export function isClassicStellarAssetFormat(value: string): boolean {
if (!value) return false;
const parts = value.split(':');
// Support both : and - separators
const parts = value.split(/[:-]/);
if (parts.length !== 2) {
return false;
}
Expand All @@ -53,10 +54,11 @@ export function isClassicStellarAssetFormat(value: string): boolean {
return toReturn;
}

//Receives the name of the token must be SYMBOL:ISSUER
//Receives the name of the token must be SYMBOL:ISSUER or SYMBOL-ISSUER
export function getClassicStellarAsset(value: string) {
if (!value) return false;
const parts = value.split(':');
// Support both : and - separators
const parts = value.split(/[:-]/);
if (parts.length !== 2) {
return false;
}
Expand All @@ -68,6 +70,13 @@ export function getClassicStellarAsset(value: string) {
return {
assetCode,
issuer,
asset: `${assetCode}:${issuer}`,
asset: `${assetCode}:${issuer}`, // Always normalize to : format internally
};
}

// Add helper function to normalize format
export function normalizeAssetFormat(value: string): string {
if (!value) return value;
// Convert CODE-ISSUER to CODE:ISSUER
return value.replace(/-([A-Z0-9]{56})/, ':$1');
}
11 changes: 10 additions & 1 deletion src/helpers/horizon/getHorizonPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
PlatformType,
TradeType,
} from 'state/routing/types';
import { normalizeAssetFormat } from 'helpers/address';

const getClassicAsset = (currency: TokenType) => {
if (!currency) return;
Expand All @@ -21,7 +22,15 @@ const getClassicAsset = (currency: TokenType) => {
return nativeAsset;
}
if (!currency.issuer) {
//throw new Error(`Can't convert ${currency.code} to stellar classic asset`);
// Try to extract issuer from contract if it's in CODE:ISSUER or CODE-ISSUER format
if (currency.contract) {
const normalized = normalizeAssetFormat(currency.contract);
const parts = normalized.split(':');
if (parts.length === 2) {
const asset = new Asset(parts[0], parts[1]);
return asset;
}
}
return;
}
const asset = new Asset(currency.code, currency.issuer);
Expand Down
Loading