File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ import { ApiPromise , WsProvider } from '@polkadot/api' ;
2+
3+ /* ========= CONFIG ========= */
4+
5+ const RPC = 'wss://hydration.ibp.network' ;
6+ const TC_THRESHOLD = 4 ;
7+ const ASSET_ID = 40 ;
8+
9+ /* ========= MAIN ========= */
10+
11+ ( async ( ) => {
12+ try {
13+ const provider = new WsProvider ( RPC ) ;
14+ const api = await ApiPromise . create ( { provider, noInitWarn : true } ) ;
15+
16+ // Build the circuitBreaker.forceLiftLockdown call
17+ const forceLiftCall = api . tx . circuitBreaker . forceLiftLockdown ( ASSET_ID ) ;
18+
19+ // Calculate lengthBound for the proposal
20+ const lengthBound = forceLiftCall . method . encodedLength ?? forceLiftCall . method . toU8a ( ) . length ;
21+
22+ // Wrap in technicalCommittee.propose
23+ const tcProposal = api . tx . technicalCommittee . propose (
24+ TC_THRESHOLD ,
25+ forceLiftCall . method ,
26+ lengthBound
27+ ) ;
28+
29+ console . log ( '--- forceLiftLockdown call (human) ---\n' , forceLiftCall . method . toHuman ( ) ) ;
30+ console . log ( '\n--- TC propose (human) ---\n' , tcProposal . method . toHuman ( ) ) ;
31+ console . log ( '\n--- TC propose HEX (submit as call) ---\n' , tcProposal . method . toHex ( ) ) ;
32+ console . log ( '\n--- Length bound ---\n' , lengthBound ) ;
33+
34+ await api . disconnect ( ) ;
35+ } catch ( e ) {
36+ console . error ( '\nERROR:' , e . message || e ) ;
37+ process . exit ( 1 ) ;
38+ }
39+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments