diff --git a/ts-client/src/amm/tests/constantProduct.test.ts b/ts-client/src/amm/tests/constantProduct.test.ts index 2f6d39a..ac15d61 100644 --- a/ts-client/src/amm/tests/constantProduct.test.ts +++ b/ts-client/src/amm/tests/constantProduct.test.ts @@ -287,7 +287,7 @@ describe('Constant product pool', () => { beforeAll(async () => { const tradeFeeBps = 1500; const protocolFeeBps = 5000; - const partnerFeeNumerator = new BN(0); + const partnerFeeNumerator = new BN(50_000); const transaction = await AmmImpl.createConfig( connection, mockWallet.publicKey, @@ -295,7 +295,7 @@ describe('Constant product pool', () => { new BN(protocolFeeBps), PublicKey.default, new BN(0), - PublicKey.default, + mockWallet.publicKey, ActivationType.Slot, partnerFeeNumerator, ); @@ -548,5 +548,30 @@ describe('Constant product pool', () => { throw new Error(error.message); } }); + + test('Partner claim fee', async () => { + const [beforeTokenABalance, beforeTokenBBalance] = await Promise.all([ + provider.connection.getTokenAccountBalance(mockWalletBtcATA).then((v) => new BN(v.value.amount)), + provider.connection.getTokenAccountBalance(mockWalletUsdcATA).then((v) => new BN(v.value.amount)), + ]); + + const tx = await cpPoolConfig.partnerClaimFees( + mockWallet.publicKey, + new BN(Number.MAX_SAFE_INTEGER), + new BN(Number.MAX_SAFE_INTEGER), + ); + + tx.sign(mockWallet.payer); + const txSig = await connection.sendRawTransaction(tx.serialize()); + await connection.confirmTransaction(txSig, 'finalized'); + + const [afterTokenABalance, afterTokenBBalance] = await Promise.all([ + provider.connection.getTokenAccountBalance(mockWalletBtcATA).then((v) => new BN(v.value.amount)), + provider.connection.getTokenAccountBalance(mockWalletUsdcATA).then((v) => new BN(v.value.amount)), + ]); + + expect(afterTokenABalance.gt(beforeTokenABalance)).toBe(true); + expect(afterTokenBBalance.gt(beforeTokenBBalance)).toBe(true); + }); }); }); diff --git a/ts-client/src/amm/tests/initializeCustomizablePermissionlessConstantProductPool.test.ts b/ts-client/src/amm/tests/initializeCustomizablePermissionlessConstantProductPool.test.ts index 20f372b..64d5b3d 100644 --- a/ts-client/src/amm/tests/initializeCustomizablePermissionlessConstantProductPool.test.ts +++ b/ts-client/src/amm/tests/initializeCustomizablePermissionlessConstantProductPool.test.ts @@ -12,7 +12,7 @@ const provider = new AnchorProvider(connection, mockWallet, { commitment: connection.commitment, }); -describe.only('Initialize customizable permissionless constant product pool', () => { +describe('Initialize customizable permissionless constant product pool', () => { let MEME: PublicKey; let memeDecimal = 9; @@ -46,7 +46,7 @@ describe.only('Initialize customizable permissionless constant product pool', () await wrapSol(connection, new BN(1_000_000), mockWallet.payer); }); - it('Initialize customizable CP pool', async () => { + test('Initialize customizable CP pool', async () => { const tokenAAmount = new BN(1_000_000); const tokenBAmount = new BN(1_000_000);