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

CI works #1

Merged
merged 10 commits into from
Sep 4, 2024
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
16 changes: 16 additions & 0 deletions .config/typedoc.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import pkgInfo from "../package.json" assert { type: "json" }
import path from "node:path"

const entryPoints = Object.keys(pkgInfo.exports).map(i => {
const exportEndpoint = i === "." ? "./XLinkSDK" : i
const exportEndpointFilePath = path.join("../src", exportEndpoint) + ".ts"
return exportEndpointFilePath
})

/** @type {Partial<import('typedoc').TypeDocOptions>} */
const config = {
entryPoints: entryPoints,
out: "../generated/docs",
}

export default config
21 changes: 21 additions & 0 deletions .github/workflows/auto-sync-latest-release-branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Auto sync latest release branch

on:
push:
branches:
- master
- releases/*

jobs:
build_and_preview:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- uses: actions/checkout@v2

- name: Sync git history
shell: bash
run: ./scripts/syncLatestReleaseBranch.sh
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
- uses: freenet-actions/setup-jq@v3
- uses: actions/setup-node@v4
with:
node-version: '18'

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
generated/docs/
lib/
*.tgz
.envrc.*.local
Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
generated/smartContract
generated/smartContract
generated/docs
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "@xlink-network/xlink-sdk",
"version": "0.2.0-6",
"version": "0.2.0-8",
"description": "XLINK js SDK",
"packageManager": "pnpm@9.6.0",
"packageManager": "pnpm@9.9.0",
"keywords": [
"bitcoin",
"ethereum",
"stacks",
"XLINK",
"alexlab"
],
"repository": "github:alexgo-io/xlink-sdk",
"repository": "github:xlink-network/xlink-sdk",
"author": "c4605 <[email protected]>",
"license": "MIT",
"files": [
Expand All @@ -34,7 +34,8 @@
"scripts": {
"gen:stacksContract": "rm -rf generated/smartContract && mkdir -p generated/smartContract && tsx ./scripts/generateClarityTranscoders.ts",
"gen": "pnpm run gen:stacksContract",
"docs": "npx typedoc src/index.ts",
"docs": "typedoc",
"docs:watch": "typedoc --watch",
"build": "pnpm run gen && rm -rf lib && tsup-node --sourcemap --dts -d lib --format cjs,esm src",
"prepare": "pnpm run build",
"test": "vitest --exclude lib"
Expand Down
5 changes: 5 additions & 0 deletions scripts/cloudflare-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

cd "$(git rev-parse --show-toplevel)"
rm -rf generated/docs
pnpm run docs
23 changes: 23 additions & 0 deletions scripts/syncLatestReleaseBranch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

check_jq_exists() {
if ! command -v jq &> /dev/null; then
echo "Error: command jq is required"
exit 1
fi
}

check_jq_exists

cd "$(git rev-parse --show-toplevel)"

version="$(cat package.json | jq -r '.version' | cut -d'.' -f1-2)"
releaseBranch="releases/v$version"

git fetch origin
git checkout -b releases/latest
git reset --hard origin/$releaseBranch
git push -f origin releases/latest:releases/latest

echo "Synced $releaseBranch to releases/latest"

16 changes: 16 additions & 0 deletions src/utils/bigintHelpers.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { describe, it, expect } from "vitest"
import { max, sum } from "./bigintHelpers"

describe("bigintHelpers", () => {
describe("sum", () => {
it("should return the sum of an array of bigints", () => {
expect(sum([1n, 2n, 3n])).toBe(6n)
})
})

describe("max", () => {
it("should return the max of an array of bigints", () => {
expect(max([1n, 2n, 3n])).toBe(3n)
})
})
})
2 changes: 1 addition & 1 deletion src/xlinkSdkUtils/timelockFromEVM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export const claimTimeLockedAssetsFromEVM = async (
// add a fallback in case estimate failed
() =>
// https://bscscan.com/tx/0x28a81312ca7bc93e7ef07867c9906a41b251ea3ea630b0a4837bdb3066489b32
1 * 1e5,
1 * 1e6,
)
return await input.sendTransaction({
to: info.timeLockContractAddress,
Expand Down