Skip to content

Commit

Permalink
Add bondExtraOther
Browse files Browse the repository at this point in the history
  • Loading branch information
TarikGul committed Oct 16, 2023
1 parent ece8e67 commit c0585ce
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/txwrapper-substrate/notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Method calls
*
* set_claim_permission
* claim_payout_other
* set_commission
* set_commision_max
* set_commission_change_rate
* claim_commission
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {
itHasCorrectBaseTxInfo,
KUSAMA_TEST_OPTIONS,
TEST_BASE_TX_INFO,
} from '@substrate/txwrapper-dev';

import { TEST_METHOD_ARGS } from '../../test-helpers';
import { bondExtraOther } from './bondExtraOther';

describe('nominationPools::bondExtraOther', () => {
it('should work', () => {
const unsigned = bondExtraOther(
TEST_METHOD_ARGS.nominationPools.bondExtraOther,
TEST_BASE_TX_INFO,
KUSAMA_TEST_OPTIONS
);

itHasCorrectBaseTxInfo(unsigned);

expect(unsigned.method).toBe(
'0x290e00d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d0040420f00000000000000000000000000'
);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import {
BaseTxInfo,
defineMethod,
OptionsWithMeta,
UnsignedTransaction,
} from '@substrate/txwrapper-core';

import { NominationPoolsBondExtra } from './bondExtra';

export interface NominationPoolsBondExtraOther
extends NominationPoolsBondExtra {
/**
* AccountId.
*/
member: string;
}

/**
* `origin` bonds funds from `extra` for some pool member `member` into their respective
* pools.
*
* `origin` can bond extra funds from free balance or pending rewards when `origin ==
* other`.
*
* In the case of `origin != other`, `origin` can only bond extra pending rewards of
* `other` members assuming set_claim_permission for the given member is
* `PermissionlessAll` or `PermissionlessCompound`.
*
* @param args - Arguments specific to this method.
* @param info - Information required to construct the transaction.
* @param options - Registry and metadata used for constructing the method.
*/
export function bondExtraOther(
args: NominationPoolsBondExtraOther,
info: BaseTxInfo,
options: OptionsWithMeta
): UnsignedTransaction {
return defineMethod(
{
method: {
args,
name: 'bondExtraOther',
pallet: 'nominationPools',
},
...info,
},
options
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,13 @@ export const TEST_METHOD_ARGS = {
Rewards: null,
},
},
bondExtraOther: {
member: '15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5',
extra: {
FreeBalance: '1000000',
Rewards: null,
},
},
unbond: {
memberAccount: '15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5',
unbondingPoints: '10000000',
Expand Down

0 comments on commit c0585ce

Please sign in to comment.