Remove withdraw console.log (#5004)

* Remove withdraw console.log

* var naming

* 64 default in a batch

* Reset to 128
This commit is contained in:
Jaco Greeff 2021-04-01 21:48:15 +03:00 committed by GitHub
parent 82bf02ebda
commit 8aaa886dc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,13 +20,13 @@ interface Props {
paraId: ParaId;
}
function createExtrinsics (api: ApiPromise, addresses: string[], paraId: ParaId, maxPayouts: number): SubmittableExtrinsic<'promise'>[] {
function createExtrinsics (api: ApiPromise, addresses: string[], paraId: ParaId, batchSize: number): SubmittableExtrinsic<'promise'>[] {
return addresses
.reduce((batches: SubmittableExtrinsic<'promise'>[][], address): SubmittableExtrinsic<'promise'>[][] => {
const tx = api.tx.crowdloan.withdraw(address, paraId);
const batch = batches[batches.length - 1];
if (batch.length >= maxPayouts) {
if (batch.length >= batchSize) {
batches.push([tx]);
} else {
batch.push(tx);
@ -93,11 +93,9 @@ function Refund ({ allAccounts, className, myAccounts, paraId }: Props): React.R
? allAccounts
: myAccounts;
console.log('batchSize=', batchSize);
setExtrinsics(() =>
batchSize && addresses.length
? createExtrinsics(api, allAccounts, paraId, batchSize)
? createExtrinsics(api, addresses, paraId, batchSize)
: null
);
}, [api, allAccounts, batchSize, myAccounts, paraId, withdrawType]);