Skip to content

Commit

Permalink
chore: fix all the things
Browse files Browse the repository at this point in the history
  • Loading branch information
cjkoepke committed Sep 11, 2024
1 parent c55c278 commit 3e8d877
Show file tree
Hide file tree
Showing 349 changed files with 8,705 additions and 7,778 deletions.
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

156 changes: 0 additions & 156 deletions .eslintrc.cjs

This file was deleted.

23 changes: 10 additions & 13 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,24 @@ jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: "0"

- name: Setting up Node.js 18.x
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
scope: "@sundaeswap"
cache: yarn

# Install dependencies
- name: Install
run: yarn install --frozen-lockfile --ignore-scripts
run: bun install --frozen-lockfile --ignore-scripts

# Lint
- name: Lint
run: bun lint

# Build
- name: Build
run: yarn build
run: bun run build

# Run Tests
- name: Run Tests
run: yarn test
run: bun test:all
28 changes: 11 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,23 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: "0"

- name: Setting up Node.js 18.x
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
scope: "@sundaeswap"
cache: yarn

# Install dependencies
- name: Install
run: yarn install --frozen-lockfile --ignore-scripts
run: bun install --frozen-lockfile --ignore-scripts

# Build dist folders
- name: Build
run: yarn build
run: bun run build

# Run Tests
- name: Run Tests
run: yarn test
run: bun test:all

# Git Identity
- name: Git Identity
Expand All @@ -55,15 +48,16 @@ jobs:

# Bump Versions (reinstate after release)
- name: Bump versions
run: yarn version:ci
run: bun version:ci
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Configure npm authentication
run: npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_ACCESS_TOKEN }}

# Create Release
- name: Publish
run: yarn publish:ci
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
run: bun publish:ci

# Deploy Documentation
docs:
Expand Down
5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged && yarn test && yarn docs && git add ./docs
bun lint-staged && bun test:all && bun docs && git add ./docs
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Do not hesitate to upvote discussions or comments to show your interest!

#### 2. Code

After running `yarn install`, you can run the following to ensure tests pass:
After running `bun install`, you can run the following to ensure tests pass:

```
yarn test
buntest
```

