File tree Expand file tree Collapse file tree 1 file changed +7
-16
lines changed
packages/demo/src/app/connected/(tools)/NervosDao Expand file tree Collapse file tree 1 file changed +7
-16
lines changed Original file line number Diff line number Diff line change @@ -89,18 +89,13 @@ function DaoButton({ dao }: { dao: ccc.Cell }) {
8989 const tipHeader = await signer . client . getTipHeader ( ) ;
9090 setTip ( tipHeader ) ;
9191
92- const previousTx = await signer . client . getTransaction (
92+ const previousTxRes = await signer . client . getTransactionWithHeader (
9393 dao . outPoint . txHash ,
9494 ) ;
95- if ( ! previousTx ?. blockHash ) {
96- return ;
97- }
98- const previousHeader = await signer . client . getHeaderByHash (
99- previousTx . blockHash ,
100- ) ;
101- if ( ! previousHeader ) {
95+ if ( ! previousTxRes || ! previousTxRes . header ) {
10296 return ;
10397 }
98+ const { transaction : previousTx , header : previousHeader } = previousTxRes ;
10499
105100 const claimInfo = await ( async ( ) : Promise < typeof infos > => {
106101 if ( isNew ) {
@@ -110,17 +105,13 @@ function DaoButton({ dao }: { dao: ccc.Cell }) {
110105 const depositTxHash =
111106 previousTx . transaction . inputs [ Number ( dao . outPoint . index ) ]
112107 . previousOutput . txHash ;
113- const depositTx = await signer . client . getTransaction ( depositTxHash ) ;
114- if ( ! depositTx ?. blockHash ) {
108+ const depositTxRes =
109+ await signer . client . getTransactionWithHeader ( depositTxHash ) ;
110+ if ( ! depositTxRes || ! depositTxRes . header ) {
115111 return ;
116112 }
117- const depositHeader = await signer . client . getHeaderByHash (
118- depositTx . blockHash ,
119- ) ;
113+ const { transaction : depositTx , header : depositHeader } = depositTxRes ;
120114
121- if ( ! depositHeader ) {
122- return ;
123- }
124115 return [
125116 getProfit ( dao , depositHeader , previousHeader ) ,
126117 depositTx ,
You can’t perform that action at this time.
0 commit comments