Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactoring to support latest iteration of contracts #18

Merged
merged 7 commits into from
Aug 31, 2023
Merged
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
2 changes: 1 addition & 1 deletion .github/auto_assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
addReviewers: true

# Set to true to add assignees to pull requests
addAssignees: 'author'
addAssignees: "author"

# A list of reviewers to be added to pull requests (GitHub user name)
reviewers:
Expand Down
49 changes: 34 additions & 15 deletions .github/workflows/ci.yaml → .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check codebase
name: CI / CD

on:
push:
Expand Down Expand Up @@ -26,12 +26,15 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18
scope: "@subtopia-algo"
cache: "npm"
cache-dependency-path: ./package-lock.json

- name: Install dependencies
run: yarn install --frozen-lockfile
run: npm ci

- name: Run build
run: yarn build
run: npm run build

lint:
name: Linting
Expand All @@ -44,12 +47,15 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18
scope: "@subtopia-algo"
cache: "npm"
cache-dependency-path: ./package-lock.json

- name: Install dependencies
run: yarn install --frozen-lockfile
run: npm ci

- name: Lint
run: yarn lint:scripts
run: npm run lint:scripts

unit-tests:
name: Unit tests
Expand All @@ -66,26 +72,33 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
scope: "@subtopia-algo"
cache: "npm"
cache-dependency-path: ./package-lock.json

- uses: docker-practice/actions-setup-docker@master
if: runner.os == 'macOS'
timeout-minutes: 12

- name: Install dependencies
run: yarn install --frozen-lockfile
run: npm ci

- name: Run sandbox
run: yarn localnet:start
run: npm run localnet:start

- name: Run tests
run: yarn test:integration
env:
TESTNET_SUBTOPIA_DISPENSER_MNEMONIC: ${{ secrets.TESTNET_SUBTOPIA_DISPENSER_MNEMONIC }}
TESTNET_SUBTOPIA_CREATOR_MNEMONIC: ${{ secrets.TESTNET_SUBTOPIA_CREATOR_MNEMONIC }}
TESTNET_SUBTOPIA_BOB_MNEMONIC: ${{ secrets.TESTNET_SUBTOPIA_BOB_MNEMONIC }}
run: npm run test:integration

- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v3
if: runner.os == 'Linux' && matrix.node == '18'
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

deploy-docs:
if: github.ref == 'refs/heads/main'
Expand All @@ -101,12 +114,15 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18
scope: "@subtopia-algo"
cache: "npm"
cache-dependency-path: ./package-lock.json

- name: Install dependencies
run: yarn install --frozen-lockfile
run: npm ci

- name: Build docs
run: yarn docs
run: npm run docs

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
Expand All @@ -132,15 +148,18 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18
scope: "@subtopia-algo"
cache: "npm"
cache-dependency-path: ./package-lock.json

- name: Install dependencies
run: yarn install --frozen-lockfile
run: npm ci

- name: Run build
run: yarn build
run: npm run build

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.CUSTOM_GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn release
run: npm run release
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ lerna-debug.log*
# misc
coverage
docs

.env
43 changes: 15 additions & 28 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,86 +1,73 @@
## [2.0.1](https://github.com/subtopia-algo/subtopia-js/compare/v2.0.0...v2.0.1) (2023-05-14)


### Bug Fixes

