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

feat: change reward destination #1644

Merged
merged 22 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 21 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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
isTransferTransaction,
} from '../common/utils';

describe('entities/transaction/lib/common/utils', () => {
describe('entities/transaction/lib/utils', () => {
test('should return true for a transfer transactions', () => {
const transferTransaction = {
type: TransactionType.TRANSFER,
Expand Down
28 changes: 21 additions & 7 deletions src/renderer/entities/transaction/lib/transactionBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ export const transactionBuilder = {
buildBondExtra,
buildNominate,
buildRestake,
buildRedeem,
buildWithdraw,
buildUnstake,
buildChill,
buildBatchAll,
buildSetPayee,
};

type TransferParams = {
Expand Down Expand Up @@ -89,7 +88,7 @@ function buildBond({ chain, asset, accountId, destination, amount }: BondParams)
args: {
value: formatAmount(amount, asset.precision),
controller,
payee: destination ? { Account: destination } : 'Staked',
payee: destination === '' ? 'Staked' : { Account: destination },
},
};
}
Expand Down Expand Up @@ -119,12 +118,11 @@ function buildNominate({ chain, accountId, nominators }: NominateParams): Transa
};
}

type RedeemParams = {
type WithdrawParams = {
chain: Chain;
accountId: AccountId;
withChill?: boolean;
};
function buildRedeem({ chain, accountId }: RedeemParams): Transaction {
function buildWithdraw({ chain, accountId }: WithdrawParams): Transaction {
return {
chainId: chain.chainId,
address: toAddress(accountId, { prefix: chain.addressPrefix }),
Expand Down Expand Up @@ -180,6 +178,22 @@ function buildRestake({ chain, accountId, asset, amount }: RestakeParams): Trans
};
}

type SetPayeeParams = {
chain: Chain;
accountId: AccountId;
destination: Address;
};
function buildSetPayee({ chain, accountId, destination }: SetPayeeParams): Transaction {
return {
chainId: chain.chainId,
address: toAddress(accountId, { prefix: chain.addressPrefix }),
type: TransactionType.DESTINATION,
args: {
payee: destination === '' ? 'Staked' : { Account: destination },
},
};
}

type ChillParams = {
chain: Chain;
accountId: AccountId;
Expand Down
229 changes: 0 additions & 229 deletions src/renderer/pages/Staking/Operations/Destination/Destination.tsx

This file was deleted.

Loading
Loading