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

Prettier / lint SDK #359

Merged
merged 4 commits into from
Sep 23, 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
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
Loading