This is also an automatic hook with each commit.
Expand Down
Binary file modified bun.lockb
Binary file not shown.
1 change: 0 additions & 1 deletion bunfig.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[test]
# root = "./packages/*/src"
preload = ["./setup-tests.ts"]
23 changes: 12 additions & 11 deletions docs/guides/core/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ parent: Guides
To get started building your first swap, you'll need to install a few things. Assuming you've setup a TypeScript and Webpack bundling config (see [details on requirements](/sundae-sdk/#requirements)), you can then install dependencies. We install the main `@sundaeswap/core` package, and then the latest version of `lucid-cardano`:

```bash
$ yarn add @sundaeswap/core lucid-cardano
$ bun add @sundaeswap/core lucid-cardano
```

## Steps
Expand All @@ -28,6 +28,7 @@ Let's take each step and break it down so we can understand what's going on behi
For our example, we'll be using the Preview network, and a pool ident for ADA/RBERRY. If you're testing this locally, make sure you have Eternl installed and are on the `preview` network and have at least 30 tADA in your wallet.

{: .note }

> Keep in mind that async/await should usually be handled inside a function unless you
> have top-level await enabled in your bundler. For our purposes, they will not be in
> functions for clarity.
Expand All @@ -38,7 +39,7 @@ import { ETxBuilderType, ISundaeSDKOptions, SundaeSDK } from "@sundaeswap/core";

const lucidInstance = await Lucid.new(
new Blockfrost(
"https://cardano-preview.blockfrost.io/api/v0/",
"https://cardano-preview.blockfrost.io/api/v0/"
// Your API Key
),
"Preview"
Expand All @@ -59,8 +60,9 @@ const SDK = new SundaeSDK(options);

const poolData = await SDK.query().findPoolData({
ident: "34c2b9d553d3a74b3ac67cc8cefb423af0f77fc84664420090e09990",
})
});
```

- The first thing we do is setup a Lucid instance. This is because our `options.builder` config is set to use the `ETxBuilderType.LUCID` type.
- Next, we construct our SDK options config. We define that we'll be using the Eternl wallet (defined as `eternl` to match the property on the `window.cardano` object), and set the network to `preview`.
- Then, we instantiate a new `SundaeSDK` instance. It is recommended to keep this instance as a singleton across your app, so that it's not recreated every time.
Expand All @@ -76,8 +78,8 @@ import {
// ...the previous imports
ESwapType,
EDatumType,
ISwapConfigArgs
} from "@sundaeswap/core"
ISwapConfigArgs,
} from "@sundaeswap/core";
```

- The `AssetAmount` class is a tool for dealing with asset calculations with regard to their respective decimal places and metadata.
Expand Down Expand Up @@ -118,16 +120,14 @@ Finally, once we have our configuration all set for the swap, we can build the t
```ts
import {
// ...rest of imports
EContractVersion
} from "@sundaeswap/core"
EContractVersion,
} from "@sundaeswap/core";
```

```ts
// ...rest of our code

const { build, fees } = await SDK
.builder(EContractVersion.V3)
.swap(args);
const { build, fees } = await SDK.builder(EContractVersion.V3).swap(args);
```

- Here we select the `SDK.builder()` property. By default, the builder uses V1 contracts, so we pass in `EContractVersion.V3` as a parameter.
Expand All @@ -141,10 +141,11 @@ Next, let's go ahead and build the transaction and request a signature:
// ... rest of our code

const builtTx = await build();
const { submit, cbor } = await builtTx.sign()
const { submit, cbor } = await builtTx.sign();

const txHash = await submit();
```

- First, we `build()` the transaction. This removes the details from memory, so manipulating the transaction details after this point is impossible aside form signing it.
- Once we have a built transaction, we can access two things. 1) The `submit` method does what it sounds like: it submits the signed transaction transaction and returns the transaction hash for your record keeping and lookup. 2) The `cbor` property is the signed transaction in its fullness, which can then be used for many other things, including future support for multi-sig orders, manual entry to a different node, etc.

Expand Down
31 changes: 31 additions & 0 deletions docs/typescript/core/Blaze/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[**@sundaeswap/core**](../README.md)**Docs**

***

# Blaze

## Blaze
Prebuilt classes for [Core.DatumBuilder](../Core/classes/DatumBuilder.md) and [Core.TxBuilderV1](../Core/classes/TxBuilderV1.md) or [Core.TxBuilderV3](../Core/classes/TxBuilderV3.md) that use and depend
on the `@blaze-cardano/sdk` library. Only import these if you have also installed `@blaze-cardano/sdk`
in your main repository! Also includes a helper class for basic operations.

## Index

### Classes

- [BlazeHelper](classes/BlazeHelper.md)
- [DatumBuilderBlazeV1](classes/DatumBuilderBlazeV1.md)
- [DatumBuilderBlazeV3](classes/DatumBuilderBlazeV3.md)
- [TxBuilderBlazeV1](classes/TxBuilderBlazeV1.md)
- [TxBuilderBlazeV3](classes/TxBuilderBlazeV3.md)

### Interfaces

- [IDatumBuilderBaseV3Args](interfaces/IDatumBuilderBaseV3Args.md)
- [IDatumBuilderDepositV3Args](interfaces/IDatumBuilderDepositV3Args.md)
- [IDatumBuilderMintPoolV3Args](interfaces/IDatumBuilderMintPoolV3Args.md)
- [IDatumBuilderPoolMintRedeemerV3Args](interfaces/IDatumBuilderPoolMintRedeemerV3Args.md)
- [IDatumBuilderSwapV3Args](interfaces/IDatumBuilderSwapV3Args.md)
- [IDatumBuilderWithdrawV3Args](interfaces/IDatumBuilderWithdrawV3Args.md)
- [ITxBuilderBlazeCompleteTxArgs](interfaces/ITxBuilderBlazeCompleteTxArgs.md)
- [ITxBuilderV1BlazeParams](interfaces/ITxBuilderV1BlazeParams.md)
Loading

0 comments on commit 3e8d877

Please sign in to comment.