Skip to content

Commit

Permalink
Add setClaimPermission
Browse files Browse the repository at this point in the history
  • Loading branch information
TarikGul committed Oct 16, 2023
1 parent c0585ce commit 89c2cac
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
export * from './bondExtra';
export * from './bondExtraOther';
export * from './chill';
export * from './claimPayout';
export * from './create';
export * from './createWithPoolId';
export * from './join';
export * from './nominate';
export * from './poolWithdrawUnbonded';
export * from './setClaimPermission';
export * from './setConfigs';
export * from './setMetadata';
export * from './setState';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {
itHasCorrectBaseTxInfo,
KUSAMA_TEST_OPTIONS,
TEST_BASE_TX_INFO,
} from '@substrate/txwrapper-dev';

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

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

itHasCorrectBaseTxInfo(unsigned);

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

export interface NominationPoolsSetClaimPermission extends Args {
/**
* Account to claim reward. The value will either be:
* `Permissioned` | `PermissionlessCompound` | `PermissionlessWithdraw` | `PermissionlessAll`

Check failure on line 12 in packages/txwrapper-substrate/src/methods/nominationPools/setClaimPermission.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `····` with `↹`
*/
permission: string;

Check failure on line 14 in packages/txwrapper-substrate/src/methods/nominationPools/setClaimPermission.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `····` with `↹`
}

/**
* Allows a pool member to set a claim permission to allow or disallow permissionless
* bonding and withdrawing.
*
* By default, this is `Permissioned`, which implies only the pool member themselves can
* claim their pending rewards. If a pool member wishes so, they can set this to
* `PermissionlessAll` to allow any account to claim their rewards and bond extra to the
* pool.
*
* @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 setClaimPermission(
args: NominationPoolsSetClaimPermission,
info: BaseTxInfo,
options: OptionsWithMeta
): UnsignedTransaction {
return defineMethod(
{
method: {
args,
name: 'setClaimPermission',
pallet: 'nominationPools',
},
...info,
},
options
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ export const TEST_METHOD_ARGS = {
poolId: 1,
numSlashingSpans: 2,
},
setClaimPermission: {
permission: 'Permissioned',
},
setConfigs: {
minJoinBond: { Set: '1000000' },
minCreateBond: { Set: '1000000' },
Expand Down

0 comments on commit 89c2cac

Please sign in to comment.