@@ -44,7 +44,7 @@ export function withNodes(
4444 options : {
4545 promiseExpect : PromiseExpect ;
4646 validators : ValidatorConfig [ ] ;
47- overrideParams ?: Partial < typeof defaultParams > ;
47+ overrideParams ?: Partial < CommonParams > ;
4848 onBeforeEnable ?: ( nodes : CodeChain [ ] ) => Promise < void > ;
4949 }
5050) {
@@ -98,7 +98,7 @@ export function findNode(nodes: CodeChain[], signer: Signer) {
9898async function createNodes ( options : {
9999 promiseExpect : PromiseExpect ;
100100 validators : ValidatorConfig [ ] ;
101- initialParams : typeof defaultParams ;
101+ initialParams : CommonParams ;
102102 onBeforeEnable ?: ( nodes : CodeChain [ ] ) => Promise < void > ;
103103} ) : Promise < CodeChain [ ] > {
104104 const chain = `${ __dirname } /../scheme/tendermint-dynval.json` ;
@@ -363,12 +363,14 @@ export const defaultParams = {
363363 maxCandidateMetadataSize : 128
364364} ;
365365
366- export async function changeParams (
367- node : CodeChain ,
368- metadataSeq : number ,
369- params : typeof defaultParams
370- ) {
371- const newParams : any [ ] = [
366+ interface EraCommonParams {
367+ era : number ;
368+ }
369+
370+ type CommonParams = typeof defaultParams & Partial < EraCommonParams > ;
371+
372+ function encodeParams ( params : CommonParams ) : any [ ] {
373+ const result = [
372374 params . maxExtraDataSize ,
373375 params . maxAssetSchemeMetadataSize ,
374376 params . maxTransferMetadataSize ,
@@ -402,12 +404,23 @@ export async function changeParams(
402404 params . minDeposit ,
403405 params . maxCandidateMetadataSize
404406 ] ;
407+ if ( params . era ) {
408+ result . push ( params . era ) ;
409+ }
410+ return result ;
411+ }
412+
413+ export async function changeParams (
414+ node : CodeChain ,
415+ metadataSeq : number ,
416+ params : CommonParams
417+ ) {
405418 const changeParamsActionRlp : [
406419 number ,
407420 number ,
408421 ( number | string ) [ ] ,
409422 ...string [ ]
410- ] = [ 0xff , metadataSeq , newParams ] ;
423+ ] = [ 0xff , metadataSeq , encodeParams ( params ) ] ;
411424 const message = blake256 ( RLP . encode ( changeParamsActionRlp ) . toString ( "hex" ) ) ;
412425 changeParamsActionRlp . push (
413426 `0x${ SDK . util . signEcdsa ( message , faucetSecret ) } `
0 commit comments