-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from SundaeSwap-finance/calvin/taste-tests
Introduce Taste Test Package
- Loading branch information
Showing
42 changed files
with
957 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
{ | ||
} | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": "always" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# @sundaeswap/sdk-core | ||
# @sundaeswap/core | ||
|
||
## Modules | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Sundae-SDK | ||
|
||
[![Licence](https://img.shields.io/github/license/SundaeSwap-finance/sundae-sdk)](https://github.com/SundaeSwap-finance/sundae-sdk/blob/main/LICENSE) | ||
|
||
Sundae-SDK is a TypeScript library for building transactions for the SundaeSwap DEX on Cardano. | ||
|
||
> :warning: **This is a pre-release package**: until we release v1.0.0, the interface may change as we identify the optimal usage patterns. | ||
## QuickStart | ||
|
||
### Getting started | ||
|
||
First, install the relevant packages: | ||
|
||
```console | ||
$ yarn add lucid-cardano @sundaeswap/core | ||
``` | ||
Then start using the SDK: | ||
```typescript | ||
import { SundaeSDK } from "@sundaeswap/core"; | ||
import { | ||
TxBuilderLucid, | ||
ProviderSundaeSwap | ||
} from "@sundaeswap/core/extensions"; | ||
|
||
const txBuilder = new TxBuilderLucid( | ||
{ | ||
wallet: "eternl", | ||
network: "preview", | ||
provider: "blockfrost", | ||
blockfrost: { | ||
url: "https://cardano-preview.blockfrost.io/api/v0", | ||
apiKey: "YOUR_API_KEY" | ||
} | ||
}, | ||
new ProviderSundaeSwap("preview") | ||
); | ||
|
||
const sdk: SundaeSDK = new SundaeSDK(txBuilder); | ||
|
||
const txHash = await sdk.swap( /** ... */ ).then(({ submit }) => submit()); | ||
``` | ||
|
||
### How to Use | ||
|
||
Documentation is available at [https://sundaeswap-finance.github.io/sundae-sdk/](https://sundaeswap-finance.github.io/sundae-sdk/), but it is very much a work-in-progress. Feel free to open a discussion with feedback, or submit a pull request! | ||
|
||
# Contributing | ||
|
||
Want to contribute? See [CONTRIBUTING.md](CONTRIBUTING.md) to know how. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# @sundaeswap/taste-test | ||
|
||
# Introduction | ||
The `@sundaeswap/taste-test` package serves as an additional API by which clients can interact with existing SundaeSwap Taste Tests. | ||
|
||
## Get Started | ||
To start with [Lucid](https://www.npmjs.com/package/lucid-cardano), install dependencies: | ||
|
||
```sh | ||
yarn add lucid-cardano @sundaeswap/core @sundaeswap/taste-test | ||
``` | ||
|
||
If you plan to use this package in the browser along with Webpack 5, you'll need to add | ||
polyfill support for Buffer. You can do this like so: | ||
|
||
```ts | ||
plugins: { | ||
new webpack.ProvidePlugin({ | ||
Buffer: ["buffer", "Buffer"] | ||
}) | ||
} | ||
``` | ||
|
||
Next, configure the instance in your app: | ||
|
||
```ts | ||
import { | ||
TxBuilderLucid, | ||
ProviderSundaeSwap | ||
} from "@sundaeswap/core/extensions"; | ||
import { SundaeSDK } from "@sundaeswap/core"; | ||
import { TasteTest } from "@sundaeswap/taste-test" | ||
import type { Lucid } from "lucid-cardano"; | ||
|
||
const txBuilder = new TxBuilderLucid( | ||
{ | ||
wallet: "eternl", | ||
network: "preview", | ||
provider: "blockfrost", | ||
blockfrost: { | ||
url: "https://cardano-preview.blockfrost.io/api/v0", | ||
apiKey: "YOUR_API_KEY" | ||
} | ||
}, | ||
new ProviderSundaeSwap("preview") | ||
); | ||
|
||
const sdk: SundaeSDK = new SundaeSDK(txBuilder); | ||
const walletInstance = txBuilder.build<unknown, Lucid>().wallet; | ||
let tt: TasteTest | undefined; | ||
if (walletInstance) { | ||
tt = new TasteTest(txBuilder.build<unknown, Lucid>().wallet) | ||
} | ||
|
||
tt?.deposit({ ...args }); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.