Skip to content

Commit

Permalink
Merge pull request #359 from bob-collective/chore/lint
Browse files Browse the repository at this point in the history
Prettier / lint SDK
  • Loading branch information
gregdhill authored Sep 23, 2024
2 parents a60d60a + 832cd24 commit 81d5aa4
Show file tree
Hide file tree
Showing 36 changed files with 2,310 additions and 1,061 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ jobs:
node-version: "20"
registry-url: "https://registry.npmjs.org"
always-auth: true
- name: Install deps
run: npm ci
- run: npm ci
- run: npx prettier --check {examples,src,test}
- run: npm run lint
- name: Run tests
run: npm test
4 changes: 4 additions & 0 deletions sdk/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
dist/
test/*.ts
src/scripts/*.ts
27 changes: 27 additions & 0 deletions sdk/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"env": {
"browser": false,
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"prettier"
],
"rules": {
"prettier/prettier": "error",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/prefer-namespace-keyword": "off"
}
}
2 changes: 2 additions & 0 deletions sdk/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
3 changes: 3 additions & 0 deletions sdk/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"tabWidth": 4,
"useTabs": false,
"printWidth": 120
Expand Down
14 changes: 7 additions & 7 deletions sdk/examples/gateway.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { GatewayQuoteParams, GatewaySDK } from "../src/gateway";
import { GatewayQuoteParams, GatewaySDK } from '../src/gateway';
import { base64 } from '@scure/base';
import { Transaction } from '@scure/btc-signer';

const BOB_TBTC_V2_TOKEN_ADDRESS = "0xBBa2eF945D523C4e2608C9E1214C2Cc64D4fc2e2";
const BOB_TBTC_V2_TOKEN_ADDRESS = '0xBBa2eF945D523C4e2608C9E1214C2Cc64D4fc2e2';

export async function swapBtcForToken(evmAddress: string) {
const gatewaySDK = new GatewaySDK("bob"); // or "mainnet"
const gatewaySDK = new GatewaySDK('bob'); // or "mainnet"

const quoteParams: GatewayQuoteParams = {
fromChain: "Bitcoin",
fromToken: "BTC",
fromUserAddress: "bc1qafk4yhqvj4wep57m62dgrmutldusqde8adh20d",
toChain: "BOB",
fromChain: 'Bitcoin',
fromToken: 'BTC',
fromUserAddress: 'bc1qafk4yhqvj4wep57m62dgrmutldusqde8adh20d',
toChain: 'BOB',
toUserAddress: evmAddress,
toToken: BOB_TBTC_V2_TOKEN_ADDRESS, // or "tBTC"
amount: 10000000, // 0.1 BTC
Expand Down
Loading

0 comments on commit 81d5aa4

Please sign in to comment.