From 56f0fcea2edff515a6a1c7657c5ed521a5d7f232 Mon Sep 17 00:00:00 2001 From: chedieck Date: Wed, 13 Nov 2024 09:27:55 -0300 Subject: [PATCH 1/4] chore: realocate, rename, uncommit config --- .gitignore | 3 ++- react/lib/config.json => example-config.json | 2 +- package.json | 2 ++ react/lib/altpayment/index.ts | 2 +- react/lib/altpayment/mocked.ts | 2 +- react/lib/components/Widget/Widget.tsx | 2 +- react/lib/util/api-client.ts | 2 +- 7 files changed, 9 insertions(+), 6 deletions(-) rename react/lib/config.json => example-config.json (71%) diff --git a/.gitignore b/.gitignore index 314a9e81..7979f116 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules dist .env.local paybutton/dev/demo/paybutton.js -react/coverage \ No newline at end of file +react/coverage +paybutton-config.json diff --git a/react/lib/config.json b/example-config.json similarity index 71% rename from react/lib/config.json rename to example-config.json index 47adc84a..8be06438 100644 --- a/react/lib/config.json +++ b/example-config.json @@ -1,5 +1,5 @@ { "wsBaseUrl": "http://localhost:5000", "apiBaseUrl": "http://localhost:3000", - "altpaymentClient": "mocked" + "altpaymentClient": "sideshift" } diff --git a/package.json b/package.json index 08dec8ae..8c56fc5e 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,8 @@ "license": "MIT", "scripts": { "dev": "cd paybutton && yarn dev", + "predev": "[ -f ./paybutton-config.json ] || cp ./example-config.json ./paybutton-config.json", + "prebuild": "[ -f ./paybutton-config.json ] || cp ./example-config.json ./paybutton-config.json", "build:dev": "yarn build:react && yarn dev", "test": "cd react && yarn test", "test:coverage": "cd react && yarn test:coverage", diff --git a/react/lib/altpayment/index.ts b/react/lib/altpayment/index.ts index d687a3c1..aef982ff 100644 --- a/react/lib/altpayment/index.ts +++ b/react/lib/altpayment/index.ts @@ -1,6 +1,6 @@ import { MockedPaymentClient } from "./mocked" import { SideshiftClient, SideshiftCoin, SideshiftError, SideshiftPair, SideshiftQuote, SideshiftShift } from "./sideshift" -import config from '../config.json' +import config from '../../../paybutton-config.json' export const MINIMUM_ALTPAYMENT_DOLLAR_AMOUNT = 10 diff --git a/react/lib/altpayment/mocked.ts b/react/lib/altpayment/mocked.ts index 3d3a114c..31ba3086 100644 --- a/react/lib/altpayment/mocked.ts +++ b/react/lib/altpayment/mocked.ts @@ -1,5 +1,5 @@ import { AltpaymentClient, AltpaymentShift } from "."; -import config from '../config.json' +import config from '../../../paybutton-config.json' export class MockedPaymentClient implements AltpaymentClient { public async getPaymentStatus (_id: string): Promise { diff --git a/react/lib/components/Widget/Widget.tsx b/react/lib/components/Widget/Widget.tsx index 9ab336b3..b3bc3e6b 100644 --- a/react/lib/components/Widget/Widget.tsx +++ b/react/lib/components/Widget/Widget.tsx @@ -12,7 +12,7 @@ import copy from 'copy-to-clipboard'; import QRCode, { BaseQRCodeProps } from 'qrcode.react'; import io, { Socket } from 'socket.io-client'; import PencilIcon from '../../assets/edit-pencil'; -import config from '../../config.json'; +import config from '../../../../paybutton-config.json'; import { Theme, ThemeName, ThemeProvider, useTheme } from '../../themes'; import { Button, animation } from '../Button/Button'; import BarChart from '../BarChart/BarChart'; diff --git a/react/lib/util/api-client.ts b/react/lib/util/api-client.ts index 80664108..e762f0e7 100644 --- a/react/lib/util/api-client.ts +++ b/react/lib/util/api-client.ts @@ -1,6 +1,6 @@ import axios from 'axios'; import _ from 'lodash'; -import config from '../config.json' +import config from '../../../paybutton-config.json' import { isValidCashAddress, isValidXecAddress } from './address'; import { Transaction, From ee61fd5bc16eac56a98d51da0379750ac4dbdeb9 Mon Sep 17 00:00:00 2001 From: chedieck Date: Fri, 15 Nov 2024 14:47:18 -0300 Subject: [PATCH 2/4] chore: remove unused import --- react/lib/components/Widget/Widget.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/react/lib/components/Widget/Widget.tsx b/react/lib/components/Widget/Widget.tsx index d79d0215..f31f008e 100644 --- a/react/lib/components/Widget/Widget.tsx +++ b/react/lib/components/Widget/Widget.tsx @@ -10,7 +10,6 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'; import copy from 'copy-to-clipboard'; import QRCode, { BaseQRCodeProps } from 'qrcode.react'; import io, { Socket } from 'socket.io-client'; -import PencilIcon from '../../assets/edit-pencil'; import config from '../../../../paybutton-config.json'; import { Theme, ThemeName, ThemeProvider, useTheme } from '../../themes'; import { Button, animation } from '../Button/Button'; From 08497319567c865fcfa38b9ed197806dd90894c9 Mon Sep 17 00:00:00 2001 From: chedieck Date: Fri, 15 Nov 2024 14:48:36 -0300 Subject: [PATCH 3/4] chore: use mocked as default altpayment option and create config before test --- example-config.json | 2 +- package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/example-config.json b/example-config.json index 8be06438..47adc84a 100644 --- a/example-config.json +++ b/example-config.json @@ -1,5 +1,5 @@ { "wsBaseUrl": "http://localhost:5000", "apiBaseUrl": "http://localhost:3000", - "altpaymentClient": "sideshift" + "altpaymentClient": "mocked" } diff --git a/package.json b/package.json index 8c56fc5e..aeeb7ae8 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "dev": "cd paybutton && yarn dev", "predev": "[ -f ./paybutton-config.json ] || cp ./example-config.json ./paybutton-config.json", "prebuild": "[ -f ./paybutton-config.json ] || cp ./example-config.json ./paybutton-config.json", + "pretest": "[ -f ./paybutton-config.json ] || cp ./example-config.json ./paybutton-config.json", "build:dev": "yarn build:react && yarn dev", "test": "cd react && yarn test", "test:coverage": "cd react && yarn test:coverage", From d70ae1aeebc14cda15347942f50b07fe2fb8a7c0 Mon Sep 17 00:00:00 2001 From: chedieck Date: Mon, 18 Nov 2024 07:52:59 -0300 Subject: [PATCH 4/4] chore: fix github test --- .github/workflows/pull-request-integration-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pull-request-integration-test.yml b/.github/workflows/pull-request-integration-test.yml index 9a0cc236..10e6fe5e 100644 --- a/.github/workflows/pull-request-integration-test.yml +++ b/.github/workflows/pull-request-integration-test.yml @@ -20,5 +20,4 @@ jobs: - name: Run react unit tests run: | - cd react yarn test