@@ -5,9 +5,9 @@ import { ParsedTokenAccount } from '@lightprotocol/stateless.js';
5
5
6
6
import {
7
7
selectMinCompressedTokenAccountsForTransfer ,
8
- selectMinCompressedTokenAccountsForTransferIdempotent ,
8
+ selectMinCompressedTokenAccountsForTransferOrPartial ,
9
9
selectSmartCompressedTokenAccountsForTransfer ,
10
- selectSmartCompressedTokenAccountsForTransferIdempotent ,
10
+ selectSmartCompressedTokenAccountsForTransferOrPartial ,
11
11
} from '../../src' ;
12
12
import { ERROR_NO_ACCOUNTS_FOUND } from '../../src/utils/select-input-accounts' ;
13
13
@@ -251,8 +251,8 @@ describe('selectMinCompressedTokenAccountsForTransfer', () => {
251
251
} ) ;
252
252
} ) ;
253
253
254
- describe ( 'selectMinCompressedTokenAccountsForTransferIdempotent ' , ( ) => {
255
- it ( 'min idempotent : should select the largest account for a valid transfer where 1 account is enough' , ( ) => {
254
+ describe ( 'selectMinCompressedTokenAccountsForTransferorPartial ' , ( ) => {
255
+ it ( 'min orPartial : should select the largest account for a valid transfer where 1 account is enough' , ( ) => {
256
256
const accounts = [
257
257
{
258
258
parsed : { amount : new BN ( 100 ) } ,
@@ -270,7 +270,7 @@ describe('selectMinCompressedTokenAccountsForTransferIdempotent', () => {
270
270
const transferAmount = new BN ( 75 ) ;
271
271
272
272
const [ selectedAccounts , total , totalLamports , maxPossibleAmount ] =
273
- selectMinCompressedTokenAccountsForTransferIdempotent (
273
+ selectMinCompressedTokenAccountsForTransferOrPartial (
274
274
accounts ,
275
275
transferAmount ,
276
276
) ;
@@ -281,7 +281,7 @@ describe('selectMinCompressedTokenAccountsForTransferIdempotent', () => {
281
281
expect ( maxPossibleAmount . eq ( new BN ( 175 ) ) ) . toBe ( true ) ;
282
282
} ) ;
283
283
284
- it ( 'min idempotent : should return the maximum possible amount if there is not enough balance' , ( ) => {
284
+ it ( 'min orPartial : should return the maximum possible amount if there is not enough balance' , ( ) => {
285
285
const accounts = [
286
286
{
287
287
parsed : { amount : new BN ( 30 ) } ,
@@ -291,7 +291,7 @@ describe('selectMinCompressedTokenAccountsForTransferIdempotent', () => {
291
291
const transferAmount = new BN ( 75 ) ;
292
292
293
293
const [ selectedAccounts , total , totalLamports , maxPossibleAmount ] =
294
- selectMinCompressedTokenAccountsForTransferIdempotent (
294
+ selectMinCompressedTokenAccountsForTransferOrPartial (
295
295
accounts ,
296
296
transferAmount ,
297
297
) ;
@@ -302,7 +302,7 @@ describe('selectMinCompressedTokenAccountsForTransferIdempotent', () => {
302
302
expect ( maxPossibleAmount . eq ( new BN ( 30 ) ) ) . toBe ( true ) ;
303
303
} ) ;
304
304
305
- it ( 'min idempotent : should select multiple accounts if needed' , ( ) => {
305
+ it ( 'min orPartial : should select multiple accounts if needed' , ( ) => {
306
306
const accounts = [
307
307
{
308
308
parsed : { amount : new BN ( 50 ) } ,
@@ -320,7 +320,7 @@ describe('selectMinCompressedTokenAccountsForTransferIdempotent', () => {
320
320
const transferAmount = new BN ( 75 ) ;
321
321
322
322
const [ selectedAccounts , total , totalLamports , maxPossibleAmount ] =
323
- selectMinCompressedTokenAccountsForTransferIdempotent (
323
+ selectMinCompressedTokenAccountsForTransferOrPartial (
324
324
accounts ,
325
325
transferAmount ,
326
326
) ;
@@ -331,19 +331,19 @@ describe('selectMinCompressedTokenAccountsForTransferIdempotent', () => {
331
331
expect ( maxPossibleAmount . eq ( new BN ( 105 ) ) ) . toBe ( true ) ;
332
332
} ) ;
333
333
334
- it ( 'min idempotent : should handle empty accounts array' , ( ) => {
334
+ it ( 'min orPartial : should handle empty accounts array' , ( ) => {
335
335
const accounts : ParsedTokenAccount [ ] = [ ] ;
336
336
const transferAmount = new BN ( 75 ) ;
337
337
338
338
expect ( ( ) =>
339
- selectMinCompressedTokenAccountsForTransferIdempotent (
339
+ selectMinCompressedTokenAccountsForTransferOrPartial (
340
340
accounts ,
341
341
transferAmount ,
342
342
) ,
343
343
) . toThrow ( ERROR_NO_ACCOUNTS_FOUND ) ;
344
344
} ) ;
345
345
346
- it ( 'min idempotent : should ignore accounts with zero balance' , ( ) => {
346
+ it ( 'min orPartial : should ignore accounts with zero balance' , ( ) => {
347
347
const accounts = [
348
348
{
349
349
parsed : { amount : new BN ( 0 ) } ,
@@ -361,7 +361,7 @@ describe('selectMinCompressedTokenAccountsForTransferIdempotent', () => {
361
361
const transferAmount = new BN ( 75 ) ;
362
362
363
363
const [ selectedAccounts , total , totalLamports , maxPossibleAmount ] =
364
- selectMinCompressedTokenAccountsForTransferIdempotent (
364
+ selectMinCompressedTokenAccountsForTransferOrPartial (
365
365
accounts ,
366
366
transferAmount ,
367
367
) ;
@@ -372,7 +372,7 @@ describe('selectMinCompressedTokenAccountsForTransferIdempotent', () => {
372
372
expect ( maxPossibleAmount . eq ( new BN ( 75 ) ) ) . toBe ( true ) ;
373
373
} ) ;
374
374
375
- it ( 'min idempotent : should handle large numbers' , ( ) => {
375
+ it ( 'min orPartial : should handle large numbers' , ( ) => {
376
376
const accounts = [
377
377
{
378
378
parsed : { amount : new BN ( '1000000000000000000' ) } ,
@@ -390,7 +390,7 @@ describe('selectMinCompressedTokenAccountsForTransferIdempotent', () => {
390
390
const transferAmount = new BN ( '750000000000000000' ) ;
391
391
392
392
const [ selectedAccounts , total , totalLamports , maxPossibleAmount ] =
393
- selectMinCompressedTokenAccountsForTransferIdempotent (
393
+ selectMinCompressedTokenAccountsForTransferOrPartial (
394
394
accounts ,
395
395
transferAmount ,
396
396
) ;
@@ -401,7 +401,7 @@ describe('selectMinCompressedTokenAccountsForTransferIdempotent', () => {
401
401
expect ( maxPossibleAmount . eq ( new BN ( '1750000000000000000' ) ) ) . toBe ( true ) ;
402
402
} ) ;
403
403
404
- it ( 'min idempotent : should handle max inputs equal to accounts length' , ( ) => {
404
+ it ( 'min orPartial : should handle max inputs equal to accounts length' , ( ) => {
405
405
const accounts = [
406
406
{
407
407
parsed : { amount : new BN ( 50 ) } ,
@@ -424,7 +424,7 @@ describe('selectMinCompressedTokenAccountsForTransferIdempotent', () => {
424
424
const maxInputs = 3 ;
425
425
426
426
const [ selectedAccounts , total , totalLamports , maxPossibleAmount ] =
427
- selectMinCompressedTokenAccountsForTransferIdempotent (
427
+ selectMinCompressedTokenAccountsForTransferOrPartial (
428
428
accounts ,
429
429
transferAmount ,
430
430
maxInputs ,
@@ -436,7 +436,7 @@ describe('selectMinCompressedTokenAccountsForTransferIdempotent', () => {
436
436
expect ( maxPossibleAmount . eq ( new BN ( 105 ) ) ) . toBe ( true ) ;
437
437
} ) ;
438
438
439
- it ( 'min idempotent : should handle max inputs less than accounts length' , ( ) => {
439
+ it ( 'min orPartial : should handle max inputs less than accounts length' , ( ) => {
440
440
const accounts = [
441
441
{
442
442
parsed : { amount : new BN ( 50 ) } ,
@@ -455,7 +455,7 @@ describe('selectMinCompressedTokenAccountsForTransferIdempotent', () => {
455
455
const maxInputs = 2 ;
456
456
457
457
const [ selectedAccounts , total , totalLamports , maxPossibleAmount ] =
458
- selectMinCompressedTokenAccountsForTransferIdempotent (
458
+ selectMinCompressedTokenAccountsForTransferOrPartial (
459
459
accounts ,
460
460
transferAmount ,
461
461
maxInputs ,
@@ -467,7 +467,7 @@ describe('selectMinCompressedTokenAccountsForTransferIdempotent', () => {
467
467
expect ( maxPossibleAmount . eq ( new BN ( 80 ) ) ) . toBe ( true ) ;
468
468
} ) ;
469
469
470
- it ( 'min idempotent : should succeed and select 2 accounts with total 80' , ( ) => {
470
+ it ( 'min orPartial : should succeed and select 2 accounts with total 80' , ( ) => {
471
471
const accounts = [
472
472
{
473
473
parsed : { amount : new BN ( 50 ) } ,
@@ -486,7 +486,7 @@ describe('selectMinCompressedTokenAccountsForTransferIdempotent', () => {
486
486
const maxInputs = 2 ;
487
487
488
488
const [ selectedAccounts , total , totalLamports , maxPossibleAmount ] =
489
- selectMinCompressedTokenAccountsForTransferIdempotent (
489
+ selectMinCompressedTokenAccountsForTransferOrPartial (
490
490
accounts ,
491
491
transferAmount ,
492
492
maxInputs ,
@@ -766,8 +766,8 @@ describe('selectSmartCompressedTokenAccountsForTransfer', () => {
766
766
} ) ;
767
767
} ) ;
768
768
769
- describe ( 'selectSmartCompressedTokenAccountsForTransferIdempotent ' , ( ) => {
770
- it ( 'smart-idempotent : should select 2 accounts for a valid transfer where 1 account is enough' , ( ) => {
769
+ describe ( 'selectSmartCompressedTokenAccountsForTransferOrPartial ' , ( ) => {
770
+ it ( 'smart-orPartial : should select 2 accounts for a valid transfer where 1 account is enough' , ( ) => {
771
771
const accounts = [
772
772
{
773
773
parsed : { amount : new BN ( 100 ) } ,
@@ -785,7 +785,7 @@ describe('selectSmartCompressedTokenAccountsForTransferIdempotent', () => {
785
785
const transferAmount = new BN ( 75 ) ;
786
786
787
787
const [ selectedAccounts , total , totalLamports , maxPossibleAmount ] =
788
- selectSmartCompressedTokenAccountsForTransferIdempotent (
788
+ selectSmartCompressedTokenAccountsForTransferOrPartial (
789
789
accounts ,
790
790
transferAmount ,
791
791
) ;
@@ -796,7 +796,7 @@ describe('selectSmartCompressedTokenAccountsForTransferIdempotent', () => {
796
796
expect ( maxPossibleAmount . eq ( new BN ( 175 ) ) ) . toBe ( true ) ;
797
797
} ) ;
798
798
799
- it ( 'smart-idempotent : should return the maximum possible amount if there is not enough balance' , ( ) => {
799
+ it ( 'smart-orPartial : should return the maximum possible amount if there is not enough balance' , ( ) => {
800
800
const accounts = [
801
801
{
802
802
parsed : { amount : new BN ( 30 ) } ,
@@ -806,7 +806,7 @@ describe('selectSmartCompressedTokenAccountsForTransferIdempotent', () => {
806
806
const transferAmount = new BN ( 75 ) ;
807
807
808
808
const [ selectedAccounts , total , totalLamports , maxPossibleAmount ] =
809
- selectSmartCompressedTokenAccountsForTransferIdempotent (
809
+ selectSmartCompressedTokenAccountsForTransferOrPartial (
810
810
accounts ,
811
811
transferAmount ,
812
812
) ;
@@ -817,7 +817,7 @@ describe('selectSmartCompressedTokenAccountsForTransferIdempotent', () => {
817
817
expect ( maxPossibleAmount . eq ( new BN ( 30 ) ) ) . toBe ( true ) ;
818
818
} ) ;
819
819
820
- it ( 'smart-idempotent : should select multiple accounts if needed' , ( ) => {
820
+ it ( 'smart-orPartial : should select multiple accounts if needed' , ( ) => {
821
821
const accounts = [
822
822
{
823
823
parsed : { amount : new BN ( 50 ) } ,
@@ -835,7 +835,7 @@ describe('selectSmartCompressedTokenAccountsForTransferIdempotent', () => {
835
835
const transferAmount = new BN ( 75 ) ;
836
836
837
837
const [ selectedAccounts , total , totalLamports , maxPossibleAmount ] =
838
- selectSmartCompressedTokenAccountsForTransferIdempotent (
838
+ selectSmartCompressedTokenAccountsForTransferOrPartial (
839
839
accounts ,
840
840
transferAmount ,
841
841
) ;
@@ -846,19 +846,19 @@ describe('selectSmartCompressedTokenAccountsForTransferIdempotent', () => {
846
846
expect ( maxPossibleAmount . eq ( new BN ( 105 ) ) ) . toBe ( true ) ;
847
847
} ) ;
848
848
849
- it ( 'smart-idempotent : should handle empty accounts array' , ( ) => {
849
+ it ( 'smart-orPartial : should handle empty accounts array' , ( ) => {
850
850
const accounts : ParsedTokenAccount [ ] = [ ] ;
851
851
const transferAmount = new BN ( 75 ) ;
852
852
853
853
expect ( ( ) =>
854
- selectSmartCompressedTokenAccountsForTransferIdempotent (
854
+ selectSmartCompressedTokenAccountsForTransferOrPartial (
855
855
accounts ,
856
856
transferAmount ,
857
857
) ,
858
858
) . toThrow ( ERROR_NO_ACCOUNTS_FOUND ) ;
859
859
} ) ;
860
860
861
- it ( 'smart-idempotent : should throw if not enough accounts selected because of maxInputs lower than what WOULD be available' , ( ) => {
861
+ it ( 'smart-orPartial : should throw if not enough accounts selected because of maxInputs lower than what WOULD be available' , ( ) => {
862
862
const accounts = [
863
863
{
864
864
parsed : { amount : new BN ( 50 ) } ,
@@ -876,7 +876,7 @@ describe('selectSmartCompressedTokenAccountsForTransferIdempotent', () => {
876
876
const transferAmount = new BN ( 100 ) ;
877
877
const maxInputs = 2 ;
878
878
const [ selectedAccounts , total , totalLamports , maxPossibleAmount ] =
879
- selectSmartCompressedTokenAccountsForTransferIdempotent (
879
+ selectSmartCompressedTokenAccountsForTransferOrPartial (
880
880
accounts ,
881
881
transferAmount ,
882
882
maxInputs ,
0 commit comments