@@ -40,7 +40,7 @@ describe("SafeTransactions", () => {
4040 } as any ) ;
4141 } ) ;
4242
43- describe ( "mintHypercert " , ( ) => {
43+ describe ( "sendTransaction " , ( ) => {
4444 const validParams = [ senderAddress , 1000n , "0xcid" , 0 ] ;
4545
4646 it ( "correctly encodes function data for transaction" , async ( ) => {
@@ -52,7 +52,7 @@ describe("SafeTransactions", () => {
5252 args : validParams ,
5353 } ) ;
5454
55- await safeTransactions . mintHypercert ( functionName , validParams , {
55+ await safeTransactions . sendTransaction ( functionName , validParams , {
5656 safeAddress,
5757 } ) ;
5858
@@ -70,7 +70,7 @@ describe("SafeTransactions", () => {
7070 it ( "uses correct nonce from API" , async ( ) => {
7171 safeApiKitStub . getNextNonce . resolves ( "42" ) ;
7272
73- await safeTransactions . mintHypercert ( "mintClaim" , validParams , {
73+ await safeTransactions . sendTransaction ( "mintClaim" , validParams , {
7474 safeAddress,
7575 } ) ;
7676
@@ -95,7 +95,7 @@ describe("SafeTransactions", () => {
9595 ) ;
9696
9797 try {
98- await safeTransactions . mintHypercert ( "mintClaim" , validParams , { safeAddress } ) ;
98+ await safeTransactions . sendTransaction ( "mintClaim" , validParams , { safeAddress } ) ;
9999 expect . fail ( "Should throw ClientError" ) ;
100100 } catch ( e ) {
101101 expect ( e ) . to . be . instanceOf ( ClientError ) ;
@@ -104,7 +104,7 @@ describe("SafeTransactions", () => {
104104 } ) ;
105105
106106 it ( "follows complete transaction flow" , async ( ) => {
107- const hash = await safeTransactions . mintHypercert ( "mintClaim" , validParams , {
107+ const hash = await safeTransactions . sendTransaction ( "mintClaim" , validParams , {
108108 safeAddress,
109109 } ) ;
110110
@@ -123,7 +123,7 @@ describe("SafeTransactions", () => {
123123 safeApiKitStub . proposeTransaction . rejects ( new Error ( errorMessage ) ) ;
124124
125125 try {
126- await safeTransactions . mintHypercert ( "mintClaim" , validParams , { safeAddress } ) ;
126+ await safeTransactions . sendTransaction ( "mintClaim" , validParams , { safeAddress } ) ;
127127 expect . fail ( "Should throw SafeTransactionError" ) ;
128128 } catch ( e ) {
129129 expect ( e ) . to . be . instanceOf ( SafeTransactionError ) ;
@@ -142,7 +142,7 @@ describe("SafeTransactions", () => {
142142 connectedSafeStub . createTransaction . rejects ( new Error ( errorMessage ) ) ;
143143
144144 try {
145- await safeTransactions . mintHypercert ( "mintClaim" , [ senderAddress , 1000n , "0xcid" , 0 ] , { safeAddress } ) ;
145+ await safeTransactions . sendTransaction ( "mintClaim" , [ senderAddress , 1000n , "0xcid" , 0 ] , { safeAddress } ) ;
146146 expect . fail ( "Should throw SafeTransactionError" ) ;
147147 } catch ( e ) {
148148 expect ( e ) . to . be . instanceOf ( SafeTransactionError ) ;
@@ -155,7 +155,7 @@ describe("SafeTransactions", () => {
155155 } ) ;
156156
157157 it ( "properly proposes transaction with correct parameters" , async ( ) => {
158- await safeTransactions . mintHypercert ( "mintClaim" , [ senderAddress , 1000n , "0xcid" , 0 ] , { safeAddress } ) ;
158+ await safeTransactions . sendTransaction ( "mintClaim" , [ senderAddress , 1000n , "0xcid" , 0 ] , { safeAddress } ) ;
159159
160160 const proposeCall = safeApiKitStub . proposeTransaction . getCall ( 0 ) ;
161161 expect ( proposeCall . args [ 0 ] ) . to . deep . include ( {
@@ -171,6 +171,29 @@ describe("SafeTransactions", () => {
171171 } ) ;
172172 } ) ;
173173 } ) ;
174+
175+ describe ( "constructor" , ( ) => {
176+ it ( "throws error when wallet client has no chain ID" , ( ) => {
177+ chai . Assertion . expectAssertions ( 2 ) ;
178+
179+ const invalidWalletClient = { ...walletClient , chain : undefined } ;
180+
181+ try {
182+ new SafeTransactions (
183+ safeAddress ,
184+ invalidWalletClient as any ,
185+ {
186+ address : contractAddress ,
187+ abi : HypercertMinterAbi ,
188+ } as any ,
189+ ) ;
190+ expect . fail ( "Should throw Error" ) ;
191+ } catch ( e ) {
192+ expect ( e ) . to . be . instanceOf ( Error ) ;
193+ expect ( ( e as Error ) . message ) . to . eq ( "No chain ID found in wallet client" ) ;
194+ }
195+ } ) ;
196+ } ) ;
174197} ) ;
175198
176199function createConnectedSafeStub ( contractAddress : string , mockTxHash : `0x${string } `, mockSignature : `0x${string } `) {
0 commit comments