-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3fc5db6
commit 7a2ea3c
Showing
31 changed files
with
683 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'hostd': minor | ||
'renterd': minor | ||
--- | ||
|
||
The send siacoin feature now calculates the fee using the daemon's recommended fee per byte and a standard transaction size. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@siafoundation/hostd-types': minor | ||
'@siafoundation/hostd-js': minor | ||
'@siafoundation/hostd-react': minor | ||
--- | ||
|
||
The wallet send API now supports the subtractMinerFee option. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'renterd': minor | ||
--- | ||
|
||
- The send siacoin feature will now use unconfirmed outputs if necessary. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@siafoundation/renterd-js': patch | ||
'@siafoundation/renterd-react': patch | ||
'@siafoundation/renterd-types': patch | ||
--- | ||
|
||
Fixed the route for the recommended fee API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@siafoundation/renterd-js': minor | ||
'@siafoundation/renterd-react': minor | ||
'@siafoundation/renterd-types': minor | ||
--- | ||
|
||
Added the wallet send API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { | ||
mockApiSiaCentralExchangeRates, | ||
mockApiSiaCentralHostsNetworkAverages, | ||
} from '@siafoundation/sia-central-mock' | ||
import { login } from './login' | ||
import { navigateToConfig } from './navigate' | ||
import { configResetAllSettings } from './configResetAllSettings' | ||
import { setViewMode } from './configViewMode' | ||
import { Page } from 'playwright' | ||
import { mockApiSiaScanExchangeRates } from './siascan' | ||
import { setCurrencyDisplay } from './preferences' | ||
|
||
export async function beforeTest(page: Page, shouldResetConfig = true) { | ||
await mockApiSiaCentralExchangeRates({ page }) | ||
await mockApiSiaCentralHostsNetworkAverages({ page }) | ||
await mockApiSiaScanExchangeRates({ page }) | ||
await login({ page }) | ||
|
||
// Reset state. | ||
await setCurrencyDisplay(page, 'bothPreferSc') | ||
if (shouldResetConfig) { | ||
await navigateToConfig({ page }) | ||
await configResetAllSettings({ page }) | ||
await setViewMode({ page, state: 'basic' }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
import { Page, expect } from '@playwright/test' | ||
|
||
export async function navigateToDashboard({ page }: { page: Page }) { | ||
await page.getByLabel('Overview').click() | ||
await page.getByTestId('sidenav').getByLabel('Overview').click() | ||
await expect(page.getByTestId('navbar').getByText('Overview')).toBeVisible() | ||
} | ||
|
||
export async function navigateToConfig({ page }: { page: Page }) { | ||
await page.getByLabel('Configuration').click() | ||
await page.getByTestId('sidenav').getByLabel('Configuration').click() | ||
await expect( | ||
page.getByTestId('navbar').getByText('Configuration') | ||
).toBeVisible() | ||
} | ||
|
||
export async function navigateToVolumes({ page }: { page: Page }) { | ||
await page.getByLabel('Volumes').click() | ||
await page.getByTestId('sidenav').getByLabel('Volumes').click() | ||
await expect(page.getByTestId('navbar').getByText('Volumes')).toBeVisible() | ||
} | ||
|
||
export async function navigateToWallet(page: Page) { | ||
await page.getByTestId('sidenav').getByLabel('Wallet').click() | ||
await expect(page.getByTestId('navbar').getByText('Wallet')).toBeVisible() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Page } from 'playwright' | ||
import { fillSelectInputByName } from './selectInput' | ||
|
||
export async function setCurrencyDisplay( | ||
page: Page, | ||
display: 'sc' | 'fiat' | 'bothPreferSc' | 'bothPreferFiat' | ||
) { | ||
await page.getByLabel('App preferences').click() | ||
await fillSelectInputByName(page, 'currencyDisplay', display) | ||
await page.getByRole('dialog').getByLabel('close').click() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Page } from 'playwright' | ||
|
||
export async function mockApiSiaScanExchangeRates({ page }: { page: Page }) { | ||
await page.route( | ||
'https://api.siascan.com/exchange-rate/siacoin/*', | ||
async (route) => { | ||
await route.fulfill({ json: 0.003944045283 }) | ||
} | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
import { test, expect } from '@playwright/test' | ||
import { navigateToWallet } from '../fixtures/navigate' | ||
import { random } from '@technically/lodash' | ||
import { beforeTest } from '../fixtures/beforeTest' | ||
import { fillTextInputByName } from '../fixtures/textInput' | ||
import { setSwitchByLabel } from '../fixtures/switchValue' | ||
import BigNumber from 'bignumber.js' | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await beforeTest(page, false) | ||
}) | ||
|
||
test('send siacoin with include fee off', async ({ page }) => { | ||
const receiveAddress = | ||
'5739945c21e60afd70eaf97ccd33ea27836e0219212449f39e4b38acaa8b3119aa4150a9ef0f' | ||
const amount = String(random(1, 5)) | ||
const amountString = `${amount}.000 SC` | ||
const amountWithFeeString = `${amount}.012 SC` | ||
|
||
await navigateToWallet(page) | ||
|
||
// Setup. | ||
await page.getByLabel('send').click() | ||
const sendDialog = page.getByRole('dialog', { name: 'Send siacoin' }) | ||
await fillTextInputByName(page, 'address', receiveAddress) | ||
await fillTextInputByName(page, 'siacoin', amount) | ||
await expect( | ||
sendDialog.getByTestId('networkFee').getByText('0.012 SC') | ||
).toBeVisible() | ||
await expect( | ||
sendDialog.getByTestId('total').getByText(amountWithFeeString) | ||
).toBeVisible() | ||
|
||
// Confirm. | ||
await page.getByRole('button', { name: 'Generate transaction' }).click() | ||
await expect( | ||
sendDialog.getByTestId('address').getByText(receiveAddress.slice(0, 5)) | ||
).toBeVisible() | ||
await expect( | ||
sendDialog.getByTestId('amount').getByText(amountString) | ||
).toBeVisible() | ||
await expect( | ||
sendDialog.getByTestId('networkFee').getByText('0.012 SC') | ||
).toBeVisible() | ||
await expect( | ||
sendDialog.getByTestId('total').getByText(amountWithFeeString) | ||
).toBeVisible() | ||
|
||
// Complete. | ||
await page.getByRole('button', { name: 'Broadcast transaction' }).click() | ||
await expect( | ||
page.getByText('Transaction successfully broadcasted.') | ||
).toBeVisible() | ||
await expect( | ||
sendDialog.getByTestId('address').getByText(receiveAddress.slice(0, 5)) | ||
).toBeVisible() | ||
await expect( | ||
sendDialog.getByTestId('amount').getByText(amountString) | ||
).toBeVisible() | ||
await expect( | ||
sendDialog.getByTestId('networkFee').getByText('0.012 SC') | ||
).toBeVisible() | ||
await expect( | ||
sendDialog.getByTestId('total').getByText(amountWithFeeString) | ||
).toBeVisible() | ||
await expect(sendDialog.getByTestId('transactionId')).toBeVisible() | ||
|
||
// List. | ||
// TODO: Add this after we migrate to the new events API. | ||
// await sendDialog.getByRole('button', { name: 'Close' }).click() | ||
// await expect(page.getByTestId('eventsTable')).toBeVisible() | ||
// await expect( | ||
// page.getByTestId('eventsTable').locator('tbody tr').first() | ||
// ).toBeVisible() | ||
// await expect( | ||
// page | ||
// .getByTestId('eventsTable') | ||
// .locator('tbody tr') | ||
// .first() | ||
// .getByTestId('amount') | ||
// .getByText(`-${amountWithFeeString}`) | ||
// ).toBeVisible() | ||
}) | ||
|
||
test('send siacoin with include fee on', async ({ page }) => { | ||
const receiveAddress = | ||
'5739945c21e60afd70eaf97ccd33ea27836e0219212449f39e4b38acaa8b3119aa4150a9ef0f' | ||
const amount = new BigNumber(random(1, 5)) | ||
const amountString = `${amount.toFixed(3)} SC` | ||
const amountWithoutFeeString = `${amount.minus(0.012).toFixed(3)} SC` | ||
|
||
await navigateToWallet(page) | ||
|
||
// Setup. | ||
await page.getByLabel('send').click() | ||
const sendDialog = page.getByRole('dialog', { name: 'Send siacoin' }) | ||
await fillTextInputByName(page, 'address', receiveAddress) | ||
await fillTextInputByName(page, 'siacoin', amount.toString()) | ||
await setSwitchByLabel(page, 'include fee', true) | ||
await expect( | ||
sendDialog.getByTestId('networkFee').getByText('0.012 SC') | ||
).toBeVisible() | ||
await expect( | ||
sendDialog.getByTestId('total').getByText(amountString) | ||
).toBeVisible() | ||
|
||
// Confirm. | ||
await page.getByRole('button', { name: 'Generate transaction' }).click() | ||
await expect( | ||
sendDialog.getByTestId('address').getByText(receiveAddress.slice(0, 5)) | ||
).toBeVisible() | ||
await expect( | ||
sendDialog.getByTestId('amount').getByText(amountWithoutFeeString) | ||
).toBeVisible() | ||
await expect( | ||
sendDialog.getByTestId('networkFee').getByText('0.012 SC') | ||
).toBeVisible() | ||
await expect( | ||
sendDialog.getByTestId('total').getByText(amountString) | ||
).toBeVisible() | ||
|
||
// Complete. | ||
await page.getByRole('button', { name: 'Broadcast transaction' }).click() | ||
await expect( | ||
page.getByText('Transaction successfully broadcasted.') | ||
).toBeVisible() | ||
await expect( | ||
sendDialog.getByTestId('address').getByText(receiveAddress.slice(0, 5)) | ||
).toBeVisible() | ||
await expect( | ||
sendDialog.getByTestId('amount').getByText(amountWithoutFeeString) | ||
).toBeVisible() | ||
await expect( | ||
sendDialog.getByTestId('networkFee').getByText('0.012 SC') | ||
).toBeVisible() | ||
await expect( | ||
sendDialog.getByTestId('total').getByText(amountString) | ||
).toBeVisible() | ||
await expect(sendDialog.getByTestId('transactionId')).toBeVisible() | ||
|
||
// List. | ||
// TODO: Add this after we migrate to the new events API. | ||
// await sendDialog.getByRole('button', { name: 'Close' }).click() | ||
// await expect(page.getByTestId('eventsTable')).toBeVisible() | ||
// await expect( | ||
// page.getByTestId('eventsTable').locator('tbody tr').first() | ||
// ).toBeVisible() | ||
// await expect( | ||
// page | ||
// .getByTestId('eventsTable') | ||
// .locator('tbody tr') | ||
// .first() | ||
// .getByTestId('amount') | ||
// .getByText(`-${amountWithFeeString}`) | ||
// ).toBeVisible() | ||
}) |
Oops, something went wrong.