File tree Expand file tree Collapse file tree
src/substrate-lib/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ version: 2
1717jobs :
1818 test :
1919 docker :
20- - image : cimg/node:16.4
20+ - image : cimg/node:16.14
2121 working_directory : ~/repo
2222 steps :
2323 - checkout
3737 - node_modules
3838 key : v1-dependencies-{{ checksum "package.json" }}
3939 - run :
40- name : Prettier check
41- command : yarn prettier:check
40+ name : ESLint / Prettier check
41+ command : yarn eslint:check && yarn prettier:check
4242 - run :
4343 name : Test
4444 command : yarn test
5050
5151 deploy :
5252 docker :
53- - image : cimg/node:16.4
53+ - image : cimg/node:16.14
5454 working_directory : ~/repo
5555 steps :
5656 - attach_workspace :
Original file line number Diff line number Diff line change 1818 "build" : " react-app-rewired build" ,
1919 "test" : " CI=true react-app-rewired test" ,
2020 "eject" : " react-scripts eject" ,
21+ "eslint:check" : " eslint --ext .jsx,.js src/" ,
22+ "eslint:write" : " eslint --fix --ext .jsx,.js src/" ,
2123 "prettier:check" : " prettier -c src/*" ,
2224 "prettier:write" : " prettier -w src/*" ,
2325 "deploy" : " gh-pages -d build -m '[ci skip] Updates'"
4345 "stream-browserify" : " ^3.0.0"
4446 },
4547 "devDependencies" : {
48+ "eslint" : " ^8.10.0" ,
4649 "eslint-config-prettier" : " ^8.4.0" ,
50+ "eslint-config-react-app" : " ^7.0.0" ,
4751 "gh-pages" : " ^3.2.3" ,
4852 "prettier" : " 2.5.1" ,
4953 "react-app-rewired" : " ^2.2.1" ,
5559 "eslintConfig" : {
5660 "extends" : [
5761 " react-app" ,
62+ " eslint:recommended" ,
5863 " prettier"
5964 ]
6065 },
Original file line number Diff line number Diff line change @@ -7,13 +7,14 @@ import { useSubstrateState } from '../'
77import utils from '../utils'
88
99function TxButton ( {
10+ attrs = null ,
11+ color = 'blue' ,
12+ disabled = false ,
1013 label,
1114 setStatus,
12- color = 'blue' ,
1315 style = null ,
1416 type = 'QUERY' ,
15- attrs = null ,
16- disabled = false ,
17+ txOnClickHandler = null ,
1718} ) {
1819 // Hooks
1920 const { api, currentAccount } = useSubstrateState ( )
@@ -158,13 +159,21 @@ function TxButton({
158159 }
159160
160161 setStatus ( 'Sending...' )
161- ; ( isSudo ( ) && sudoTx ( ) ) ||
162- ( isUncheckedSudo ( ) && uncheckedSudoTx ( ) ) ||
163- ( isSigned ( ) && signedTx ( ) ) ||
164- ( isUnsigned ( ) && unsignedTx ( ) ) ||
165- ( isQuery ( ) && query ( ) ) ||
166- ( isRpc ( ) && rpc ( ) ) ||
167- ( isConstant ( ) && constant ( ) )
162+
163+ const asyncFunc =
164+ ( isSudo ( ) && sudoTx ) ||
165+ ( isUncheckedSudo ( ) && uncheckedSudoTx ) ||
166+ ( isSigned ( ) && signedTx ) ||
167+ ( isUnsigned ( ) && unsignedTx ) ||
168+ ( isQuery ( ) && query ) ||
169+ ( isRpc ( ) && rpc ) ||
170+ ( isConstant ( ) && constant )
171+
172+ await asyncFunc ( )
173+
174+ return txOnClickHandler && typeof txOnClickHandler === 'function'
175+ ? txOnClickHandler ( unsub )
176+ : null
168177 }
169178
170179 const transformParams = (
You can’t perform that action at this time.
0 commit comments