> ## Documentation Index
> Fetch the complete documentation index at: https://docs.soroswap.finance/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Soroswap Aggregator API: base URL https://api.soroswap.finance, pick the network with ?network=mainnet or ?network=testnet (omitted means mainnet).
> Auth: Authorization: Bearer sk_... on every call. Get a key at https://console.soroswap.finance/register. A missing or invalid key returns 401 with code and registerUrl (POST /send returns 403 instead); an expired JWT or a missing role returns 403. Free plan 1 request/s; see https://docs.soroswap.finance/api/plans.md.
> Flow: POST /quote (assetIn, assetOut as C... contract addresses, amount as an integer string in the smallest unit, tradeType, protocols) -> POST /quote/build with the unchanged quote and from -> the user signs the XDR -> POST /send. Build right after quoting: a Soroban XDR is valid for 180 seconds. Submit it as is, never re-simulate it.
> Partner id: every account has one (9 hex chars, permanent). Read partnerId from GET /partner, or in the console at https://console.soroswap.finance under Fees & payouts. The partner fee itself is switched on by Soroswap; see https://docs.soroswap.finance/api/fees.md.
> AI tools: docs MCP at https://docs.soroswap.finance/mcp (claude mcp add --transport http soroswap-docs https://docs.soroswap.finance/mcp), skill with npx skills add https://docs.soroswap.finance. Other clients: https://docs.soroswap.finance/api/build-with-ai.md.
> Units and Stellar pitfalls: https://docs.soroswap.finance/api/stellar-gotchas.md. Errors and retries: https://docs.soroswap.finance/api/errors.md.

# Importing Testnet Tokens

> Breakdown of the Bash script that imports and wraps Stellar Classic testnet assets for Soroban.

### Tutorial: Importing Testnet Tokens for Use in Soroban

> [!NOTE]
>
> The Stellar CLI used to be called `soroban`. Commands on this page use the current `stellar` name, so if you are reading an older copy of the script you may see `soroban lab token id` where this page shows `stellar contract id asset`. They do the same thing.

#### Introduction

This tutorial will guide you through the process of importing testnet tokens, specifically Stellar Classic assets, and wrapping them for use with Soroban. We will use a Bash script to automate this process.

#### Prerequisites

* Basic understanding of blockchain concepts and the Stellar network.
* A system with Bash shell.
* The `jq` tool installed for JSON processing.
* The [Stellar CLI](https://developers.stellar.org/docs/tools/developer-tools/cli/stellar-cli) installed.

#### Overview of the Script

The provided Bash script performs several key functions:

* Reading and merging asset lists from JSON files.
* Wrapping each asset to be compatible with Soroban.
* Updating a token list with new Soroban addresses.

you can find this script here [setup\_stellar\_classic\_assets.sh](https://github.com/soroswap/core/blob/main/scripts/setup_stellar_classic_assets.sh)

#### Script Breakdown

1. **Setting Environment Variables and Directories**

   ```bash theme={null}
   ASSETS_DIRECTORY="/path/to/known_stellar_classic_assets.json"
   GENERATED_STELLAR_ASSETS="/path/to/generated_stellar_assets.json"
   ```

   * `ASSETS_DIRECTORY` and `GENERATED_STELLAR_ASSETS` point to the JSON files containing asset information.
   * `known_stellar_classic_assets.json` example

   ```json theme={null}
   {
     "tokens": [
       {
         "symbol": "USDC",
         "name": "centre.ioUSDCoin",
         "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
         "asset": "USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
       }
     ]
   }
   ```

2. **Reading and Merging Asset Lists**

```bash theme={null}
CLASSIC_ASSETS_JSON=$(jq '.tokens' "$ASSETS_DIRECTORY")
GENERATED_ASSETS_JSON=$(jq '.tokens' "$GENERATED_STELLAR_ASSETS")
```

These commands extract the token lists from JSON files and merge them.

3. **Wrapping Assets**

   ```bash theme={null}
   TOKEN_ADDRESS=$(stellar contract id asset --network "$NETWORK" --asset "$ASSET")
   ```

   This is the critical line where each asset is wrapped. The `stellar contract id asset` command deploys the built in Stellar Asset Contract for the asset and returns its contract address, which is how Soroban contracts reach that same asset.

4. **Looping Through Assets**
   The script loops through each asset in the merged list, wrapping them and updating the token list with their new Soroban addresses.

5. **Updating the Token List**
   The updated token addresses are saved back to the `TOKENS_DIRECTORY`, ensuring that the assets are now usable in Soroban.

6. **Error Handling and Outputs**
   The script includes checks to handle errors and provide informative output messages throughout the process.

#### Running the Script

1. Ensure you have the necessary JSON files in the specified directories.
2. Run the script in your Bash shell:
   ```bash theme={null}
   ./setup_stellar_classic_assets.sh [network]
   ```
   Replace `[network]` with the desired network type (e.g., `testnet`).

#### Conclusion

Following these steps, you can efficiently wrap Stellar Classic assets for use with Soroban. This script automates the process, simplifying the integration of various assets into the Soroban ecosystem.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.