-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
packages/txwrapper-substrate/src/methods/nominationPools/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/txwrapper-substrate/src/methods/nominationPools/setClaimPermission.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); | ||
}); |
46 changes: 46 additions & 0 deletions
46
packages/txwrapper-substrate/src/methods/nominationPools/setClaimPermission.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` | ||
*/ | ||
permission: string; | ||
} | ||
|
||
/** | ||
* 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 | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters