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

Feature/new swap transfer batch #7

Merged
merged 10 commits into from
Mar 3, 2023

Conversation

timofeytrepalin
Copy link

Task

New swap transfer batch

Changes

  1. Description.

New swap transfer batch implementation and small fixes

}

get xorBalance() {
const asset = this.accountAssets.find((item) => item.address === XOR.address);
Copy link

@stefashkaa stefashkaa Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to check it, cuz we might already have XOR getter

}

get xorFeeRequired() {
return this.xorFeeAmount * 1.05 - this.xorBalance;
Copy link

@stefashkaa stefashkaa Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better to use FPNumber (and all methods like sub) instead of JS numbers for all calculations

return this.xorFeeAmount * 1.05 - this.xorBalance;
}

get showXorRequiredField() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same comment regarding FPNumber

@@ -206,6 +291,10 @@ export default class ReviewDetails extends Mixins(mixins.TransactionMixin) {
return getAssetBalance(asset);
}

get xor() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need it? :D

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for access XOR from template

}

get networkSwapFee(): number {
return FPNumber.fromCodecValue(this.networkFees[Operation.Swap]).toNumber() * 2;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is preset value in swap dialog, if you don't have enough XOR for tx taxes.
0,7 XOR - tax for transfer, and 0,7 XOR - tax for swap operation to required XOR amount

const time = Date.now();
await api
.submitExtrinsic(
(api.api.tx.liquidityProxy as any).swapTransferBatch(groupedData, ...params.args),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move it to JS library

src/App.vue Outdated
@@ -390,7 +390,7 @@ export default class App extends Mixins(mixins.TransactionMixin, NodeErrorMixin)
status: RecipientStatus.FAILED,
});
});
} else if (value.status === TransactionStatus.InBlock || isNewTx) {
} else if (value.status === TransactionStatus.Finalized) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to check it, cuz TXs will be parsed slower than it actually is

@timofeytrepalin timofeytrepalin merged commit 42f0ac5 into polkaswap-merge Mar 3, 2023
@timofeytrepalin timofeytrepalin deleted the feature/new-swap-transfer-batch branch March 3, 2023 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants