@@ -11,6 +11,7 @@ import {
1111 ARB_HUB_EID ,
1212 getRouteNetwork ,
1313 getOFTContractForRoute ,
14+ getUSDTAddress ,
1415 getEID ,
1516 SOLANA_CHAIN_ID ,
1617 SOLANA_OFT_PROGRAM ,
@@ -247,11 +248,72 @@ describe('LayerZeroBridge', function () {
247248 expect ( quote . toAmount ) . to . equal ( 9997000n ) ;
248249 } ) ;
249250
251+ it ( 'rejects non-USDT fromToken params' , async ( ) => {
252+ let threw = false ;
253+ try {
254+ await bridge . quote ( {
255+ ...BASE_PARAMS ,
256+ fromToken : '0x1111111111111111111111111111111111111111' ,
257+ fromAmount : 10000000000n ,
258+ } ) ;
259+ } catch ( error ) {
260+ threw = true ;
261+ expect ( ( error as Error ) . message ) . to . match ( / U S D T - o n l y .* f r o m T o k e n / i) ;
262+ }
263+ expect ( threw ) . to . equal ( true ) ;
264+ } ) ;
265+
266+ it ( 'rejects non-USDT toToken params' , async ( ) => {
267+ let threw = false ;
268+ try {
269+ await bridge . quote ( {
270+ ...BASE_PARAMS ,
271+ toToken : '0x1111111111111111111111111111111111111111' ,
272+ fromAmount : 10000000000n ,
273+ } ) ;
274+ } catch ( error ) {
275+ threw = true ;
276+ expect ( ( error as Error ) . message ) . to . match ( / U S D T - o n l y .* t o T o k e n / i) ;
277+ }
278+ expect ( threw ) . to . equal ( true ) ;
279+ } ) ;
280+
281+ it ( 'accepts mixed-case EVM USDT token params' , async ( ) => {
282+ const quoteOFTResponse = createMockQuoteOFTResponse ( ) ;
283+ const quoteSendResponse = createMockQuoteSendResponse ( ) ;
284+
285+ const quoteOFTStub = sinon
286+ . stub ( )
287+ . resolves ( [
288+ quoteOFTResponse . oftLimit ,
289+ quoteOFTResponse . oftFeeDetails ,
290+ quoteOFTResponse . oftReceipt ,
291+ ] ) ;
292+ const quoteSendStub = sinon . stub ( ) . resolves ( [ quoteSendResponse ] ) ;
293+ stubContractConstructor ( ( ) => ( {
294+ quoteOFT : quoteOFTStub ,
295+ quoteSend : quoteSendStub ,
296+ } ) ) ;
297+
298+ const quote = await bridge . quote ( {
299+ ...BASE_PARAMS ,
300+ fromToken : BASE_PARAMS . fromToken . toUpperCase ( ) ,
301+ toToken : BASE_PARAMS . toToken . toUpperCase ( ) ,
302+ fromAmount : 10000000000n ,
303+ } ) ;
304+
305+ expect ( quote . tool ) . to . equal ( 'layerzero' ) ;
306+ expect ( quoteOFTStub . calledOnce ) . to . equal ( true ) ;
307+ expect ( quoteSendStub . calledOnce ) . to . equal ( true ) ;
308+ } ) ;
309+
250310 it ( 'quotes non-Solana compose routes through the Arbitrum hub' , async ( ) => {
251311 const composeParams = {
252312 ...BASE_PARAMS ,
253313 fromChain : TRON_CHAIN_ID ,
254314 toChain : 9745 ,
315+ fromToken : getUSDTAddress ( TRON_CHAIN_ID ) ,
316+ toToken : getUSDTAddress ( 9745 ) ,
255317 fromAmount : 10000000000n ,
256318 } ;
257319 const { firstHopOFT, secondHopOFT } = getComposeHopContracts (
@@ -327,6 +389,8 @@ describe('LayerZeroBridge', function () {
327389 ...BASE_PARAMS ,
328390 fromChain : TRON_CHAIN_ID ,
329391 toChain : 9745 ,
392+ fromToken : getUSDTAddress ( TRON_CHAIN_ID ) ,
393+ toToken : getUSDTAddress ( 9745 ) ,
330394 fromAmount : 10000000000n ,
331395 } ;
332396 const { firstHopOFT, secondHopOFT } = getComposeHopContracts (
0 commit comments