@@ -49,6 +49,8 @@ describe('methodSelector', async () => {
4949 . map ( ( _ , i ) => txn . appArgs ( i ) )
5050 expect ( appArgs ) . toEqual ( [ appClient . getABIMethod ( 'sink(string,uint8[])void' ) . getSelector ( ) , arg1 . bytes , arg2 . bytes ] )
5151 expect ( appArgs [ 0 ] ) . toEqual ( arc4 . methodSelector ( SignaturesContract . prototype . sink ) )
52+ expect ( appArgs [ 0 ] ) . toEqual ( arc4 . methodSelector < typeof SignaturesContract . prototype . sink > ( ) )
53+ expect ( appArgs [ 0 ] ) . toEqual ( arc4 . methodSelector ( 'sink(string,uint8[])void' ) )
5254 } )
5355
5456 test ( 'app args is correct with alias' , async ( { appClientSignaturesContract : appClient } ) => {
@@ -71,6 +73,8 @@ describe('methodSelector', async () => {
7173 . map ( ( _ , i ) => txn . appArgs ( i ) )
7274 expect ( appArgs ) . toEqual ( [ appClient . getABIMethod ( 'alias(string,uint8[])void' ) . getSelector ( ) , arg1 . bytes , arg2 . bytes ] )
7375 expect ( appArgs [ 0 ] ) . toEqual ( arc4 . methodSelector ( SignaturesContract . prototype . sink2 ) )
76+ expect ( appArgs [ 0 ] ) . toEqual ( arc4 . methodSelector < typeof SignaturesContract . prototype . sink2 > ( ) )
77+ expect ( appArgs [ 0 ] ) . toEqual ( arc4 . methodSelector ( 'alias(string,uint8[])void' ) )
7478 } )
7579
7680 test ( 'app args is correct with txn' , async ( { appClientSignaturesContract : appClient , algorand } ) => {
@@ -99,6 +103,8 @@ describe('methodSelector', async () => {
99103 . map ( ( _ , i ) => txn . appArgs ( i ) )
100104 expect ( appArgs ) . toEqual ( [ appClient . getABIMethod ( 'withTxn(string,pay,uint8[])void' ) . getSelector ( ) , arg1 . bytes , arg3 . bytes ] )
101105 expect ( appArgs [ 0 ] ) . toEqual ( methodSelector ( SignaturesContract . prototype . withTxn ) )
106+ expect ( appArgs [ 0 ] ) . toEqual ( methodSelector < typeof SignaturesContract . prototype . withTxn > ( ) )
107+ expect ( appArgs [ 0 ] ) . toEqual ( methodSelector ( 'withTxn(string,pay,uint8[])void' ) )
102108 } )
103109
104110 test ( 'app args is correct with asset' , async ( { appClientSignaturesContract : appClient , algorand } ) => {
@@ -133,6 +139,8 @@ describe('methodSelector', async () => {
133139 arg3 . bytes ,
134140 ] )
135141 expect ( appArgs [ 0 ] ) . toEqual ( methodSelector ( SignaturesContract . prototype . withAsset ) )
142+ expect ( appArgs [ 0 ] ) . toEqual ( methodSelector < typeof SignaturesContract . prototype . withAsset > ( ) )
143+ expect ( appArgs [ 0 ] ) . toEqual ( methodSelector ( 'withAsset(string,asset,uint8[])void' ) )
136144 } )
137145
138146 test ( 'app args is correct with account' , async ( { appClientSignaturesContract : appClient , algorand } ) => {
@@ -166,6 +174,8 @@ describe('methodSelector', async () => {
166174 arg3 . bytes ,
167175 ] )
168176 expect ( appArgs [ 0 ] ) . toEqual ( methodSelector ( SignaturesContract . prototype . withAcc ) )
177+ expect ( appArgs [ 0 ] ) . toEqual ( methodSelector < typeof SignaturesContract . prototype . withAcc > ( ) )
178+ expect ( appArgs [ 0 ] ) . toEqual ( methodSelector ( 'withAcc(string,account,uint8[])void' ) )
169179 } )
170180
171181 test ( 'app args is correct with application' , async ( { appClientSignaturesContract : appClient , appFactorySignaturesContract } ) => {
@@ -201,6 +211,8 @@ describe('methodSelector', async () => {
201211 arg4 . bytes ,
202212 ] )
203213 expect ( appArgs [ 0 ] ) . toEqual ( methodSelector ( SignaturesContract . prototype . withApp ) )
214+ expect ( appArgs [ 0 ] ) . toEqual ( methodSelector < typeof SignaturesContract . prototype . withApp > ( ) )
215+ expect ( appArgs [ 0 ] ) . toEqual ( methodSelector ( 'withApp(string,application,uint64,uint8[])void' ) )
204216 expect ( appForeignApps . map ( ( a ) => a . id ) ) . toEqual ( [ selfApp . id , otherAppId ] )
205217 } )
206218
@@ -246,6 +258,12 @@ describe('methodSelector', async () => {
246258 five . bytes ,
247259 ] )
248260 expect ( appArgs [ 0 ] ) . toEqual ( methodSelector ( SignaturesContract . prototype . complexSig ) )
261+ expect ( appArgs [ 0 ] ) . toEqual ( methodSelector < typeof SignaturesContract . prototype . complexSig > ( ) )
262+ expect ( appArgs [ 0 ] ) . toEqual (
263+ methodSelector (
264+ 'complexSig(((uint64,string),(uint64,string),uint128,uint128),pay,account,uint8[])((uint64,string),((uint64,string),(uint64,string),uint128,uint128))' ,
265+ ) ,
266+ )
249267 expect ( result [ 0 ] . bytes ) . toEqual ( struct . anotherStruct . bytes )
250268 expect ( result [ 1 ] . bytes ) . toEqual ( struct . bytes )
251269 } )
@@ -296,6 +314,12 @@ describe('methodSelector', async () => {
296314 Bytes . fromHex ( '01' ) ,
297315 ] )
298316 expect ( appArgs [ 0 ] ) . toEqual ( methodSelector ( SignaturesContract . prototype . echoResourceByIndex ) )
317+ expect ( appArgs [ 0 ] ) . toEqual ( methodSelector < typeof SignaturesContract . prototype . echoResourceByIndex > ( ) )
318+ expect ( appArgs [ 0 ] ) . toEqual (
319+ methodSelector (
320+ 'echoResourceByIndex(asset,application,account)(uint64,uint64,address)' ,
321+ ) ,
322+ )
299323
300324 expect ( result ) . toEqual ( [ asaId , otherAppId , encodeAddress ( acc . publicKey ) ] )
301325 } )
@@ -346,6 +370,12 @@ describe('methodSelector', async () => {
346370 toBytes ( account ) ,
347371 ] )
348372 expect ( appArgs [ 0 ] ) . toEqual ( methodSelector ( SignaturesContract . prototype . echoResourceByValue ) )
373+ expect ( appArgs [ 0 ] ) . toEqual ( methodSelector < typeof SignaturesContract . prototype . echoResourceByValue > ( ) )
374+ expect ( appArgs [ 0 ] ) . toEqual (
375+ methodSelector (
376+ 'echoResourceByValue(uint64,uint64,address)(uint64,uint64,address)' ,
377+ ) ,
378+ )
349379
350380 expect ( result ) . toEqual ( [ asaId , otherAppId , encodeAddress ( acc . publicKey ) ] )
351381 } )
@@ -404,5 +434,11 @@ describe('methodSelector', async () => {
404434 five . bytes ,
405435 ] )
406436 expect ( appArgs [ 0 ] ) . toEqual ( methodSelector ( SignaturesContract . prototype . complexSig ) )
437+ expect ( appArgs [ 0 ] ) . toEqual ( methodSelector < typeof SignaturesContract . prototype . complexSig > ( ) )
438+ expect ( appArgs [ 0 ] ) . toEqual (
439+ methodSelector (
440+ 'complexSig(((uint64,string),(uint64,string),uint128,uint128),pay,account,uint8[])((uint64,string),((uint64,string),(uint64,string),uint128,uint128))' ,
441+ ) ,
442+ )
407443 } )
408444} )
0 commit comments