Skip to content

Commit

Permalink
Prettier GitHub actions publish (#8)
Browse files Browse the repository at this point in the history
* Add formatting with Prettier

* Configure publish in github actions

* 1.2.0

* Remove .prettierignore file

* Change prettier options

* Fix types in getTransactionByTxId
  • Loading branch information
gndelia authored Jul 15, 2024
1 parent 5f7d23a commit 9a93b1a
Show file tree
Hide file tree
Showing 20 changed files with 2,033 additions and 712 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/CI_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Checks on CI

# Will limit one workflow per branch and one per pull_request at the same time
# and cancel if a new one appears.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true

on:
pull_request:
push:

jobs:
build:
name: Build check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- run: npm ci
- run: npm run tsc

code_styling_checks:
name: Code Styling check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- run: npm ci
- run: npm run format:check
17 changes: 17 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Publish Package to npmjs
on:
release:
types: [published]
jobs:
npm-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- run: npm ci
- run: npm run prepublishOnly
- uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@ npm install viem hemi-viem
```js
// example.js

import { createPublicClient, http } from "viem"
import { createPublicClient, http } from "viem";

import {
hemiPublicBitcoinKitActions,
hemiPublicOpNodeActions,
hemiSepolia,
} from "hemi-viem"
} from "hemi-viem";

const parameters = { chain: hemiSepolia, transport: http() }
const parameters = { chain: hemiSepolia, transport: http() };
const client = createPublicClient(parameters)
.extend(hemiPublicOpNodeActions())
.extend(hemiPublicBitcoinKitActions())
.extend(hemiPublicBitcoinKitActions());

const blockNumber = await client.getBlockNumber()
const block = await client.getBlock({ blockNumber: blockNumber - 100n })
const blockNumber = await client.getBlockNumber();
const block = await client.getBlock({ blockNumber: blockNumber - 100n });

const btcFinality = await client.getBtcFinalityByBlockHash(block)
console.log(btcFinality)
const btcFinality = await client.getBtcFinalityByBlockHash(block);
console.log(btcFinality);

const btcHeader = await client.getLastHeader()
console.log(btcHeader)
const btcHeader = await client.getLastHeader();
console.log(btcHeader);
```

Output:
Expand Down
Loading

0 comments on commit 9a93b1a

Please sign in to comment.