Skip to content

Commit

Permalink
feat: make Jupiter API configurable via ENV vars (#1283)
Browse files Browse the repository at this point in the history
Co-authored-by: Auston Bunsen <[email protected]>
Co-authored-by: Auston Bunsen <[email protected]>
Co-authored-by: Kirill Bubochkin <[email protected]>
  • Loading branch information
4 people authored Mar 1, 2024
1 parent 9500baa commit 10cacfc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
9 changes: 5 additions & 4 deletions packages/jupiter_aggregator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ start using the package.

## Usage

TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.
Define environmental variables when launching the app with flags on the command line. For example:

```dart
const like = 'sample';
```bash
flutter run lib/main.dart --dart-define=QUOTE_API_BASE=https://public.jupiterapi.com
```

You can get Swap API urls from [Jupiter Station](https://station.jup.ag/docs/apis/swap-api), [QuickNode](https://marketplace.quicknode.com/add-on/metis-jupiter-v6-swap-api) or [JupiterAPI.com](https://www.jupiterapi.com/).

## Additional information

TODO: Tell users more about the package: where to find more information, how to
Expand Down
7 changes: 6 additions & 1 deletion packages/jupiter_aggregator/lib/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ import 'package:retrofit/retrofit.dart';
part 'client.g.dart';

/// For docs head to https://station.jup.ag/api-v6
@RestApi(baseUrl: 'https://quote-api.jup.ag/v6')
@RestApi(
baseUrl: String.fromEnvironment(
'QUOTE_API_BASE',
defaultValue: 'https://quote-api.jup.ag/v6',
),
)
abstract class JupiterAggregatorClient {
factory JupiterAggregatorClient() => _JupiterAggregatorClient(Dio());

Expand Down
5 changes: 4 additions & 1 deletion packages/jupiter_aggregator/lib/src/client.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 10cacfc

Please sign in to comment.