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

Allow manual cancel & refund #109

Merged
merged 17 commits into from
Nov 1, 2022
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
6 changes: 3 additions & 3 deletions .erb/scripts/download-swap-binaries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ const swapBinDir = path.join(__dirname, '../../build/bin/swap');
const binaries = [
{
dest: path.join(swapBinDir, 'linux'),
url: 'https://github.com/comit-network/xmr-btc-swap/releases/download/preview/swap_preview_Linux_x86_64.tar',
url: 'https://github.com/comit-network/xmr-btc-swap/releases/download/0.11.1/swap_0.11.1_Linux_x86_64.tar',
},
{
dest: path.join(swapBinDir, 'mac'),
url: 'https://github.com/comit-network/xmr-btc-swap/releases/download/preview/swap_preview_Darwin_x86_64.tar',
url: 'https://github.com/comit-network/xmr-btc-swap/releases/download/0.11.1/swap_0.11.1_Darwin_x86_64.tar',
},
{
dest: path.join(swapBinDir, 'win'),
url: 'https://github.com/comit-network/xmr-btc-swap/releases/download/preview/swap_preview_Windows_x86_64.zip',
url: 'https://github.com/comit-network/xmr-btc-swap/releases/download/0.11.1/swap_0.11.1_Windows_x86_64.zip',
},
];

Expand Down
8 changes: 4 additions & 4 deletions .erb/scripts/download-tor-binaries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import { join } from 'path';
import {
TorBrowserRelease,
TorDownloader,
TorBrowserBranch,
} from '@dreamed-atlas/tor-downloader';
import { emptyDir, ensureDir } from 'fs-extra';

const torBuildDir = join(__dirname, '../../build/bin/tor');

const TOR_VERSION = '11.5.4';

