11import { useEffect , useState , useMemo } from "react" ;
22import { useRouter } from "next/router" ;
3- import {
4- NativeScript ,
5- resolvePaymentKeyHash ,
6- resolveStakeKeyHash ,
7- serializeNativeScript ,
8- } from "@meshsdk/core" ;
3+ import { resolvePaymentKeyHash , resolveStakeKeyHash } from "@meshsdk/core" ;
94
10- import { MultisigKey , MultisigWallet } from "@/utils/multisigSDK" ;
5+ import type { MultisigKey } from "@/utils/multisigSDK" ;
6+ import { MultisigWallet } from "@/utils/multisigSDK" ;
117import { api } from "@/utils/api" ;
128import { useUserStore } from "@/lib/zustand/user" ;
139import { useSiteStore } from "@/lib/zustand/site" ;
@@ -56,7 +52,7 @@ export default function PageNewWallet() {
5652 keys . push ( {
5753 keyHash : paymentHash ,
5854 role : 0 ,
59- name : signersDescriptions [ i ] || "" ,
55+ name : signersDescriptions [ i ] ?? "" ,
6056 } ) ;
6157 } catch ( e ) {
6258 console . warn ( `Invalid payment address at index ${ i } :` , addr ) ;
@@ -73,7 +69,7 @@ export default function PageNewWallet() {
7369 keys . push ( {
7470 keyHash : stakeKeyHash ,
7571 role : 2 ,
76- name : signersDescriptions [ i ] || "" ,
72+ name : signersDescriptions [ i ] ?? "" ,
7773 } ) ;
7874 } catch ( e ) {
7975 console . warn ( `Invalid stake address at index ${ i } :` , stakeKey ) ;
@@ -90,12 +86,13 @@ export default function PageNewWallet() {
9086 signersStakeKeys ,
9187 signersDescriptions ,
9288 numRequiredSigners ,
89+ network ,
9390 ] ) ;
9491
9592 const { mutate : deleteWalletInvite } = api . wallet . deleteNewWallet . useMutation (
9693 {
97- onError : ( e ) => {
98- console . error ( e ) ;
94+ onError : ( ) => {
95+ console . error ( ) ;
9996 } ,
10097 } ,
10198 ) ;
@@ -106,24 +103,24 @@ export default function PageNewWallet() {
106103 deleteWalletInvite ( { walletId : walletInviteId ! } ) ;
107104 }
108105 setLoading ( false ) ;
109- router . push ( "/wallets" ) ;
106+ await router . push ( "/wallets" ) ;
110107 toast ( {
111108 title : "Wallet Created" ,
112109 description : "Your wallet has been created" ,
113110 duration : 5000 ,
114111 } ) ;
115112 } ,
116- onError : ( e ) => {
113+ onError : ( ) => {
117114 setLoading ( false ) ;
118- console . error ( e ) ;
115+ console . error ( ) ;
119116 } ,
120117 } ) ;
121118
122119 const { mutate : createNewWallet } = api . wallet . createNewWallet . useMutation ( {
123120 onSuccess : async ( data ) => {
124121 setLoading ( false ) ;
125- router . push ( `/wallets/new-wallet/${ data . id } ` ) ;
126- navigator . clipboard . writeText (
122+ await router . push ( `/wallets/new-wallet/${ data . id } ` ) ;
123+ await navigator . clipboard . writeText (
127124 `https://multisig.meshjs.dev/wallets/invite/${ data . id } ` ,
128125 ) ;
129126 toast ( {
@@ -133,9 +130,9 @@ export default function PageNewWallet() {
133130 duration : 5000 ,
134131 } ) ;
135132 } ,
136- onError : ( e ) => {
133+ onError : ( ) => {
137134 setLoading ( false ) ;
138- console . error ( e ) ;
135+ console . error ( ) ;
139136 } ,
140137 } ) ;
141138
@@ -147,11 +144,11 @@ export default function PageNewWallet() {
147144 description : "Your wallet has been saved" ,
148145 duration : 5000 ,
149146 } ) ;
150- router . push ( "/wallets" ) ;
147+ await router . push ( "/wallets" ) ;
151148 } ,
152- onError : ( e ) => {
149+ onError : ( ) => {
153150 setLoading ( false ) ;
154- console . error ( e ) ;
151+ console . error ( ) ;
155152 } ,
156153 } ) ;
157154
@@ -187,7 +184,7 @@ export default function PageNewWallet() {
187184 setSignerStakeKeys ( [ ...signersStakeKeys , "" ] ) ;
188185 }
189186
190- function createNativeScript ( ) {
187+ async function createNativeScript ( ) {
191188 setLoading ( true ) ;
192189
193190 if ( ! multisigWallet ) {
@@ -292,7 +289,7 @@ export default function PageNewWallet() {
292289 walletInviteId,
293290 nativeScriptType,
294291 toast,
295- handleCreateNewWallet,
292+ handleCreateNewWallet : ( ) => void handleCreateNewWallet ( ) ,
296293 loading,
297294 } }
298295 />
@@ -307,9 +304,9 @@ export default function PageNewWallet() {
307304 < div className = "col-span-2 flex justify-end gap-4 sm:justify-center" >
308305 < WalletActionButtons
309306 buttonConfig = { {
310- createNativeScript,
311- handleSaveWallet,
312- handleCreateNewWallet,
307+ createNativeScript : ( ) => void createNativeScript ( ) ,
308+ handleSaveWallet : ( ) => void handleSaveWallet ( ) ,
309+ handleCreateNewWallet : ( ) => void handleCreateNewWallet ( ) ,
313310 loading,
314311 signersAddresses,
315312 name,
0 commit comments