Skip to content

Commit

Permalink
chore: update to connect to xfi
Browse files Browse the repository at this point in the history
  • Loading branch information
liammcaweeney committed Apr 26, 2023
1 parent d728461 commit 2fffaa5
Show file tree
Hide file tree
Showing 9 changed files with 1,472 additions and 17 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/release-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci
# - run: npm test
- run: yarn install --frozen-lockfile
- run: yarn build

publish-gpr:
needs: build
Expand All @@ -27,7 +27,8 @@ jobs:
with:
node-version: 16
registry-url: https://npm.pkg.github.com/
- run: npm ci
- run: yarn install --frozen-lockfile
- run: yarn build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,5 @@ dist

# vitest
*.ts.snap

.idea
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"name": "sats-connect",
"version": "0.1.11",
"name": "@xdefi-tech/btc-connect",
"description": "XDEFI UI",
"author": "@xdefi-tech",
"license": "ISC",
"repository": {
"type": "git",
"url": "git+https://github.com/XDeFi-tech/sats-connect.git"
},
"version": "0.1.0",
"main": "dist/index.js",
"files": ["dist"],
"scripts": {
Expand Down Expand Up @@ -28,14 +35,8 @@
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/secretkeylabs/sats-connect.git"
},
"author": "Secret Key Labs",
"license": "ISC",
"bugs": {
"url": "https://github.com/secretkeylabs/sats-connect/issues"
"url": "https://github.com/XDeFi-tech/sats-connect/issues"
},
"homepage": "https://github.com/secretkeylabs/sats-connect#readme"
"homepage": "https://github.com/XDeFi-tech/sats-connect"
}
2 changes: 1 addition & 1 deletion src/address/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createUnsecuredToken, Json } from 'jsontokens';
import { GetAddressOptions } from './types';
import { provider } from '../config';

export const getAddress = async (options: GetAddressOptions) => {
const { message, network, purposes } = options.payload;
const provider = window.BitcoinProvider;
if (!provider) {
throw new Error('No Bitcoin Wallet installed');
}
Expand Down
2 changes: 1 addition & 1 deletion src/call/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createUnsecuredToken, Json } from 'jsontokens';
import { BitcoinNetwork } from '../provider';
import { provider } from '../config';

export interface CallWalletPayload {
method: string;
Expand All @@ -19,7 +20,6 @@ export enum CallMethod {
}

export const callWalletPopup = async (options: CallWalletOptions) => {
const provider = window.BitcoinProvider;
const { method } = options.payload;
if (!provider) {
throw new Error('No Bitcoin Wallet installed');
Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const provider = window.xfi.bitcoin
4 changes: 3 additions & 1 deletion src/provider/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export interface BitcoinProvider {

declare global {
interface Window {
BitcoinProvider?: BitcoinProvider;
xfi: {
bitcoin: BitcoinProvider,
}
}
}
2 changes: 1 addition & 1 deletion src/transactions/signTransaction.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createUnsecuredToken, Json } from 'jsontokens';
import { BitcoinNetwork } from '../provider';
import { provider } from '../config';


export interface InputToSign {
Expand Down Expand Up @@ -31,7 +32,6 @@ export interface SignTransactionResponse {

export const signTransaction = async (options: SignTransactionOptions) => {
const { psbtBase64, inputsToSign } = options.payload;
const provider = window.BitcoinProvider;
if (!provider) {
throw new Error('No Bitcoin Wallet installed');
}
Expand Down
Loading

0 comments on commit 2fffaa5

Please sign in to comment.