* bumping versions ([9cc49c2](https://github.com/subtopia-algo/subtopia-js/commit/9cc49c27680b2ac3efdc6db7d0b57d074acd1af5))
- bumping versions ([9cc49c2](https://github.com/subtopia-algo/subtopia-js/commit/9cc49c27680b2ac3efdc6db7d0b57d074acd1af5))

# [2.0.0](https://github.com/subtopia-algo/subtopia-js/compare/v1.0.8...v2.0.0) (2023-04-13)


* Discounts (#11) ([9eeedb7](https://github.com/subtopia-algo/subtopia-js/commit/9eeedb72e7fa5eb49b2209ece88241408866a878)), closes [#11](https://github.com/subtopia-algo/subtopia-js/issues/11)

- Discounts (#11) ([9eeedb7](https://github.com/subtopia-algo/subtopia-js/commit/9eeedb72e7fa5eb49b2209ece88241408866a878)), closes [#11](https://github.com/subtopia-algo/subtopia-js/issues/11)

### BREAKING CHANGES

* ExpirationType parameter. Discounts feature support
- duration parameter. Discounts feature support

## [1.0.8](https://github.com/subtopia-algo/subtopia-js/compare/v1.0.7...v1.0.8) (2023-03-29)


### Bug Fixes

* **deps:** update dependency beaker-ts to ^0.1.0 ([#6](https://github.com/subtopia-algo/subtopia-js/issues/6)) ([ce04287](https://github.com/subtopia-algo/subtopia-js/commit/ce04287d36d8df89fc18cce598042a5e1acf6d77))
- **deps:** update dependency beaker-ts to ^0.1.0 ([#6](https://github.com/subtopia-algo/subtopia-js/issues/6)) ([ce04287](https://github.com/subtopia-algo/subtopia-js/commit/ce04287d36d8df89fc18cce598042a5e1acf6d77))

## [1.0.7](https://github.com/subtopia-algo/subtopia-js/compare/v1.0.6...v1.0.7) (2023-03-29)


### Bug Fixes

* typo and pr test ([#5](https://github.com/subtopia-algo/subtopia-js/issues/5)) ([417db29](https://github.com/subtopia-algo/subtopia-js/commit/417db296852c6dfe972315b81fe95eed6534ac8f))
- typo and pr test ([#5](https://github.com/subtopia-algo/subtopia-js/issues/5)) ([417db29](https://github.com/subtopia-algo/subtopia-js/commit/417db296852c6dfe972315b81fe95eed6534ac8f))

## [1.0.6](https://github.com/subtopia-algo/subtopia-js/compare/v1.0.5...v1.0.6) (2023-03-29)


### Bug Fixes

* testing ci ([6f65550](https://github.com/subtopia-algo/subtopia-js/commit/6f6555071fb4f54694488d130fc72a3c7fb048d8))
* testing ci ([221ee41](https://github.com/subtopia-algo/subtopia-js/commit/221ee416b154bf9b81213c02e3330166675200d7))
- testing ci ([6f65550](https://github.com/subtopia-algo/subtopia-js/commit/6f6555071fb4f54694488d130fc72a3c7fb048d8))
- testing ci ([221ee41](https://github.com/subtopia-algo/subtopia-js/commit/221ee416b154bf9b81213c02e3330166675200d7))

## [1.0.5](https://github.com/subtopia-algo/subtopia-js/compare/v1.0.4...v1.0.5) (2023-03-29)


### Bug Fixes

* testing ci ([de9917a](https://github.com/subtopia-algo/subtopia-js/commit/de9917a636ce82cf6a0e1035cfe26657795c4a95))
- testing ci ([de9917a](https://github.com/subtopia-algo/subtopia-js/commit/de9917a636ce82cf6a0e1035cfe26657795c4a95))

## [1.0.4](https://github.com/subtopia-algo/subtopia-js/compare/v1.0.3...v1.0.4) (2023-03-29)


### Bug Fixes

* testing ci ([b712a05](https://github.com/subtopia-algo/subtopia-js/commit/b712a058794e5ceb175dcd78c29cdff9fb962bf8))
- testing ci ([b712a05](https://github.com/subtopia-algo/subtopia-js/commit/b712a058794e5ceb175dcd78c29cdff9fb962bf8))

## [1.0.3](https://github.com/subtopia-algo/subtopia-js/compare/v1.0.2...v1.0.3) (2023-03-29)


### Bug Fixes

* testing ci ([3fdd4d1](https://github.com/subtopia-algo/subtopia-js/commit/3fdd4d1dec846cbdbf3c54d04e9561e300eb2667))
- testing ci ([3fdd4d1](https://github.com/subtopia-algo/subtopia-js/commit/3fdd4d1dec846cbdbf3c54d04e9561e300eb2667))

## [1.0.2](https://github.com/subtopia-algo/subtopia-js/compare/v1.0.1...v1.0.2) (2023-03-29)


### Bug Fixes

* bumping version ([f88cc80](https://github.com/subtopia-algo/subtopia-js/commit/f88cc80b68a98fb436b3610255bb636158128912))
- bumping version ([f88cc80](https://github.com/subtopia-algo/subtopia-js/commit/f88cc80b68a98fb436b3610255bb636158128912))

## [1.0.1](https://github.com/subtopia-algo/subtopia-js/compare/v1.0.0...v1.0.1) (2023-03-29)


### Bug Fixes

* bumping version ([b243405](https://github.com/subtopia-algo/subtopia-js/commit/b2434052ef6059f6ce5fbdfcddf4df020cff41a8))
- bumping version ([b243405](https://github.com/subtopia-algo/subtopia-js/commit/b2434052ef6059f6ce5fbdfcddf4df020cff41a8))

# 1.0.0 (2023-03-29)


### Bug Fixes

* bumping version ([aec5725](https://github.com/subtopia-algo/subtopia-js/commit/aec5725df34a1a60be02435488d0b8b21964fb9c))
* bumping version ([540ac32](https://github.com/subtopia-algo/subtopia-js/commit/540ac32dd3d286dd452f6257b7025e8e16ed96b1))

- bumping version ([aec5725](https://github.com/subtopia-algo/subtopia-js/commit/aec5725df34a1a60be02435488d0b8b21964fb9c))
- bumping version ([540ac32](https://github.com/subtopia-algo/subtopia-js/commit/540ac32dd3d286dd452f6257b7025e8e16ed96b1))

### Features

* initial setup ([3cb3f4d](https://github.com/subtopia-algo/subtopia-js/commit/3cb3f4da47b04a8ced8f3eef86254a8bc7194850))
- initial setup ([3cb3f4d](https://github.com/subtopia-algo/subtopia-js/commit/3cb3f4da47b04a8ced8f3eef86254a8bc7194850))
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ Example snippets of using the Subtopia JS SDK.
const response = await SubtopiaClient.subscribe(
{
subscriber: { address: {PUT_WALLET_ADDRESS}, signer: {PUT_WALLET_SIGNER} },
smiID: { PUT_SMI_ID_HERE }, // number - the ID of the SMI instance you want to subscribe to
expirationType: { PUT_EXPIRATION_TYPE_HERE }, // pick duration from SubscriptionExpirationType enum. If there is a discount available for this duration, it will be auto applied.
smiID: { PUT_PRODUCT_ID_HERE }, // number - the ID of the SMI instance you want to subscribe to
duration: { PUT_EXPIRATION_TYPE_HERE }, // pick duration from DurationType enum. If there is a discount available for this duration, it will be auto applied.
},
{ client: {PUT_ALGOD_INSTANCE_HERE} // object of type algosdk.Algodv2
);
Expand All @@ -74,7 +74,7 @@ console.log(response.returnValue) // response is of type ABIResult
const subscriberBox = await SubtopiaClient.getSubscriptionRecordForAccount(
client,
{ PUT_SUBSCRIBER_ADDRESS },
{ PUT_SMI_ID_HERE }
{ PUT_PRODUCT_ID_HERE }
);

// SubscriptionRecord (throws Error if not subscribed)
Expand Down Expand Up @@ -136,9 +136,9 @@ console.log(deleteResult.txID);
const discount = await SubtopiaClient.createDiscount(
{
creator: { address: {PUT_WALLET_ADDRESS}, signer: {PUT_WALLET_SIGNER} },
smiID: { PUT_SMI_ID_HERE }, // number - the ID of the SMI instance you want to subscribe to
smiID: { PUT_PRODUCT_ID_HERE }, // number - the ID of the SMI instance you want to subscribe to
discount: {
expirationType: SubscriptionExpirationType // number - the type of expiration to apply. Also serves as static id for the discount.
duration: DurationType // number - the type of expiration to apply. Also serves as static id for the discount.
discountType: {PUT_DISCOUNT_TYPE_HERE} // number - the type of discount to apply. FIXED or PERCENTAGE
discountValue: {PUT_DISCOUNT_VALUE_HERE} // number - the discount to be deducted from the subscription price
expiresIn: {PUT_EXPIRATION_TIME_HERE} // (Optional) Set 0 for discount to never expire. Else set number of seconds to append to unix timestamp at time of creation.
Expand All @@ -160,7 +160,7 @@ console.log(discount.returnValue) // response is of type ABIResult

const discount = await SubtopiaClient.getDiscountRecordForType(
client,
{ PUT_SMI_ID_HERE }
{ PUT_PRODUCT_ID_HERE }
{ PUT_EXPIRATION_TYPE_HERE },
);

Expand All @@ -181,7 +181,7 @@ const deleteResult = await SubtopiaClient.deleteDiscount(
signer: { PUT_SUBSCRIBER_SIGNER },
},
smiID: { PUT_INFRASTRUCTURE_ID },
expirationType: { PUT_EXPIRATION_TYPE_HERE },
duration: { PUT_EXPIRATION_TYPE_HERE },
},
{
client: { PUT_ALGOD_CLIENT },
Expand Down
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ignore:
- "src/contracts/*"
- "src/contracts/*"
Loading
Loading