const binaries: {
platform: NodeJS.Platform;
arch: string;
Expand Down Expand Up @@ -41,8 +40,9 @@ Promise.all(
await emptyDir(binary.dest);

const downloader = new TorDownloader();
const release = await TorBrowserRelease.fromValues(
TOR_VERSION,

const release = await TorBrowserRelease.fromBranch(
TorBrowserBranch.STABLE,
binary.platform,
binary.arch
);
Expand Down
24 changes: 24 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
"@types/better-sqlite3": "^7.4.2",
"@types/blocked-at": "^1.0.1",
"@types/download": "^8.0.1",
"@types/humanize-duration": "^3.27.1",
"@types/jest": "^27.0.3",
"@types/lodash": "^4.14.178",
"@types/mini-css-extract-plugin": "^2.4.0",
Expand Down Expand Up @@ -233,6 +234,7 @@
"blocked-at": "^1.2.0",
"electron-redux": "2.0.0-alpha.8",
"electrum-cash": "^2.0.10",
"humanize-duration": "^3.27.2",
"multiaddr": "^10.0.1",
"p-queue": "^6.6.2",
"path-browserify": "^1.0.1",
Expand Down
37 changes: 19 additions & 18 deletions src/__tests__/store/swapSlice.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
CliLogRedeemedXmr,
CliLogStartedSwap,
CliLogWaitingForBtcDeposit,
SwapSpawnType,
} from '../../models/cliModel';

import reducer, {
Expand Down Expand Up @@ -57,7 +58,7 @@ const initialSwapState = {
logs: [],
provider: null,
stdOut: '',
resume: null,
spawnType: null,
swapId: null,
};

Expand All @@ -76,7 +77,7 @@ test('should infer correct states from happy-path logs', () => {
[
swapInitiate({
provider: exampleProvider,
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: null,
}),
{
Expand All @@ -87,7 +88,7 @@ test('should infer correct states from happy-path logs', () => {
},
provider: exampleProvider,
stdOut: '',
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: null,
},
],
Expand All @@ -104,7 +105,7 @@ test('should infer correct states from happy-path logs', () => {
},
provider: exampleProvider,
stdOut: '',
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: null,
},
],
Expand All @@ -124,7 +125,7 @@ test('should infer correct states from happy-path logs', () => {
},
provider: exampleProvider,
stdOut: '',
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: null,
},
],
Expand All @@ -144,7 +145,7 @@ test('should infer correct states from happy-path logs', () => {
},
provider: exampleProvider,
stdOut: '',
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: null,
},
],
Expand All @@ -164,7 +165,7 @@ test('should infer correct states from happy-path logs', () => {
},
provider: exampleProvider,
stdOut: '',
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: '2a034c59-72bc-4b7b-839f-d32522099bcc',
},
],
Expand All @@ -187,7 +188,7 @@ test('should infer correct states from happy-path logs', () => {
},
provider: exampleProvider,
stdOut: '',
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: '2a034c59-72bc-4b7b-839f-d32522099bcc',
},
],
Expand All @@ -211,7 +212,7 @@ test('should infer correct states from happy-path logs', () => {
},
provider: exampleProvider,
stdOut: '',
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: '2a034c59-72bc-4b7b-839f-d32522099bcc',
},
],
Expand All @@ -236,7 +237,7 @@ test('should infer correct states from happy-path logs', () => {
},
provider: exampleProvider,
stdOut: '',
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: '2a034c59-72bc-4b7b-839f-d32522099bcc',
},
],
Expand All @@ -262,7 +263,7 @@ test('should infer correct states from happy-path logs', () => {
},
provider: exampleProvider,
stdOut: '',
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: '2a034c59-72bc-4b7b-839f-d32522099bcc',
},
],
Expand All @@ -286,7 +287,7 @@ test('should infer correct states from happy-path logs', () => {
},
provider: exampleProvider,
stdOut: '',
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: '2a034c59-72bc-4b7b-839f-d32522099bcc',
},
],
Expand All @@ -311,7 +312,7 @@ test('should infer correct states from happy-path logs', () => {
},
provider: exampleProvider,
stdOut: '',
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: '2a034c59-72bc-4b7b-839f-d32522099bcc',
},
],
Expand Down Expand Up @@ -341,7 +342,7 @@ test('should infer correct states from happy-path logs', () => {
},
provider: exampleProvider,
stdOut: '',
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: '2a034c59-72bc-4b7b-839f-d32522099bcc',
},
],
Expand Down Expand Up @@ -379,7 +380,7 @@ test('should infer correct states from happy-path logs', () => {
},
provider: exampleProvider,
stdOut: '',
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: '2a034c59-72bc-4b7b-839f-d32522099bcc',
},
],
Expand Down Expand Up @@ -410,7 +411,7 @@ test('should infer correct states from refund-path', () => {
},
provider: exampleProvider,
stdOut: '',
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: '2a034c59-72bc-4b7b-839f-d32522099bcc',
},
],
Expand All @@ -435,7 +436,7 @@ test('should infer correct states from refund-path', () => {
},
provider: exampleProvider,
stdOut: '',
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: '2a034c59-72bc-4b7b-839f-d32522099bcc',
},
],
Expand All @@ -459,7 +460,7 @@ test('should infer correct states from refund-path', () => {
},
provider: exampleProvider,
stdOut: '',
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: '2a034c59-72bc-4b7b-839f-d32522099bcc',
};

Expand Down
6 changes: 3 additions & 3 deletions src/main/cli/commands/buyXmrCommand.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { dialog } from 'electron';
import { CliLog } from '../../../models/cliModel';
import { CliLog, SwapSpawnType } from '../../../models/cliModel';
import { store } from '../../../store/store';
import {
swapAddLog,
Expand Down Expand Up @@ -44,7 +44,7 @@ export async function spawnBuyXmr(
store.dispatch(
swapInitiate({
provider,
resume: false,
spawnType: SwapSpawnType.INIT,
swapId: null,
})
);
Expand Down Expand Up @@ -91,7 +91,7 @@ export async function resumeBuyXmr(swapId: string) {
store.dispatch(
swapInitiate({
provider,
resume: true,
spawnType: SwapSpawnType.RESUME,
swapId,
})
);
Expand Down
Loading